@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -30,54 +30,54 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return bool|array List of all user donations. |
32 | 32 | */ |
33 | -function give_get_users_donations( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) { |
|
33 | +function give_get_users_donations($user = 0, $number = 20, $pagination = false, $status = 'complete') { |
|
34 | 34 | |
35 | - if ( empty( $user ) ) { |
|
35 | + if (empty($user)) { |
|
36 | 36 | $user = get_current_user_id(); |
37 | 37 | } |
38 | 38 | |
39 | - if ( 0 === $user && ! Give()->email_access->token_exists ) { |
|
39 | + if (0 === $user && ! Give()->email_access->token_exists) { |
|
40 | 40 | return false; |
41 | 41 | } |
42 | 42 | |
43 | - $status = ( 'complete' === $status ) ? 'publish' : $status; |
|
43 | + $status = ('complete' === $status) ? 'publish' : $status; |
|
44 | 44 | $paged = 1; |
45 | 45 | |
46 | - if ( $pagination ) { |
|
47 | - if ( get_query_var( 'paged' ) ) { |
|
48 | - $paged = get_query_var( 'paged' ); |
|
49 | - } elseif ( get_query_var( 'page' ) ) { |
|
50 | - $paged = get_query_var( 'page' ); |
|
46 | + if ($pagination) { |
|
47 | + if (get_query_var('paged')) { |
|
48 | + $paged = get_query_var('paged'); |
|
49 | + } elseif (get_query_var('page')) { |
|
50 | + $paged = get_query_var('page'); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | - $args = apply_filters( 'give_get_users_donations_args', array( |
|
54 | + $args = apply_filters('give_get_users_donations_args', array( |
|
55 | 55 | 'user' => $user, |
56 | 56 | 'number' => $number, |
57 | 57 | 'status' => $status, |
58 | 58 | 'orderby' => 'date', |
59 | - ) ); |
|
59 | + )); |
|
60 | 60 | |
61 | - if ( $pagination ) { |
|
61 | + if ($pagination) { |
|
62 | 62 | $args['page'] = $paged; |
63 | 63 | } else { |
64 | 64 | $args['nopaging'] = true; |
65 | 65 | } |
66 | 66 | |
67 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
68 | - $donor = new Give_Donor( $user, $by_user_id ); |
|
67 | + $by_user_id = is_numeric($user) ? true : false; |
|
68 | + $donor = new Give_Donor($user, $by_user_id); |
|
69 | 69 | |
70 | - if ( ! empty( $donor->payment_ids ) ) { |
|
70 | + if ( ! empty($donor->payment_ids)) { |
|
71 | 71 | |
72 | - unset( $args['user'] ); |
|
73 | - $args['post__in'] = array_map( 'absint', explode( ',', $donor->payment_ids ) ); |
|
72 | + unset($args['user']); |
|
73 | + $args['post__in'] = array_map('absint', explode(',', $donor->payment_ids)); |
|
74 | 74 | |
75 | 75 | } |
76 | 76 | |
77 | - $donations = give_get_payments( apply_filters( 'give_get_users_donations_args', $args ) ); |
|
77 | + $donations = give_get_payments(apply_filters('give_get_users_donations_args', $args)); |
|
78 | 78 | |
79 | 79 | // No donations. |
80 | - if ( ! $donations ) { |
|
80 | + if ( ! $donations) { |
|
81 | 81 | return false; |
82 | 82 | } |
83 | 83 | |
@@ -96,65 +96,65 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return bool|object List of unique forms donated by user |
98 | 98 | */ |
99 | -function give_get_users_completed_donations( $user = 0, $status = 'complete' ) { |
|
100 | - if ( empty( $user ) ) { |
|
99 | +function give_get_users_completed_donations($user = 0, $status = 'complete') { |
|
100 | + if (empty($user)) { |
|
101 | 101 | $user = get_current_user_id(); |
102 | 102 | } |
103 | 103 | |
104 | - if ( empty( $user ) ) { |
|
104 | + if (empty($user)) { |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | |
108 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
108 | + $by_user_id = is_numeric($user) ? true : false; |
|
109 | 109 | |
110 | - $donor = new Give_Donor( $user, $by_user_id ); |
|
110 | + $donor = new Give_Donor($user, $by_user_id); |
|
111 | 111 | |
112 | - if ( empty( $donor->payment_ids ) ) { |
|
112 | + if (empty($donor->payment_ids)) { |
|
113 | 113 | return false; |
114 | 114 | } |
115 | 115 | |
116 | 116 | // Get all the items donated. |
117 | - $payment_ids = array_reverse( explode( ',', $donor->payment_ids ) ); |
|
118 | - $limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 ); |
|
119 | - if ( ! empty( $limit_payments ) ) { |
|
120 | - $payment_ids = array_slice( $payment_ids, 0, $limit_payments ); |
|
117 | + $payment_ids = array_reverse(explode(',', $donor->payment_ids)); |
|
118 | + $limit_payments = apply_filters('give_users_completed_donations_payments', 50); |
|
119 | + if ( ! empty($limit_payments)) { |
|
120 | + $payment_ids = array_slice($payment_ids, 0, $limit_payments); |
|
121 | 121 | } |
122 | 122 | $donation_data = array(); |
123 | - foreach ( $payment_ids as $payment_id ) { |
|
124 | - $donation_data[] = give_get_payment_meta( $payment_id ); |
|
123 | + foreach ($payment_ids as $payment_id) { |
|
124 | + $donation_data[] = give_get_payment_meta($payment_id); |
|
125 | 125 | } |
126 | 126 | |
127 | - if ( empty( $donation_data ) ) { |
|
127 | + if (empty($donation_data)) { |
|
128 | 128 | return false; |
129 | 129 | } |
130 | 130 | |
131 | 131 | // Grab only the post ids "form_id" of the forms donated on this order. |
132 | 132 | $completed_donations_ids = array(); |
133 | - foreach ( $donation_data as $donation_meta ) { |
|
134 | - $completed_donations_ids[] = isset( $donation_meta['form_id'] ) ? $donation_meta['form_id'] : ''; |
|
133 | + foreach ($donation_data as $donation_meta) { |
|
134 | + $completed_donations_ids[] = isset($donation_meta['form_id']) ? $donation_meta['form_id'] : ''; |
|
135 | 135 | } |
136 | 136 | |
137 | - if ( empty( $completed_donations_ids ) ) { |
|
137 | + if (empty($completed_donations_ids)) { |
|
138 | 138 | return false; |
139 | 139 | } |
140 | 140 | |
141 | 141 | // Only include each donation once. |
142 | - $form_ids = array_unique( $completed_donations_ids ); |
|
142 | + $form_ids = array_unique($completed_donations_ids); |
|
143 | 143 | |
144 | 144 | // Make sure we still have some products and a first item. |
145 | - if ( empty( $form_ids ) || ! isset( $form_ids[0] ) ) { |
|
145 | + if (empty($form_ids) || ! isset($form_ids[0])) { |
|
146 | 146 | return false; |
147 | 147 | } |
148 | 148 | |
149 | - $post_type = get_post_type( $form_ids[0] ); |
|
149 | + $post_type = get_post_type($form_ids[0]); |
|
150 | 150 | |
151 | - $args = apply_filters( 'give_get_users_completed_donations_args', array( |
|
151 | + $args = apply_filters('give_get_users_completed_donations_args', array( |
|
152 | 152 | 'include' => $form_ids, |
153 | 153 | 'post_type' => $post_type, |
154 | - 'posts_per_page' => - 1, |
|
155 | - ) ); |
|
154 | + 'posts_per_page' => -1, |
|
155 | + )); |
|
156 | 156 | |
157 | - return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) ); |
|
157 | + return apply_filters('give_users_completed_donations_list', get_posts($args)); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return bool True if has donated, false other wise. |
172 | 172 | */ |
173 | -function give_has_donations( $user_id = null ) { |
|
174 | - if ( empty( $user_id ) ) { |
|
173 | +function give_has_donations($user_id = null) { |
|
174 | + if (empty($user_id)) { |
|
175 | 175 | $user_id = get_current_user_id(); |
176 | 176 | } |
177 | 177 | |
178 | - if ( give_get_users_donations( $user_id, 1 ) ) { |
|
178 | + if (give_get_users_donations($user_id, 1)) { |
|
179 | 179 | return true; // User has at least one donation. |
180 | 180 | } |
181 | 181 | |
@@ -196,23 +196,23 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return array |
198 | 198 | */ |
199 | -function give_get_donation_stats_by_user( $user = '' ) { |
|
199 | +function give_get_donation_stats_by_user($user = '') { |
|
200 | 200 | |
201 | 201 | $field = ''; |
202 | 202 | |
203 | - if ( is_email( $user ) ) { |
|
203 | + if (is_email($user)) { |
|
204 | 204 | $field = 'email'; |
205 | - } elseif ( is_numeric( $user ) ) { |
|
205 | + } elseif (is_numeric($user)) { |
|
206 | 206 | $field = 'user_id'; |
207 | 207 | } |
208 | 208 | |
209 | - $stats = array(); |
|
210 | - $donor = Give()->donors->get_donor_by( $field, $user ); |
|
209 | + $stats = array(); |
|
210 | + $donor = Give()->donors->get_donor_by($field, $user); |
|
211 | 211 | |
212 | - if ( $donor ) { |
|
213 | - $donor = new Give_Donor( $donor->id ); |
|
214 | - $stats['purchases'] = absint( $donor->purchase_count ); |
|
215 | - $stats['total_spent'] = give_maybe_sanitize_amount( $donor->get_total_donation_amount() ); |
|
212 | + if ($donor) { |
|
213 | + $donor = new Give_Donor($donor->id); |
|
214 | + $stats['purchases'] = absint($donor->purchase_count); |
|
215 | + $stats['total_spent'] = give_maybe_sanitize_amount($donor->get_total_donation_amount()); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @since 1.7 |
222 | 222 | */ |
223 | - $stats = (array) apply_filters( 'give_donation_stats_by_user', $stats, $user ); |
|
223 | + $stats = (array) apply_filters('give_donation_stats_by_user', $stats, $user); |
|
224 | 224 | |
225 | 225 | return $stats; |
226 | 226 | } |
@@ -238,21 +238,21 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return int The total number of donations. |
240 | 240 | */ |
241 | -function give_count_donations_of_donor( $user = null ) { |
|
241 | +function give_count_donations_of_donor($user = null) { |
|
242 | 242 | |
243 | 243 | // Logged in? |
244 | - if ( empty( $user ) ) { |
|
244 | + if (empty($user)) { |
|
245 | 245 | $user = get_current_user_id(); |
246 | 246 | } |
247 | 247 | |
248 | 248 | // Email access? |
249 | - if ( empty( $user ) && Give()->email_access->token_email ) { |
|
249 | + if (empty($user) && Give()->email_access->token_email) { |
|
250 | 250 | $user = Give()->email_access->token_email; |
251 | 251 | } |
252 | 252 | |
253 | - $stats = ! empty( $user ) ? give_get_donation_stats_by_user( $user ) : false; |
|
253 | + $stats = ! empty($user) ? give_get_donation_stats_by_user($user) : false; |
|
254 | 254 | |
255 | - return isset( $stats['purchases'] ) ? $stats['purchases'] : 0; |
|
255 | + return isset($stats['purchases']) ? $stats['purchases'] : 0; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @return float The total amount the user has spent |
267 | 267 | */ |
268 | -function give_donation_total_of_user( $user = null ) { |
|
268 | +function give_donation_total_of_user($user = null) { |
|
269 | 269 | |
270 | - $stats = give_get_donation_stats_by_user( $user ); |
|
270 | + $stats = give_get_donation_stats_by_user($user); |
|
271 | 271 | |
272 | 272 | return $stats['total_spent']; |
273 | 273 | } |
@@ -283,40 +283,40 @@ discard block |
||
283 | 283 | * |
284 | 284 | * @return bool |
285 | 285 | */ |
286 | -function give_validate_username( $username, $form_id = 0 ) { |
|
286 | +function give_validate_username($username, $form_id = 0) { |
|
287 | 287 | $valid = true; |
288 | 288 | |
289 | 289 | // Validate username. |
290 | - if ( ! empty( $username ) ) { |
|
290 | + if ( ! empty($username)) { |
|
291 | 291 | |
292 | 292 | // Sanitize username. |
293 | - $sanitized_user_name = sanitize_user( $username, false ); |
|
293 | + $sanitized_user_name = sanitize_user($username, false); |
|
294 | 294 | |
295 | 295 | // We have an user name, check if it already exists. |
296 | - if ( username_exists( $username ) ) { |
|
296 | + if (username_exists($username)) { |
|
297 | 297 | // Username already registered. |
298 | - give_set_error( 'username_unavailable', __( 'Username already taken.', 'give' ) ); |
|
298 | + give_set_error('username_unavailable', __('Username already taken.', 'give')); |
|
299 | 299 | $valid = false; |
300 | 300 | |
301 | 301 | // Check if it's valid. |
302 | - } elseif ( $sanitized_user_name !== $username ) { |
|
302 | + } elseif ($sanitized_user_name !== $username) { |
|
303 | 303 | // Invalid username. |
304 | - if ( is_multisite() ) { |
|
305 | - give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ) ); |
|
304 | + if (is_multisite()) { |
|
305 | + give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give')); |
|
306 | 306 | $valid = false; |
307 | 307 | } else { |
308 | - give_set_error( 'username_invalid', __( 'Invalid username.', 'give' ) ); |
|
308 | + give_set_error('username_invalid', __('Invalid username.', 'give')); |
|
309 | 309 | $valid = false; |
310 | 310 | } |
311 | 311 | } |
312 | 312 | } else { |
313 | 313 | // Username is empty. |
314 | - give_set_error( 'username_empty', __( 'Enter a username.', 'give' ) ); |
|
314 | + give_set_error('username_empty', __('Enter a username.', 'give')); |
|
315 | 315 | $valid = false; |
316 | 316 | |
317 | 317 | // Check if guest checkout is disable for form. |
318 | - if ( $form_id && give_logged_in_only( $form_id ) ) { |
|
319 | - give_set_error( 'registration_required', __( 'You must register or login to complete your donation.', 'give' ) ); |
|
318 | + if ($form_id && give_logged_in_only($form_id)) { |
|
319 | + give_set_error('registration_required', __('You must register or login to complete your donation.', 'give')); |
|
320 | 320 | $valid = false; |
321 | 321 | } |
322 | 322 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @since 1.8 |
332 | 332 | */ |
333 | - $valid = (bool) apply_filters( 'give_validate_username', $valid, $username, $form_id ); |
|
333 | + $valid = (bool) apply_filters('give_validate_username', $valid, $username, $form_id); |
|
334 | 334 | |
335 | 335 | return $valid; |
336 | 336 | } |
@@ -346,30 +346,30 @@ discard block |
||
346 | 346 | * |
347 | 347 | * @return bool |
348 | 348 | */ |
349 | -function give_validate_user_email( $email, $registering_new_user = false ) { |
|
349 | +function give_validate_user_email($email, $registering_new_user = false) { |
|
350 | 350 | $valid = true; |
351 | 351 | |
352 | - if ( empty( $email ) ) { |
|
352 | + if (empty($email)) { |
|
353 | 353 | // No email. |
354 | - give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) ); |
|
354 | + give_set_error('email_empty', __('Enter an email.', 'give')); |
|
355 | 355 | $valid = false; |
356 | 356 | |
357 | - } elseif ( email_exists( $email ) ) { |
|
357 | + } elseif (email_exists($email)) { |
|
358 | 358 | // Email already exists. |
359 | - give_set_error( 'email_exists', __( 'Email already exists.', 'give' ) ); |
|
359 | + give_set_error('email_exists', __('Email already exists.', 'give')); |
|
360 | 360 | $valid = false; |
361 | 361 | |
362 | - } elseif ( ! is_email( $email ) ) { |
|
362 | + } elseif ( ! is_email($email)) { |
|
363 | 363 | // Validate email. |
364 | - give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) ); |
|
364 | + give_set_error('email_invalid', __('Invalid email.', 'give')); |
|
365 | 365 | $valid = false; |
366 | 366 | |
367 | - } elseif ( $registering_new_user ) { |
|
367 | + } elseif ($registering_new_user) { |
|
368 | 368 | |
369 | 369 | // If donor email is not primary. |
370 | - if ( ! email_exists( $email ) && give_donor_email_exists( $email ) && give_is_additional_email( $email ) ) { |
|
370 | + if ( ! email_exists($email) && give_donor_email_exists($email) && give_is_additional_email($email)) { |
|
371 | 371 | // Check if email exists. |
372 | - give_set_error( 'email_used', __( 'The email address provided is already active for another user.', 'give' ) ); |
|
372 | + give_set_error('email_used', __('The email address provided is already active for another user.', 'give')); |
|
373 | 373 | $valid = false; |
374 | 374 | } |
375 | 375 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * |
384 | 384 | * @since 1.8 |
385 | 385 | */ |
386 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $email, $registering_new_user ); |
|
386 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $email, $registering_new_user); |
|
387 | 387 | |
388 | 388 | return $valid; |
389 | 389 | } |
@@ -399,34 +399,34 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @return bool |
401 | 401 | */ |
402 | -function give_validate_user_password( $password = '', $confirm_password = '', $registering_new_user = false ) { |
|
402 | +function give_validate_user_password($password = '', $confirm_password = '', $registering_new_user = false) { |
|
403 | 403 | $valid = true; |
404 | 404 | |
405 | 405 | // Passwords Validation For New Donors Only. |
406 | - if ( $registering_new_user ) { |
|
406 | + if ($registering_new_user) { |
|
407 | 407 | // Password or confirmation missing. |
408 | - if ( ! $password ) { |
|
408 | + if ( ! $password) { |
|
409 | 409 | // The password is invalid. |
410 | - give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) ); |
|
410 | + give_set_error('password_empty', __('Enter a password.', 'give')); |
|
411 | 411 | $valid = false; |
412 | - } elseif ( ! $confirm_password ) { |
|
412 | + } elseif ( ! $confirm_password) { |
|
413 | 413 | // Confirmation password is invalid. |
414 | - give_set_error( 'confirmation_empty', __( 'Enter the password confirmation.', 'give' ) ); |
|
414 | + give_set_error('confirmation_empty', __('Enter the password confirmation.', 'give')); |
|
415 | 415 | $valid = false; |
416 | 416 | } |
417 | 417 | } |
418 | 418 | // Passwords Validation For New Donors as well as Existing Donors. |
419 | - if ( $password || $confirm_password ) { |
|
420 | - if ( strlen( $password ) < 6 || strlen( $confirm_password ) < 6 ) { |
|
419 | + if ($password || $confirm_password) { |
|
420 | + if (strlen($password) < 6 || strlen($confirm_password) < 6) { |
|
421 | 421 | // Seems Weak Password. |
422 | - give_set_error( 'password_weak', __( 'Passwords should have at least 6 characters.', 'give' ) ); |
|
422 | + give_set_error('password_weak', __('Passwords should have at least 6 characters.', 'give')); |
|
423 | 423 | $valid = false; |
424 | 424 | } |
425 | - if ( $password && $confirm_password ) { |
|
425 | + if ($password && $confirm_password) { |
|
426 | 426 | // Verify confirmation matches. |
427 | - if ( $password !== $confirm_password ) { |
|
427 | + if ($password !== $confirm_password) { |
|
428 | 428 | // Passwords do not match. |
429 | - give_set_error( 'password_mismatch', __( 'Passwords you entered do not match. Please try again.', 'give' ) ); |
|
429 | + give_set_error('password_mismatch', __('Passwords you entered do not match. Please try again.', 'give')); |
|
430 | 430 | $valid = false; |
431 | 431 | } |
432 | 432 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | * |
443 | 443 | * @since 1.8 |
444 | 444 | */ |
445 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user ); |
|
445 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user); |
|
446 | 446 | |
447 | 447 | return $valid; |
448 | 448 | } |
@@ -471,8 +471,8 @@ discard block |
||
471 | 471 | * |
472 | 472 | * @return array The donor's address, if any |
473 | 473 | */ |
474 | -function give_get_donor_address( $donor_id = null, $args = array() ) { |
|
475 | - if ( empty( $donor_id ) ) { |
|
474 | +function give_get_donor_address($donor_id = null, $args = array()) { |
|
475 | + if (empty($donor_id)) { |
|
476 | 476 | $donor_id = get_current_user_id(); |
477 | 477 | } |
478 | 478 | |
@@ -493,34 +493,34 @@ discard block |
||
493 | 493 | ); |
494 | 494 | |
495 | 495 | // Backward compatibility for user id param. |
496 | - $by_user_id = get_user_by( 'id', $donor_id ) ? true : false; |
|
496 | + $by_user_id = get_user_by('id', $donor_id) ? true : false; |
|
497 | 497 | |
498 | 498 | // Backward compatibility. |
499 | - if( ! give_has_upgrade_completed( 'v20_upgrades_user_address' ) && $by_user_id ){ |
|
499 | + if ( ! give_has_upgrade_completed('v20_upgrades_user_address') && $by_user_id) { |
|
500 | 500 | return wp_parse_args( |
501 | - (array) get_user_meta( $donor_id, '_give_user_address', true ), |
|
501 | + (array) get_user_meta($donor_id, '_give_user_address', true), |
|
502 | 502 | $default_address |
503 | 503 | ); |
504 | 504 | } |
505 | 505 | |
506 | - $donor = new Give_Donor( $donor_id, $by_user_id ); |
|
506 | + $donor = new Give_Donor($donor_id, $by_user_id); |
|
507 | 507 | |
508 | 508 | |
509 | 509 | if ( |
510 | 510 | ! $donor->id || |
511 | - empty( $donor->address ) || |
|
512 | - ! array_key_exists( $args['address_type'], $donor->address ) |
|
511 | + empty($donor->address) || |
|
512 | + ! array_key_exists($args['address_type'], $donor->address) |
|
513 | 513 | ) { |
514 | 514 | return $default_address; |
515 | 515 | } |
516 | 516 | |
517 | - switch ( true ){ |
|
518 | - case is_string( end( $donor->address[ $args['address_type'] ] ) ) : |
|
519 | - $address = wp_parse_args( $donor->address[ $args['address_type'] ], $default_address ); |
|
517 | + switch (true) { |
|
518 | + case is_string(end($donor->address[$args['address_type']])) : |
|
519 | + $address = wp_parse_args($donor->address[$args['address_type']], $default_address); |
|
520 | 520 | break; |
521 | 521 | |
522 | - case is_array( end( $donor->address[ $args['address_type'] ] ) ) : |
|
523 | - $address = wp_parse_args( array_shift( $donor->address[ $args['address_type'] ] ), $default_address ); |
|
522 | + case is_array(end($donor->address[$args['address_type']])) : |
|
523 | + $address = wp_parse_args(array_shift($donor->address[$args['address_type']]), $default_address); |
|
524 | 524 | break; |
525 | 525 | } |
526 | 526 | |
@@ -540,17 +540,17 @@ discard block |
||
540 | 540 | * |
541 | 541 | * @return void |
542 | 542 | */ |
543 | -function give_new_user_notification( $user_id = 0, $user_data = array() ) { |
|
543 | +function give_new_user_notification($user_id = 0, $user_data = array()) { |
|
544 | 544 | // Bailout. |
545 | - if ( empty( $user_id ) || empty( $user_data ) ) { |
|
545 | + if (empty($user_id) || empty($user_data)) { |
|
546 | 546 | return; |
547 | 547 | } |
548 | 548 | |
549 | - do_action( 'give_new-donor-register_email_notification', $user_id, $user_data ); |
|
550 | - do_action( 'give_donor-register_email_notification', $user_id, $user_data ); |
|
549 | + do_action('give_new-donor-register_email_notification', $user_id, $user_data); |
|
550 | + do_action('give_donor-register_email_notification', $user_id, $user_data); |
|
551 | 551 | } |
552 | 552 | |
553 | -add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
553 | +add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
|
554 | 554 | |
555 | 555 | |
556 | 556 | /** |
@@ -566,33 +566,33 @@ discard block |
||
566 | 566 | * |
567 | 567 | * @return string |
568 | 568 | */ |
569 | -function give_get_donor_name_by( $id = 0, $from = 'donation' ) { |
|
569 | +function give_get_donor_name_by($id = 0, $from = 'donation') { |
|
570 | 570 | |
571 | 571 | // ID shouldn't be empty. |
572 | - if ( empty( $id ) ) { |
|
572 | + if (empty($id)) { |
|
573 | 573 | return ''; |
574 | 574 | } |
575 | 575 | |
576 | 576 | $name = ''; |
577 | 577 | |
578 | - switch ( $from ) { |
|
578 | + switch ($from) { |
|
579 | 579 | |
580 | 580 | case 'donation': |
581 | - $first_name = give_get_meta( $id, '_give_donor_billing_first_name', true ); |
|
582 | - $last_name = give_get_meta( $id, '_give_donor_billing_last_name', true ); |
|
581 | + $first_name = give_get_meta($id, '_give_donor_billing_first_name', true); |
|
582 | + $last_name = give_get_meta($id, '_give_donor_billing_last_name', true); |
|
583 | 583 | |
584 | - $name = trim( "{$first_name} {$last_name}" ); |
|
584 | + $name = trim("{$first_name} {$last_name}"); |
|
585 | 585 | |
586 | 586 | break; |
587 | 587 | |
588 | 588 | case 'donor': |
589 | - $name = Give()->donors->get_column( 'name', $id ); |
|
589 | + $name = Give()->donors->get_column('name', $id); |
|
590 | 590 | |
591 | 591 | break; |
592 | 592 | |
593 | 593 | } |
594 | 594 | |
595 | - return trim( $name ); |
|
595 | + return trim($name); |
|
596 | 596 | |
597 | 597 | } |
598 | 598 | |
@@ -605,8 +605,8 @@ discard block |
||
605 | 605 | * |
606 | 606 | * @return boolean The user's ID on success, and false on failure. |
607 | 607 | */ |
608 | -function give_donor_email_exists( $email ) { |
|
609 | - if ( Give()->donors->get_donor_by( 'email', $email ) ) { |
|
608 | +function give_donor_email_exists($email) { |
|
609 | + if (Give()->donors->get_donor_by('email', $email)) { |
|
610 | 610 | return true; |
611 | 611 | } |
612 | 612 | return false; |
@@ -621,14 +621,14 @@ discard block |
||
621 | 621 | * |
622 | 622 | * @return bool |
623 | 623 | */ |
624 | -function give_is_additional_email( $email ) { |
|
624 | +function give_is_additional_email($email) { |
|
625 | 625 | global $wpdb; |
626 | 626 | |
627 | 627 | $meta_table = Give()->donor_meta->table_name; |
628 | 628 | $meta_type = Give()->donor_meta->meta_type; |
629 | - $donor_id = $wpdb->get_var( $wpdb->prepare( "SELECT {$meta_type}_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $email ) ); |
|
629 | + $donor_id = $wpdb->get_var($wpdb->prepare("SELECT {$meta_type}_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $email)); |
|
630 | 630 | |
631 | - if ( empty( $donor_id ) ) { |
|
631 | + if (empty($donor_id)) { |
|
632 | 632 | return false; |
633 | 633 | } |
634 | 634 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | // Default, built-in gateways |
25 | 25 | $gateways = array( |
26 | 26 | 'paypal' => array( |
27 | - 'admin_label' => __( 'PayPal Standard', 'give' ), |
|
28 | - 'checkout_label' => __( 'PayPal', 'give' ), |
|
27 | + 'admin_label' => __('PayPal Standard', 'give'), |
|
28 | + 'checkout_label' => __('PayPal', 'give'), |
|
29 | 29 | ), |
30 | 30 | 'manual' => array( |
31 | - 'admin_label' => __( 'Test Donation', 'give' ), |
|
32 | - 'checkout_label' => __( 'Test Donation', 'give' ) |
|
31 | + 'admin_label' => __('Test Donation', 'give'), |
|
32 | + 'checkout_label' => __('Test Donation', 'give') |
|
33 | 33 | ), |
34 | 34 | ); |
35 | 35 | |
36 | - return apply_filters( 'give_payment_gateways', $gateways ); |
|
36 | + return apply_filters('give_payment_gateways', $gateways); |
|
37 | 37 | |
38 | 38 | } |
39 | 39 | |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array $gateway_list All the available gateways |
48 | 48 | */ |
49 | -function give_get_enabled_payment_gateways( $form_id = 0 ) { |
|
49 | +function give_get_enabled_payment_gateways($form_id = 0) { |
|
50 | 50 | |
51 | 51 | $gateways = give_get_payment_gateways(); |
52 | 52 | |
53 | - $enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
53 | + $enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
54 | 54 | |
55 | 55 | $gateway_list = array(); |
56 | 56 | |
57 | - foreach ( $gateways as $key => $gateway ) { |
|
58 | - if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) { |
|
59 | - $gateway_list[ $key ] = $gateway; |
|
57 | + foreach ($gateways as $key => $gateway) { |
|
58 | + if (isset($enabled[$key]) && $enabled[$key] == 1) { |
|
59 | + $gateway_list[$key] = $gateway; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Set order of payment gateway in list. |
64 | - $gateway_list = give_get_ordered_payment_gateways( $gateway_list ); |
|
64 | + $gateway_list = give_get_ordered_payment_gateways($gateway_list); |
|
65 | 65 | |
66 | - return apply_filters( 'give_enabled_payment_gateways', $gateway_list, $form_id ); |
|
66 | + return apply_filters('give_enabled_payment_gateways', $gateway_list, $form_id); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @return boolean true if enabled, false otherwise |
77 | 77 | */ |
78 | -function give_is_gateway_active( $gateway ) { |
|
78 | +function give_is_gateway_active($gateway) { |
|
79 | 79 | $gateways = give_get_enabled_payment_gateways(); |
80 | 80 | |
81 | - $ret = array_key_exists( $gateway, $gateways ); |
|
81 | + $ret = array_key_exists($gateway, $gateways); |
|
82 | 82 | |
83 | - return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways ); |
|
83 | + return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -92,25 +92,25 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return string Gateway ID |
94 | 94 | */ |
95 | -function give_get_default_gateway( $form_id ) { |
|
95 | +function give_get_default_gateway($form_id) { |
|
96 | 96 | |
97 | - $enabled_gateways = array_keys( give_get_enabled_payment_gateways() ); |
|
97 | + $enabled_gateways = array_keys(give_get_enabled_payment_gateways()); |
|
98 | 98 | $default_gateway = give_get_option('default_gateway'); |
99 | - $default = ! empty( $default_gateway ) && give_is_gateway_active( $default_gateway ) ? $default_gateway : $enabled_gateways[0]; |
|
100 | - $form_default = give_get_meta( $form_id, '_give_default_gateway', true ); |
|
99 | + $default = ! empty($default_gateway) && give_is_gateway_active($default_gateway) ? $default_gateway : $enabled_gateways[0]; |
|
100 | + $form_default = give_get_meta($form_id, '_give_default_gateway', true); |
|
101 | 101 | |
102 | 102 | // Single Form settings varies compared to the Global default settings. |
103 | 103 | if ( |
104 | - ! empty( $form_default ) && |
|
104 | + ! empty($form_default) && |
|
105 | 105 | $form_id !== null && |
106 | 106 | $default !== $form_default && |
107 | 107 | 'global' !== $form_default && |
108 | - give_is_gateway_active( $form_default ) |
|
108 | + give_is_gateway_active($form_default) |
|
109 | 109 | ) { |
110 | 110 | $default = $form_default; |
111 | 111 | } |
112 | 112 | |
113 | - return apply_filters( 'give_default_gateway', $default ); |
|
113 | + return apply_filters('give_default_gateway', $default); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -122,15 +122,15 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return string Gateway admin label |
124 | 124 | */ |
125 | -function give_get_gateway_admin_label( $gateway ) { |
|
125 | +function give_get_gateway_admin_label($gateway) { |
|
126 | 126 | $gateways = give_get_payment_gateways(); |
127 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway; |
|
127 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway; |
|
128 | 128 | |
129 | - if ( $gateway == 'manual' ) { |
|
130 | - $label = __( 'Test Donation', 'give' ); |
|
129 | + if ($gateway == 'manual') { |
|
130 | + $label = __('Test Donation', 'give'); |
|
131 | 131 | } |
132 | 132 | |
133 | - return apply_filters( 'give_gateway_admin_label', $label, $gateway ); |
|
133 | + return apply_filters('give_gateway_admin_label', $label, $gateway); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -142,15 +142,15 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return string Checkout label for the gateway |
144 | 144 | */ |
145 | -function give_get_gateway_checkout_label( $gateway ) { |
|
145 | +function give_get_gateway_checkout_label($gateway) { |
|
146 | 146 | $gateways = give_get_payment_gateways(); |
147 | - $label = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway; |
|
147 | + $label = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway; |
|
148 | 148 | |
149 | - if ( $gateway == 'manual' ) { |
|
150 | - $label = __( 'Test Donation', 'give' ); |
|
149 | + if ($gateway == 'manual') { |
|
150 | + $label = __('Test Donation', 'give'); |
|
151 | 151 | } |
152 | 152 | |
153 | - return apply_filters( 'give_gateway_checkout_label', $label, $gateway ); |
|
153 | + return apply_filters('give_gateway_checkout_label', $label, $gateway); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return array Options the gateway supports |
164 | 164 | */ |
165 | -function give_get_gateway_supports( $gateway ) { |
|
165 | +function give_get_gateway_supports($gateway) { |
|
166 | 166 | $gateways = give_get_enabled_payment_gateways(); |
167 | - $supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array(); |
|
167 | + $supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array(); |
|
168 | 168 | |
169 | - return apply_filters( 'give_gateway_supports', $supports, $gateway ); |
|
169 | + return apply_filters('give_gateway_supports', $supports, $gateway); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return void |
181 | 181 | */ |
182 | -function give_send_to_gateway( $gateway, $payment_data ) { |
|
182 | +function give_send_to_gateway($gateway, $payment_data) { |
|
183 | 183 | |
184 | - $payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' ); |
|
184 | + $payment_data['gateway_nonce'] = wp_create_nonce('give-gateway'); |
|
185 | 185 | |
186 | 186 | /** |
187 | 187 | * Fires while loading payment gateway via AJAX. |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @param array $payment_data All the payment data to be sent to the gateway. |
194 | 194 | */ |
195 | - do_action( "give_gateway_{$gateway}", $payment_data ); |
|
195 | + do_action("give_gateway_{$gateway}", $payment_data); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -206,34 +206,34 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @return string $enabled_gateway The slug of the gateway |
208 | 208 | */ |
209 | -function give_get_chosen_gateway( $form_id ) { |
|
209 | +function give_get_chosen_gateway($form_id) { |
|
210 | 210 | |
211 | - $request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0; |
|
211 | + $request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0; |
|
212 | 212 | |
213 | 213 | // Back to check if 'form-id' is present. |
214 | - if ( empty( $request_form_id ) ) { |
|
215 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0; |
|
214 | + if (empty($request_form_id)) { |
|
215 | + $request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0; |
|
216 | 216 | } |
217 | 217 | |
218 | - $request_payment_mode = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : ''; |
|
218 | + $request_payment_mode = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : ''; |
|
219 | 219 | $chosen = false; |
220 | 220 | |
221 | 221 | // If both 'payment-mode' and 'form-id' then set for only this form. |
222 | - if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) { |
|
222 | + if ( ! empty($request_form_id) && $form_id == $request_form_id) { |
|
223 | 223 | $chosen = $request_payment_mode; |
224 | - } elseif ( empty( $request_form_id ) && $request_payment_mode ) { |
|
224 | + } elseif (empty($request_form_id) && $request_payment_mode) { |
|
225 | 225 | // If no 'form-id' but there is 'payment-mode'. |
226 | 226 | $chosen = $request_payment_mode; |
227 | 227 | } |
228 | 228 | |
229 | 229 | // Get the enable gateway based of chosen var. |
230 | - if ( $chosen && give_is_gateway_active( $chosen ) ) { |
|
231 | - $enabled_gateway = urldecode( $chosen ); |
|
230 | + if ($chosen && give_is_gateway_active($chosen)) { |
|
231 | + $enabled_gateway = urldecode($chosen); |
|
232 | 232 | } else { |
233 | - $enabled_gateway = give_get_default_gateway( $form_id ); |
|
233 | + $enabled_gateway = give_get_default_gateway($form_id); |
|
234 | 234 | } |
235 | 235 | |
236 | - return apply_filters( 'give_chosen_gateway', $enabled_gateway ); |
|
236 | + return apply_filters('give_chosen_gateway', $enabled_gateway); |
|
237 | 237 | |
238 | 238 | } |
239 | 239 | |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @return int ID of the new log entry. |
254 | 254 | */ |
255 | -function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) { |
|
256 | - return Give()->logs->add( $title, $message, $parent, $type ); |
|
255 | +function give_record_log($title = '', $message = '', $parent = 0, $type = null) { |
|
256 | + return Give()->logs->add($title, $message, $parent, $type); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @return int ID of the new log entry |
272 | 272 | */ |
273 | -function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) { |
|
274 | - $title = empty( $title ) ? esc_html__( 'Payment Error', 'give' ) : $title; |
|
273 | +function give_record_gateway_error($title = '', $message = '', $parent = 0) { |
|
274 | + $title = empty($title) ? esc_html__('Payment Error', 'give') : $title; |
|
275 | 275 | |
276 | - return give_record_log( $title, $message, $parent, 'gateway_error' ); |
|
276 | + return give_record_log($title, $message, $parent, 'gateway_error'); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * |
287 | 287 | * @return int |
288 | 288 | */ |
289 | -function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) { |
|
289 | +function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') { |
|
290 | 290 | |
291 | 291 | $ret = 0; |
292 | 292 | $args = array( |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | 'fields' => 'ids', |
299 | 299 | ); |
300 | 300 | |
301 | - $payments = new WP_Query( $args ); |
|
301 | + $payments = new WP_Query($args); |
|
302 | 302 | |
303 | - if ( $payments ) { |
|
303 | + if ($payments) { |
|
304 | 304 | $ret = $payments->post_count; |
305 | 305 | } |
306 | 306 | |
@@ -317,27 +317,27 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @return array $gateways All the available gateways |
319 | 319 | */ |
320 | -function give_get_ordered_payment_gateways( $gateways ) { |
|
320 | +function give_get_ordered_payment_gateways($gateways) { |
|
321 | 321 | |
322 | 322 | // Get gateways setting. |
323 | - $gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' ); |
|
323 | + $gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways'); |
|
324 | 324 | |
325 | 325 | // Return from here if we do not have gateways setting. |
326 | - if ( empty( $gateways_setting ) ) { |
|
326 | + if (empty($gateways_setting)) { |
|
327 | 327 | return $gateways; |
328 | 328 | } |
329 | 329 | |
330 | 330 | // Reverse array to order payment gateways. |
331 | - $gateways_setting = array_reverse( $gateways_setting ); |
|
331 | + $gateways_setting = array_reverse($gateways_setting); |
|
332 | 332 | |
333 | 333 | // Reorder gateways array |
334 | - foreach ( $gateways_setting as $gateway_key => $value ) { |
|
334 | + foreach ($gateways_setting as $gateway_key => $value) { |
|
335 | 335 | |
336 | - $new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : ''; |
|
337 | - unset( $gateways[ $gateway_key ] ); |
|
336 | + $new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : ''; |
|
337 | + unset($gateways[$gateway_key]); |
|
338 | 338 | |
339 | - if ( ! empty( $new_gateway_value ) ) { |
|
340 | - $gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways ); |
|
339 | + if ( ! empty($new_gateway_value)) { |
|
340 | + $gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
@@ -348,5 +348,5 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @param array $gateways All the available gateways |
350 | 350 | */ |
351 | - return apply_filters( 'give_payment_gateways_order', $gateways ); |
|
351 | + return apply_filters('give_payment_gateways_order', $gateways); |
|
352 | 352 | } |
353 | 353 | \ No newline at end of file |
@@ -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,34 +26,34 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_set_settings_with_disable_prefix( $old_settings, $settings ) { |
|
29 | +function give_set_settings_with_disable_prefix($old_settings, $settings) { |
|
30 | 30 | // Bailout. |
31 | - if ( ! function_exists( 'give_v18_renamed_core_settings' ) ) { |
|
31 | + if ( ! function_exists('give_v18_renamed_core_settings')) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
35 | 35 | // Get old setting names. |
36 | - $old_settings = array_flip( give_v18_renamed_core_settings() ); |
|
36 | + $old_settings = array_flip(give_v18_renamed_core_settings()); |
|
37 | 37 | $update_setting = false; |
38 | 38 | |
39 | - foreach ( $settings as $key => $value ) { |
|
39 | + foreach ($settings as $key => $value) { |
|
40 | 40 | |
41 | 41 | // Check 1. Check if new option is really updated or not. |
42 | 42 | // Check 2. Continue if key is not renamed. |
43 | - if ( ! isset( $old_settings[ $key ] ) ) { |
|
43 | + if ( ! isset($old_settings[$key])) { |
|
44 | 44 | continue; |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set old setting. |
48 | - $settings[ $old_settings[ $key ] ] = 'on'; |
|
48 | + $settings[$old_settings[$key]] = 'on'; |
|
49 | 49 | |
50 | 50 | // Do not need to set old setting if new setting is not set. |
51 | 51 | if ( |
52 | - ( give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'disable_' ) ) ) |
|
53 | - || ( ! give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'enable_' ) ) ) |
|
52 | + (give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'disable_'))) |
|
53 | + || ( ! give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'enable_'))) |
|
54 | 54 | |
55 | 55 | ) { |
56 | - unset( $settings[ $old_settings[ $key ] ] ); |
|
56 | + unset($settings[$old_settings[$key]]); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Tell bot to update setting. |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // Update setting if any old setting set. |
64 | - if ( $update_setting ) { |
|
65 | - update_option( 'give_settings', $settings ); |
|
64 | + if ($update_setting) { |
|
65 | + update_option('give_settings', $settings); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2 ); |
|
69 | +add_action('update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Check spam through Akismet. |
@@ -80,45 +80,45 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return bool|mixed |
82 | 82 | */ |
83 | -function give_akismet( $spam ) { |
|
83 | +function give_akismet($spam) { |
|
84 | 84 | |
85 | 85 | // Bail out, If spam. |
86 | - if ( $spam ) { |
|
86 | + if ($spam) { |
|
87 | 87 | return $spam; |
88 | 88 | } |
89 | 89 | |
90 | 90 | // Bail out, if Akismet key not exist. |
91 | - if ( ! give_check_akismet_key() ) { |
|
91 | + if ( ! give_check_akismet_key()) { |
|
92 | 92 | return false; |
93 | 93 | } |
94 | 94 | |
95 | 95 | // Build args array. |
96 | 96 | $args = array(); |
97 | 97 | |
98 | - $args['comment_author'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : ''; |
|
99 | - $args['comment_author_email'] = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false; |
|
100 | - $args['blog'] = get_option( 'home' ); |
|
98 | + $args['comment_author'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : ''; |
|
99 | + $args['comment_author_email'] = isset($_POST['give_email']) ? $_POST['give_email'] : false; |
|
100 | + $args['blog'] = get_option('home'); |
|
101 | 101 | $args['blog_lang'] = get_locale(); |
102 | - $args['blog_charset'] = get_option( 'blog_charset' ); |
|
102 | + $args['blog_charset'] = get_option('blog_charset'); |
|
103 | 103 | $args['user_ip'] = $_SERVER['REMOTE_ADDR']; |
104 | 104 | $args['user_agent'] = $_SERVER['HTTP_USER_AGENT']; |
105 | 105 | $args['referrer'] = $_SERVER['HTTP_REFERER']; |
106 | 106 | $args['comment_type'] = 'contact-form'; |
107 | 107 | |
108 | - $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ); |
|
108 | + $ignore = array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'); |
|
109 | 109 | |
110 | - foreach ( $_SERVER as $key => $value ) { |
|
111 | - if ( ! in_array( $key, (array) $ignore ) ) { |
|
110 | + foreach ($_SERVER as $key => $value) { |
|
111 | + if ( ! in_array($key, (array) $ignore)) { |
|
112 | 112 | $args["$key"] = $value; |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | // It will return Akismet spam detect API response. |
117 | - return give_akismet_spam_check( $args ); |
|
117 | + return give_akismet_spam_check($args); |
|
118 | 118 | |
119 | 119 | } |
120 | 120 | |
121 | -add_filter( 'give_spam', 'give_akismet' ); |
|
121 | +add_filter('give_spam', 'give_akismet'); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Check Akismet API Key. |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | * @return bool |
129 | 129 | */ |
130 | 130 | function give_check_akismet_key() { |
131 | - if ( is_callable( array( 'Akismet', 'get_api_key' ) ) ) { // Akismet v3.0+ |
|
131 | + if (is_callable(array('Akismet', 'get_api_key'))) { // Akismet v3.0+ |
|
132 | 132 | return (bool) Akismet::get_api_key(); |
133 | 133 | } |
134 | 134 | |
135 | - if ( function_exists( 'akismet_get_key' ) ) { |
|
135 | + if (function_exists('akismet_get_key')) { |
|
136 | 136 | return (bool) akismet_get_key(); |
137 | 137 | } |
138 | 138 | |
@@ -148,26 +148,26 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return bool|mixed |
150 | 150 | */ |
151 | -function give_akismet_spam_check( $args ) { |
|
151 | +function give_akismet_spam_check($args) { |
|
152 | 152 | global $akismet_api_host, $akismet_api_port; |
153 | 153 | |
154 | 154 | $spam = false; |
155 | - $query_string = http_build_query( $args ); |
|
155 | + $query_string = http_build_query($args); |
|
156 | 156 | |
157 | - if ( is_callable( array( 'Akismet', 'http_post' ) ) ) { // Akismet v3.0+ |
|
158 | - $response = Akismet::http_post( $query_string, 'comment-check' ); |
|
157 | + if (is_callable(array('Akismet', 'http_post'))) { // Akismet v3.0+ |
|
158 | + $response = Akismet::http_post($query_string, 'comment-check'); |
|
159 | 159 | } else { |
160 | - $response = akismet_http_post( $query_string, $akismet_api_host, |
|
161 | - '/1.1/comment-check', $akismet_api_port ); |
|
160 | + $response = akismet_http_post($query_string, $akismet_api_host, |
|
161 | + '/1.1/comment-check', $akismet_api_port); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // It's spam if response status is true. |
165 | - if ( 'true' === $response[1] ) { |
|
165 | + if ('true' === $response[1]) { |
|
166 | 166 | $spam = true; |
167 | 167 | } |
168 | 168 | |
169 | 169 | // Allow developer to modified Akismet spam detection response. |
170 | - return apply_filters( 'give_akismet_spam_check', $spam, $args ); |
|
170 | + return apply_filters('give_akismet_spam_check', $spam, $args); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -180,15 +180,15 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return array |
182 | 182 | */ |
183 | -function give_bc_v1817_iranian_currency_code( $currencies ) { |
|
184 | - if ( ! give_has_upgrade_completed( 'v1817_update_donation_iranian_currency_code' ) ) { |
|
183 | +function give_bc_v1817_iranian_currency_code($currencies) { |
|
184 | + if ( ! give_has_upgrade_completed('v1817_update_donation_iranian_currency_code')) { |
|
185 | 185 | $currencies['RIAL'] = $currencies['IRR']; |
186 | 186 | } |
187 | 187 | |
188 | 188 | return $currencies; |
189 | 189 | } |
190 | 190 | |
191 | -add_filter( 'give_currencies', 'give_bc_v1817_iranian_currency_code', 0 ); |
|
191 | +add_filter('give_currencies', 'give_bc_v1817_iranian_currency_code', 0); |
|
192 | 192 | |
193 | 193 | |
194 | 194 | /** |
@@ -202,25 +202,23 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return string |
204 | 204 | */ |
205 | -function give_format_price_for_right_to_left_supported_currency( $formatted_amount, $currency_args, $price ) { |
|
206 | - if ( ! give_is_right_to_left_supported_currency( $currency_args['currency_code'] ) ) { |
|
205 | +function give_format_price_for_right_to_left_supported_currency($formatted_amount, $currency_args, $price) { |
|
206 | + if ( ! give_is_right_to_left_supported_currency($currency_args['currency_code'])) { |
|
207 | 207 | return $formatted_amount; |
208 | 208 | } |
209 | 209 | |
210 | 210 | $formatted_amount = ( |
211 | 211 | 'before' === (string) $currency_args['position'] ? |
212 | - '‫' . $price . $currency_args['symbol'] . '‬' : |
|
213 | - '‪' . $price . $currency_args['symbol'] . '‬' |
|
212 | + '‫'.$price.$currency_args['symbol'].'‬' : '‪'.$price.$currency_args['symbol'].'‬' |
|
214 | 213 | ); |
215 | 214 | |
216 | 215 | $formatted_amount = $currency_args['decode_currency'] ? |
217 | - html_entity_decode( $formatted_amount, ENT_COMPAT, 'UTF-8' ) : |
|
218 | - $formatted_amount; |
|
216 | + html_entity_decode($formatted_amount, ENT_COMPAT, 'UTF-8') : $formatted_amount; |
|
219 | 217 | |
220 | 218 | return $formatted_amount; |
221 | 219 | } |
222 | 220 | |
223 | -add_filter( 'give_currency_filter', 'give_format_price_for_right_to_left_supported_currency', 10, 3 ); |
|
221 | +add_filter('give_currency_filter', 'give_format_price_for_right_to_left_supported_currency', 10, 3); |
|
224 | 222 | |
225 | 223 | /** |
226 | 224 | * Validate active gateway value before returning result. |
@@ -231,31 +229,31 @@ discard block |
||
231 | 229 | * |
232 | 230 | * @return array |
233 | 231 | */ |
234 | -function __give_validate_active_gateways( $value ) { |
|
235 | - $gateways = array_keys( give_get_payment_gateways() ); |
|
236 | - $active_gateways = is_array( $value ) ? array_keys( $value ) : array(); |
|
232 | +function __give_validate_active_gateways($value) { |
|
233 | + $gateways = array_keys(give_get_payment_gateways()); |
|
234 | + $active_gateways = is_array($value) ? array_keys($value) : array(); |
|
237 | 235 | |
238 | 236 | // Remove deactivated payment gateways. |
239 | - if( ! empty( $active_gateways ) ) { |
|
240 | - foreach ( $active_gateways as $index => $gateway_id ) { |
|
241 | - if( ! in_array( $gateway_id, $gateways ) ) { |
|
242 | - unset( $value[$gateway_id] ); |
|
237 | + if ( ! empty($active_gateways)) { |
|
238 | + foreach ($active_gateways as $index => $gateway_id) { |
|
239 | + if ( ! in_array($gateway_id, $gateways)) { |
|
240 | + unset($value[$gateway_id]); |
|
243 | 241 | } |
244 | 242 | } |
245 | 243 | } |
246 | 244 | |
247 | - if ( empty( $value ) ) { |
|
245 | + if (empty($value)) { |
|
248 | 246 | /** |
249 | 247 | * Filter the default active gateway |
250 | 248 | * |
251 | 249 | * @since 2.1.0 |
252 | 250 | */ |
253 | - $value = apply_filters( 'give_default_active_gateways', array( |
|
251 | + $value = apply_filters('give_default_active_gateways', array( |
|
254 | 252 | 'manual' => 1, |
255 | - ) ); |
|
253 | + )); |
|
256 | 254 | } |
257 | 255 | |
258 | 256 | return $value; |
259 | 257 | } |
260 | 258 | |
261 | -add_filter( 'give_get_option_gateways', '__give_validate_active_gateways', 10, 1 ); |
|
262 | 259 | \ No newline at end of file |
260 | +add_filter('give_get_option_gateways', '__give_validate_active_gateways', 10, 1); |
|
263 | 261 | \ No newline at end of file |
@@ -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 | |
@@ -53,21 +53,21 @@ discard block |
||
53 | 53 | * @since 1.8.9 |
54 | 54 | */ |
55 | 55 | public function __construct() { |
56 | - add_action( 'admin_notices', array( $this, 'render_admin_notices' ), 999 ); |
|
57 | - add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) ); |
|
56 | + add_action('admin_notices', array($this, 'render_admin_notices'), 999); |
|
57 | + add_action('give_dismiss_notices', array($this, 'dismiss_notices')); |
|
58 | 58 | |
59 | - add_action( 'give_frontend_notices', array( $this, 'render_frontend_notices' ), 999 ); |
|
60 | - add_action( 'give_pre_form', array( $this, 'render_frontend_notices' ), 11 ); |
|
61 | - add_action( 'give_ajax_donation_errors', array( $this, 'render_frontend_notices' ) ); |
|
59 | + add_action('give_frontend_notices', array($this, 'render_frontend_notices'), 999); |
|
60 | + add_action('give_pre_form', array($this, 'render_frontend_notices'), 11); |
|
61 | + add_action('give_ajax_donation_errors', array($this, 'render_frontend_notices')); |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Backward compatibility for deprecated params. |
65 | 65 | * |
66 | 66 | * @since 1.8.14 |
67 | 67 | */ |
68 | - add_filter( 'give_register_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
69 | - add_filter( 'give_frontend_errors_args', array( $this, 'bc_deprecated_params' ) ); |
|
70 | - add_filter( 'give_frontend_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
68 | + add_filter('give_register_notice_args', array($this, 'bc_deprecated_params')); |
|
69 | + add_filter('give_frontend_errors_args', array($this, 'bc_deprecated_params')); |
|
70 | + add_filter('give_frontend_notice_args', array($this, 'bc_deprecated_params')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -80,19 +80,19 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return array |
82 | 82 | */ |
83 | - public function bc_deprecated_params( $args ) { |
|
83 | + public function bc_deprecated_params($args) { |
|
84 | 84 | /** |
85 | 85 | * Param: auto_dismissible |
86 | 86 | * deprecated in 1.8.14 |
87 | 87 | * |
88 | 88 | * Check if auto_dismissible is set and it true then unset and change dismissible parameter value to auto |
89 | 89 | */ |
90 | - if ( isset( $args['auto_dismissible'] ) ) { |
|
91 | - if ( ! empty( $args['auto_dismissible'] ) ) { |
|
90 | + if (isset($args['auto_dismissible'])) { |
|
91 | + if ( ! empty($args['auto_dismissible'])) { |
|
92 | 92 | $args['dismissible'] = 'auto'; |
93 | 93 | } |
94 | 94 | // unset auto_dismissible as it has been deprecated. |
95 | - unset( $args['auto_dismissible'] ); |
|
95 | + unset($args['auto_dismissible']); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return $args; |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return bool |
110 | 110 | */ |
111 | - public function register_notice( $notice_args ) { |
|
111 | + public function register_notice($notice_args) { |
|
112 | 112 | // Bailout. |
113 | - if ( empty( $notice_args['id'] ) || array_key_exists( $notice_args['id'], self::$notices ) ) { |
|
113 | + if (empty($notice_args['id']) || array_key_exists($notice_args['id'], self::$notices)) { |
|
114 | 114 | return false; |
115 | 115 | } |
116 | 116 | |
@@ -159,39 +159,39 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @since 1.8.14 |
161 | 161 | */ |
162 | - $notice_args = apply_filters( 'give_register_notice_args', $notice_args ); |
|
162 | + $notice_args = apply_filters('give_register_notice_args', $notice_args); |
|
163 | 163 | |
164 | 164 | // Set extra dismiss links if any. |
165 | - if ( false !== strpos( $notice_args['description'], 'data-dismiss-interval' ) ) { |
|
165 | + if (false !== strpos($notice_args['description'], 'data-dismiss-interval')) { |
|
166 | 166 | |
167 | - preg_match_all( "/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link ); |
|
167 | + preg_match_all("/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link); |
|
168 | 168 | |
169 | - if ( ! empty( $extra_notice_dismiss_link ) ) { |
|
170 | - $extra_notice_dismiss_links = array_chunk( current( $extra_notice_dismiss_link ), 3 ); |
|
171 | - foreach ( $extra_notice_dismiss_links as $extra_notice_dismiss_link ) { |
|
169 | + if ( ! empty($extra_notice_dismiss_link)) { |
|
170 | + $extra_notice_dismiss_links = array_chunk(current($extra_notice_dismiss_link), 3); |
|
171 | + foreach ($extra_notice_dismiss_links as $extra_notice_dismiss_link) { |
|
172 | 172 | // Create array og key ==> value by parsing query string created after renaming data attributes. |
173 | - $data_attribute_query_str = str_replace( array( 'data-', '-', '"' ), array( |
|
173 | + $data_attribute_query_str = str_replace(array('data-', '-', '"'), array( |
|
174 | 174 | '', |
175 | 175 | '_', |
176 | 176 | '', |
177 | - ), implode( '&', $extra_notice_dismiss_link ) ); |
|
177 | + ), implode('&', $extra_notice_dismiss_link)); |
|
178 | 178 | |
179 | - $notice_args['extra_links'][] = wp_parse_args( $data_attribute_query_str ); |
|
179 | + $notice_args['extra_links'][] = wp_parse_args($data_attribute_query_str); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | - self::$notices[ $notice_args['id'] ] = $notice_args; |
|
185 | + self::$notices[$notice_args['id']] = $notice_args; |
|
186 | 186 | |
187 | 187 | // Auto set show param if not already set. |
188 | - if ( ! isset( self::$notices[ $notice_args['id'] ]['show'] ) ) { |
|
189 | - self::$notices[ $notice_args['id'] ]['show'] = $this->is_notice_dismissed( $notice_args ) ? false : true; |
|
188 | + if ( ! isset(self::$notices[$notice_args['id']]['show'])) { |
|
189 | + self::$notices[$notice_args['id']]['show'] = $this->is_notice_dismissed($notice_args) ? false : true; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | // Auto set time interval for shortly. |
193 | - if ( 'shortly' === self::$notices[ $notice_args['id'] ]['dismiss_interval'] ) { |
|
194 | - self::$notices[ $notice_args['id'] ]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
193 | + if ('shortly' === self::$notices[$notice_args['id']]['dismiss_interval']) { |
|
194 | + self::$notices[$notice_args['id']]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | return true; |
@@ -205,51 +205,51 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function render_admin_notices() { |
207 | 207 | // Bailout. |
208 | - if ( empty( self::$notices ) ) { |
|
208 | + if (empty(self::$notices)) { |
|
209 | 209 | return; |
210 | 210 | } |
211 | 211 | |
212 | 212 | $output = ''; |
213 | 213 | |
214 | - foreach ( self::$notices as $notice_id => $notice ) { |
|
214 | + foreach (self::$notices as $notice_id => $notice) { |
|
215 | 215 | // Check flag set to true to show notice. |
216 | - if ( ! $notice['show'] ) { |
|
216 | + if ( ! $notice['show']) { |
|
217 | 217 | continue; |
218 | 218 | } |
219 | 219 | |
220 | 220 | |
221 | 221 | // Render custom html. |
222 | - if( ! empty( $notice['description_html'] ) ) { |
|
222 | + if ( ! empty($notice['description_html'])) { |
|
223 | 223 | $output .= "{$notice['description_html']} \n"; |
224 | 224 | continue; |
225 | 225 | } |
226 | 226 | |
227 | 227 | // Check if notice dismissible or not. |
228 | - if ( ! self::$has_auto_dismissible_notice ) { |
|
229 | - self::$has_auto_dismissible_notice = ( 'auto' === $notice['dismissible'] ); |
|
228 | + if ( ! self::$has_auto_dismissible_notice) { |
|
229 | + self::$has_auto_dismissible_notice = ('auto' === $notice['dismissible']); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | // Check if notice dismissible or not. |
233 | - if ( ! self::$has_dismiss_interval_notice ) { |
|
233 | + if ( ! self::$has_dismiss_interval_notice) { |
|
234 | 234 | self::$has_dismiss_interval_notice = $notice['dismiss_interval']; |
235 | 235 | } |
236 | 236 | |
237 | - $css_id = ( false === strpos( $notice['id'], 'give' ) ? "give-{$notice['id']}" : $notice['id'] ); |
|
237 | + $css_id = (false === strpos($notice['id'], 'give') ? "give-{$notice['id']}" : $notice['id']); |
|
238 | 238 | |
239 | - $css_class = 'give-notice notice ' . ( empty( $notice['dismissible'] ) ? 'non' : 'is' ) . "-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
240 | - $output .= sprintf( |
|
241 | - '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">' . " \n", |
|
239 | + $css_class = 'give-notice notice '.(empty($notice['dismissible']) ? 'non' : 'is')."-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
240 | + $output .= sprintf( |
|
241 | + '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">'." \n", |
|
242 | 242 | $css_id, |
243 | 243 | $css_class, |
244 | - give_clean( $notice['dismissible'] ), |
|
244 | + give_clean($notice['dismissible']), |
|
245 | 245 | $notice['dismissible_type'], |
246 | 246 | $notice['dismiss_interval'], |
247 | 247 | $notice['id'], |
248 | - empty( $notice['dismissible_type'] ) ? '' : wp_create_nonce( "give_edit_{$notice_id}_notice" ), |
|
248 | + empty($notice['dismissible_type']) ? '' : wp_create_nonce("give_edit_{$notice_id}_notice"), |
|
249 | 249 | $notice['dismiss_interval_time'] |
250 | 250 | ); |
251 | 251 | |
252 | - $output .= ( 0 === strpos( $notice['description'], '<div' ) || 0 === strpos( $notice['description'], '<p' ) ? $notice['description'] : "<p>{$notice['description']}</p>" ); |
|
252 | + $output .= (0 === strpos($notice['description'], '<div') || 0 === strpos($notice['description'], '<p') ? $notice['description'] : "<p>{$notice['description']}</p>"); |
|
253 | 253 | $output .= "</div> \n"; |
254 | 254 | } |
255 | 255 | |
@@ -267,18 +267,18 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @param int $form_id |
269 | 269 | */ |
270 | - public function render_frontend_notices( $form_id = 0 ) { |
|
270 | + public function render_frontend_notices($form_id = 0) { |
|
271 | 271 | $errors = give_get_errors(); |
272 | 272 | |
273 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? absint( $_REQUEST['form-id'] ) : 0; |
|
273 | + $request_form_id = isset($_REQUEST['form-id']) ? absint($_REQUEST['form-id']) : 0; |
|
274 | 274 | |
275 | 275 | // Sanity checks first: Ensure that gateway returned errors display on the appropriate form. |
276 | - if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) { |
|
276 | + if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) { |
|
277 | 277 | return; |
278 | 278 | } |
279 | 279 | |
280 | - if ( $errors ) { |
|
281 | - self::print_frontend_errors( $errors ); |
|
280 | + if ($errors) { |
|
281 | + self::print_frontend_errors($errors); |
|
282 | 282 | |
283 | 283 | give_clear_errors(); |
284 | 284 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @access private |
292 | 292 | */ |
293 | 293 | private function print_js() { |
294 | - if ( self::$has_auto_dismissible_notice ) : |
|
294 | + if (self::$has_auto_dismissible_notice) : |
|
295 | 295 | ?> |
296 | 296 | <script> |
297 | 297 | jQuery(document).ready(function () { |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | <?php |
308 | 308 | endif; |
309 | 309 | |
310 | - if ( self::$has_dismiss_interval_notice ) : |
|
310 | + if (self::$has_dismiss_interval_notice) : |
|
311 | 311 | ?> |
312 | 312 | <script> |
313 | 313 | jQuery(document).ready(function () { |
@@ -386,36 +386,36 @@ discard block |
||
386 | 386 | * @access public |
387 | 387 | */ |
388 | 388 | public function dismiss_notices() { |
389 | - $_post = give_clean( $_POST ); |
|
390 | - $notice_id = esc_attr( $_post['notice_id'] ); |
|
389 | + $_post = give_clean($_POST); |
|
390 | + $notice_id = esc_attr($_post['notice_id']); |
|
391 | 391 | |
392 | 392 | // Bailout. |
393 | 393 | if ( |
394 | - empty( $notice_id ) || |
|
395 | - empty( $_post['dismissible_type'] ) || |
|
396 | - empty( $_post['dismiss_interval'] ) || |
|
397 | - ! check_ajax_referer( "give_edit_{$notice_id}_notice", '_wpnonce' ) |
|
394 | + empty($notice_id) || |
|
395 | + empty($_post['dismissible_type']) || |
|
396 | + empty($_post['dismiss_interval']) || |
|
397 | + ! check_ajax_referer("give_edit_{$notice_id}_notice", '_wpnonce') |
|
398 | 398 | ) { |
399 | 399 | wp_send_json_error(); |
400 | 400 | } |
401 | 401 | |
402 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'] ); |
|
403 | - if ( 'user' === $_post['dismissible_type'] ) { |
|
402 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval']); |
|
403 | + if ('user' === $_post['dismissible_type']) { |
|
404 | 404 | $current_user = wp_get_current_user(); |
405 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'], $current_user->ID ); |
|
405 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval'], $current_user->ID); |
|
406 | 406 | } |
407 | 407 | |
408 | - $notice_dismiss_time = ! empty( $_post['dismiss_interval_time'] ) ? $_post['dismiss_interval_time'] : null; |
|
408 | + $notice_dismiss_time = ! empty($_post['dismiss_interval_time']) ? $_post['dismiss_interval_time'] : null; |
|
409 | 409 | |
410 | 410 | // Save option to hide notice. |
411 | - Give_Cache::set( $notice_key, true, $notice_dismiss_time, true ); |
|
411 | + Give_Cache::set($notice_key, true, $notice_dismiss_time, true); |
|
412 | 412 | |
413 | 413 | /** |
414 | 414 | * Fire the action when notice dismissed |
415 | 415 | * |
416 | 416 | * @since 2.0 |
417 | 417 | */ |
418 | - do_action( 'give_dismiss_notices', $_post ); |
|
418 | + do_action('give_dismiss_notices', $_post); |
|
419 | 419 | |
420 | 420 | wp_send_json_success(); |
421 | 421 | } |
@@ -433,18 +433,18 @@ discard block |
||
433 | 433 | * |
434 | 434 | * @return string |
435 | 435 | */ |
436 | - public function get_notice_key( $notice_id, $dismiss_interval = null, $user_id = 0 ) { |
|
436 | + public function get_notice_key($notice_id, $dismiss_interval = null, $user_id = 0) { |
|
437 | 437 | $notice_key = "_give_notice_{$notice_id}"; |
438 | 438 | |
439 | - if ( ! empty( $dismiss_interval ) ) { |
|
439 | + if ( ! empty($dismiss_interval)) { |
|
440 | 440 | $notice_key .= "_{$dismiss_interval}"; |
441 | 441 | } |
442 | 442 | |
443 | - if ( $user_id ) { |
|
443 | + if ($user_id) { |
|
444 | 444 | $notice_key .= "_{$user_id}"; |
445 | 445 | } |
446 | 446 | |
447 | - $notice_key = sanitize_key( $notice_key ); |
|
447 | + $notice_key = sanitize_key($notice_key); |
|
448 | 448 | |
449 | 449 | return $notice_key; |
450 | 450 | } |
@@ -457,11 +457,11 @@ discard block |
||
457 | 457 | * |
458 | 458 | * @return string |
459 | 459 | */ |
460 | - public function get_dismiss_link( $notice_args ) { |
|
460 | + public function get_dismiss_link($notice_args) { |
|
461 | 461 | $notice_args = wp_parse_args( |
462 | 462 | $notice_args, |
463 | 463 | array( |
464 | - 'title' => __( 'Click here', 'give' ), |
|
464 | + 'title' => __('Click here', 'give'), |
|
465 | 465 | 'dismissible_type' => '', |
466 | 466 | 'dismiss_interval' => '', |
467 | 467 | 'dismiss_interval_time' => null, |
@@ -488,31 +488,31 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @return bool|null |
490 | 490 | */ |
491 | - public function is_notice_dismissed( $notice ) { |
|
492 | - $notice_key = $this->get_notice_key( $notice['id'], $notice['dismiss_interval'] ); |
|
491 | + public function is_notice_dismissed($notice) { |
|
492 | + $notice_key = $this->get_notice_key($notice['id'], $notice['dismiss_interval']); |
|
493 | 493 | $is_notice_dismissed = false; |
494 | 494 | |
495 | - if ( 'user' === $notice['dismissible_type'] ) { |
|
495 | + if ('user' === $notice['dismissible_type']) { |
|
496 | 496 | $current_user = wp_get_current_user(); |
497 | - $notice_key = Give()->notices->get_notice_key( $notice['id'], $notice['dismiss_interval'], $current_user->ID ); |
|
497 | + $notice_key = Give()->notices->get_notice_key($notice['id'], $notice['dismiss_interval'], $current_user->ID); |
|
498 | 498 | } |
499 | 499 | |
500 | - $notice_data = Give_Cache::get( $notice_key, true ); |
|
500 | + $notice_data = Give_Cache::get($notice_key, true); |
|
501 | 501 | |
502 | 502 | // Find notice dismiss link status if notice has extra dismissible links. |
503 | - if ( ( empty( $notice_data ) || is_wp_error( $notice_data ) ) && ! empty( $notice['extra_links'] ) ) { |
|
503 | + if ((empty($notice_data) || is_wp_error($notice_data)) && ! empty($notice['extra_links'])) { |
|
504 | 504 | |
505 | - foreach ( $notice['extra_links'] as $extra_link ) { |
|
506 | - $new_notice_data = wp_parse_args( $extra_link, $notice ); |
|
507 | - unset( $new_notice_data['extra_links'] ); |
|
505 | + foreach ($notice['extra_links'] as $extra_link) { |
|
506 | + $new_notice_data = wp_parse_args($extra_link, $notice); |
|
507 | + unset($new_notice_data['extra_links']); |
|
508 | 508 | |
509 | - if ( $is_notice_dismissed = $this->is_notice_dismissed( $new_notice_data ) ) { |
|
509 | + if ($is_notice_dismissed = $this->is_notice_dismissed($new_notice_data)) { |
|
510 | 510 | return $is_notice_dismissed; |
511 | 511 | } |
512 | 512 | } |
513 | 513 | } |
514 | 514 | |
515 | - $is_notice_dismissed = ! empty( $notice_data ) && ! is_wp_error( $notice_data ); |
|
515 | + $is_notice_dismissed = ! empty($notice_data) && ! is_wp_error($notice_data); |
|
516 | 516 | |
517 | 517 | return $is_notice_dismissed; |
518 | 518 | } |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | * |
527 | 527 | * @param array $errors |
528 | 528 | */ |
529 | - public static function print_frontend_errors( $errors ) { |
|
529 | + public static function print_frontend_errors($errors) { |
|
530 | 530 | // Bailout. |
531 | - if ( ! $errors ) { |
|
531 | + if ( ! $errors) { |
|
532 | 532 | return; |
533 | 533 | } |
534 | 534 | |
@@ -543,37 +543,37 @@ discard block |
||
543 | 543 | ); |
544 | 544 | |
545 | 545 | // Note: we will remove give_errors class in future. |
546 | - $classes = apply_filters( 'give_error_class', array( 'give_notices', 'give_errors' ) ); |
|
546 | + $classes = apply_filters('give_error_class', array('give_notices', 'give_errors')); |
|
547 | 547 | |
548 | - echo sprintf( '<div class="%s">', implode( ' ', $classes ) ); |
|
548 | + echo sprintf('<div class="%s">', implode(' ', $classes)); |
|
549 | 549 | |
550 | 550 | // Loop error codes and display errors. |
551 | - foreach ( $errors as $error_id => $error ) { |
|
551 | + foreach ($errors as $error_id => $error) { |
|
552 | 552 | // Backward compatibility v<1.8.11 |
553 | - if ( is_string( $error ) ) { |
|
553 | + if (is_string($error)) { |
|
554 | 554 | $error = array( |
555 | 555 | 'message' => $error, |
556 | 556 | 'notice_args' => array(), |
557 | 557 | ); |
558 | 558 | } |
559 | 559 | |
560 | - $notice_args = wp_parse_args( $error['notice_args'], $default_notice_args ); |
|
560 | + $notice_args = wp_parse_args($error['notice_args'], $default_notice_args); |
|
561 | 561 | |
562 | 562 | /** |
563 | 563 | * Filter to modify Frontend Errors args before errors is display. |
564 | 564 | * |
565 | 565 | * @since 1.8.14 |
566 | 566 | */ |
567 | - $notice_args = apply_filters( 'give_frontend_errors_args', $notice_args ); |
|
567 | + $notice_args = apply_filters('give_frontend_errors_args', $notice_args); |
|
568 | 568 | |
569 | 569 | echo sprintf( |
570 | 570 | '<div class="give_error give_notice" id="give_error_%1$s" data-dismissible="%2$s" data-dismiss-interval="%3$d"> |
571 | 571 | <p><strong>%4$s</strong>: %5$s</p> |
572 | 572 | </div>', |
573 | 573 | $error_id, |
574 | - give_clean( $notice_args['dismissible'] ), |
|
575 | - absint( $notice_args['dismiss_interval'] ), |
|
576 | - esc_html__( 'Error', 'give' ), |
|
574 | + give_clean($notice_args['dismissible']), |
|
575 | + absint($notice_args['dismiss_interval']), |
|
576 | + esc_html__('Error', 'give'), |
|
577 | 577 | $error['message'] |
578 | 578 | ); |
579 | 579 | } |
@@ -595,8 +595,8 @@ discard block |
||
595 | 595 | * |
596 | 596 | * @return string |
597 | 597 | */ |
598 | - public static function print_frontend_notice( $message, $echo = true, $notice_type = 'warning', $notice_args = array() ) { |
|
599 | - if ( empty( $message ) ) { |
|
598 | + public static function print_frontend_notice($message, $echo = true, $notice_type = 'warning', $notice_args = array()) { |
|
599 | + if (empty($message)) { |
|
600 | 600 | return ''; |
601 | 601 | } |
602 | 602 | |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | 'dismiss_interval' => 5000, |
612 | 612 | ); |
613 | 613 | |
614 | - $notice_args = wp_parse_args( $notice_args, $default_notice_args ); |
|
614 | + $notice_args = wp_parse_args($notice_args, $default_notice_args); |
|
615 | 615 | |
616 | 616 | // Notice dismissible must be true for dismiss type. |
617 | 617 | $notice_args['dismiss_type'] = ! $notice_args['dismissible'] ? '' : $notice_args['dismiss_type']; |
@@ -621,15 +621,14 @@ discard block |
||
621 | 621 | * |
622 | 622 | * @since 1.8.14 |
623 | 623 | */ |
624 | - $notice_args = apply_filters( 'give_frontend_notice_args', $notice_args ); |
|
624 | + $notice_args = apply_filters('give_frontend_notice_args', $notice_args); |
|
625 | 625 | |
626 | 626 | $close_icon = 'manual' === $notice_args['dismiss_type'] ? |
627 | 627 | sprintf( |
628 | 628 | '<img class="notice-dismiss give-notice-close" src="%s" />', |
629 | - esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/close.svg' ) |
|
629 | + esc_url(GIVE_PLUGIN_URL.'assets/dist/images/close.svg') |
|
630 | 630 | |
631 | - ) : |
|
632 | - ''; |
|
631 | + ) : ''; |
|
633 | 632 | |
634 | 633 | // Note: we will remove give_errors class in future. |
635 | 634 | $error = sprintf( |
@@ -640,15 +639,15 @@ discard block |
||
640 | 639 | %6$s |
641 | 640 | </div>', |
642 | 641 | $notice_type, |
643 | - give_clean( $notice_args['dismissible'] ), |
|
644 | - absint( $notice_args['dismiss_interval'] ), |
|
645 | - give_clean( $notice_args['dismiss_type'] ), |
|
642 | + give_clean($notice_args['dismissible']), |
|
643 | + absint($notice_args['dismiss_interval']), |
|
644 | + give_clean($notice_args['dismiss_type']), |
|
646 | 645 | $message, |
647 | 646 | $close_icon |
648 | 647 | |
649 | 648 | ); |
650 | 649 | |
651 | - if ( ! $echo ) { |
|
650 | + if ( ! $echo) { |
|
652 | 651 | return $error; |
653 | 652 | } |
654 | 653 | |
@@ -668,24 +667,24 @@ discard block |
||
668 | 667 | * |
669 | 668 | * @return string |
670 | 669 | */ |
671 | - public function print_admin_notices( $notice_args = array() ) { |
|
670 | + public function print_admin_notices($notice_args = array()) { |
|
672 | 671 | // Bailout. |
673 | - if ( empty( $notice_args['description'] ) ) { |
|
672 | + if (empty($notice_args['description'])) { |
|
674 | 673 | return ''; |
675 | 674 | } |
676 | 675 | |
677 | - $defaults = array( |
|
676 | + $defaults = array( |
|
678 | 677 | 'id' => '', |
679 | 678 | 'echo' => true, |
680 | 679 | 'notice_type' => 'warning', |
681 | 680 | 'dismissible' => true, |
682 | 681 | ); |
683 | - $notice_args = wp_parse_args( $notice_args, $defaults ); |
|
682 | + $notice_args = wp_parse_args($notice_args, $defaults); |
|
684 | 683 | |
685 | 684 | $output = ''; |
686 | - $css_id = ! empty( $notice_args['id'] ) ? $notice_args['id'] : uniqid( 'give-inline-notice-' ); |
|
685 | + $css_id = ! empty($notice_args['id']) ? $notice_args['id'] : uniqid('give-inline-notice-'); |
|
687 | 686 | $css_class = "notice-{$notice_args['notice_type']} give-notice notice inline"; |
688 | - $css_class .= ( $notice_args['dismissible'] ) ? ' is-dismissible' : ''; |
|
687 | + $css_class .= ($notice_args['dismissible']) ? ' is-dismissible' : ''; |
|
689 | 688 | $output .= sprintf( |
690 | 689 | '<div id="%1$s" class="%2$s"><p>%3$s</p></div>', |
691 | 690 | $css_id, |
@@ -693,7 +692,7 @@ discard block |
||
693 | 692 | $notice_args['description'] |
694 | 693 | ); |
695 | 694 | |
696 | - if ( ! $notice_args['echo'] ) { |
|
695 | + if ( ! $notice_args['echo']) { |
|
697 | 696 | return $output; |
698 | 697 | } |
699 | 698 |
@@ -20,17 +20,17 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @return string The currency code |
22 | 22 | */ |
23 | -function give_get_currency( $donation_or_form_id = null, $args = array() ) { |
|
23 | +function give_get_currency($donation_or_form_id = null, $args = array()) { |
|
24 | 24 | |
25 | 25 | // Get currency from donation |
26 | - if ( is_numeric( $donation_or_form_id ) && 'give_payment' === get_post_type( $donation_or_form_id ) ) { |
|
27 | - $currency = give_get_meta( $donation_or_form_id, '_give_payment_currency', true ); |
|
26 | + if (is_numeric($donation_or_form_id) && 'give_payment' === get_post_type($donation_or_form_id)) { |
|
27 | + $currency = give_get_meta($donation_or_form_id, '_give_payment_currency', true); |
|
28 | 28 | |
29 | - if ( empty( $currency ) ) { |
|
30 | - $currency = give_get_option( 'currency', 'USD' ); |
|
29 | + if (empty($currency)) { |
|
30 | + $currency = give_get_option('currency', 'USD'); |
|
31 | 31 | } |
32 | 32 | } else { |
33 | - $currency = give_get_option( 'currency', 'USD' ); |
|
33 | + $currency = give_get_option('currency', 'USD'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.0 |
40 | 40 | */ |
41 | - return apply_filters( 'give_currency', $currency, $donation_or_form_id, $args ); |
|
41 | + return apply_filters('give_currency', $currency, $donation_or_form_id, $args); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | */ |
51 | 51 | function give_get_currency_position() { |
52 | 52 | |
53 | - $currency_pos = give_get_option( 'currency_position', 'before' ); |
|
53 | + $currency_pos = give_get_option('currency_position', 'before'); |
|
54 | 54 | |
55 | - return apply_filters( 'give_currency_position', $currency_pos ); |
|
55 | + return apply_filters('give_currency_position', $currency_pos); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | function give_get_currencies_list() { |
66 | 66 | $currencies = array( |
67 | 67 | 'USD' => array( |
68 | - 'admin_label' => sprintf( __('US Dollars (%1$s)', 'give'), '$'), |
|
68 | + 'admin_label' => sprintf(__('US Dollars (%1$s)', 'give'), '$'), |
|
69 | 69 | 'symbol' => '$', |
70 | 70 | 'setting' => array( |
71 | 71 | 'currency_position' => 'before', |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ), |
76 | 76 | ), |
77 | 77 | 'EUR' => array( |
78 | - 'admin_label' => sprintf( __('Euros (%1$s)', 'give'), '€'), |
|
78 | + 'admin_label' => sprintf(__('Euros (%1$s)', 'give'), '€'), |
|
79 | 79 | 'symbol' => '€', |
80 | 80 | 'setting' => array( |
81 | 81 | 'currency_position' => 'before', |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ), |
86 | 86 | ), |
87 | 87 | 'GBP' => array( |
88 | - 'admin_label' => sprintf( __('Pounds Sterling (%1$s)', 'give'), '£'), |
|
88 | + 'admin_label' => sprintf(__('Pounds Sterling (%1$s)', 'give'), '£'), |
|
89 | 89 | 'symbol' => '£', |
90 | 90 | 'setting' => array( |
91 | 91 | 'currency_position' => 'before', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ), |
96 | 96 | ), |
97 | 97 | 'AUD' => array( |
98 | - 'admin_label' => sprintf( __('Australian Dollars (%1$s)', 'give'), '$'), |
|
98 | + 'admin_label' => sprintf(__('Australian Dollars (%1$s)', 'give'), '$'), |
|
99 | 99 | 'symbol' => '$', |
100 | 100 | 'setting' => array( |
101 | 101 | 'currency_position' => 'before', |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | ), |
106 | 106 | ), |
107 | 107 | 'BRL' => array( |
108 | - 'admin_label' => sprintf( __('Brazilian Real (%1$s)', 'give'), 'R$'), |
|
108 | + 'admin_label' => sprintf(__('Brazilian Real (%1$s)', 'give'), 'R$'), |
|
109 | 109 | 'symbol' => 'R$', |
110 | 110 | 'setting' => array( |
111 | 111 | 'currency_position' => 'before', |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ), |
116 | 116 | ), |
117 | 117 | 'CAD' => array( |
118 | - 'admin_label' => sprintf( __('Canadian Dollars (%1$s)', 'give'), '$'), |
|
118 | + 'admin_label' => sprintf(__('Canadian Dollars (%1$s)', 'give'), '$'), |
|
119 | 119 | 'symbol' => '$', |
120 | 120 | 'setting' => array( |
121 | 121 | 'currency_position' => 'before', |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | ), |
126 | 126 | ), |
127 | 127 | 'CZK' => array( |
128 | - 'admin_label' => sprintf( __('Czech Koruna (%1$s)', 'give'), 'Kč'), |
|
128 | + 'admin_label' => sprintf(__('Czech Koruna (%1$s)', 'give'), 'Kč'), |
|
129 | 129 | 'symbol' => 'Kč', |
130 | 130 | 'setting' => array( |
131 | 131 | 'currency_position' => 'after', |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ), |
136 | 136 | ), |
137 | 137 | 'DKK' => array( |
138 | - 'admin_label' => sprintf( __('Danish Krone (%1$s)', 'give'), ' kr. '), |
|
138 | + 'admin_label' => sprintf(__('Danish Krone (%1$s)', 'give'), ' kr. '), |
|
139 | 139 | 'symbol' => ' kr. ', |
140 | 140 | 'setting' => array( |
141 | 141 | 'currency_position' => 'before', |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | ), |
146 | 146 | ), |
147 | 147 | 'HKD' => array( |
148 | - 'admin_label' => sprintf( __('Hong Kong Dollar (%1$s)', 'give'), '$'), |
|
148 | + 'admin_label' => sprintf(__('Hong Kong Dollar (%1$s)', 'give'), '$'), |
|
149 | 149 | 'symbol' => '$', |
150 | 150 | 'setting' => array( |
151 | 151 | 'currency_position' => 'before', |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | ), |
156 | 156 | ), |
157 | 157 | 'HUF' => array( |
158 | - 'admin_label' => sprintf( __('Hungarian Forint (%1$s)', 'give'), 'Ft'), |
|
158 | + 'admin_label' => sprintf(__('Hungarian Forint (%1$s)', 'give'), 'Ft'), |
|
159 | 159 | 'symbol' => 'Ft', |
160 | 160 | 'setting' => array( |
161 | 161 | 'currency_position' => 'after', |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | ), |
166 | 166 | ), |
167 | 167 | 'ILS' => array( |
168 | - 'admin_label' => sprintf( __('Israeli Shekel (%1$s)', 'give'), '₪'), |
|
168 | + 'admin_label' => sprintf(__('Israeli Shekel (%1$s)', 'give'), '₪'), |
|
169 | 169 | 'symbol' => '₪', |
170 | 170 | 'setting' => array( |
171 | 171 | 'currency_position' => 'after', |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | ), |
176 | 176 | ), |
177 | 177 | 'JPY' => array( |
178 | - 'admin_label' => sprintf( __('Japanese Yen (%1$s)', 'give'), '¥'), |
|
178 | + 'admin_label' => sprintf(__('Japanese Yen (%1$s)', 'give'), '¥'), |
|
179 | 179 | 'symbol' => '¥', |
180 | 180 | 'setting' => array( |
181 | 181 | 'currency_position' => 'before', |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | ), |
186 | 186 | ), |
187 | 187 | 'MYR' => array( |
188 | - 'admin_label' => sprintf( __('Malaysian Ringgits (%1$s)', 'give'), 'RM'), |
|
188 | + 'admin_label' => sprintf(__('Malaysian Ringgits (%1$s)', 'give'), 'RM'), |
|
189 | 189 | 'symbol' => 'RM', |
190 | 190 | 'setting' => array( |
191 | 191 | 'currency_position' => 'before', |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | ), |
196 | 196 | ), |
197 | 197 | 'MXN' => array( |
198 | - 'admin_label' => sprintf( __('Mexican Peso (%1$s)', 'give'), '$'), |
|
198 | + 'admin_label' => sprintf(__('Mexican Peso (%1$s)', 'give'), '$'), |
|
199 | 199 | 'symbol' => '$', |
200 | 200 | 'setting' => array( |
201 | 201 | 'currency_position' => 'before', |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | ), |
206 | 206 | ), |
207 | 207 | 'MAD' => array( |
208 | - 'admin_label' => sprintf( __('Moroccan Dirham (%1$s)', 'give'), '.د.م'), |
|
208 | + 'admin_label' => sprintf(__('Moroccan Dirham (%1$s)', 'give'), '.د.م'), |
|
209 | 209 | 'symbol' => '.د.م', |
210 | 210 | 'setting' => array( |
211 | 211 | 'currency_position' => 'before', |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | ), |
216 | 216 | ), |
217 | 217 | 'NZD' => array( |
218 | - 'admin_label' => sprintf( __('New Zealand Dollar (%1$s)', 'give'), '$'), |
|
218 | + 'admin_label' => sprintf(__('New Zealand Dollar (%1$s)', 'give'), '$'), |
|
219 | 219 | 'symbol' => '$', |
220 | 220 | 'setting' => array( |
221 | 221 | 'currency_position' => 'before', |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | ), |
226 | 226 | ), |
227 | 227 | 'NOK' => array( |
228 | - 'admin_label' => sprintf( __('Norwegian Krone (%1$s)', 'give'), 'kr.'), |
|
228 | + 'admin_label' => sprintf(__('Norwegian Krone (%1$s)', 'give'), 'kr.'), |
|
229 | 229 | 'symbol' => 'kr.', |
230 | 230 | 'setting' => array( |
231 | 231 | 'currency_position' => 'before', |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | ), |
236 | 236 | ), |
237 | 237 | 'PHP' => array( |
238 | - 'admin_label' => sprintf( __('Philippine Pesos (%1$s)', 'give'), '₱'), |
|
238 | + 'admin_label' => sprintf(__('Philippine Pesos (%1$s)', 'give'), '₱'), |
|
239 | 239 | 'symbol' => '₱', |
240 | 240 | 'setting' => array( |
241 | 241 | 'currency_position' => 'before', |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | ), |
246 | 246 | ), |
247 | 247 | 'PLN' => array( |
248 | - 'admin_label' => sprintf( __('Polish Zloty (%1$s)', 'give'), 'zł'), |
|
248 | + 'admin_label' => sprintf(__('Polish Zloty (%1$s)', 'give'), 'zł'), |
|
249 | 249 | 'symbol' => 'zł', |
250 | 250 | 'setting' => array( |
251 | 251 | 'currency_position' => 'after', |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | ), |
256 | 256 | ), |
257 | 257 | 'SGD' => array( |
258 | - 'admin_label' => sprintf( __('Singapore Dollar (%1$s)', 'give'), '$'), |
|
258 | + 'admin_label' => sprintf(__('Singapore Dollar (%1$s)', 'give'), '$'), |
|
259 | 259 | 'symbol' => '$', |
260 | 260 | 'setting' => array( |
261 | 261 | 'currency_position' => 'before', |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | ), |
266 | 266 | ), |
267 | 267 | 'KRW' => array( |
268 | - 'admin_label' => sprintf( __('South Korean Won (%1$s)', 'give'), '₩'), |
|
268 | + 'admin_label' => sprintf(__('South Korean Won (%1$s)', 'give'), '₩'), |
|
269 | 269 | 'symbol' => '₩', |
270 | 270 | 'setting' => array( |
271 | 271 | 'currency_position' => 'before', |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | ), |
276 | 276 | ), |
277 | 277 | 'ZAR' => array( |
278 | - 'admin_label' => sprintf( __('South African Rand (%1$s)', 'give'), 'R'), |
|
278 | + 'admin_label' => sprintf(__('South African Rand (%1$s)', 'give'), 'R'), |
|
279 | 279 | 'symbol' => 'R', |
280 | 280 | 'setting' => array( |
281 | 281 | 'currency_position' => 'before', |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | ), |
286 | 286 | ), |
287 | 287 | 'SEK' => array( |
288 | - 'admin_label' => sprintf( __('Swedish Krona (%1$s)', 'give'), ' kr. '), |
|
288 | + 'admin_label' => sprintf(__('Swedish Krona (%1$s)', 'give'), ' kr. '), |
|
289 | 289 | 'symbol' => ' kr. ', |
290 | 290 | 'setting' => array( |
291 | 291 | 'currency_position' => 'before', |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | ), |
296 | 296 | ), |
297 | 297 | 'CHF' => array( |
298 | - 'admin_label' => sprintf( __('Swiss Franc (%1$s)', 'give'), 'Fr'), |
|
298 | + 'admin_label' => sprintf(__('Swiss Franc (%1$s)', 'give'), 'Fr'), |
|
299 | 299 | 'symbol' => 'Fr', |
300 | 300 | 'setting' => array( |
301 | 301 | 'currency_position' => 'before', |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | ), |
306 | 306 | ), |
307 | 307 | 'TWD' => array( |
308 | - 'admin_label' => sprintf( __('Taiwan New Dollars (%1$s)', 'give'), 'NT$'), |
|
308 | + 'admin_label' => sprintf(__('Taiwan New Dollars (%1$s)', 'give'), 'NT$'), |
|
309 | 309 | 'symbol' => 'NT$', |
310 | 310 | 'setting' => array( |
311 | 311 | 'currency_position' => 'before', |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | ), |
316 | 316 | ), |
317 | 317 | 'THB' => array( |
318 | - 'admin_label' => sprintf( __('Thai Baht (%1$s)', 'give'), '฿'), |
|
318 | + 'admin_label' => sprintf(__('Thai Baht (%1$s)', 'give'), '฿'), |
|
319 | 319 | 'symbol' => '฿', |
320 | 320 | 'setting' => array( |
321 | 321 | 'currency_position' => 'before', |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | ), |
326 | 326 | ), |
327 | 327 | 'INR' => array( |
328 | - 'admin_label' => sprintf( __('Indian Rupee (%1$s)', 'give'), '₹'), |
|
328 | + 'admin_label' => sprintf(__('Indian Rupee (%1$s)', 'give'), '₹'), |
|
329 | 329 | 'symbol' => '₹', |
330 | 330 | 'setting' => array( |
331 | 331 | 'currency_position' => 'before', |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | ), |
336 | 336 | ), |
337 | 337 | 'TRY' => array( |
338 | - 'admin_label' => sprintf( __('Turkish Lira (%1$s)', 'give'), '₺'), |
|
338 | + 'admin_label' => sprintf(__('Turkish Lira (%1$s)', 'give'), '₺'), |
|
339 | 339 | 'symbol' => '₺', |
340 | 340 | 'setting' => array( |
341 | 341 | 'currency_position' => 'after', |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | ), |
346 | 346 | ), |
347 | 347 | 'IRR' => array( |
348 | - 'admin_label' => sprintf( __('Iranian Rial (%1$s)', 'give'), '﷼'), |
|
348 | + 'admin_label' => sprintf(__('Iranian Rial (%1$s)', 'give'), '﷼'), |
|
349 | 349 | 'symbol' => '﷼', |
350 | 350 | 'setting' => array( |
351 | 351 | 'currency_position' => 'after', |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | ), |
356 | 356 | ), |
357 | 357 | 'RUB' => array( |
358 | - 'admin_label' => sprintf( __('Russian Rubles (%1$s)', 'give'), '₽'), |
|
358 | + 'admin_label' => sprintf(__('Russian Rubles (%1$s)', 'give'), '₽'), |
|
359 | 359 | 'symbol' => '₽', |
360 | 360 | 'setting' => array( |
361 | 361 | 'currency_position' => 'before', |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | ), |
366 | 366 | ), |
367 | 367 | 'AED' => array( |
368 | - 'admin_label' => sprintf( __('United Arab Emirates dirham (%1$s)', 'give'), 'د.إ'), |
|
368 | + 'admin_label' => sprintf(__('United Arab Emirates dirham (%1$s)', 'give'), 'د.إ'), |
|
369 | 369 | 'symbol' => 'د.إ', |
370 | 370 | 'setting' => array( |
371 | 371 | 'currency_position' => 'before', |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | ), |
376 | 376 | ), |
377 | 377 | 'AMD' => array( |
378 | - 'admin_label' => sprintf( __('Armenian dram (%1$s)', 'give'), 'AMD'), |
|
378 | + 'admin_label' => sprintf(__('Armenian dram (%1$s)', 'give'), 'AMD'), |
|
379 | 379 | 'symbol' => 'AMD', // Add backward compatibility. Using AMD in place of ֏ |
380 | 380 | 'setting' => array( |
381 | 381 | 'currency_position' => 'before', |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | ), |
386 | 386 | ), |
387 | 387 | 'ANG' => array( |
388 | - 'admin_label' => sprintf( __('Netherlands Antillean guilder (%1$s)', 'give'), 'ƒ'), |
|
388 | + 'admin_label' => sprintf(__('Netherlands Antillean guilder (%1$s)', 'give'), 'ƒ'), |
|
389 | 389 | 'symbol' => 'ƒ', |
390 | 390 | 'setting' => array( |
391 | 391 | 'currency_position' => 'before', |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | ), |
396 | 396 | ), |
397 | 397 | 'ARS' => array( |
398 | - 'admin_label' => sprintf( __('Argentine peso (%1$s)', 'give'), '$'), |
|
398 | + 'admin_label' => sprintf(__('Argentine peso (%1$s)', 'give'), '$'), |
|
399 | 399 | 'symbol' => '$', |
400 | 400 | 'setting' => array( |
401 | 401 | 'currency_position' => 'before', |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | ), |
406 | 406 | ), |
407 | 407 | 'AWG' => array( |
408 | - 'admin_label' => sprintf( __( 'Aruban florin (%1$s)', 'give' ), 'ƒ' ), |
|
408 | + 'admin_label' => sprintf(__('Aruban florin (%1$s)', 'give'), 'ƒ'), |
|
409 | 409 | 'symbol' => 'ƒ', |
410 | 410 | 'setting' => array( |
411 | 411 | 'currency_position' => 'before', |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | ), |
416 | 416 | ), |
417 | 417 | 'BAM' => array( |
418 | - 'admin_label' => sprintf( __( 'Bosnia and Herzegovina convertible mark (%1$s)', 'give' ), 'KM' ), |
|
418 | + 'admin_label' => sprintf(__('Bosnia and Herzegovina convertible mark (%1$s)', 'give'), 'KM'), |
|
419 | 419 | 'symbol' => 'KM', |
420 | 420 | 'setting' => array( |
421 | 421 | 'currency_position' => 'before', |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | ), |
426 | 426 | ), |
427 | 427 | 'BDT' => array( |
428 | - 'admin_label' => sprintf( __( 'Bangladeshi taka (%1$s)', 'give' ), '৳' ), |
|
428 | + 'admin_label' => sprintf(__('Bangladeshi taka (%1$s)', 'give'), '৳'), |
|
429 | 429 | 'symbol' => '৳', |
430 | 430 | 'setting' => array( |
431 | 431 | 'currency_position' => 'before', |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | ), |
436 | 436 | ), |
437 | 437 | 'BHD' => array( |
438 | - 'admin_label' => sprintf( __( 'Bahraini dinar (%1$s)', 'give' ), '.د.ب' ), |
|
438 | + 'admin_label' => sprintf(__('Bahraini dinar (%1$s)', 'give'), '.د.ب'), |
|
439 | 439 | 'symbol' => '.د.ب', |
440 | 440 | 'setting' => array( |
441 | 441 | 'currency_position' => 'before', |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | ), |
446 | 446 | ), |
447 | 447 | 'BMD' => array( |
448 | - 'admin_label' => sprintf( __( 'Bermudian dollar (%1$s)', 'give' ), 'BD$' ), |
|
448 | + 'admin_label' => sprintf(__('Bermudian dollar (%1$s)', 'give'), 'BD$'), |
|
449 | 449 | 'symbol' => 'BD$', |
450 | 450 | 'setting' => array( |
451 | 451 | 'currency_position' => 'before', |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | ), |
456 | 456 | ), |
457 | 457 | 'BND' => array( |
458 | - 'admin_label' => sprintf( __( 'Brunei dollar (%1$s)', 'give' ), 'B$' ), |
|
458 | + 'admin_label' => sprintf(__('Brunei dollar (%1$s)', 'give'), 'B$'), |
|
459 | 459 | 'symbol' => 'B$', |
460 | 460 | 'setting' => array( |
461 | 461 | 'currency_position' => 'before', |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | ), |
466 | 466 | ), |
467 | 467 | 'BOB' => array( |
468 | - 'admin_label' => sprintf( __( 'Bolivian boliviano (%1$s)', 'give' ), 'Bs.' ), |
|
468 | + 'admin_label' => sprintf(__('Bolivian boliviano (%1$s)', 'give'), 'Bs.'), |
|
469 | 469 | 'symbol' => 'Bs.', |
470 | 470 | 'setting' => array( |
471 | 471 | 'currency_position' => 'before', |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | ), |
476 | 476 | ), |
477 | 477 | 'BSD' => array( |
478 | - 'admin_label' => sprintf( __( 'Bahamian dollar (%1$s)', 'give' ), 'B$' ), |
|
478 | + 'admin_label' => sprintf(__('Bahamian dollar (%1$s)', 'give'), 'B$'), |
|
479 | 479 | 'symbol' => 'B$', |
480 | 480 | 'setting' => array( |
481 | 481 | 'currency_position' => 'before', |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | ), |
486 | 486 | ), |
487 | 487 | 'BWP' => array( |
488 | - 'admin_label' => sprintf( __( 'Botswana pula (%1$s)', 'give' ), 'P' ), |
|
488 | + 'admin_label' => sprintf(__('Botswana pula (%1$s)', 'give'), 'P'), |
|
489 | 489 | 'symbol' => 'P', |
490 | 490 | 'setting' => array( |
491 | 491 | 'currency_position' => 'before', |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | ), |
496 | 496 | ), |
497 | 497 | 'BZD' => array( |
498 | - 'admin_label' => sprintf( __( 'Belizean dollar (%1$s)', 'give' ), 'BZ$' ), |
|
498 | + 'admin_label' => sprintf(__('Belizean dollar (%1$s)', 'give'), 'BZ$'), |
|
499 | 499 | 'symbol' => 'BZ$', |
500 | 500 | 'setting' => array( |
501 | 501 | 'currency_position' => 'before', |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | ), |
506 | 506 | ), |
507 | 507 | 'CLP' => array( |
508 | - 'admin_label' => sprintf( __( 'Chilean peso (%1$s)', 'give' ), '$' ), |
|
508 | + 'admin_label' => sprintf(__('Chilean peso (%1$s)', 'give'), '$'), |
|
509 | 509 | 'symbol' => '$', |
510 | 510 | 'setting' => array( |
511 | 511 | 'currency_position' => 'before', |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | ), |
516 | 516 | ), |
517 | 517 | 'CNY' => array( |
518 | - 'admin_label' => sprintf( __( 'Chinese yuan (%1$s)', 'give' ), '¥' ), |
|
518 | + 'admin_label' => sprintf(__('Chinese yuan (%1$s)', 'give'), '¥'), |
|
519 | 519 | 'symbol' => '¥', |
520 | 520 | 'setting' => array( |
521 | 521 | 'currency_position' => 'before', |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | ), |
526 | 526 | ), |
527 | 527 | 'COP' => array( |
528 | - 'admin_label' => sprintf( __( 'Colombian peso (%1$s)', 'give' ), '$' ), |
|
528 | + 'admin_label' => sprintf(__('Colombian peso (%1$s)', 'give'), '$'), |
|
529 | 529 | 'symbol' => '$', |
530 | 530 | 'setting' => array( |
531 | 531 | 'currency_position' => 'before', |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | ), |
536 | 536 | ), |
537 | 537 | 'CRC' => array( |
538 | - 'admin_label' => sprintf( __( 'Costa Rican colón (%1$s)', 'give' ), '₡' ), |
|
538 | + 'admin_label' => sprintf(__('Costa Rican colón (%1$s)', 'give'), '₡'), |
|
539 | 539 | 'symbol' => '₡', |
540 | 540 | 'setting' => array( |
541 | 541 | 'currency_position' => 'before', |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | ), |
546 | 546 | ), |
547 | 547 | 'CUC' => array( |
548 | - 'admin_label' => sprintf( __( 'Cuban convertible peso (%1$s)', 'give' ), '₱' ), |
|
548 | + 'admin_label' => sprintf(__('Cuban convertible peso (%1$s)', 'give'), '₱'), |
|
549 | 549 | 'symbol' => '₱', |
550 | 550 | 'setting' => array( |
551 | 551 | 'currency_position' => 'before', |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | ), |
556 | 556 | ), |
557 | 557 | 'CUP' => array( |
558 | - 'admin_label' => sprintf( __( 'Cuban convertible peso (%1$s)', 'give' ), '₱' ), |
|
558 | + 'admin_label' => sprintf(__('Cuban convertible peso (%1$s)', 'give'), '₱'), |
|
559 | 559 | 'symbol' => '₱', |
560 | 560 | 'setting' => array( |
561 | 561 | 'currency_position' => 'before', |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | ), |
566 | 566 | ), |
567 | 567 | 'DOP' => array( |
568 | - 'admin_label' => sprintf( __( 'Dominican peso (%1$s)', 'give' ), 'RD$' ), |
|
568 | + 'admin_label' => sprintf(__('Dominican peso (%1$s)', 'give'), 'RD$'), |
|
569 | 569 | 'symbol' => 'RD$', |
570 | 570 | 'setting' => array( |
571 | 571 | 'currency_position' => 'before', |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | ), |
576 | 576 | ), |
577 | 577 | 'EGP' => array( |
578 | - 'admin_label' => sprintf( __( 'Egyptian pound (%1$s)', 'give' ), 'E£' ), |
|
578 | + 'admin_label' => sprintf(__('Egyptian pound (%1$s)', 'give'), 'E£'), |
|
579 | 579 | 'symbol' => 'E£', |
580 | 580 | 'setting' => array( |
581 | 581 | 'currency_position' => 'before', |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | ), |
586 | 586 | ), |
587 | 587 | 'GIP' => array( |
588 | - 'admin_label' => sprintf( __( 'Gibraltar pound (%1$s)', 'give' ), '£' ), |
|
588 | + 'admin_label' => sprintf(__('Gibraltar pound (%1$s)', 'give'), '£'), |
|
589 | 589 | 'symbol' => '£', |
590 | 590 | 'setting' => array( |
591 | 591 | 'currency_position' => 'before', |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | ), |
596 | 596 | ), |
597 | 597 | 'GTQ' => array( |
598 | - 'admin_label' => sprintf( __( 'Guatemalan quetzal (%1$s)', 'give' ), 'Q' ), |
|
598 | + 'admin_label' => sprintf(__('Guatemalan quetzal (%1$s)', 'give'), 'Q'), |
|
599 | 599 | 'symbol' => 'Q', |
600 | 600 | 'setting' => array( |
601 | 601 | 'currency_position' => 'before', |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | ), |
606 | 606 | ), |
607 | 607 | 'HNL' => array( |
608 | - 'admin_label' => sprintf( __( 'Honduran lempira (%1$s)', 'give' ), 'L' ), |
|
608 | + 'admin_label' => sprintf(__('Honduran lempira (%1$s)', 'give'), 'L'), |
|
609 | 609 | 'symbol' => 'L', |
610 | 610 | 'setting' => array( |
611 | 611 | 'currency_position' => 'before', |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | ), |
616 | 616 | ), |
617 | 617 | 'HRK' => array( |
618 | - 'admin_label' => sprintf( __( 'Croatian kuna (%1$s)', 'give' ), 'kn' ), |
|
618 | + 'admin_label' => sprintf(__('Croatian kuna (%1$s)', 'give'), 'kn'), |
|
619 | 619 | 'symbol' => 'kn', |
620 | 620 | 'setting' => array( |
621 | 621 | 'currency_position' => 'after', |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | ), |
626 | 626 | ), |
627 | 627 | 'IDR' => array( |
628 | - 'admin_label' => sprintf( __( 'Indonesian rupiah (%1$s)', 'give' ), 'Rp' ), |
|
628 | + 'admin_label' => sprintf(__('Indonesian rupiah (%1$s)', 'give'), 'Rp'), |
|
629 | 629 | 'symbol' => 'Rp', |
630 | 630 | 'setting' => array( |
631 | 631 | 'currency_position' => 'before', |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | ), |
636 | 636 | ), |
637 | 637 | 'ISK' => array( |
638 | - 'admin_label' => sprintf( __( 'Icelandic króna (%1$s)', 'give' ), 'kr' ), |
|
638 | + 'admin_label' => sprintf(__('Icelandic króna (%1$s)', 'give'), 'kr'), |
|
639 | 639 | 'symbol' => 'kr', |
640 | 640 | 'setting' => array( |
641 | 641 | 'currency_position' => 'after', |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | ), |
646 | 646 | ), |
647 | 647 | 'JMD' => array( |
648 | - 'admin_label' => sprintf( __( 'Jamaican dollar (%1$s)', 'give' ), 'j$' ), |
|
648 | + 'admin_label' => sprintf(__('Jamaican dollar (%1$s)', 'give'), 'j$'), |
|
649 | 649 | 'symbol' => 'j$', |
650 | 650 | 'setting' => array( |
651 | 651 | 'currency_position' => 'before', |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | ), |
656 | 656 | ), |
657 | 657 | 'JOD' => array( |
658 | - 'admin_label' => sprintf( __( 'Jordanian dinar (%1$s)', 'give' ), 'د.ا' ), |
|
658 | + 'admin_label' => sprintf(__('Jordanian dinar (%1$s)', 'give'), 'د.ا'), |
|
659 | 659 | 'symbol' => 'د.ا', |
660 | 660 | 'setting' => array( |
661 | 661 | 'currency_position' => 'before', |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | ), |
666 | 666 | ), |
667 | 667 | 'KES' => array( |
668 | - 'admin_label' => sprintf( __( 'Kenyan shilling (%1$s)', 'give' ), 'KSh' ), |
|
668 | + 'admin_label' => sprintf(__('Kenyan shilling (%1$s)', 'give'), 'KSh'), |
|
669 | 669 | 'symbol' => 'KSh', |
670 | 670 | 'setting' => array( |
671 | 671 | 'currency_position' => 'before', |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | ), |
676 | 676 | ), |
677 | 677 | 'KWD' => array( |
678 | - 'admin_label' => sprintf( __( 'Kuwaiti dinar (%1$s)', 'give' ), 'د.ك' ), |
|
678 | + 'admin_label' => sprintf(__('Kuwaiti dinar (%1$s)', 'give'), 'د.ك'), |
|
679 | 679 | 'symbol' => 'د.ك', |
680 | 680 | 'setting' => array( |
681 | 681 | 'currency_position' => 'before', |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | ), |
686 | 686 | ), |
687 | 687 | 'KYD' => array( |
688 | - 'admin_label' => sprintf( __( 'Cayman Islands dollar (%1$s)', 'give' ), 'KY$' ), |
|
688 | + 'admin_label' => sprintf(__('Cayman Islands dollar (%1$s)', 'give'), 'KY$'), |
|
689 | 689 | 'symbol' => 'KY$', |
690 | 690 | 'setting' => array( |
691 | 691 | 'currency_position' => 'before', |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | ), |
696 | 696 | ), |
697 | 697 | 'MKD' => array( |
698 | - 'admin_label' => sprintf( __( 'Macedonian denar (%1$s)', 'give' ), 'ден' ), |
|
698 | + 'admin_label' => sprintf(__('Macedonian denar (%1$s)', 'give'), 'ден'), |
|
699 | 699 | 'symbol' => 'ден', |
700 | 700 | 'setting' => array( |
701 | 701 | 'currency_position' => 'before', |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | ), |
706 | 706 | ), |
707 | 707 | 'NPR' => array( |
708 | - 'admin_label' => sprintf( __( 'Nepalese rupee (%1$s)', 'give' ), '₨' ), |
|
708 | + 'admin_label' => sprintf(__('Nepalese rupee (%1$s)', 'give'), '₨'), |
|
709 | 709 | 'symbol' => '₨', |
710 | 710 | 'setting' => array( |
711 | 711 | 'currency_position' => 'before', |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | ), |
716 | 716 | ), |
717 | 717 | 'OMR' => array( |
718 | - 'admin_label' => sprintf( __( 'Omani rial (%1$s)', 'give' ), 'ر.ع.' ), |
|
718 | + 'admin_label' => sprintf(__('Omani rial (%1$s)', 'give'), 'ر.ع.'), |
|
719 | 719 | 'symbol' => 'ر.ع.', |
720 | 720 | 'setting' => array( |
721 | 721 | 'currency_position' => 'before', |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | ), |
726 | 726 | ), |
727 | 727 | 'PEN' => array( |
728 | - 'admin_label' => sprintf( __( 'Peruvian nuevo sol (%1$s)', 'give' ), 'S/.' ), |
|
728 | + 'admin_label' => sprintf(__('Peruvian nuevo sol (%1$s)', 'give'), 'S/.'), |
|
729 | 729 | 'symbol' => 'S/.', |
730 | 730 | 'setting' => array( |
731 | 731 | 'currency_position' => 'before', |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | ), |
736 | 736 | ), |
737 | 737 | 'PKR' => array( |
738 | - 'admin_label' => sprintf( __( 'Pakistani rupee (%1$s)', 'give' ), '₨' ), |
|
738 | + 'admin_label' => sprintf(__('Pakistani rupee (%1$s)', 'give'), '₨'), |
|
739 | 739 | 'symbol' => '₨', |
740 | 740 | 'setting' => array( |
741 | 741 | 'currency_position' => 'before', |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | ), |
746 | 746 | ), |
747 | 747 | 'RON' => array( |
748 | - 'admin_label' => sprintf( __( 'Romanian leu (%1$s)', 'give' ), 'L' ), |
|
748 | + 'admin_label' => sprintf(__('Romanian leu (%1$s)', 'give'), 'L'), |
|
749 | 749 | 'symbol' => 'L', |
750 | 750 | 'setting' => array( |
751 | 751 | 'currency_position' => 'after', |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | ), |
756 | 756 | ), |
757 | 757 | 'SAR' => array( |
758 | - 'admin_label' => sprintf( __( 'Saudi riyal (%1$s)', 'give' ), 'ر.س' ), |
|
758 | + 'admin_label' => sprintf(__('Saudi riyal (%1$s)', 'give'), 'ر.س'), |
|
759 | 759 | 'symbol' => 'ر.س', |
760 | 760 | 'setting' => array( |
761 | 761 | 'currency_position' => 'before', |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | ), |
766 | 766 | ), |
767 | 767 | 'SZL' => array( |
768 | - 'admin_label' => sprintf( __( 'Swazi lilangeni (%1$s)', 'give' ), 'L'), |
|
768 | + 'admin_label' => sprintf(__('Swazi lilangeni (%1$s)', 'give'), 'L'), |
|
769 | 769 | 'symbol' => 'L', |
770 | 770 | 'setting' => array( |
771 | 771 | 'currency_position' => 'before', |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | ), |
776 | 776 | ), |
777 | 777 | 'TOP' => array( |
778 | - 'admin_label' => sprintf( __( 'Tongan paʻanga (%1$s)', 'give' ), 'T$'), |
|
778 | + 'admin_label' => sprintf(__('Tongan paʻanga (%1$s)', 'give'), 'T$'), |
|
779 | 779 | 'symbol' => 'T$', |
780 | 780 | 'setting' => array( |
781 | 781 | 'currency_position' => 'before', |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | ), |
786 | 786 | ), |
787 | 787 | 'TZS' => array( |
788 | - 'admin_label' => sprintf( __( 'Tanzanian shilling (%1$s)', 'give' ), 'TSh'), |
|
788 | + 'admin_label' => sprintf(__('Tanzanian shilling (%1$s)', 'give'), 'TSh'), |
|
789 | 789 | 'symbol' => 'TSh', |
790 | 790 | 'setting' => array( |
791 | 791 | 'currency_position' => 'before', |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | ), |
796 | 796 | ), |
797 | 797 | 'UAH' => array( |
798 | - 'admin_label' => sprintf( __( 'Ukrainian hryvnia (%1$s)', 'give' ), '₴'), |
|
798 | + 'admin_label' => sprintf(__('Ukrainian hryvnia (%1$s)', 'give'), '₴'), |
|
799 | 799 | 'symbol' => '₴', |
800 | 800 | 'setting' => array( |
801 | 801 | 'currency_position' => 'before', |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | ), |
806 | 806 | ), |
807 | 807 | 'UYU' => array( |
808 | - 'admin_label' => sprintf( __( 'Uruguayan peso (%1$s)', 'give' ), '$U'), |
|
808 | + 'admin_label' => sprintf(__('Uruguayan peso (%1$s)', 'give'), '$U'), |
|
809 | 809 | 'symbol' => '$U', |
810 | 810 | 'setting' => array( |
811 | 811 | 'currency_position' => 'before', |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | ), |
816 | 816 | ), |
817 | 817 | 'VEF' => array( |
818 | - 'admin_label' => sprintf( __( 'Venezuelan bolívar (%1$s)', 'give' ), 'Bs'), |
|
818 | + 'admin_label' => sprintf(__('Venezuelan bolívar (%1$s)', 'give'), 'Bs'), |
|
819 | 819 | 'symbol' => 'Bs', |
820 | 820 | 'setting' => array( |
821 | 821 | 'currency_position' => 'before', |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | ), |
826 | 826 | ), |
827 | 827 | 'XCD' => array( |
828 | - 'admin_label' => sprintf( __( 'East Caribbean dollar (%1$s)', 'give' ), 'EC$'), |
|
828 | + 'admin_label' => sprintf(__('East Caribbean dollar (%1$s)', 'give'), 'EC$'), |
|
829 | 829 | 'symbol' => 'EC$', |
830 | 830 | 'setting' => array( |
831 | 831 | 'currency_position' => 'before', |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | * |
851 | 851 | * @param array $currencies |
852 | 852 | */ |
853 | - return (array) apply_filters( 'give_currencies', $currencies ); |
|
853 | + return (array) apply_filters('give_currencies', $currencies); |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | /** |
@@ -862,22 +862,22 @@ discard block |
||
862 | 862 | * |
863 | 863 | * @return array $currencies A list of the available currencies |
864 | 864 | */ |
865 | -function give_get_currencies( $info = 'admin_label' ) { |
|
865 | +function give_get_currencies($info = 'admin_label') { |
|
866 | 866 | |
867 | 867 | $currencies = give_get_currencies_list(); |
868 | 868 | |
869 | 869 | // Backward compatibility: handle old way of currency registration. |
870 | 870 | // Backward compatibility: Return desired result. |
871 | - if ( ! empty( $currencies ) ) { |
|
872 | - foreach ( $currencies as $currency_code => $currency_setting ) { |
|
873 | - if ( is_string( $currency_setting ) ) { |
|
874 | - $currencies[ $currency_code ] = array( |
|
871 | + if ( ! empty($currencies)) { |
|
872 | + foreach ($currencies as $currency_code => $currency_setting) { |
|
873 | + if (is_string($currency_setting)) { |
|
874 | + $currencies[$currency_code] = array( |
|
875 | 875 | 'admin_label' => $currency_setting, |
876 | 876 | ); |
877 | 877 | } |
878 | 878 | |
879 | - $currencies[ $currency_code ] = wp_parse_args( |
|
880 | - $currencies[ $currency_code ], |
|
879 | + $currencies[$currency_code] = wp_parse_args( |
|
880 | + $currencies[$currency_code], |
|
881 | 881 | array( |
882 | 882 | 'admin_label' => '', |
883 | 883 | 'symbol' => $currency_code, |
@@ -886,8 +886,8 @@ discard block |
||
886 | 886 | ); |
887 | 887 | } |
888 | 888 | |
889 | - if ( ! empty( $info ) && is_string( $info ) && 'all' !== $info ) { |
|
890 | - $currencies = wp_list_pluck( $currencies, $info ); |
|
889 | + if ( ! empty($info) && is_string($info) && 'all' !== $info) { |
|
890 | + $currencies = wp_list_pluck($currencies, $info); |
|
891 | 891 | } |
892 | 892 | } |
893 | 893 | |
@@ -904,12 +904,12 @@ discard block |
||
904 | 904 | * |
905 | 905 | * @return array |
906 | 906 | */ |
907 | -function give_currency_symbols( $decode_currencies = false ) { |
|
908 | - $currencies = give_get_currencies( 'symbol' ); |
|
907 | +function give_currency_symbols($decode_currencies = false) { |
|
908 | + $currencies = give_get_currencies('symbol'); |
|
909 | 909 | |
910 | - if ( $decode_currencies ) { |
|
911 | - array_walk( $currencies, function ( &$currency_symbol ) { |
|
912 | - $currency_symbol = html_entity_decode( $currency_symbol, ENT_COMPAT, 'UTF-8' ); |
|
910 | + if ($decode_currencies) { |
|
911 | + array_walk($currencies, function(&$currency_symbol) { |
|
912 | + $currency_symbol = html_entity_decode($currency_symbol, ENT_COMPAT, 'UTF-8'); |
|
913 | 913 | } ); |
914 | 914 | } |
915 | 915 | |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | * |
921 | 921 | * @param array $currencies |
922 | 922 | */ |
923 | - return apply_filters( 'give_currency_symbols', $currencies ); |
|
923 | + return apply_filters('give_currency_symbols', $currencies); |
|
924 | 924 | } |
925 | 925 | |
926 | 926 | |
@@ -937,14 +937,14 @@ discard block |
||
937 | 937 | * |
938 | 938 | * @return string The symbol to use for the currency |
939 | 939 | */ |
940 | -function give_currency_symbol( $currency = '', $decode_currency = false ) { |
|
940 | +function give_currency_symbol($currency = '', $decode_currency = false) { |
|
941 | 941 | |
942 | - if ( empty( $currency ) ) { |
|
942 | + if (empty($currency)) { |
|
943 | 943 | $currency = give_get_currency(); |
944 | 944 | } |
945 | 945 | |
946 | - $currencies = give_currency_symbols( $decode_currency ); |
|
947 | - $symbol = array_key_exists( $currency, $currencies ) ? $currencies[ $currency ] : $currency; |
|
946 | + $currencies = give_currency_symbols($decode_currency); |
|
947 | + $symbol = array_key_exists($currency, $currencies) ? $currencies[$currency] : $currency; |
|
948 | 948 | |
949 | 949 | /** |
950 | 950 | * Filter the currency symbol |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | * @param string $symbol |
955 | 955 | * @param string $currency |
956 | 956 | */ |
957 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
957 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
958 | 958 | } |
959 | 959 | |
960 | 960 | |
@@ -967,13 +967,13 @@ discard block |
||
967 | 967 | * |
968 | 968 | * @return string |
969 | 969 | */ |
970 | -function give_get_currency_name( $currency_code ) { |
|
970 | +function give_get_currency_name($currency_code) { |
|
971 | 971 | $currency_name = ''; |
972 | 972 | $currency_names = give_get_currencies(); |
973 | 973 | |
974 | - if ( $currency_code && array_key_exists( $currency_code, $currency_names ) ) { |
|
975 | - $currency_name = explode( '(', $currency_names[ $currency_code ] ); |
|
976 | - $currency_name = trim( current( $currency_name ) ); |
|
974 | + if ($currency_code && array_key_exists($currency_code, $currency_names)) { |
|
975 | + $currency_name = explode('(', $currency_names[$currency_code]); |
|
976 | + $currency_name = trim(current($currency_name)); |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | /** |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | * @param string $currency_name |
985 | 985 | * @param string $currency_code |
986 | 986 | */ |
987 | - return apply_filters( 'give_currency_name', $currency_name, $currency_code ); |
|
987 | + return apply_filters('give_currency_name', $currency_name, $currency_code); |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | /** |
@@ -997,20 +997,20 @@ discard block |
||
997 | 997 | * |
998 | 998 | * @return mixed|string |
999 | 999 | */ |
1000 | -function give_currency_filter( $price = '', $args = array() ) { |
|
1000 | +function give_currency_filter($price = '', $args = array()) { |
|
1001 | 1001 | |
1002 | 1002 | // Get functions arguments. |
1003 | 1003 | $func_args = func_get_args(); |
1004 | 1004 | |
1005 | 1005 | // Backward compatibility: modify second param to array |
1006 | - if ( isset( $func_args[1] ) && is_string( $func_args[1] ) ) { |
|
1006 | + if (isset($func_args[1]) && is_string($func_args[1])) { |
|
1007 | 1007 | $args = array( |
1008 | - 'currency_code' => isset( $func_args[1] ) ? $func_args[1] : '', |
|
1009 | - 'decode_currency' => isset( $func_args[2] ) ? $func_args[2] : false, |
|
1010 | - 'form_id' => isset( $func_args[3] ) ? $func_args[3] : '', |
|
1008 | + 'currency_code' => isset($func_args[1]) ? $func_args[1] : '', |
|
1009 | + 'decode_currency' => isset($func_args[2]) ? $func_args[2] : false, |
|
1010 | + 'form_id' => isset($func_args[3]) ? $func_args[3] : '', |
|
1011 | 1011 | ); |
1012 | 1012 | |
1013 | - give_doing_it_wrong( __FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION ); |
|
1013 | + give_doing_it_wrong(__FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION); |
|
1014 | 1014 | } |
1015 | 1015 | |
1016 | 1016 | // Set default values. |
@@ -1023,22 +1023,22 @@ discard block |
||
1023 | 1023 | ) |
1024 | 1024 | ); |
1025 | 1025 | |
1026 | - if ( empty( $args['currency_code'] ) || ! array_key_exists( (string) $args['currency_code'], give_get_currencies() ) ) { |
|
1027 | - $args['currency_code'] = give_get_currency( $args['form_id'] ); |
|
1026 | + if (empty($args['currency_code']) || ! array_key_exists((string) $args['currency_code'], give_get_currencies())) { |
|
1027 | + $args['currency_code'] = give_get_currency($args['form_id']); |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | - $args['position'] = give_get_option( 'currency_position', 'before' ); |
|
1030 | + $args['position'] = give_get_option('currency_position', 'before'); |
|
1031 | 1031 | |
1032 | 1032 | $negative = $price < 0; |
1033 | 1033 | |
1034 | - if ( $negative ) { |
|
1034 | + if ($negative) { |
|
1035 | 1035 | // Remove proceeding "-". |
1036 | - $price = substr( $price, 1 ); |
|
1036 | + $price = substr($price, 1); |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | - $args['symbol'] = give_currency_symbol( $args['currency_code'], $args['decode_currency'] ); |
|
1039 | + $args['symbol'] = give_currency_symbol($args['currency_code'], $args['decode_currency']); |
|
1040 | 1040 | |
1041 | - switch ( $args['currency_code'] ) : |
|
1041 | + switch ($args['currency_code']) : |
|
1042 | 1042 | case 'GBP' : |
1043 | 1043 | case 'BRL' : |
1044 | 1044 | case 'EUR' : |
@@ -1068,13 +1068,13 @@ discard block |
||
1068 | 1068 | case 'MAD' : |
1069 | 1069 | case 'KRW' : |
1070 | 1070 | case 'ZAR' : |
1071 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . $price : $price . $args['symbol'] ); |
|
1071 | + $formatted = ('before' === $args['position'] ? $args['symbol'].$price : $price.$args['symbol']); |
|
1072 | 1072 | break; |
1073 | 1073 | case 'NOK': |
1074 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] ); |
|
1074 | + $formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']); |
|
1075 | 1075 | break; |
1076 | 1076 | default: |
1077 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] ); |
|
1077 | + $formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']); |
|
1078 | 1078 | break; |
1079 | 1079 | endswitch; |
1080 | 1080 | |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | * |
1084 | 1084 | * @since 1.8.17 |
1085 | 1085 | */ |
1086 | - $formatted = apply_filters( 'give_currency_filter', $formatted, $args, $price ); |
|
1086 | + $formatted = apply_filters('give_currency_filter', $formatted, $args, $price); |
|
1087 | 1087 | |
1088 | 1088 | /** |
1089 | 1089 | * Filter formatted amount with currency |
@@ -1097,16 +1097,16 @@ discard block |
||
1097 | 1097 | * filter name will be give_usd_currency_filter_after |
1098 | 1098 | */ |
1099 | 1099 | $formatted = apply_filters( |
1100 | - 'give_' . strtolower( $args['currency_code'] ) . "_currency_filter_{$args['position']}", |
|
1100 | + 'give_'.strtolower($args['currency_code'])."_currency_filter_{$args['position']}", |
|
1101 | 1101 | $formatted, |
1102 | 1102 | $args['currency_code'], |
1103 | 1103 | $price, |
1104 | 1104 | $args |
1105 | 1105 | ); |
1106 | 1106 | |
1107 | - if ( $negative ) { |
|
1107 | + if ($negative) { |
|
1108 | 1108 | // Prepend the minus sign before the currency sign. |
1109 | - $formatted = '-' . $formatted; |
|
1109 | + $formatted = '-'.$formatted; |
|
1110 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | return $formatted; |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | * |
1124 | 1124 | * @return bool |
1125 | 1125 | */ |
1126 | -function give_is_zero_based_currency( $currency = '' ) { |
|
1126 | +function give_is_zero_based_currency($currency = '') { |
|
1127 | 1127 | $zero_based_currency = array( |
1128 | 1128 | 'PYG', // Paraguayan Guarani. |
1129 | 1129 | 'GNF', // Guinean Franc. |
@@ -1143,12 +1143,12 @@ discard block |
||
1143 | 1143 | ); |
1144 | 1144 | |
1145 | 1145 | // Set default currency. |
1146 | - if ( empty( $currency ) ) { |
|
1146 | + if (empty($currency)) { |
|
1147 | 1147 | $currency = give_get_currency(); |
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | // Check for Zero Based Currency. |
1151 | - if ( in_array( $currency, $zero_based_currency ) ) { |
|
1151 | + if (in_array($currency, $zero_based_currency)) { |
|
1152 | 1152 | return true; |
1153 | 1153 | } |
1154 | 1154 | |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * |
1164 | 1164 | * @return bool |
1165 | 1165 | */ |
1166 | -function give_is_right_to_left_supported_currency( $currency = '' ) { |
|
1166 | +function give_is_right_to_left_supported_currency($currency = '') { |
|
1167 | 1167 | $zero_based_currency = apply_filters( |
1168 | 1168 | 'give_right_to_left_supported_currency', |
1169 | 1169 | array( |
@@ -1179,12 +1179,12 @@ discard block |
||
1179 | 1179 | ); |
1180 | 1180 | |
1181 | 1181 | // Set default currency. |
1182 | - if ( empty( $currency ) ) { |
|
1182 | + if (empty($currency)) { |
|
1183 | 1183 | $currency = give_get_currency(); |
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | // Check for Zero Based Currency. |
1187 | - if ( in_array( $currency, $zero_based_currency ) ) { |
|
1187 | + if (in_array($currency, $zero_based_currency)) { |
|
1188 | 1188 | return true; |
1189 | 1189 | } |
1190 | 1190 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct() { |
25 | 25 | |
26 | - $this->shortcode['title'] = esc_html__( 'Donation Form Grid', 'give' ); |
|
27 | - $this->shortcode['label'] = esc_html__( 'Donation Form Grid', 'give' ); |
|
26 | + $this->shortcode['title'] = esc_html__('Donation Form Grid', 'give'); |
|
27 | + $this->shortcode['label'] = esc_html__('Donation Form Grid', 'give'); |
|
28 | 28 | |
29 | - parent::__construct( 'give_form_grid' ); |
|
29 | + parent::__construct('give_form_grid'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -39,73 +39,73 @@ discard block |
||
39 | 39 | return array( |
40 | 40 | array( |
41 | 41 | 'type' => 'container', |
42 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
42 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
43 | 43 | ), |
44 | 44 | array( |
45 | 45 | 'type' => 'textbox', |
46 | 46 | 'name' => 'ids', |
47 | - 'label' => esc_attr__( 'Form IDs:', 'give' ), |
|
48 | - 'tooltip' => esc_attr__( 'Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give' ), |
|
49 | - 'placeholder' => esc_html__( 'All Forms', 'give' ) |
|
47 | + 'label' => esc_attr__('Form IDs:', 'give'), |
|
48 | + 'tooltip' => esc_attr__('Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give'), |
|
49 | + 'placeholder' => esc_html__('All Forms', 'give') |
|
50 | 50 | ), |
51 | 51 | array( |
52 | 52 | 'type' => 'listbox', |
53 | 53 | 'name' => 'columns', |
54 | - 'label' => esc_attr__( 'Columns:', 'give' ), |
|
55 | - 'tooltip' => esc_attr__( 'Sets the number of donations per row.', 'give' ), |
|
54 | + 'label' => esc_attr__('Columns:', 'give'), |
|
55 | + 'tooltip' => esc_attr__('Sets the number of donations per row.', 'give'), |
|
56 | 56 | 'options' => array( |
57 | - '1' => esc_html__( '1', 'give' ), |
|
58 | - '2' => esc_html__( '2', 'give' ), |
|
59 | - '3' => esc_html__( '3', 'give' ), |
|
60 | - '4' => esc_html__( '4', 'give' ), |
|
57 | + '1' => esc_html__('1', 'give'), |
|
58 | + '2' => esc_html__('2', 'give'), |
|
59 | + '3' => esc_html__('3', 'give'), |
|
60 | + '4' => esc_html__('4', 'give'), |
|
61 | 61 | ), |
62 | - 'placeholder' => esc_html__( 'Best Fit', 'give' ) |
|
62 | + 'placeholder' => esc_html__('Best Fit', 'give') |
|
63 | 63 | ), |
64 | 64 | array( |
65 | 65 | 'type' => 'listbox', |
66 | 66 | 'name' => 'show_goal', |
67 | - 'label' => esc_attr__( 'Show Goal:', 'give' ), |
|
68 | - 'tooltip' => __( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
67 | + 'label' => esc_attr__('Show Goal:', 'give'), |
|
68 | + 'tooltip' => __('Do you want to display the goal\'s progress bar?', 'give'), |
|
69 | 69 | 'options' => array( |
70 | - 'true' => esc_html__( 'Show', 'give' ), |
|
71 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
70 | + 'true' => esc_html__('Show', 'give'), |
|
71 | + 'false' => esc_html__('Hide', 'give'), |
|
72 | 72 | ), |
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'type' => 'listbox', |
76 | 76 | 'name' => 'show_excerpt', |
77 | - 'label' => esc_attr__( 'Show Excerpt:', 'give' ), |
|
78 | - 'tooltip' => esc_attr__( 'Do you want to display the excerpt?', 'give' ), |
|
77 | + 'label' => esc_attr__('Show Excerpt:', 'give'), |
|
78 | + 'tooltip' => esc_attr__('Do you want to display the excerpt?', 'give'), |
|
79 | 79 | 'options' => array( |
80 | - 'true' => esc_html__( 'Show', 'give' ), |
|
81 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
80 | + 'true' => esc_html__('Show', 'give'), |
|
81 | + 'false' => esc_html__('Hide', 'give'), |
|
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | array( |
85 | 85 | 'type' => 'listbox', |
86 | 86 | 'name' => 'show_featured_image', |
87 | - 'label' => esc_attr__( 'Show Featured Image:', 'give' ), |
|
88 | - 'tooltip' => esc_attr__( 'Do you want to display the featured image?', 'give' ), |
|
87 | + 'label' => esc_attr__('Show Featured Image:', 'give'), |
|
88 | + 'tooltip' => esc_attr__('Do you want to display the featured image?', 'give'), |
|
89 | 89 | 'options' => array( |
90 | - 'true' => esc_html__( 'Show', 'give' ), |
|
91 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
90 | + 'true' => esc_html__('Show', 'give'), |
|
91 | + 'false' => esc_html__('Hide', 'give'), |
|
92 | 92 | ), |
93 | 93 | ), |
94 | 94 | array( |
95 | 95 | 'type' => 'listbox', |
96 | 96 | 'name' => 'display_style', |
97 | - 'label' => esc_attr__( 'Display Style:', 'give' ), |
|
98 | - 'tooltip' => esc_attr__( 'Show form as modal window or redirect to a new page?', 'give' ), |
|
97 | + 'label' => esc_attr__('Display Style:', 'give'), |
|
98 | + 'tooltip' => esc_attr__('Show form as modal window or redirect to a new page?', 'give'), |
|
99 | 99 | 'options' => array( |
100 | - 'redirect' => esc_html__( 'Redirect', 'give' ), |
|
101 | - 'modal_reveal' => esc_html__( 'Modal', 'give' ), |
|
100 | + 'redirect' => esc_html__('Redirect', 'give'), |
|
101 | + 'modal_reveal' => esc_html__('Modal', 'give'), |
|
102 | 102 | ), |
103 | 103 | ), |
104 | 104 | array( |
105 | 105 | 'type' => 'textbox', |
106 | 106 | 'name' => 'forms_per_page', |
107 | - 'label' => esc_attr__( 'Forms Per Page:', 'give' ), |
|
108 | - 'tooltip' => esc_attr__( 'Sets the number of donations form per row.', 'give' ), |
|
107 | + 'label' => esc_attr__('Forms Per Page:', 'give'), |
|
108 | + 'tooltip' => esc_attr__('Sets the number of donations form per row.', 'give'), |
|
109 | 109 | 'value' => 12, |
110 | 110 | ), |
111 | 111 | ); |
@@ -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 | |
@@ -18,56 +18,55 @@ discard block |
||
18 | 18 | ?> |
19 | 19 | <div class="wrap" id="poststuff"> |
20 | 20 | <div id="give-updates"> |
21 | - <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1> |
|
21 | + <h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1> |
|
22 | 22 | <hr class="wp-header-end" |
23 | 23 | |
24 | 24 | <?php $db_updates = $give_updates->get_pending_db_update_count(); ?> |
25 | - <?php if ( ! empty( $db_updates ) ) : ?> |
|
25 | + <?php if ( ! empty($db_updates)) : ?> |
|
26 | 26 | <?php |
27 | 27 | $is_doing_updates = $give_updates->is_doing_updates(); |
28 | - $db_update_url = add_query_arg( array( 'type' => 'database', ) ); |
|
29 | - $resume_updates = get_option( 'give_doing_upgrade' ); |
|
30 | - $width = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0; |
|
28 | + $db_update_url = add_query_arg(array('type' => 'database',)); |
|
29 | + $resume_updates = get_option('give_doing_upgrade'); |
|
30 | + $width = ! empty($resume_updates) ? $resume_updates['percentage'] : 0; |
|
31 | 31 | ?> |
32 | 32 | <div class="give-update-panel-content"> |
33 | - <p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p> |
|
33 | + <p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p> |
|
34 | 34 | </div> |
35 | 35 | |
36 | - <div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>"> |
|
36 | + <div id="give-db-updates" data-resume-update="<?php echo absint($give_updates->is_doing_updates()); ?>"> |
|
37 | 37 | <div class="postbox-container"> |
38 | 38 | <div class="postbox"> |
39 | - <h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2> |
|
39 | + <h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2> |
|
40 | 40 | <div class="inside"> |
41 | 41 | <div class="panel-content"> |
42 | 42 | <p class="give-update-button"> |
43 | - <span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
43 | + <span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
44 | 44 | <?php echo sprintf( |
45 | - __( '%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give' ), |
|
45 | + __('%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give'), |
|
46 | 46 | $is_doing_updates ? |
47 | - __( 'Give is currently updating the database in the background.', 'give' ) : |
|
48 | - __( 'Give needs to update the database.', 'give' ), |
|
47 | + __('Give is currently updating the database in the background.', 'give') : __('Give needs to update the database.', 'give'), |
|
49 | 48 | $db_update_url, |
50 | - ( $is_doing_updates ? 'give-hidden' : '' ), |
|
51 | - __( 'Update now', 'give' ) |
|
49 | + ($is_doing_updates ? 'give-hidden' : ''), |
|
50 | + __('Update now', 'give') |
|
52 | 51 | ); |
53 | 52 | ?> |
54 | 53 | </span> |
55 | - <span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
56 | - <?php if ( get_option( 'give_upgrade_error' ) ) : ?> |
|
57 | - <?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?> |
|
54 | + <span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
55 | + <?php if (get_option('give_upgrade_error')) : ?> |
|
56 | + <?php _e('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); ?> |
|
58 | 57 | <?php else : ?> |
59 | - <?php _e( 'The updates have been paused.', 'give' ); ?> |
|
58 | + <?php _e('The updates have been paused.', 'give'); ?> |
|
60 | 59 | |
61 | 60 | <?php endif; ?> |
62 | 61 | </span> |
63 | 62 | |
64 | - <?php if ( Give_Updates::$background_updater->is_paused_process() ) : ?> |
|
65 | - <?php $is_disabled = isset( $_GET['give-restart-db-upgrades'] ) ? ' disabled' : ''; ?> |
|
66 | - <button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>><?php _e( 'Restart Upgrades', 'give' ); ?></button> |
|
67 | - <?php elseif( $give_updates->is_doing_updates() ): ?> |
|
68 | - <?php $is_disabled = isset( $_GET['give-pause-db-upgrades'] ) ? ' disabled' : ''; ?> |
|
69 | - <button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>> |
|
70 | - <?php _e( 'Pause Upgrades', 'give' ); ?> |
|
63 | + <?php if (Give_Updates::$background_updater->is_paused_process()) : ?> |
|
64 | + <?php $is_disabled = isset($_GET['give-restart-db-upgrades']) ? ' disabled' : ''; ?> |
|
65 | + <button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>><?php _e('Restart Upgrades', 'give'); ?></button> |
|
66 | + <?php elseif ($give_updates->is_doing_updates()): ?> |
|
67 | + <?php $is_disabled = isset($_GET['give-pause-db-upgrades']) ? ' disabled' : ''; ?> |
|
68 | + <button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>> |
|
69 | + <?php _e('Pause Upgrades', 'give'); ?> |
|
71 | 70 | </button> |
72 | 71 | <?php endif; ?> |
73 | 72 | </p> |
@@ -77,7 +76,7 @@ discard block |
||
77 | 76 | <strong> |
78 | 77 | <?php |
79 | 78 | echo sprintf( |
80 | - __( 'Update %s of %s', 'give' ), |
|
79 | + __('Update %s of %s', 'give'), |
|
81 | 80 | $give_updates->get_running_db_update(), |
82 | 81 | $give_updates->get_total_new_db_update_count() |
83 | 82 | ); |
@@ -85,10 +84,10 @@ discard block |
||
85 | 84 | </strong> |
86 | 85 | </p> |
87 | 86 | <div class="progress-content"> |
88 | - <?php if ( $is_doing_updates ) : ?> |
|
87 | + <?php if ($is_doing_updates) : ?> |
|
89 | 88 | <div class="notice-wrap give-clearfix"> |
90 | 89 | |
91 | - <?php if ( ! Give_Updates::$background_updater->is_paused_process() ) : ?> |
|
90 | + <?php if ( ! Give_Updates::$background_updater->is_paused_process()) : ?> |
|
92 | 91 | <span class="spinner is-active"></span> |
93 | 92 | <?php endif; ?> |
94 | 93 | |
@@ -100,7 +99,7 @@ discard block |
||
100 | 99 | </div> |
101 | 100 | </div> |
102 | 101 | |
103 | - <?php if ( ! $is_doing_updates ) : ?> |
|
102 | + <?php if ( ! $is_doing_updates) : ?> |
|
104 | 103 | <div class="give-run-database-update"></div> |
105 | 104 | <?php endif; ?> |
106 | 105 | </div> |
@@ -108,18 +107,18 @@ discard block |
||
108 | 107 | </div><!-- .postbox --> |
109 | 108 | </div> |
110 | 109 | </div> |
111 | - <?php else: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php';?> |
|
110 | + <?php else: include GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; ?> |
|
112 | 111 | <?php endif; ?> |
113 | 112 | |
114 | 113 | <?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?> |
115 | - <?php if ( ! empty( $plugin_updates ) ) : ?> |
|
116 | - <?php $plugin_update_url = add_query_arg( array( |
|
114 | + <?php if ( ! empty($plugin_updates)) : ?> |
|
115 | + <?php $plugin_update_url = add_query_arg(array( |
|
117 | 116 | 'plugin_status' => 'give', |
118 | - ), admin_url( '/plugins.php' ) ); ?> |
|
117 | + ), admin_url('/plugins.php')); ?> |
|
119 | 118 | <div id="give-plugin-updates"> |
120 | 119 | <div class="postbox-container"> |
121 | 120 | <div class="postbox"> |
122 | - <h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2> |
|
121 | + <h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2> |
|
123 | 122 | <div class="inside"> |
124 | 123 | <div class="panel-content"> |
125 | 124 | <p> |
@@ -55,8 +55,11 @@ discard block |
||
55 | 55 | <span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
56 | 56 | <?php if ( get_option( 'give_upgrade_error' ) ) : ?> |
57 | 57 | <?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?> |
58 | - <?php else : ?> |
|
59 | - <?php _e( 'The updates have been paused.', 'give' ); ?> |
|
58 | + <?php else { |
|
59 | + : ?> |
|
60 | + <?php _e( 'The updates have been paused.', 'give' ); |
|
61 | +} |
|
62 | +?> |
|
60 | 63 | |
61 | 64 | <?php endif; ?> |
62 | 65 | </span> |
@@ -108,7 +111,10 @@ discard block |
||
108 | 111 | </div><!-- .postbox --> |
109 | 112 | </div> |
110 | 113 | </div> |
111 | - <?php else: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php';?> |
|
114 | + <?php else { |
|
115 | + : include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; |
|
116 | +} |
|
117 | +?> |
|
112 | 118 | <?php endif; ?> |
113 | 119 | |
114 | 120 | <?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?> |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <div id="give-db-updates" data-resume-update="0"> |
2 | 2 | <div class="postbox-container"> |
3 | 3 | <div class="postbox"> |
4 | - <h2 class="hndle"><?php esc_html_e( 'Database Updates', 'give' ); ?></h2> |
|
4 | + <h2 class="hndle"><?php esc_html_e('Database Updates', 'give'); ?></h2> |
|
5 | 5 | <div class="inside"> |
6 | 6 | <div class="progress-container"> |
7 | - <p class="update-message"><strong><?php esc_html_e( 'Updates Completed.', 'give' ) ?></strong></p> |
|
7 | + <p class="update-message"><strong><?php esc_html_e('Updates Completed.', 'give') ?></strong></p> |
|
8 | 8 | <div class="progress-content"> |
9 | 9 | <div class="notice-wrap give-clearfix"> |
10 | 10 | <div class="notice notice-success is-dismissible inline"> |
11 | - <p><?php esc_html_e( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ) ?> |
|
11 | + <p><?php esc_html_e('Give database updates completed successfully. Thank you for updating to the latest version!', 'give') ?> |
|
12 | 12 | </p> |
13 | 13 | <button type="button" class="notice-dismiss"></button> |
14 | 14 | </div> |
@@ -20,4 +20,4 @@ discard block |
||
20 | 20 | </div><!-- .postbox --> |
21 | 21 | </div> |
22 | 22 | </div> |
23 | -<?php delete_option( 'give_show_db_upgrade_complete_notice' ); ?> |
|
24 | 23 | \ No newline at end of file |
24 | +<?php delete_option('give_show_db_upgrade_complete_notice'); ?> |
|
25 | 25 | \ No newline at end of file |
@@ -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 | |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | * @param int|bool $_id Post id. Default is false. |
349 | 349 | * @param array $_args Arguments passed. |
350 | 350 | */ |
351 | - public function __construct( $_id = false, $_args = array() ) { |
|
351 | + public function __construct($_id = false, $_args = array()) { |
|
352 | 352 | |
353 | - $donation_form = WP_Post::get_instance( $_id ); |
|
353 | + $donation_form = WP_Post::get_instance($_id); |
|
354 | 354 | |
355 | - return $this->setup_donation_form( $donation_form ); |
|
355 | + return $this->setup_donation_form($donation_form); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -365,23 +365,23 @@ discard block |
||
365 | 365 | * |
366 | 366 | * @return bool If the setup was successful or not. |
367 | 367 | */ |
368 | - private function setup_donation_form( $donation_form ) { |
|
368 | + private function setup_donation_form($donation_form) { |
|
369 | 369 | |
370 | - if ( ! is_object( $donation_form ) ) { |
|
370 | + if ( ! is_object($donation_form)) { |
|
371 | 371 | return false; |
372 | 372 | } |
373 | 373 | |
374 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
374 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
375 | 375 | return false; |
376 | 376 | } |
377 | 377 | |
378 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
378 | + if ('give_forms' !== $donation_form->post_type) { |
|
379 | 379 | return false; |
380 | 380 | } |
381 | 381 | |
382 | - foreach ( $donation_form as $key => $value ) { |
|
382 | + foreach ($donation_form as $key => $value) { |
|
383 | 383 | |
384 | - switch ( $key ) { |
|
384 | + switch ($key) { |
|
385 | 385 | |
386 | 386 | default: |
387 | 387 | $this->$key = $value; |
@@ -405,16 +405,16 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @return mixed |
407 | 407 | */ |
408 | - public function __get( $key ) { |
|
408 | + public function __get($key) { |
|
409 | 409 | |
410 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
410 | + if (method_exists($this, 'get_'.$key)) { |
|
411 | 411 | |
412 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
412 | + return call_user_func(array($this, 'get_'.$key)); |
|
413 | 413 | |
414 | 414 | } else { |
415 | 415 | |
416 | 416 | /* translators: %s: property key */ |
417 | - return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
417 | + return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
418 | 418 | |
419 | 419 | } |
420 | 420 | |
@@ -430,30 +430,30 @@ discard block |
||
430 | 430 | * |
431 | 431 | * @return bool|int False if data isn't passed and class not instantiated for creation, or New Form ID. |
432 | 432 | */ |
433 | - public function create( $data = array() ) { |
|
433 | + public function create($data = array()) { |
|
434 | 434 | |
435 | - if ( $this->id != 0 ) { |
|
435 | + if ($this->id != 0) { |
|
436 | 436 | return false; |
437 | 437 | } |
438 | 438 | |
439 | 439 | $defaults = array( |
440 | 440 | 'post_type' => 'give_forms', |
441 | 441 | 'post_status' => 'draft', |
442 | - 'post_title' => __( 'New Donation Form', 'give' ), |
|
442 | + 'post_title' => __('New Donation Form', 'give'), |
|
443 | 443 | ); |
444 | 444 | |
445 | - $args = wp_parse_args( $data, $defaults ); |
|
445 | + $args = wp_parse_args($data, $defaults); |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Fired before a donation form is created |
449 | 449 | * |
450 | 450 | * @param array $args The post object arguments used for creation. |
451 | 451 | */ |
452 | - do_action( 'give_form_pre_create', $args ); |
|
452 | + do_action('give_form_pre_create', $args); |
|
453 | 453 | |
454 | - $id = wp_insert_post( $args, true ); |
|
454 | + $id = wp_insert_post($args, true); |
|
455 | 455 | |
456 | - $donation_form = WP_Post::get_instance( $id ); |
|
456 | + $donation_form = WP_Post::get_instance($id); |
|
457 | 457 | |
458 | 458 | /** |
459 | 459 | * Fired after a donation form is created |
@@ -461,9 +461,9 @@ discard block |
||
461 | 461 | * @param int $id The post ID of the created item. |
462 | 462 | * @param array $args The post object arguments used for creation. |
463 | 463 | */ |
464 | - do_action( 'give_form_post_create', $id, $args ); |
|
464 | + do_action('give_form_post_create', $id, $args); |
|
465 | 465 | |
466 | - return $this->setup_donation_form( $donation_form ); |
|
466 | + return $this->setup_donation_form($donation_form); |
|
467 | 467 | |
468 | 468 | } |
469 | 469 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * @return string Donation form name. |
489 | 489 | */ |
490 | 490 | public function get_name() { |
491 | - return get_the_title( $this->ID ); |
|
491 | + return get_the_title($this->ID); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | /** |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | */ |
502 | 502 | public function get_price() { |
503 | 503 | |
504 | - if ( ! isset( $this->price ) ) { |
|
504 | + if ( ! isset($this->price)) { |
|
505 | 505 | |
506 | 506 | $this->price = give_maybe_sanitize_amount( |
507 | 507 | give_get_meta( |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | ) |
512 | 512 | ); |
513 | 513 | |
514 | - if ( ! $this->price ) { |
|
514 | + if ( ! $this->price) { |
|
515 | 515 | $this->price = 0; |
516 | 516 | } |
517 | 517 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * @param string $price The donation form price. |
526 | 526 | * @param string|int $id The form ID. |
527 | 527 | */ |
528 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
528 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | /** |
@@ -538,22 +538,22 @@ discard block |
||
538 | 538 | */ |
539 | 539 | public function get_minimum_price() { |
540 | 540 | |
541 | - if ( ! isset( $this->minimum_price ) ) { |
|
541 | + if ( ! isset($this->minimum_price)) { |
|
542 | 542 | |
543 | - $this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_range_minimum', true ); |
|
543 | + $this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_range_minimum', true); |
|
544 | 544 | |
545 | 545 | // Give backward < 2.1 |
546 | - if ( empty( $this->minimum_price ) ) { |
|
547 | - $this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
546 | + if (empty($this->minimum_price)) { |
|
547 | + $this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_minimum', true); |
|
548 | 548 | } |
549 | 549 | |
550 | - if ( ! $this->is_custom_price_mode() ) { |
|
551 | - $this->minimum_price = give_get_lowest_price_option( $this->ID ); |
|
550 | + if ( ! $this->is_custom_price_mode()) { |
|
551 | + $this->minimum_price = give_get_lowest_price_option($this->ID); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | } |
555 | 555 | |
556 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
556 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | /** |
@@ -566,15 +566,15 @@ discard block |
||
566 | 566 | */ |
567 | 567 | public function get_maximum_price() { |
568 | 568 | |
569 | - if ( ! isset( $this->maximum_price ) ) { |
|
570 | - $this->maximum_price = give_get_meta( $this->ID, '_give_custom_amount_range_maximum', true, 999999.99 ); |
|
569 | + if ( ! isset($this->maximum_price)) { |
|
570 | + $this->maximum_price = give_get_meta($this->ID, '_give_custom_amount_range_maximum', true, 999999.99); |
|
571 | 571 | |
572 | - if ( ! $this->is_custom_price_mode() ) { |
|
572 | + if ( ! $this->is_custom_price_mode()) { |
|
573 | 573 | $this->maximum_price = give_get_highest_price_option(); |
574 | 574 | } |
575 | 575 | } |
576 | 576 | |
577 | - return apply_filters( 'give_get_set_maximum_price', $this->maximum_price, $this->ID ); |
|
577 | + return apply_filters('give_get_set_maximum_price', $this->maximum_price, $this->ID); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | /** |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | */ |
588 | 588 | public function get_prices() { |
589 | 589 | |
590 | - if ( ! isset( $this->prices ) ) { |
|
590 | + if ( ! isset($this->prices)) { |
|
591 | 591 | |
592 | - $this->prices = give_get_meta( $this->ID, '_give_donation_levels', true ); |
|
592 | + $this->prices = give_get_meta($this->ID, '_give_donation_levels', true); |
|
593 | 593 | |
594 | 594 | } |
595 | 595 | |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | * @param array $prices The array of mulit-level prices. |
602 | 602 | * @param int|string $ID The ID of the form. |
603 | 603 | */ |
604 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
604 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
605 | 605 | |
606 | 606 | } |
607 | 607 | |
@@ -615,18 +615,18 @@ discard block |
||
615 | 615 | * |
616 | 616 | * @return array|null |
617 | 617 | */ |
618 | - public function get_level_info( $price_id ) { |
|
618 | + public function get_level_info($price_id) { |
|
619 | 619 | $level_info = array(); |
620 | 620 | |
621 | 621 | // Bailout. |
622 | - if ( 'multi' !== $this->get_type() ) { |
|
622 | + if ('multi' !== $this->get_type()) { |
|
623 | 623 | return null; |
624 | - } elseif ( ! ( $levels = $this->get_prices() ) ) { |
|
624 | + } elseif ( ! ($levels = $this->get_prices())) { |
|
625 | 625 | return $level_info; |
626 | 626 | } |
627 | 627 | |
628 | - foreach ( $levels as $level ) { |
|
629 | - if ( $price_id === $level['_give_id']['level_id'] ) { |
|
628 | + foreach ($levels as $level) { |
|
629 | + if ($price_id === $level['_give_id']['level_id']) { |
|
630 | 630 | $level_info = $level; |
631 | 631 | break; |
632 | 632 | } |
@@ -646,25 +646,25 @@ discard block |
||
646 | 646 | */ |
647 | 647 | public function get_goal() { |
648 | 648 | |
649 | - if ( ! isset( $this->goal ) ) { |
|
649 | + if ( ! isset($this->goal)) { |
|
650 | 650 | |
651 | - $goal_format = give_get_form_goal_format( $this->ID ); |
|
651 | + $goal_format = give_get_form_goal_format($this->ID); |
|
652 | 652 | |
653 | - if ( 'donation' === $goal_format ) { |
|
654 | - $this->goal = give_get_meta( $this->ID, '_give_number_of_donation_goal', true ); |
|
655 | - } elseif ( 'donors' === $goal_format ) { |
|
656 | - $this->goal = give_get_meta( $this->ID, '_give_number_of_donor_goal', true ); |
|
653 | + if ('donation' === $goal_format) { |
|
654 | + $this->goal = give_get_meta($this->ID, '_give_number_of_donation_goal', true); |
|
655 | + } elseif ('donors' === $goal_format) { |
|
656 | + $this->goal = give_get_meta($this->ID, '_give_number_of_donor_goal', true); |
|
657 | 657 | } else { |
658 | - $this->goal = give_get_meta( $this->ID, '_give_set_goal', true ); |
|
658 | + $this->goal = give_get_meta($this->ID, '_give_set_goal', true); |
|
659 | 659 | } |
660 | 660 | |
661 | - if ( ! $this->goal ) { |
|
661 | + if ( ! $this->goal) { |
|
662 | 662 | $this->goal = 0; |
663 | 663 | } |
664 | 664 | |
665 | 665 | } |
666 | 666 | |
667 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
667 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
668 | 668 | |
669 | 669 | } |
670 | 670 | |
@@ -678,10 +678,10 @@ discard block |
||
678 | 678 | */ |
679 | 679 | public function is_single_price_mode() { |
680 | 680 | |
681 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
681 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
682 | 682 | $ret = 0; |
683 | 683 | |
684 | - if ( empty( $option ) || $option === 'set' ) { |
|
684 | + if (empty($option) || $option === 'set') { |
|
685 | 685 | $ret = 1; |
686 | 686 | } |
687 | 687 | |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | * @param bool $ret Is donation form in single price mode? |
694 | 694 | * @param int|string $ID The ID of the donation form. |
695 | 695 | */ |
696 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
696 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
697 | 697 | |
698 | 698 | } |
699 | 699 | |
@@ -707,10 +707,10 @@ discard block |
||
707 | 707 | */ |
708 | 708 | public function is_custom_price_mode() { |
709 | 709 | |
710 | - $option = give_get_meta( $this->ID, '_give_custom_amount', true ); |
|
710 | + $option = give_get_meta($this->ID, '_give_custom_amount', true); |
|
711 | 711 | $ret = 0; |
712 | 712 | |
713 | - if ( give_is_setting_enabled( $option ) ) { |
|
713 | + if (give_is_setting_enabled($option)) { |
|
714 | 714 | $ret = 1; |
715 | 715 | } |
716 | 716 | |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | * @param bool $ret Is donation form in custom price mode? |
723 | 723 | * @param int|string $ID The ID of the donation form. |
724 | 724 | */ |
725 | - return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID ); |
|
725 | + return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID); |
|
726 | 726 | |
727 | 727 | } |
728 | 728 | |
@@ -736,20 +736,20 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @return bool |
738 | 738 | */ |
739 | - public function is_custom_price( $amount ) { |
|
739 | + public function is_custom_price($amount) { |
|
740 | 740 | $result = false; |
741 | - $amount = give_maybe_sanitize_amount( $amount ); |
|
741 | + $amount = give_maybe_sanitize_amount($amount); |
|
742 | 742 | |
743 | - if ( $this->is_custom_price_mode() ) { |
|
743 | + if ($this->is_custom_price_mode()) { |
|
744 | 744 | |
745 | - if ( 'set' === $this->get_type() ) { |
|
746 | - if ( $amount !== $this->get_price() ) { |
|
745 | + if ('set' === $this->get_type()) { |
|
746 | + if ($amount !== $this->get_price()) { |
|
747 | 747 | $result = true; |
748 | 748 | } |
749 | 749 | |
750 | - } elseif ( 'multi' === $this->get_type() ) { |
|
751 | - $level_amounts = array_map( 'give_maybe_sanitize_amount', wp_list_pluck( $this->get_prices(), '_give_amount' ) ); |
|
752 | - $result = ! in_array( $amount, $level_amounts ); |
|
750 | + } elseif ('multi' === $this->get_type()) { |
|
751 | + $level_amounts = array_map('give_maybe_sanitize_amount', wp_list_pluck($this->get_prices(), '_give_amount')); |
|
752 | + $result = ! in_array($amount, $level_amounts); |
|
753 | 753 | } |
754 | 754 | } |
755 | 755 | |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | * |
763 | 763 | * @since 1.8.18 |
764 | 764 | */ |
765 | - return (bool) apply_filters( 'give_is_custom_price', $result, $amount, $this->ID ); |
|
765 | + return (bool) apply_filters('give_is_custom_price', $result, $amount, $this->ID); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | /** |
@@ -777,10 +777,10 @@ discard block |
||
777 | 777 | */ |
778 | 778 | public function has_variable_prices() { |
779 | 779 | |
780 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
780 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
781 | 781 | $ret = 0; |
782 | 782 | |
783 | - if ( $option === 'multi' ) { |
|
783 | + if ($option === 'multi') { |
|
784 | 784 | $ret = 1; |
785 | 785 | } |
786 | 786 | |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | * @param bool $ret Does donation form have variable prices? |
791 | 791 | * @param int|string $ID The ID of the donation form. |
792 | 792 | */ |
793 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
793 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
794 | 794 | |
795 | 795 | } |
796 | 796 | |
@@ -804,17 +804,17 @@ discard block |
||
804 | 804 | */ |
805 | 805 | public function get_type() { |
806 | 806 | |
807 | - if ( ! isset( $this->type ) ) { |
|
807 | + if ( ! isset($this->type)) { |
|
808 | 808 | |
809 | - $this->type = give_get_meta( $this->ID, '_give_price_option', true ); |
|
809 | + $this->type = give_get_meta($this->ID, '_give_price_option', true); |
|
810 | 810 | |
811 | - if ( empty( $this->type ) ) { |
|
811 | + if (empty($this->type)) { |
|
812 | 812 | $this->type = 'set'; |
813 | 813 | } |
814 | 814 | |
815 | 815 | } |
816 | 816 | |
817 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
817 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
818 | 818 | |
819 | 819 | } |
820 | 820 | |
@@ -830,23 +830,23 @@ discard block |
||
830 | 830 | * |
831 | 831 | * @return string |
832 | 832 | */ |
833 | - public function get_form_classes( $args ) { |
|
833 | + public function get_form_classes($args) { |
|
834 | 834 | |
835 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
835 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
836 | 836 | ? 'float-labels-enabled' |
837 | 837 | : ''; |
838 | 838 | |
839 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
839 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
840 | 840 | 'give-form', |
841 | - 'give-form-' . $this->ID, |
|
842 | - 'give-form-type-' . $this->get_type(), |
|
841 | + 'give-form-'.$this->ID, |
|
842 | + 'give-form-type-'.$this->get_type(), |
|
843 | 843 | $float_labels_option, |
844 | - ), $this->ID, $args ); |
|
844 | + ), $this->ID, $args); |
|
845 | 845 | |
846 | 846 | // Remove empty class names. |
847 | - $form_classes_array = array_filter( $form_classes_array ); |
|
847 | + $form_classes_array = array_filter($form_classes_array); |
|
848 | 848 | |
849 | - return implode( ' ', $form_classes_array ); |
|
849 | + return implode(' ', $form_classes_array); |
|
850 | 850 | |
851 | 851 | } |
852 | 852 | |
@@ -861,22 +861,22 @@ discard block |
||
861 | 861 | * |
862 | 862 | * @return string |
863 | 863 | */ |
864 | - public function get_form_wrap_classes( $args ) { |
|
864 | + public function get_form_wrap_classes($args) { |
|
865 | 865 | $custom_class = array( |
866 | 866 | 'give-form-wrap', |
867 | 867 | ); |
868 | 868 | |
869 | - if ( $this->is_close_donation_form() ) { |
|
869 | + if ($this->is_close_donation_form()) { |
|
870 | 870 | $custom_class[] = 'give-form-closed'; |
871 | 871 | } else { |
872 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
872 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
873 | 873 | ? $args['display_style'] |
874 | - : give_get_meta( $this->ID, '_give_payment_display', true ); |
|
874 | + : give_get_meta($this->ID, '_give_payment_display', true); |
|
875 | 875 | |
876 | 876 | $custom_class[] = "give-display-{$display_option}"; |
877 | 877 | |
878 | 878 | // If admin want to show only button for form then user inbuilt modal functionality. |
879 | - if ( 'button' === $display_option ) { |
|
879 | + if ('button' === $display_option) { |
|
880 | 880 | $custom_class[] = 'give-display-button-only'; |
881 | 881 | } |
882 | 882 | } |
@@ -887,10 +887,10 @@ discard block |
||
887 | 887 | * |
888 | 888 | * @since 1.0 |
889 | 889 | */ |
890 | - $form_wrap_classes_array = (array) apply_filters( 'give_form_wrap_classes', $custom_class, $this->ID, $args ); |
|
890 | + $form_wrap_classes_array = (array) apply_filters('give_form_wrap_classes', $custom_class, $this->ID, $args); |
|
891 | 891 | |
892 | 892 | |
893 | - return implode( ' ', $form_wrap_classes_array ); |
|
893 | + return implode(' ', $form_wrap_classes_array); |
|
894 | 894 | |
895 | 895 | } |
896 | 896 | |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | public function is_set_type_donation_form() { |
906 | 906 | $form_type = $this->get_type(); |
907 | 907 | |
908 | - return ( 'set' === $form_type ? true : false ); |
|
908 | + return ('set' === $form_type ? true : false); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | /** |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | public function is_multi_type_donation_form() { |
920 | 920 | $form_type = $this->get_type(); |
921 | 921 | |
922 | - return ( 'multi' === $form_type ? true : false ); |
|
922 | + return ('multi' === $form_type ? true : false); |
|
923 | 923 | |
924 | 924 | } |
925 | 925 | |
@@ -933,15 +933,15 @@ discard block |
||
933 | 933 | */ |
934 | 934 | public function get_sales() { |
935 | 935 | |
936 | - if ( ! isset( $this->sales ) ) { |
|
936 | + if ( ! isset($this->sales)) { |
|
937 | 937 | |
938 | - if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) { |
|
939 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
938 | + if ('' == give_get_meta($this->ID, '_give_form_sales', true)) { |
|
939 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
940 | 940 | } // End if |
941 | 941 | |
942 | - $this->sales = give_get_meta( $this->ID, '_give_form_sales', true ); |
|
942 | + $this->sales = give_get_meta($this->ID, '_give_form_sales', true); |
|
943 | 943 | |
944 | - if ( $this->sales < 0 ) { |
|
944 | + if ($this->sales < 0) { |
|
945 | 945 | // Never let sales be less than zero. |
946 | 946 | $this->sales = 0; |
947 | 947 | } |
@@ -962,13 +962,13 @@ discard block |
||
962 | 962 | * |
963 | 963 | * @return int|false New number of total sales. |
964 | 964 | */ |
965 | - public function increase_sales( $quantity = 1 ) { |
|
965 | + public function increase_sales($quantity = 1) { |
|
966 | 966 | |
967 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
968 | - $quantity = absint( $quantity ); |
|
967 | + $sales = give_get_form_sales_stats($this->ID); |
|
968 | + $quantity = absint($quantity); |
|
969 | 969 | $total_sales = $sales + $quantity; |
970 | 970 | |
971 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
971 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
972 | 972 | |
973 | 973 | $this->sales = $total_sales; |
974 | 974 | |
@@ -989,17 +989,17 @@ discard block |
||
989 | 989 | * |
990 | 990 | * @return int|false New number of total sales. |
991 | 991 | */ |
992 | - public function decrease_sales( $quantity = 1 ) { |
|
992 | + public function decrease_sales($quantity = 1) { |
|
993 | 993 | |
994 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
994 | + $sales = give_get_form_sales_stats($this->ID); |
|
995 | 995 | |
996 | 996 | // Only decrease if not already zero |
997 | - if ( $sales > 0 ) { |
|
997 | + if ($sales > 0) { |
|
998 | 998 | |
999 | - $quantity = absint( $quantity ); |
|
999 | + $quantity = absint($quantity); |
|
1000 | 1000 | $total_sales = $sales - $quantity; |
1001 | 1001 | |
1002 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
1002 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
1003 | 1003 | |
1004 | 1004 | $this->sales = $sales; |
1005 | 1005 | |
@@ -1023,15 +1023,15 @@ discard block |
||
1023 | 1023 | */ |
1024 | 1024 | public function get_earnings() { |
1025 | 1025 | |
1026 | - if ( ! isset( $this->earnings ) ) { |
|
1026 | + if ( ! isset($this->earnings)) { |
|
1027 | 1027 | |
1028 | - if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
1029 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
1028 | + if ('' == give_get_meta($this->ID, '_give_form_earnings', true)) { |
|
1029 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
1030 | 1030 | } |
1031 | 1031 | |
1032 | - $this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true ); |
|
1032 | + $this->earnings = give_get_meta($this->ID, '_give_form_earnings', true); |
|
1033 | 1033 | |
1034 | - if ( $this->earnings < 0 ) { |
|
1034 | + if ($this->earnings < 0) { |
|
1035 | 1035 | // Never let earnings be less than zero |
1036 | 1036 | $this->earnings = 0; |
1037 | 1037 | } |
@@ -1055,9 +1055,9 @@ discard block |
||
1055 | 1055 | * |
1056 | 1056 | * @return float|false |
1057 | 1057 | */ |
1058 | - public function increase_earnings( $amount = 0, $payment_id = 0 ) { |
|
1058 | + public function increase_earnings($amount = 0, $payment_id = 0) { |
|
1059 | 1059 | |
1060 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
1060 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
1061 | 1061 | |
1062 | 1062 | /** |
1063 | 1063 | * Modify the earning amount when increasing. |
@@ -1068,11 +1068,11 @@ discard block |
||
1068 | 1068 | * @param int $form_id Donation form ID. |
1069 | 1069 | * @param int $payment_id Donation ID. |
1070 | 1070 | */ |
1071 | - $amount = apply_filters( 'give_increase_form_earnings_amount', $amount, $this->ID, $payment_id ); |
|
1071 | + $amount = apply_filters('give_increase_form_earnings_amount', $amount, $this->ID, $payment_id); |
|
1072 | 1072 | |
1073 | 1073 | $new_amount = $earnings + (float) $amount; |
1074 | 1074 | |
1075 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
1075 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
1076 | 1076 | |
1077 | 1077 | $this->earnings = $new_amount; |
1078 | 1078 | |
@@ -1095,11 +1095,11 @@ discard block |
||
1095 | 1095 | * |
1096 | 1096 | * @return float|false |
1097 | 1097 | */ |
1098 | - public function decrease_earnings( $amount, $payment_id = 0 ) { |
|
1098 | + public function decrease_earnings($amount, $payment_id = 0) { |
|
1099 | 1099 | |
1100 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
1100 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
1101 | 1101 | |
1102 | - if ( $earnings > 0 ) { |
|
1102 | + if ($earnings > 0) { |
|
1103 | 1103 | |
1104 | 1104 | /** |
1105 | 1105 | * Modify the earning value when decreasing it. |
@@ -1110,12 +1110,12 @@ discard block |
||
1110 | 1110 | * @param int $form_id Donation Form ID. |
1111 | 1111 | * @param int $payment_id Donation ID. |
1112 | 1112 | */ |
1113 | - $amount = apply_filters( 'give_decrease_form_earnings_amount', $amount, $this->ID, $payment_id ); |
|
1113 | + $amount = apply_filters('give_decrease_form_earnings_amount', $amount, $this->ID, $payment_id); |
|
1114 | 1114 | |
1115 | 1115 | // Only decrease if greater than zero |
1116 | 1116 | $new_amount = $earnings - (float) $amount; |
1117 | 1117 | |
1118 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
1118 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
1119 | 1119 | $this->earnings = $new_amount; |
1120 | 1120 | |
1121 | 1121 | return $this->earnings; |
@@ -1141,10 +1141,10 @@ discard block |
||
1141 | 1141 | * @return bool |
1142 | 1142 | */ |
1143 | 1143 | public function is_close_donation_form() { |
1144 | - $is_closed = ( 'closed' === give_get_meta( $this->ID, '_give_form_status', true, 'open' ) ); |
|
1144 | + $is_closed = ('closed' === give_get_meta($this->ID, '_give_form_status', true, 'open')); |
|
1145 | 1145 | |
1146 | 1146 | // If manual upgrade not completed, proceed with backward compatible code. |
1147 | - if ( ! give_has_upgrade_completed( 'v210_verify_form_status_upgrades' ) ) { |
|
1147 | + if ( ! give_has_upgrade_completed('v210_verify_form_status_upgrades')) { |
|
1148 | 1148 | |
1149 | 1149 | // Check for backward compatibility. |
1150 | 1150 | $is_closed = $this->bc_210_is_close_donation_form(); |
@@ -1174,17 +1174,17 @@ discard block |
||
1174 | 1174 | * |
1175 | 1175 | * @return bool The result of the update query. |
1176 | 1176 | */ |
1177 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
1177 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
1178 | 1178 | |
1179 | 1179 | /* @var WPDB $wpdb */ |
1180 | 1180 | global $wpdb; |
1181 | 1181 | |
1182 | 1182 | // Bailout. |
1183 | - if ( empty( $meta_key ) ) { |
|
1183 | + if (empty($meta_key)) { |
|
1184 | 1184 | return false; |
1185 | 1185 | } |
1186 | 1186 | |
1187 | - if ( give_update_meta( $this->ID, $meta_key, $meta_value ) ) { |
|
1187 | + if (give_update_meta($this->ID, $meta_key, $meta_value)) { |
|
1188 | 1188 | return true; |
1189 | 1189 | } |
1190 | 1190 | |
@@ -1201,33 +1201,33 @@ discard block |
||
1201 | 1201 | private function bc_210_is_close_donation_form() { |
1202 | 1202 | |
1203 | 1203 | $close_form = false; |
1204 | - $is_goal_enabled = give_is_setting_enabled( give_get_meta( $this->ID, '_give_goal_option', true, 'disabled' ) ); |
|
1204 | + $is_goal_enabled = give_is_setting_enabled(give_get_meta($this->ID, '_give_goal_option', true, 'disabled')); |
|
1205 | 1205 | |
1206 | 1206 | // Proceed, if the form goal is enabled. |
1207 | - if ( $is_goal_enabled ) { |
|
1207 | + if ($is_goal_enabled) { |
|
1208 | 1208 | |
1209 | - $close_form_when_goal_achieved = give_is_setting_enabled( give_get_meta( $this->ID, '_give_close_form_when_goal_achieved', true, 'disabled' ) ); |
|
1209 | + $close_form_when_goal_achieved = give_is_setting_enabled(give_get_meta($this->ID, '_give_close_form_when_goal_achieved', true, 'disabled')); |
|
1210 | 1210 | |
1211 | 1211 | // Proceed, if close form when goal achieved option is enabled. |
1212 | - if ( $close_form_when_goal_achieved ) { |
|
1212 | + if ($close_form_when_goal_achieved) { |
|
1213 | 1213 | |
1214 | - $form = new Give_Donate_Form( $this->ID ); |
|
1215 | - $goal_format = give_get_form_goal_format( $this->ID ); |
|
1214 | + $form = new Give_Donate_Form($this->ID); |
|
1215 | + $goal_format = give_get_form_goal_format($this->ID); |
|
1216 | 1216 | |
1217 | 1217 | // Verify whether the form is closed or not after processing data based on goal format. |
1218 | - switch ( $goal_format ) { |
|
1218 | + switch ($goal_format) { |
|
1219 | 1219 | case 'donation': |
1220 | 1220 | $closed = $form->get_goal() <= $form->get_sales(); |
1221 | 1221 | break; |
1222 | 1222 | case 'donors': |
1223 | - $closed = $form->get_goal() <= give_get_form_donor_count( $this->ID ); |
|
1223 | + $closed = $form->get_goal() <= give_get_form_donor_count($this->ID); |
|
1224 | 1224 | break; |
1225 | 1225 | default : |
1226 | 1226 | $closed = $form->get_goal() <= $form->get_earnings(); |
1227 | 1227 | break; |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - if ( $closed ) { |
|
1230 | + if ($closed) { |
|
1231 | 1231 | $close_form = true; |
1232 | 1232 | } |
1233 | 1233 |