@@ -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,36 +30,36 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return bool|object List of all user donations |
32 | 32 | */ |
33 | -function give_get_users_purchases( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) { |
|
33 | +function give_get_users_purchases($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 | 43 | $status = $status === 'complete' ? 'publish' : $status; |
44 | 44 | |
45 | - if ( $pagination ) { |
|
46 | - if ( get_query_var( 'paged' ) ) { |
|
47 | - $paged = get_query_var( 'paged' ); |
|
48 | - } else if ( get_query_var( 'page' ) ) { |
|
49 | - $paged = get_query_var( 'page' ); |
|
45 | + if ($pagination) { |
|
46 | + if (get_query_var('paged')) { |
|
47 | + $paged = get_query_var('paged'); |
|
48 | + } else if (get_query_var('page')) { |
|
49 | + $paged = get_query_var('page'); |
|
50 | 50 | } else { |
51 | 51 | $paged = 1; |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - $args = apply_filters( 'give_get_users_donations_args', array( |
|
55 | + $args = apply_filters('give_get_users_donations_args', array( |
|
56 | 56 | 'user' => $user, |
57 | 57 | 'number' => $number, |
58 | 58 | 'status' => $status, |
59 | 59 | 'orderby' => 'date' |
60 | - ) ); |
|
60 | + )); |
|
61 | 61 | |
62 | - if ( $pagination ) { |
|
62 | + if ($pagination) { |
|
63 | 63 | |
64 | 64 | $args['page'] = $paged; |
65 | 65 | |
@@ -69,20 +69,20 @@ discard block |
||
69 | 69 | |
70 | 70 | } |
71 | 71 | |
72 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
73 | - $customer = new Give_Customer( $user, $by_user_id ); |
|
72 | + $by_user_id = is_numeric($user) ? true : false; |
|
73 | + $customer = new Give_Customer($user, $by_user_id); |
|
74 | 74 | |
75 | - if ( ! empty( $customer->payment_ids ) ) { |
|
75 | + if ( ! empty($customer->payment_ids)) { |
|
76 | 76 | |
77 | - unset( $args['user'] ); |
|
78 | - $args['post__in'] = array_map( 'absint', explode( ',', $customer->payment_ids ) ); |
|
77 | + unset($args['user']); |
|
78 | + $args['post__in'] = array_map('absint', explode(',', $customer->payment_ids)); |
|
79 | 79 | |
80 | 80 | } |
81 | 81 | |
82 | - $purchases = give_get_payments( apply_filters( 'give_get_users_donations_args', $args ) ); |
|
82 | + $purchases = give_get_payments(apply_filters('give_get_users_donations_args', $args)); |
|
83 | 83 | |
84 | 84 | // No donations |
85 | - if ( ! $purchases ) { |
|
85 | + if ( ! $purchases) { |
|
86 | 86 | return false; |
87 | 87 | } |
88 | 88 | |
@@ -101,65 +101,65 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return bool|object List of unique forms donated by user |
103 | 103 | */ |
104 | -function give_get_users_completed_donations( $user = 0, $status = 'complete' ) { |
|
105 | - if ( empty( $user ) ) { |
|
104 | +function give_get_users_completed_donations($user = 0, $status = 'complete') { |
|
105 | + if (empty($user)) { |
|
106 | 106 | $user = get_current_user_id(); |
107 | 107 | } |
108 | 108 | |
109 | - if ( empty( $user ) ) { |
|
109 | + if (empty($user)) { |
|
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | |
113 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
113 | + $by_user_id = is_numeric($user) ? true : false; |
|
114 | 114 | |
115 | - $customer = new Give_Customer( $user, $by_user_id ); |
|
115 | + $customer = new Give_Customer($user, $by_user_id); |
|
116 | 116 | |
117 | - if ( empty( $customer->payment_ids ) ) { |
|
117 | + if (empty($customer->payment_ids)) { |
|
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
121 | 121 | // Get all the items donated |
122 | - $payment_ids = array_reverse( explode( ',', $customer->payment_ids ) ); |
|
123 | - $limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 ); |
|
124 | - if ( ! empty( $limit_payments ) ) { |
|
125 | - $payment_ids = array_slice( $payment_ids, 0, $limit_payments ); |
|
122 | + $payment_ids = array_reverse(explode(',', $customer->payment_ids)); |
|
123 | + $limit_payments = apply_filters('give_users_completed_donations_payments', 50); |
|
124 | + if ( ! empty($limit_payments)) { |
|
125 | + $payment_ids = array_slice($payment_ids, 0, $limit_payments); |
|
126 | 126 | } |
127 | 127 | $donation_data = array(); |
128 | - foreach ( $payment_ids as $payment_id ) { |
|
129 | - $donation_data[] = give_get_payment_meta( $payment_id ); |
|
128 | + foreach ($payment_ids as $payment_id) { |
|
129 | + $donation_data[] = give_get_payment_meta($payment_id); |
|
130 | 130 | } |
131 | 131 | |
132 | - if ( empty( $donation_data ) ) { |
|
132 | + if (empty($donation_data)) { |
|
133 | 133 | return false; |
134 | 134 | } |
135 | 135 | |
136 | 136 | // Grab only the post ids "form_id" of the forms donated on this order |
137 | 137 | $completed_donations_ids = array(); |
138 | - foreach ( $donation_data as $purchase_meta ) { |
|
138 | + foreach ($donation_data as $purchase_meta) { |
|
139 | 139 | $completed_donations_ids[] = isset($purchase_meta['form_id']) ? $purchase_meta['form_id'] : ''; |
140 | 140 | } |
141 | 141 | |
142 | - if ( empty( $completed_donations_ids ) ) { |
|
142 | + if (empty($completed_donations_ids)) { |
|
143 | 143 | return false; |
144 | 144 | } |
145 | 145 | |
146 | 146 | // Only include each donation once |
147 | - $form_ids = array_unique( $completed_donations_ids ); |
|
147 | + $form_ids = array_unique($completed_donations_ids); |
|
148 | 148 | |
149 | 149 | // Make sure we still have some products and a first item |
150 | - if ( empty ( $form_ids ) || ! isset( $form_ids[0] ) ) { |
|
150 | + if (empty ($form_ids) || ! isset($form_ids[0])) { |
|
151 | 151 | return false; |
152 | 152 | } |
153 | 153 | |
154 | - $post_type = get_post_type( $form_ids[0] ); |
|
154 | + $post_type = get_post_type($form_ids[0]); |
|
155 | 155 | |
156 | - $args = apply_filters( 'give_get_users_completed_donations_args', array( |
|
156 | + $args = apply_filters('give_get_users_completed_donations_args', array( |
|
157 | 157 | 'include' => $form_ids, |
158 | 158 | 'post_type' => $post_type, |
159 | - 'posts_per_page' => - 1 |
|
160 | - ) ); |
|
159 | + 'posts_per_page' => -1 |
|
160 | + )); |
|
161 | 161 | |
162 | - return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) ); |
|
162 | + return apply_filters('give_users_completed_donations_list', get_posts($args)); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -175,12 +175,12 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return bool True if has donated, false other wise. |
177 | 177 | */ |
178 | -function give_has_purchases( $user_id = null ) { |
|
179 | - if ( empty( $user_id ) ) { |
|
178 | +function give_has_purchases($user_id = null) { |
|
179 | + if (empty($user_id)) { |
|
180 | 180 | $user_id = get_current_user_id(); |
181 | 181 | } |
182 | 182 | |
183 | - if ( give_get_users_purchases( $user_id, 1 ) ) { |
|
183 | + if (give_get_users_purchases($user_id, 1)) { |
|
184 | 184 | return true; // User has at least one donation |
185 | 185 | } |
186 | 186 | |
@@ -200,27 +200,27 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return array |
202 | 202 | */ |
203 | -function give_get_purchase_stats_by_user( $user = '' ) { |
|
203 | +function give_get_purchase_stats_by_user($user = '') { |
|
204 | 204 | |
205 | - if ( is_email( $user ) ) { |
|
205 | + if (is_email($user)) { |
|
206 | 206 | |
207 | 207 | $field = 'email'; |
208 | 208 | |
209 | - } elseif ( is_numeric( $user ) ) { |
|
209 | + } elseif (is_numeric($user)) { |
|
210 | 210 | |
211 | 211 | $field = 'user_id'; |
212 | 212 | |
213 | 213 | } |
214 | 214 | |
215 | 215 | $stats = array(); |
216 | - $customer = Give()->customers->get_customer_by( $field, $user ); |
|
216 | + $customer = Give()->customers->get_customer_by($field, $user); |
|
217 | 217 | |
218 | - if ( $customer ) { |
|
218 | + if ($customer) { |
|
219 | 219 | |
220 | - $customer = new Give_Customer( $customer->id ); |
|
220 | + $customer = new Give_Customer($customer->id); |
|
221 | 221 | |
222 | - $stats['purchases'] = absint( $customer->purchase_count ); |
|
223 | - $stats['total_spent'] = give_sanitize_amount( $customer->purchase_value ); |
|
222 | + $stats['purchases'] = absint($customer->purchase_count); |
|
223 | + $stats['total_spent'] = give_sanitize_amount($customer->purchase_value); |
|
224 | 224 | |
225 | 225 | } |
226 | 226 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @since 1.7 |
231 | 231 | */ |
232 | - $stats = (array) apply_filters( 'give_donation_stats_by_user', $stats, $user ); |
|
232 | + $stats = (array) apply_filters('give_donation_stats_by_user', $stats, $user); |
|
233 | 233 | |
234 | 234 | return $stats; |
235 | 235 | } |
@@ -247,22 +247,22 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return int The total number of donations |
249 | 249 | */ |
250 | -function give_count_purchases_of_customer( $user = null ) { |
|
250 | +function give_count_purchases_of_customer($user = null) { |
|
251 | 251 | |
252 | 252 | //Logged in? |
253 | - if ( empty( $user ) ) { |
|
253 | + if (empty($user)) { |
|
254 | 254 | $user = get_current_user_id(); |
255 | 255 | } |
256 | 256 | |
257 | 257 | //Email access? |
258 | - if ( empty( $user ) && Give()->email_access->token_email ) { |
|
258 | + if (empty($user) && Give()->email_access->token_email) { |
|
259 | 259 | $user = Give()->email_access->token_email; |
260 | 260 | } |
261 | 261 | |
262 | 262 | |
263 | - $stats = ! empty( $user ) ? give_get_purchase_stats_by_user( $user ) : false; |
|
263 | + $stats = ! empty($user) ? give_get_purchase_stats_by_user($user) : false; |
|
264 | 264 | |
265 | - return isset( $stats['purchases'] ) ? $stats['purchases'] : 0; |
|
265 | + return isset($stats['purchases']) ? $stats['purchases'] : 0; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @return float The total amount the user has spent |
277 | 277 | */ |
278 | -function give_purchase_total_of_user( $user = null ) { |
|
278 | +function give_purchase_total_of_user($user = null) { |
|
279 | 279 | |
280 | - $stats = give_get_purchase_stats_by_user( $user ); |
|
280 | + $stats = give_get_purchase_stats_by_user($user); |
|
281 | 281 | |
282 | 282 | return $stats['total_spent']; |
283 | 283 | } |
@@ -293,11 +293,11 @@ discard block |
||
293 | 293 | * |
294 | 294 | * @return bool |
295 | 295 | */ |
296 | -function give_validate_username( $username ) { |
|
297 | - $sanitized = sanitize_user( $username, false ); |
|
298 | - $valid = ( $sanitized == $username ); |
|
296 | +function give_validate_username($username) { |
|
297 | + $sanitized = sanitize_user($username, false); |
|
298 | + $valid = ($sanitized == $username); |
|
299 | 299 | |
300 | - return (bool) apply_filters( 'give_validate_username', $valid, $username ); |
|
300 | + return (bool) apply_filters('give_validate_username', $valid, $username); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
@@ -314,32 +314,32 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @return void |
316 | 316 | */ |
317 | -function give_add_past_purchases_to_new_user( $user_id ) { |
|
317 | +function give_add_past_purchases_to_new_user($user_id) { |
|
318 | 318 | |
319 | - $email = get_the_author_meta( 'user_email', $user_id ); |
|
319 | + $email = get_the_author_meta('user_email', $user_id); |
|
320 | 320 | |
321 | - $payments = give_get_payments( array( 's' => $email ) ); |
|
321 | + $payments = give_get_payments(array('s' => $email)); |
|
322 | 322 | |
323 | - if ( $payments ) { |
|
324 | - foreach ( $payments as $payment ) { |
|
325 | - if ( intval( give_get_payment_user_id( $payment->ID ) ) > 0 ) { |
|
323 | + if ($payments) { |
|
324 | + foreach ($payments as $payment) { |
|
325 | + if (intval(give_get_payment_user_id($payment->ID)) > 0) { |
|
326 | 326 | continue; |
327 | 327 | } // This payment already associated with an account |
328 | 328 | |
329 | - $meta = give_get_payment_meta( $payment->ID ); |
|
330 | - $meta['user_info'] = maybe_unserialize( $meta['user_info'] ); |
|
329 | + $meta = give_get_payment_meta($payment->ID); |
|
330 | + $meta['user_info'] = maybe_unserialize($meta['user_info']); |
|
331 | 331 | $meta['user_info']['id'] = $user_id; |
332 | 332 | $meta['user_info'] = $meta['user_info']; |
333 | 333 | |
334 | 334 | // Store the updated user ID in the payment meta |
335 | - give_update_payment_meta( $payment->ID, '_give_payment_meta', $meta ); |
|
336 | - give_update_payment_meta( $payment->ID, '_give_payment_user_id', $user_id ); |
|
335 | + give_update_payment_meta($payment->ID, '_give_payment_meta', $meta); |
|
336 | + give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id); |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
340 | 340 | } |
341 | 341 | |
342 | -add_action( 'user_register', 'give_add_past_purchases_to_new_user' ); |
|
342 | +add_action('user_register', 'give_add_past_purchases_to_new_user'); |
|
343 | 343 | |
344 | 344 | |
345 | 345 | /** |
@@ -365,34 +365,34 @@ discard block |
||
365 | 365 | * |
366 | 366 | * @return array The donor's address, if any |
367 | 367 | */ |
368 | -function give_get_donor_address( $user_id = 0 ) { |
|
369 | - if ( empty( $user_id ) ) { |
|
368 | +function give_get_donor_address($user_id = 0) { |
|
369 | + if (empty($user_id)) { |
|
370 | 370 | $user_id = get_current_user_id(); |
371 | 371 | } |
372 | 372 | |
373 | - $address = get_user_meta( $user_id, '_give_user_address', true ); |
|
373 | + $address = get_user_meta($user_id, '_give_user_address', true); |
|
374 | 374 | |
375 | - if ( ! isset( $address['line1'] ) ) { |
|
375 | + if ( ! isset($address['line1'])) { |
|
376 | 376 | $address['line1'] = ''; |
377 | 377 | } |
378 | 378 | |
379 | - if ( ! isset( $address['line2'] ) ) { |
|
379 | + if ( ! isset($address['line2'])) { |
|
380 | 380 | $address['line2'] = ''; |
381 | 381 | } |
382 | 382 | |
383 | - if ( ! isset( $address['city'] ) ) { |
|
383 | + if ( ! isset($address['city'])) { |
|
384 | 384 | $address['city'] = ''; |
385 | 385 | } |
386 | 386 | |
387 | - if ( ! isset( $address['zip'] ) ) { |
|
387 | + if ( ! isset($address['zip'])) { |
|
388 | 388 | $address['zip'] = ''; |
389 | 389 | } |
390 | 390 | |
391 | - if ( ! isset( $address['country'] ) ) { |
|
391 | + if ( ! isset($address['country'])) { |
|
392 | 392 | $address['country'] = ''; |
393 | 393 | } |
394 | 394 | |
395 | - if ( ! isset( $address['state'] ) ) { |
|
395 | + if ( ! isset($address['state'])) { |
|
396 | 396 | $address['state'] = ''; |
397 | 397 | } |
398 | 398 | |
@@ -412,42 +412,42 @@ discard block |
||
412 | 412 | * |
413 | 413 | * @return void |
414 | 414 | */ |
415 | -function give_new_user_notification( $user_id = 0, $user_data = array() ) { |
|
415 | +function give_new_user_notification($user_id = 0, $user_data = array()) { |
|
416 | 416 | |
417 | - if ( empty( $user_id ) || empty( $user_data ) ) { |
|
417 | + if (empty($user_id) || empty($user_data)) { |
|
418 | 418 | return; |
419 | 419 | } |
420 | - $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); |
|
420 | + $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
|
421 | 421 | |
422 | 422 | /* translators: %s: site name */ |
423 | - $message = sprintf( esc_attr__( 'New user registration on your site %s:', 'give' ), $blogname ) . "\r\n\r\n"; |
|
423 | + $message = sprintf(esc_attr__('New user registration on your site %s:', 'give'), $blogname)."\r\n\r\n"; |
|
424 | 424 | /* translators: %s: user login */ |
425 | - $message .= sprintf( esc_attr__( 'Username: %s', 'give' ), $user_data['user_login'] ) . "\r\n\r\n"; |
|
425 | + $message .= sprintf(esc_attr__('Username: %s', 'give'), $user_data['user_login'])."\r\n\r\n"; |
|
426 | 426 | /* translators: %s: user email */ |
427 | - $message .= sprintf( esc_attr__( 'E-mail: %s', 'give' ), $user_data['user_email'] ) . "\r\n"; |
|
427 | + $message .= sprintf(esc_attr__('E-mail: %s', 'give'), $user_data['user_email'])."\r\n"; |
|
428 | 428 | |
429 | 429 | @wp_mail( |
430 | - get_option( 'admin_email' ), |
|
430 | + get_option('admin_email'), |
|
431 | 431 | sprintf( |
432 | 432 | /* translators: %s: site name */ |
433 | - esc_attr__( '[%s] New User Registration', 'give' ), |
|
433 | + esc_attr__('[%s] New User Registration', 'give'), |
|
434 | 434 | $blogname |
435 | 435 | ), |
436 | 436 | $message |
437 | 437 | ); |
438 | 438 | |
439 | 439 | /* translators: %s: user login */ |
440 | - $message = sprintf( esc_attr__( 'Username: %s', 'give' ), $user_data['user_login'] ) . "\r\n"; |
|
440 | + $message = sprintf(esc_attr__('Username: %s', 'give'), $user_data['user_login'])."\r\n"; |
|
441 | 441 | /* translators: %s: paswword */ |
442 | - $message .= sprintf( esc_attr__( 'Password: %s', 'give' ), esc_attr__( '[Password entered during donation]', 'give' ) ) . "\r\n"; |
|
442 | + $message .= sprintf(esc_attr__('Password: %s', 'give'), esc_attr__('[Password entered during donation]', 'give'))."\r\n"; |
|
443 | 443 | |
444 | - $message .= '<a href="' . wp_login_url() . '"> ' . esc_attr__( 'Click Here to Login »', 'give' ) . '</a>' . "\r\n"; |
|
444 | + $message .= '<a href="'.wp_login_url().'"> '.esc_attr__('Click Here to Login »', 'give').'</a>'."\r\n"; |
|
445 | 445 | |
446 | 446 | wp_mail( |
447 | 447 | $user_data['user_email'], |
448 | 448 | sprintf( |
449 | 449 | /* translators: %s: site name */ |
450 | - esc_attr__( '[%s] Your username and password', 'give' ), |
|
450 | + esc_attr__('[%s] Your username and password', 'give'), |
|
451 | 451 | $blogname |
452 | 452 | ), |
453 | 453 | $message |
@@ -455,4 +455,4 @@ discard block |
||
455 | 455 | |
456 | 456 | } |
457 | 457 | |
458 | -add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
458 | +add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
@@ -1283,7 +1283,7 @@ |
||
1283 | 1283 | * |
1284 | 1284 | * @param $field |
1285 | 1285 | * |
1286 | - * @return string |
|
1286 | + * @return integer |
|
1287 | 1287 | */ |
1288 | 1288 | function _give_set_field_give_id_default_value( $field ) { |
1289 | 1289 | return 0; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; // Exit if accessed directly |
13 | 13 | } |
14 | 14 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return bool|string |
24 | 24 | */ |
25 | -function give_is_field_callback_exist( $field ) { |
|
26 | - return ( give_get_field_callback( $field ) ? true : false ); |
|
25 | +function give_is_field_callback_exist($field) { |
|
26 | + return (give_get_field_callback($field) ? true : false); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return bool|string |
37 | 37 | */ |
38 | -function give_get_field_callback( $field ) { |
|
38 | +function give_get_field_callback($field) { |
|
39 | 39 | $func_name_prefix = 'give'; |
40 | 40 | $func_name = ''; |
41 | 41 | |
42 | 42 | // Set callback function on basis of cmb2 field name. |
43 | - switch ( $field['type'] ) { |
|
43 | + switch ($field['type']) { |
|
44 | 44 | case 'radio_inline': |
45 | 45 | $func_name = "{$func_name_prefix}_radio"; |
46 | 46 | break; |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | $func_name = "{$func_name_prefix}_{$field['type']}"; |
79 | 79 | } |
80 | 80 | |
81 | - $func_name = apply_filters( 'give_setting_callback', $func_name, $field ); |
|
81 | + $func_name = apply_filters('give_setting_callback', $func_name, $field); |
|
82 | 82 | |
83 | 83 | // Check if render callback exist or not. |
84 | - if ( ! function_exists( "$func_name" ) || empty( $func_name ) ) { |
|
84 | + if ( ! function_exists("$func_name") || empty($func_name)) { |
|
85 | 85 | return false; |
86 | 86 | } |
87 | 87 | |
88 | - return apply_filters( 'give_setting_callback', $func_name, $field ); |
|
88 | + return apply_filters('give_setting_callback', $func_name, $field); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -97,37 +97,37 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return bool |
99 | 99 | */ |
100 | -function give_render_field( $field ) { |
|
101 | - $func_name = give_get_field_callback( $field ); |
|
100 | +function give_render_field($field) { |
|
101 | + $func_name = give_get_field_callback($field); |
|
102 | 102 | |
103 | 103 | // Check if render callback exist or not. |
104 | - if ( ! $func_name ) { |
|
104 | + if ( ! $func_name) { |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | |
108 | 108 | // CMB2 compatibility: Push all classes to attributes's class key |
109 | - if ( empty( $field['class'] ) ) { |
|
109 | + if (empty($field['class'])) { |
|
110 | 110 | $field['class'] = ''; |
111 | 111 | } |
112 | 112 | |
113 | - if ( empty( $field['attributes']['class'] ) ) { |
|
113 | + if (empty($field['attributes']['class'])) { |
|
114 | 114 | $field['attributes']['class'] = ''; |
115 | 115 | } |
116 | 116 | |
117 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
118 | - unset( $field['class'] ); |
|
117 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
118 | + unset($field['class']); |
|
119 | 119 | |
120 | 120 | |
121 | 121 | // CMB2 compatibility: Set wrapper class if any. |
122 | - if ( ! empty( $field['row_classes'] ) ) { |
|
122 | + if ( ! empty($field['row_classes'])) { |
|
123 | 123 | $field['wrapper_class'] = $field['row_classes']; |
124 | - unset( $field['row_classes'] ); |
|
124 | + unset($field['row_classes']); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | // Set field params on basis of cmb2 field name. |
128 | - switch ( $field['type'] ) { |
|
128 | + switch ($field['type']) { |
|
129 | 129 | case 'radio_inline': |
130 | - if ( empty( $field['wrapper_class'] ) ) { |
|
130 | + if (empty($field['wrapper_class'])) { |
|
131 | 131 | $field['wrapper_class'] = ''; |
132 | 132 | } |
133 | 133 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | case 'text-small' : |
141 | 141 | case 'text_small' : |
142 | 142 | // CMB2 compatibility: Set field type to text. |
143 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
143 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
144 | 144 | |
145 | 145 | // CMB2 compatibility: Set data type to price. |
146 | 146 | if ( |
147 | - empty( $field['data_type'] ) |
|
148 | - && ! empty( $field['attributes']['class'] ) |
|
147 | + empty($field['data_type']) |
|
148 | + && ! empty($field['attributes']['class']) |
|
149 | 149 | && ( |
150 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
151 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
150 | + false !== strpos($field['attributes']['class'], 'money') |
|
151 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
152 | 152 | ) |
153 | 153 | ) { |
154 | 154 | $field['data_type'] = 'decimal'; |
@@ -167,19 +167,19 @@ discard block |
||
167 | 167 | case 'give_default_radio_inline': |
168 | 168 | $field['type'] = 'radio'; |
169 | 169 | $field['options'] = array( |
170 | - 'default' => __( 'Default' ), |
|
170 | + 'default' => __('Default'), |
|
171 | 171 | ); |
172 | 172 | break; |
173 | 173 | } |
174 | 174 | |
175 | 175 | // CMB2 compatibility: Add support to define field description by desc & description param. |
176 | 176 | // We encourage you to use description param. |
177 | - $field['description'] = ( ! empty( $field['description'] ) |
|
177 | + $field['description'] = ( ! empty($field['description']) |
|
178 | 178 | ? $field['description'] |
179 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
179 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
180 | 180 | |
181 | 181 | // Call render function. |
182 | - $func_name( $field ); |
|
182 | + $func_name($field); |
|
183 | 183 | |
184 | 184 | return true; |
185 | 185 | } |
@@ -206,29 +206,29 @@ discard block |
||
206 | 206 | * } |
207 | 207 | * @return void |
208 | 208 | */ |
209 | -function give_text_input( $field ) { |
|
209 | +function give_text_input($field) { |
|
210 | 210 | global $thepostid, $post; |
211 | 211 | |
212 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
213 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
214 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
215 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
216 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; |
|
212 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
213 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
214 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
215 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
216 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text'; |
|
217 | 217 | $field['before_field'] = ''; |
218 | 218 | $field['after_field'] = ''; |
219 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; |
|
219 | + $data_type = empty($field['data_type']) ? '' : $field['data_type']; |
|
220 | 220 | |
221 | - switch ( $data_type ) { |
|
221 | + switch ($data_type) { |
|
222 | 222 | case 'price' : |
223 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( $field['value'] ) : $field['value'] ); |
|
223 | + $field['value'] = ( ! empty($field['value']) ? give_format_amount($field['value']) : $field['value']); |
|
224 | 224 | |
225 | - $field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); |
|
226 | - $field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); |
|
225 | + $field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); |
|
226 | + $field['after_field'] = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); |
|
227 | 227 | break; |
228 | 228 | |
229 | 229 | case 'decimal' : |
230 | 230 | $field['attributes']['class'] .= ' give_input_decimal'; |
231 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( $field['value'] ) : $field['value'] ); |
|
231 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal($field['value']) : $field['value']); |
|
232 | 232 | break; |
233 | 233 | |
234 | 234 | default : |
@@ -238,17 +238,17 @@ discard block |
||
238 | 238 | // Custom attribute handling |
239 | 239 | $custom_attributes = array(); |
240 | 240 | |
241 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
241 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
242 | 242 | |
243 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
244 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
243 | + foreach ($field['attributes'] as $attribute => $value) { |
|
244 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | |
248 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label>' . $field['before_field'] . '<input type="' . esc_attr( $field['type'] ) . '" style="' . esc_attr( $field['style'] ) . '" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['value'] ) . '" ' . implode( ' ', $custom_attributes ) . ' />' . $field['after_field']; |
|
248 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label>'.$field['before_field'].'<input type="'.esc_attr($field['type']).'" style="'.esc_attr($field['style']).'" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" value="'.esc_attr($field['value']).'" '.implode(' ', $custom_attributes).' />'.$field['after_field']; |
|
249 | 249 | |
250 | - if ( ! empty( $field['description'] ) ) { |
|
251 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
250 | + if ( ! empty($field['description'])) { |
|
251 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
252 | 252 | } |
253 | 253 | echo '</p>'; |
254 | 254 | } |
@@ -269,23 +269,23 @@ discard block |
||
269 | 269 | * } |
270 | 270 | * @return void |
271 | 271 | */ |
272 | -function give_hidden_input( $field ) { |
|
272 | +function give_hidden_input($field) { |
|
273 | 273 | global $thepostid, $post; |
274 | 274 | |
275 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
276 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
275 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
276 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
277 | 277 | |
278 | 278 | // Custom attribute handling |
279 | 279 | $custom_attributes = array(); |
280 | 280 | |
281 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
281 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
282 | 282 | |
283 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
284 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
283 | + foreach ($field['attributes'] as $attribute => $value) { |
|
284 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
288 | - echo '<input type="hidden" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['value'] ) . '" ' . implode( ' ', $custom_attributes ) . '/> '; |
|
288 | + echo '<input type="hidden" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" value="'.esc_attr($field['value']).'" '.implode(' ', $custom_attributes).'/> '; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -307,28 +307,28 @@ discard block |
||
307 | 307 | * } |
308 | 308 | * @return void |
309 | 309 | */ |
310 | -function give_textarea_input( $field ) { |
|
310 | +function give_textarea_input($field) { |
|
311 | 311 | global $thepostid, $post; |
312 | 312 | |
313 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
314 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
315 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
316 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
313 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
314 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
315 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
316 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
317 | 317 | |
318 | 318 | // Custom attribute handling |
319 | 319 | $custom_attributes = array(); |
320 | 320 | |
321 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
321 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
322 | 322 | |
323 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
324 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
323 | + foreach ($field['attributes'] as $attribute => $value) { |
|
324 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
328 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label><textarea style="' . esc_attr( $field['style'] ) . '" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" rows="10" cols="20" ' . implode( ' ', $custom_attributes ) . '>' . esc_textarea( $field['value'] ) . '</textarea> '; |
|
328 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label><textarea style="'.esc_attr($field['style']).'" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" rows="10" cols="20" '.implode(' ', $custom_attributes).'>'.esc_textarea($field['value']).'</textarea> '; |
|
329 | 329 | |
330 | - if ( ! empty( $field['description'] ) ) { |
|
331 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
330 | + if ( ! empty($field['description'])) { |
|
331 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
332 | 332 | } |
333 | 333 | echo '</p>'; |
334 | 334 | } |
@@ -351,24 +351,24 @@ discard block |
||
351 | 351 | * } |
352 | 352 | * @return void |
353 | 353 | */ |
354 | -function give_wysiwyg( $field ) { |
|
354 | +function give_wysiwyg($field) { |
|
355 | 355 | global $thepostid, $post; |
356 | 356 | |
357 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
358 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
359 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
360 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
361 | - $field['unique_field_id'] = give_get_field_name( $field ); |
|
357 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
358 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
359 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
360 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
361 | + $field['unique_field_id'] = give_get_field_name($field); |
|
362 | 362 | $editor_attributes = array( |
363 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'], |
|
363 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'], |
|
364 | 364 | 'textarea_rows' => '10', |
365 | - 'editor_css' => esc_attr( $field['style'] ), |
|
365 | + 'editor_css' => esc_attr($field['style']), |
|
366 | 366 | 'editor_class' => $field['attributes']['class'] |
367 | 367 | ); |
368 | - $data_wp_editor = ' data-wp-editor="'. base64_encode( json_encode( array( $field['value'], $field['unique_field_id'],$editor_attributes ) ) ) .'"'; |
|
369 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : ''; |
|
368 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array($field['value'], $field['unique_field_id'], $editor_attributes))).'"'; |
|
369 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : ''; |
|
370 | 370 | |
371 | - echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"'.$data_wp_editor.'><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
371 | + echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>'; |
|
372 | 372 | |
373 | 373 | wp_editor( |
374 | 374 | $field['value'], |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | $editor_attributes |
377 | 377 | ); |
378 | 378 | |
379 | - if ( ! empty( $field['description'] ) ) { |
|
380 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
379 | + if ( ! empty($field['description'])) { |
|
380 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
381 | 381 | } |
382 | 382 | echo '</div>'; |
383 | 383 | } |
@@ -401,30 +401,30 @@ discard block |
||
401 | 401 | * } |
402 | 402 | * @return void |
403 | 403 | */ |
404 | -function give_checkbox( $field ) { |
|
404 | +function give_checkbox($field) { |
|
405 | 405 | global $thepostid, $post; |
406 | 406 | |
407 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
408 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
409 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
410 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
411 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
412 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
407 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
408 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
409 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
410 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
411 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
412 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
413 | 413 | |
414 | 414 | // Custom attribute handling. |
415 | 415 | $custom_attributes = array(); |
416 | 416 | |
417 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
417 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
418 | 418 | |
419 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
420 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
419 | + foreach ($field['attributes'] as $attribute => $value) { |
|
420 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
421 | 421 | } |
422 | 422 | } |
423 | 423 | |
424 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label><input type="checkbox" style="' . esc_attr( $field['style'] ) . '" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['cbvalue'] ) . '" ' . checked( $field['value'], $field['cbvalue'], false ) . ' ' . implode( ' ', $custom_attributes ) . '/> '; |
|
424 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label><input type="checkbox" style="'.esc_attr($field['style']).'" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" value="'.esc_attr($field['cbvalue']).'" '.checked($field['value'], $field['cbvalue'], false).' '.implode(' ', $custom_attributes).'/> '; |
|
425 | 425 | |
426 | - if ( ! empty( $field['description'] ) ) { |
|
427 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
426 | + if ( ! empty($field['description'])) { |
|
427 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | echo '</p>'; |
@@ -450,35 +450,35 @@ discard block |
||
450 | 450 | * } |
451 | 451 | * @return void |
452 | 452 | */ |
453 | -function give_select( $field ) { |
|
453 | +function give_select($field) { |
|
454 | 454 | global $thepostid, $post; |
455 | 455 | |
456 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
457 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
458 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
459 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
460 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
456 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
457 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
458 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
459 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
460 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
461 | 461 | |
462 | 462 | // Custom attribute handling |
463 | 463 | $custom_attributes = array(); |
464 | 464 | |
465 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
465 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
466 | 466 | |
467 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
468 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
467 | + foreach ($field['attributes'] as $attribute => $value) { |
|
468 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
469 | 469 | } |
470 | 470 | } |
471 | 471 | |
472 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label><select id="' . esc_attr( $field['id'] ) . '" name="' . give_get_field_name( $field ) . '" style="' . esc_attr( $field['style'] ) . '" ' . implode( ' ', $custom_attributes ) . '>'; |
|
472 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label><select id="'.esc_attr($field['id']).'" name="'.give_get_field_name($field).'" style="'.esc_attr($field['style']).'" '.implode(' ', $custom_attributes).'>'; |
|
473 | 473 | |
474 | - foreach ( $field['options'] as $key => $value ) { |
|
475 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
474 | + foreach ($field['options'] as $key => $value) { |
|
475 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | echo '</select> '; |
479 | 479 | |
480 | - if ( ! empty( $field['description'] ) ) { |
|
481 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
480 | + if ( ! empty($field['description'])) { |
|
481 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
482 | 482 | } |
483 | 483 | echo '</p>'; |
484 | 484 | } |
@@ -503,43 +503,43 @@ discard block |
||
503 | 503 | * } |
504 | 504 | * @return void |
505 | 505 | */ |
506 | -function give_radio( $field ) { |
|
506 | +function give_radio($field) { |
|
507 | 507 | global $thepostid, $post; |
508 | 508 | |
509 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
510 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
511 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
512 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
513 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
509 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
510 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
511 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
512 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
513 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
514 | 514 | |
515 | 515 | // Custom attribute handling |
516 | 516 | $custom_attributes = array(); |
517 | 517 | |
518 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
518 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
519 | 519 | |
520 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
521 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
520 | + foreach ($field['attributes'] as $attribute => $value) { |
|
521 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
525 | - echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">'; |
|
525 | + echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">'; |
|
526 | 526 | |
527 | - foreach ( $field['options'] as $key => $value ) { |
|
527 | + foreach ($field['options'] as $key => $value) { |
|
528 | 528 | |
529 | 529 | echo '<li><label><input |
530 | - name="' . give_get_field_name( $field ) . '" |
|
531 | - value="' . esc_attr( $key ) . '" |
|
530 | + name="' . give_get_field_name($field).'" |
|
531 | + value="' . esc_attr($key).'" |
|
532 | 532 | type="radio" |
533 | - style="' . esc_attr( $field['style'] ) . '" |
|
534 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
535 | - . implode( ' ', $custom_attributes ) . ' |
|
536 | - /> ' . esc_html( $value ) . '</label> |
|
533 | + style="' . esc_attr($field['style']).'" |
|
534 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
535 | + . implode(' ', $custom_attributes).' |
|
536 | + /> ' . esc_html($value).'</label> |
|
537 | 537 | </li>'; |
538 | 538 | } |
539 | 539 | echo '</ul>'; |
540 | 540 | |
541 | - if ( ! empty( $field['description'] ) ) { |
|
542 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
541 | + if ( ! empty($field['description'])) { |
|
542 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | echo '</fieldset>'; |
@@ -563,30 +563,30 @@ discard block |
||
563 | 563 | * } |
564 | 564 | * @return void |
565 | 565 | */ |
566 | -function give_colorpicker( $field ) { |
|
566 | +function give_colorpicker($field) { |
|
567 | 567 | global $thepostid, $post; |
568 | 568 | |
569 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
570 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
571 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
572 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
573 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
569 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
570 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
571 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
572 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
573 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
574 | 574 | $field['type'] = 'text'; |
575 | 575 | |
576 | 576 | // Custom attribute handling |
577 | 577 | $custom_attributes = array(); |
578 | 578 | |
579 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
579 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
580 | 580 | |
581 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
582 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
581 | + foreach ($field['attributes'] as $attribute => $value) { |
|
582 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
583 | 583 | } |
584 | 584 | } |
585 | 585 | |
586 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label><input type="' . esc_attr( $field['type'] ) . '" style="' . esc_attr( $field['style'] ) . '" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['value'] ) . '" ' . implode( ' ', $custom_attributes ) . ' /> '; |
|
586 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label><input type="'.esc_attr($field['type']).'" style="'.esc_attr($field['style']).'" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" value="'.esc_attr($field['value']).'" '.implode(' ', $custom_attributes).' /> '; |
|
587 | 587 | |
588 | - if ( ! empty( $field['description'] ) ) { |
|
589 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
588 | + if ( ! empty($field['description'])) { |
|
589 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
590 | 590 | } |
591 | 591 | echo '</p>'; |
592 | 592 | } |
@@ -600,24 +600,24 @@ discard block |
||
600 | 600 | * |
601 | 601 | * @return void |
602 | 602 | */ |
603 | -function give_default_gateway( $field ) { |
|
603 | +function give_default_gateway($field) { |
|
604 | 604 | global $thepostid, $post; |
605 | 605 | |
606 | 606 | // get all active payment gateways. |
607 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
607 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
608 | 608 | |
609 | 609 | // Set field option value. |
610 | - foreach ( $gateways as $key => $option ) { |
|
611 | - $field['options'][ $key ] = $option['admin_label']; |
|
610 | + foreach ($gateways as $key => $option) { |
|
611 | + $field['options'][$key] = $option['admin_label']; |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | //Add a field to the Give Form admin single post view of this field |
615 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
616 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
615 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
616 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | // Render select field. |
620 | - give_select( $field ); |
|
620 | + give_select($field); |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | |
@@ -633,13 +633,13 @@ discard block |
||
633 | 633 | * |
634 | 634 | * @return mixed |
635 | 635 | */ |
636 | -function give_get_field_value( $field, $postid ) { |
|
637 | - if ( isset( $field['attributes']['value'] ) ) { |
|
636 | +function give_get_field_value($field, $postid) { |
|
637 | + if (isset($field['attributes']['value'])) { |
|
638 | 638 | return $field['attributes']['value']; |
639 | 639 | } |
640 | 640 | |
641 | 641 | // Get value from db. |
642 | - $field_value = get_post_meta( $postid, $field['id'], true ); |
|
642 | + $field_value = get_post_meta($postid, $field['id'], true); |
|
643 | 643 | |
644 | 644 | /** |
645 | 645 | * Filter the field value before apply default value. |
@@ -648,11 +648,11 @@ discard block |
||
648 | 648 | * |
649 | 649 | * @param mixed $field_value Field value. |
650 | 650 | */ |
651 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
651 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
652 | 652 | |
653 | 653 | |
654 | 654 | // Set default value if no any data saved to db. |
655 | - if ( ! $field_value && isset( $field['default'] ) ) { |
|
655 | + if ( ! $field_value && isset($field['default'])) { |
|
656 | 656 | $field_value = $field['default']; |
657 | 657 | } |
658 | 658 | |
@@ -672,8 +672,8 @@ discard block |
||
672 | 672 | * |
673 | 673 | * @return string |
674 | 674 | */ |
675 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
676 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
675 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
676 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
677 | 677 | |
678 | 678 | /** |
679 | 679 | * Filter the specific repeater field value |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | * |
683 | 683 | * @param string $field_id |
684 | 684 | */ |
685 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
685 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
686 | 686 | |
687 | 687 | /** |
688 | 688 | * Filter the repeater field value |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | * |
692 | 692 | * @param string $field_id |
693 | 693 | */ |
694 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
694 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
695 | 695 | |
696 | 696 | return $field_value; |
697 | 697 | } |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | * |
710 | 710 | * @return string |
711 | 711 | */ |
712 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
712 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
713 | 713 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
714 | 714 | |
715 | 715 | // Get field id. |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | * |
723 | 723 | * @param string $field_id |
724 | 724 | */ |
725 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
725 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
726 | 726 | |
727 | 727 | |
728 | 728 | /** |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | * |
733 | 733 | * @param string $field_id |
734 | 734 | */ |
735 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
735 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
736 | 736 | |
737 | 737 | return $field_id; |
738 | 738 | } |
@@ -747,8 +747,8 @@ discard block |
||
747 | 747 | * |
748 | 748 | * @return string |
749 | 749 | */ |
750 | -function give_get_field_name( $field ) { |
|
751 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
750 | +function give_get_field_name($field) { |
|
751 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
752 | 752 | |
753 | 753 | /** |
754 | 754 | * Filter the field name. |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | * |
758 | 758 | * @param string $field_name |
759 | 759 | */ |
760 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
760 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
761 | 761 | |
762 | 762 | return $field_name; |
763 | 763 | } |
@@ -773,38 +773,38 @@ discard block |
||
773 | 773 | * |
774 | 774 | * @return void |
775 | 775 | */ |
776 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
776 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
777 | 777 | global $thepostid, $post; |
778 | 778 | |
779 | 779 | // Bailout. |
780 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
780 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
781 | 781 | return; |
782 | 782 | } |
783 | 783 | |
784 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
785 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
784 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
785 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
786 | 786 | ?> |
787 | 787 | <div class="give-repeatable-field-section" id="<?php echo "{$fields['id']}_field"; ?>" data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
788 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
788 | + <?php if ( ! empty($fields['name'])) : ?> |
|
789 | 789 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
790 | 790 | <?php endif; ?> |
791 | 791 | |
792 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
792 | + <?php if ( ! empty($fields['description'])) : ?> |
|
793 | 793 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
794 | 794 | <?php endif; ?> |
795 | 795 | |
796 | 796 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
797 | 797 | <?php |
798 | - $repeater_field_values = get_post_meta( $thepostid, $fields['id'], true ); |
|
799 | - $header_title = isset( $fields['options']['header_title'] ) |
|
798 | + $repeater_field_values = get_post_meta($thepostid, $fields['id'], true); |
|
799 | + $header_title = isset($fields['options']['header_title']) |
|
800 | 800 | ? $fields['options']['header_title'] |
801 | - : esc_attr__( 'Group', 'give' ); |
|
801 | + : esc_attr__('Group', 'give'); |
|
802 | 802 | |
803 | 803 | $add_default_donation_field = false; |
804 | 804 | |
805 | 805 | // Check if level is not created or we have to add default level. |
806 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
807 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
806 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
807 | + $repeater_field_values = array_values($repeater_field_values); |
|
808 | 808 | } else { |
809 | 809 | $fields_count = 1; |
810 | 810 | $add_default_donation_field = true; |
@@ -817,73 +817,73 @@ discard block |
||
817 | 817 | <div class="give-row-head give-move"> |
818 | 818 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
819 | 819 | </button> |
820 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
820 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
821 | 821 | <h2> |
822 | 822 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
823 | 823 | </h2> |
824 | 824 | </div> |
825 | 825 | <div class="give-row-body"> |
826 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
827 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
826 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
827 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
828 | 828 | continue; |
829 | 829 | } ?> |
830 | 830 | <?php |
831 | 831 | $field['repeat'] = true; |
832 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
833 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
832 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
833 | + $field['id'] = str_replace(array('[', ']'), array( |
|
834 | 834 | '_', |
835 | 835 | '', |
836 | - ), $field['repeatable_field_id'] ); |
|
836 | + ), $field['repeatable_field_id']); |
|
837 | 837 | ?> |
838 | - <?php give_render_field( $field ); ?> |
|
838 | + <?php give_render_field($field); ?> |
|
839 | 839 | <?php endforeach; ?> |
840 | 840 | </div> |
841 | 841 | </td> |
842 | 842 | </tr> |
843 | 843 | |
844 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
844 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
845 | 845 | <!--Stored repeater field group--> |
846 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
846 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
847 | 847 | <tr class="give-row"> |
848 | 848 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
849 | 849 | <div class="give-row-head give-move"> |
850 | 850 | <button type="button" class="handlediv button-link"> |
851 | 851 | <span class="toggle-indicator"></span></button> |
852 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
852 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
853 | 853 | </sapn> |
854 | 854 | <h2> |
855 | 855 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
856 | 856 | </h2> |
857 | 857 | </div> |
858 | 858 | <div class="give-row-body"> |
859 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
860 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
859 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
860 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
861 | 861 | continue; |
862 | 862 | } ?> |
863 | 863 | <?php |
864 | 864 | $field['repeat'] = true; |
865 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
866 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
867 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
865 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
866 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
867 | + $field['id'] = str_replace(array('[', ']'), array( |
|
868 | 868 | '_', |
869 | 869 | '', |
870 | - ), $field['repeatable_field_id'] ); |
|
870 | + ), $field['repeatable_field_id']); |
|
871 | 871 | ?> |
872 | - <?php give_render_field( $field ); ?> |
|
872 | + <?php give_render_field($field); ?> |
|
873 | 873 | <?php endforeach; ?> |
874 | 874 | </div> |
875 | 875 | </td> |
876 | 876 | </tr> |
877 | - <?php endforeach;; ?> |
|
877 | + <?php endforeach; ; ?> |
|
878 | 878 | |
879 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
879 | + <?php elseif ($add_default_donation_field) : ?> |
|
880 | 880 | <!--Default repeater field group--> |
881 | 881 | <tr class="give-row"> |
882 | 882 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
883 | 883 | <div class="give-row-head give-move"> |
884 | 884 | <button type="button" class="handlediv button-link"> |
885 | 885 | <span class="toggle-indicator"></span></button> |
886 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
886 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
887 | 887 | </sapn> |
888 | 888 | <h2> |
889 | 889 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -891,19 +891,19 @@ discard block |
||
891 | 891 | </div> |
892 | 892 | <div class="give-row-body"> |
893 | 893 | <?php |
894 | - foreach ( $fields['fields'] as $field ) : |
|
895 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
894 | + foreach ($fields['fields'] as $field) : |
|
895 | + if ( ! give_is_field_callback_exist($field)) { |
|
896 | 896 | continue; |
897 | 897 | } |
898 | 898 | |
899 | 899 | $field['repeat'] = true; |
900 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
901 | - $field['attributes']['value'] = apply_filters( "give_default_field_group_field_{$field['id']}_value", ( ! empty( $field['default'] ) ? $field['default'] : '' ), $field ); |
|
902 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
900 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
901 | + $field['attributes']['value'] = apply_filters("give_default_field_group_field_{$field['id']}_value", ( ! empty($field['default']) ? $field['default'] : ''), $field); |
|
902 | + $field['id'] = str_replace(array('[', ']'), array( |
|
903 | 903 | '_', |
904 | 904 | '', |
905 | - ), $field['repeatable_field_id'] ); |
|
906 | - give_render_field( $field ); |
|
905 | + ), $field['repeatable_field_id']); |
|
906 | + give_render_field($field); |
|
907 | 907 | endforeach; |
908 | 908 | ?> |
909 | 909 | </div> |
@@ -914,9 +914,9 @@ discard block |
||
914 | 914 | <tfoot> |
915 | 915 | <tr> |
916 | 916 | <?php |
917 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
917 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
918 | 918 | ? $add_row_btn_title = $fields['options']['add_button'] |
919 | - : esc_html__( 'Add Row', 'give' ); |
|
919 | + : esc_html__('Add Row', 'give'); |
|
920 | 920 | ?> |
921 | 921 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
922 | 922 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span> |
@@ -946,10 +946,10 @@ discard block |
||
946 | 946 | * |
947 | 947 | * @param string |
948 | 948 | */ |
949 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
949 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
950 | 950 | |
951 | 951 | // Get current tab. |
952 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
952 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
953 | 953 | |
954 | 954 | // Output. |
955 | 955 | return $current_tab; |
@@ -973,10 +973,10 @@ discard block |
||
973 | 973 | * |
974 | 974 | * @param string |
975 | 975 | */ |
976 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
976 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
977 | 977 | |
978 | 978 | // Get current section. |
979 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
979 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
980 | 980 | |
981 | 981 | //Output. |
982 | 982 | return $current_section; |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | */ |
991 | 991 | function give_get_current_setting_page() { |
992 | 992 | // Get current page. |
993 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
993 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
994 | 994 | |
995 | 995 | //Output. |
996 | 996 | return $setting_page; |
@@ -1009,13 +1009,13 @@ discard block |
||
1009 | 1009 | * |
1010 | 1010 | * @return string |
1011 | 1011 | */ |
1012 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
1013 | - $show_content = get_post_meta( $postid, '_give_content_option', true ); |
|
1012 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
1013 | + $show_content = get_post_meta($postid, '_give_content_option', true); |
|
1014 | 1014 | |
1015 | 1015 | if ( |
1016 | - ! get_post_meta( $postid, '_give_display_content', true ) |
|
1016 | + ! get_post_meta($postid, '_give_display_content', true) |
|
1017 | 1017 | && $show_content |
1018 | - && ( 'none' !== $show_content ) |
|
1018 | + && ('none' !== $show_content) |
|
1019 | 1019 | ) { |
1020 | 1020 | $field_value = 'enabled'; |
1021 | 1021 | } |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | return $field_value; |
1024 | 1024 | } |
1025 | 1025 | |
1026 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
1026 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
1027 | 1027 | |
1028 | 1028 | |
1029 | 1029 | /** |
@@ -1039,12 +1039,12 @@ discard block |
||
1039 | 1039 | * |
1040 | 1040 | * @return string |
1041 | 1041 | */ |
1042 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
1043 | - $show_content = get_post_meta( $postid, '_give_content_option', true ); |
|
1042 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
1043 | + $show_content = get_post_meta($postid, '_give_content_option', true); |
|
1044 | 1044 | |
1045 | 1045 | if ( |
1046 | - ! get_post_meta( $postid, '_give_content_placement', true ) |
|
1047 | - && ( 'none' !== $show_content ) |
|
1046 | + ! get_post_meta($postid, '_give_content_placement', true) |
|
1047 | + && ('none' !== $show_content) |
|
1048 | 1048 | ) { |
1049 | 1049 | $field_value = $show_content; |
1050 | 1050 | } |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | return $field_value; |
1053 | 1053 | } |
1054 | 1054 | |
1055 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
1055 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
1056 | 1056 | |
1057 | 1057 | |
1058 | 1058 | /** |
@@ -1068,17 +1068,17 @@ discard block |
||
1068 | 1068 | * |
1069 | 1069 | * @return string |
1070 | 1070 | */ |
1071 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
1072 | - $term_option = get_post_meta( $postid, '_give_terms_option', true ); |
|
1071 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
1072 | + $term_option = get_post_meta($postid, '_give_terms_option', true); |
|
1073 | 1073 | |
1074 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
1075 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
1074 | + if (in_array($term_option, array('none', 'yes'))) { |
|
1075 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | return $field_value; |
1079 | 1079 | } |
1080 | 1080 | |
1081 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
1081 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
1082 | 1082 | |
1083 | 1083 | |
1084 | 1084 | /** |
@@ -1094,17 +1094,17 @@ discard block |
||
1094 | 1094 | * |
1095 | 1095 | * @return string |
1096 | 1096 | */ |
1097 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
1098 | - $offline_donation = get_post_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
1097 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
1098 | + $offline_donation = get_post_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
1099 | 1099 | |
1100 | - if ( 'on' === $offline_donation ) { |
|
1100 | + if ('on' === $offline_donation) { |
|
1101 | 1101 | $field_value = 'enabled'; |
1102 | 1102 | } |
1103 | 1103 | |
1104 | 1104 | return $field_value; |
1105 | 1105 | } |
1106 | 1106 | |
1107 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
1107 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
1108 | 1108 | |
1109 | 1109 | |
1110 | 1110 | /** |
@@ -1120,17 +1120,17 @@ discard block |
||
1120 | 1120 | * |
1121 | 1121 | * @return string |
1122 | 1122 | */ |
1123 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
1124 | - $custom_amount = get_post_meta( $postid, '_give_custom_amount', true ); |
|
1123 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
1124 | + $custom_amount = get_post_meta($postid, '_give_custom_amount', true); |
|
1125 | 1125 | |
1126 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
1127 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
1126 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
1127 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | return $field_value; |
1131 | 1131 | } |
1132 | 1132 | |
1133 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
1133 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
1134 | 1134 | |
1135 | 1135 | |
1136 | 1136 | /** |
@@ -1146,17 +1146,17 @@ discard block |
||
1146 | 1146 | * |
1147 | 1147 | * @return string |
1148 | 1148 | */ |
1149 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
1150 | - $goal_option = get_post_meta( $postid, '_give_goal_option', true ); |
|
1149 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
1150 | + $goal_option = get_post_meta($postid, '_give_goal_option', true); |
|
1151 | 1151 | |
1152 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
1153 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
1152 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
1153 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
1154 | 1154 | } |
1155 | 1155 | |
1156 | 1156 | return $field_value; |
1157 | 1157 | } |
1158 | 1158 | |
1159 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
1159 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
1160 | 1160 | |
1161 | 1161 | /** |
1162 | 1162 | * Set value for Donation Goal --> close Form. |
@@ -1171,17 +1171,17 @@ discard block |
||
1171 | 1171 | * |
1172 | 1172 | * @return string |
1173 | 1173 | */ |
1174 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
1175 | - $close_form = get_post_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
1174 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
1175 | + $close_form = get_post_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
1176 | 1176 | |
1177 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
1178 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
1177 | + if (in_array($close_form, array('yes', 'no'))) { |
|
1178 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
1179 | 1179 | } |
1180 | 1180 | |
1181 | 1181 | return $field_value; |
1182 | 1182 | } |
1183 | 1183 | |
1184 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
1184 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
1185 | 1185 | |
1186 | 1186 | |
1187 | 1187 | /** |
@@ -1197,17 +1197,17 @@ discard block |
||
1197 | 1197 | * |
1198 | 1198 | * @return string |
1199 | 1199 | */ |
1200 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
1201 | - $guest_donation = get_post_meta( $postid, '_give_logged_in_only', true ); |
|
1200 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
1201 | + $guest_donation = get_post_meta($postid, '_give_logged_in_only', true); |
|
1202 | 1202 | |
1203 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
1204 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
1203 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
1204 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
1205 | 1205 | } |
1206 | 1206 | |
1207 | 1207 | return $field_value; |
1208 | 1208 | } |
1209 | 1209 | |
1210 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
1210 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
1211 | 1211 | |
1212 | 1212 | /** |
1213 | 1213 | * Set value for Offline Donations --> Offline Donations. |
@@ -1222,17 +1222,17 @@ discard block |
||
1222 | 1222 | * |
1223 | 1223 | * @return string |
1224 | 1224 | */ |
1225 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
1226 | - $customize_offline_text = get_post_meta( $postid, '_give_customize_offline_donations', true ); |
|
1225 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
1226 | + $customize_offline_text = get_post_meta($postid, '_give_customize_offline_donations', true); |
|
1227 | 1227 | |
1228 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
1229 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
1228 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
1229 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | return $field_value; |
1233 | 1233 | } |
1234 | 1234 | |
1235 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
1235 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
1236 | 1236 | |
1237 | 1237 | |
1238 | 1238 | /** |
@@ -1247,14 +1247,14 @@ discard block |
||
1247 | 1247 | * |
1248 | 1248 | * @return mixed |
1249 | 1249 | */ |
1250 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
1250 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
1251 | 1251 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
1252 | 1252 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
1253 | 1253 | |
1254 | 1254 | return $field_id; |
1255 | 1255 | } |
1256 | 1256 | |
1257 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
1257 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
1258 | 1258 | |
1259 | 1259 | /** |
1260 | 1260 | * Set repeater field value for multi donation form. |
@@ -1268,13 +1268,13 @@ discard block |
||
1268 | 1268 | * |
1269 | 1269 | * @return mixed |
1270 | 1270 | */ |
1271 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
1272 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
1271 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
1272 | + $field_value = $field_group[$field['id']]['level_id']; |
|
1273 | 1273 | |
1274 | 1274 | return $field_value; |
1275 | 1275 | } |
1276 | 1276 | |
1277 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
1277 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
1278 | 1278 | |
1279 | 1279 | /** |
1280 | 1280 | * Set default value for _give_id field. |
@@ -1285,11 +1285,11 @@ discard block |
||
1285 | 1285 | * |
1286 | 1286 | * @return string |
1287 | 1287 | */ |
1288 | -function _give_set_field_give_id_default_value( $field ) { |
|
1288 | +function _give_set_field_give_id_default_value($field) { |
|
1289 | 1289 | return 0; |
1290 | 1290 | } |
1291 | 1291 | |
1292 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
1292 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
1293 | 1293 | |
1294 | 1294 | /** |
1295 | 1295 | * Set default value for _give_default field. |
@@ -1300,11 +1300,11 @@ discard block |
||
1300 | 1300 | * |
1301 | 1301 | * @return string |
1302 | 1302 | */ |
1303 | -function _give_set_field_give_default_default_value( $field ) { |
|
1303 | +function _give_set_field_give_default_default_value($field) { |
|
1304 | 1304 | return 'default'; |
1305 | 1305 | } |
1306 | 1306 | |
1307 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
1307 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
1308 | 1308 | |
1309 | 1309 | /** |
1310 | 1310 | * Set repeater field editor id for field type wysiwyg. |
@@ -1316,11 +1316,11 @@ discard block |
||
1316 | 1316 | * |
1317 | 1317 | * @return string |
1318 | 1318 | */ |
1319 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
1320 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
1321 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
1319 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
1320 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
1321 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
1322 | 1322 | } |
1323 | 1323 | |
1324 | 1324 | return $field_name; |
1325 | 1325 | } |
1326 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
1327 | 1326 | \ No newline at end of file |
1327 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
|
1328 | 1328 | \ 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,11 +26,11 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | |
31 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
31 | + $payment_data = give_get_payment_meta($payment_id); |
|
32 | 32 | |
33 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Filters the from name. |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @since 1.0 |
42 | 42 | */ |
43 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
43 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
44 | 44 | |
45 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
45 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Filters the from email. |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @since 1.0 |
54 | 54 | */ |
55 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
55 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
56 | 56 | |
57 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
57 | + $to_email = give_get_payment_user_email($payment_id); |
|
58 | 58 | |
59 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
59 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Filters the donation email receipt subject. |
63 | 63 | * |
64 | 64 | * @since 1.0 |
65 | 65 | */ |
66 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
67 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
66 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
67 | + $subject = give_do_email_tags($subject, $payment_id); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Filters the donation email receipt attachments. By default, there is no attachment but plugins can hook in to provide one more multiple for the donor. Examples would be a printable ticket or PDF receipt. |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @since 1.0 |
76 | 76 | */ |
77 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
78 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
77 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
78 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
79 | 79 | |
80 | 80 | $emails = Give()->emails; |
81 | 81 | |
82 | - $emails->__set( 'from_name', $from_name ); |
|
83 | - $emails->__set( 'from_email', $from_email ); |
|
84 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
82 | + $emails->__set('from_name', $from_name); |
|
83 | + $emails->__set('from_email', $from_email); |
|
84 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Filters the donation receipt's email headers. |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @since 1.0 |
93 | 93 | */ |
94 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
95 | - $emails->__set( 'headers', $headers ); |
|
94 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
95 | + $emails->__set('headers', $headers); |
|
96 | 96 | |
97 | 97 | //Send the donation receipt. |
98 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
98 | + $emails->send($to_email, $subject, $message, $attachments); |
|
99 | 99 | |
100 | 100 | //If admin notifications are on, send the admin notice. |
101 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
101 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
102 | 102 | /** |
103 | 103 | * Fires in the donation email receipt. |
104 | 104 | * |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param int $payment_id Payment id. |
110 | 110 | * @param mixed $payment_data Payment meta data. |
111 | 111 | */ |
112 | - do_action( 'give_admin_donation_email', $payment_id, $payment_data ); |
|
112 | + do_action('give_admin_donation_email', $payment_id, $payment_data); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -122,41 +122,41 @@ discard block |
||
122 | 122 | */ |
123 | 123 | function give_email_test_donation_receipt() { |
124 | 124 | |
125 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
125 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Filters the from name. |
129 | 129 | * |
130 | 130 | * @since 1.7 |
131 | 131 | */ |
132 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, 0, array() ); |
|
132 | + $from_name = apply_filters('give_donation_from_name', $from_name, 0, array()); |
|
133 | 133 | |
134 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
134 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Filters the from email. |
138 | 138 | * |
139 | 139 | * @since 1.7 |
140 | 140 | */ |
141 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, 0, array() ); |
|
141 | + $from_email = apply_filters('give_donation_from_address', $from_email, 0, array()); |
|
142 | 142 | |
143 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
144 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
145 | - $subject = give_do_email_tags( $subject, 0 ); |
|
143 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
144 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
145 | + $subject = give_do_email_tags($subject, 0); |
|
146 | 146 | |
147 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
147 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
148 | 148 | |
149 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
149 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
150 | 150 | |
151 | 151 | $emails = Give()->emails; |
152 | - $emails->__set( 'from_name', $from_name ); |
|
153 | - $emails->__set( 'from_email', $from_email ); |
|
154 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
152 | + $emails->__set('from_name', $from_name); |
|
153 | + $emails->__set('from_email', $from_email); |
|
154 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
155 | 155 | |
156 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
157 | - $emails->__set( 'headers', $headers ); |
|
156 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
157 | + $emails->__set('headers', $headers); |
|
158 | 158 | |
159 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
159 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
160 | 160 | |
161 | 161 | } |
162 | 162 | |
@@ -170,49 +170,49 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return void |
172 | 172 | */ |
173 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
173 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
174 | 174 | |
175 | - $payment_id = absint( $payment_id ); |
|
175 | + $payment_id = absint($payment_id); |
|
176 | 176 | |
177 | - if ( empty( $payment_id ) ) { |
|
177 | + if (empty($payment_id)) { |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
181 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
181 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
182 | 182 | return; |
183 | 183 | } |
184 | 184 | |
185 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
185 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Filters the from name. |
189 | 189 | * |
190 | 190 | * @since 1.0 |
191 | 191 | */ |
192 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
192 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
193 | 193 | |
194 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
194 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Filters the from email. |
198 | 198 | * |
199 | 199 | * @since 1.0 |
200 | 200 | */ |
201 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
201 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
202 | 202 | |
203 | 203 | /* translators: %s: payment id */ |
204 | - $subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) ); |
|
204 | + $subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id)); |
|
205 | 205 | |
206 | 206 | /** |
207 | 207 | * Filters the donation notification subject. |
208 | 208 | * |
209 | 209 | * @since 1.0 |
210 | 210 | */ |
211 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
212 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
211 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
212 | + $subject = give_do_email_tags($subject, $payment_id); |
|
213 | 213 | |
214 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
215 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
214 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
215 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
216 | 216 | //$headers .= "MIME-Version: 1.0\r\n"; |
217 | 217 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
218 | 218 | |
@@ -221,28 +221,28 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @since 1.0 |
223 | 223 | */ |
224 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
224 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
225 | 225 | |
226 | 226 | /** |
227 | 227 | * Filters the donation notification email attachments. By default, there is no attachment but plugins can hook in to provide one more multiple. |
228 | 228 | * |
229 | 229 | * @since 1.0 |
230 | 230 | */ |
231 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
231 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
232 | 232 | |
233 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
233 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
234 | 234 | |
235 | 235 | $emails = Give()->emails; |
236 | - $emails->__set( 'from_name', $from_name ); |
|
237 | - $emails->__set( 'from_email', $from_email ); |
|
238 | - $emails->__set( 'headers', $headers ); |
|
239 | - $emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) ); |
|
236 | + $emails->__set('from_name', $from_name); |
|
237 | + $emails->__set('from_email', $from_email); |
|
238 | + $emails->__set('headers', $headers); |
|
239 | + $emails->__set('heading', esc_html__('New Donation!', 'give')); |
|
240 | 240 | |
241 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
241 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
242 | 242 | |
243 | 243 | } |
244 | 244 | |
245 | -add_action( 'give_admin_donation_email', 'give_admin_email_notice', 10, 2 ); |
|
245 | +add_action('give_admin_donation_email', 'give_admin_email_notice', 10, 2); |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings). |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | */ |
253 | 253 | function give_get_admin_notice_emails() { |
254 | 254 | |
255 | - $email_option = give_get_option( 'admin_notice_emails' ); |
|
255 | + $email_option = give_get_option('admin_notice_emails'); |
|
256 | 256 | |
257 | - $emails = ! empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' ); |
|
258 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
257 | + $emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email'); |
|
258 | + $emails = array_map('trim', explode("\n", $emails)); |
|
259 | 259 | |
260 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
260 | + return apply_filters('give_admin_notice_emails', $emails); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return mixed |
271 | 271 | */ |
272 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
272 | +function give_admin_notices_disabled($payment_id = 0) { |
|
273 | 273 | |
274 | 274 | return apply_filters( |
275 | 275 | 'give_admin_notices_disabled', |
276 | - ! give_is_setting_enabled( give_get_option( 'admin_notices' ) ), |
|
276 | + ! give_is_setting_enabled(give_get_option('admin_notices')), |
|
277 | 277 | $payment_id |
278 | 278 | ); |
279 | 279 | } |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | */ |
289 | 289 | function give_get_default_donation_notification_email() { |
290 | 290 | |
291 | - $default_email_body = esc_html__( 'Hi there,', 'give' ) . "\n\n"; |
|
292 | - $default_email_body .= esc_html__( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n"; |
|
293 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {name}' . "\n"; |
|
294 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
295 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
296 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n"; |
|
297 | - $default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n"; |
|
298 | - $default_email_body .= '{sitename}' . "\n"; |
|
291 | + $default_email_body = esc_html__('Hi there,', 'give')."\n\n"; |
|
292 | + $default_email_body .= esc_html__('This email is to inform you that a new donation has been made on your website:', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n"; |
|
293 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {name}'."\n"; |
|
294 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
295 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
296 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n"; |
|
297 | + $default_email_body .= esc_html__('Thank you,', 'give')."\n\n"; |
|
298 | + $default_email_body .= '{sitename}'."\n"; |
|
299 | 299 | |
300 | - $custom_message = give_get_option( 'donation_notification' ); |
|
301 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
300 | + $custom_message = give_get_option('donation_notification'); |
|
301 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
302 | 302 | |
303 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
303 | + return apply_filters('give_default_donation_notification_email', $message); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -314,25 +314,25 @@ discard block |
||
314 | 314 | */ |
315 | 315 | function give_get_default_donation_receipt_email() { |
316 | 316 | |
317 | - $default_email_body = esc_html__( 'Dear', 'give' ) . " {name},\n\n"; |
|
318 | - $default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
319 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
320 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
321 | - $default_email_body .= '<strong>' . esc_html__( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n"; |
|
322 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
323 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n"; |
|
324 | - $default_email_body .= '<strong>' . esc_html__( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n"; |
|
325 | - $default_email_body .= '<strong>' . esc_html__( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n"; |
|
326 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
317 | + $default_email_body = esc_html__('Dear', 'give')." {name},\n\n"; |
|
318 | + $default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
319 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
320 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
321 | + $default_email_body .= '<strong>'.esc_html__('Donation Date:', 'give').'</strong> {date}'."\n"; |
|
322 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
323 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n"; |
|
324 | + $default_email_body .= '<strong>'.esc_html__('Payment ID:', 'give').'</strong> {payment_id}'."\n"; |
|
325 | + $default_email_body .= '<strong>'.esc_html__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n"; |
|
326 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
327 | 327 | $default_email_body .= "\n\n"; |
328 | - $default_email_body .= esc_html__( 'Sincerely,', 'give' ) . "\n"; |
|
329 | - $default_email_body .= '{sitename}' . "\n"; |
|
328 | + $default_email_body .= esc_html__('Sincerely,', 'give')."\n"; |
|
329 | + $default_email_body .= '{sitename}'."\n"; |
|
330 | 330 | |
331 | - $custom_message = give_get_option( 'donation_receipt' ); |
|
331 | + $custom_message = give_get_option('donation_receipt'); |
|
332 | 332 | |
333 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
333 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
334 | 334 | |
335 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
335 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -344,19 +344,19 @@ discard block |
||
344 | 344 | * |
345 | 345 | * @return array $email_names |
346 | 346 | */ |
347 | -function give_get_email_names( $user_info ) { |
|
347 | +function give_get_email_names($user_info) { |
|
348 | 348 | $email_names = array(); |
349 | - $user_info = maybe_unserialize( $user_info ); |
|
349 | + $user_info = maybe_unserialize($user_info); |
|
350 | 350 | |
351 | 351 | $email_names['fullname'] = ''; |
352 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
353 | - $user_data = get_userdata( $user_info['id'] ); |
|
352 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
353 | + $user_data = get_userdata($user_info['id']); |
|
354 | 354 | $email_names['name'] = $user_info['first_name']; |
355 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
355 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
356 | 356 | $email_names['username'] = $user_data->user_login; |
357 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
357 | + } elseif (isset($user_info['first_name'])) { |
|
358 | 358 | $email_names['name'] = $user_info['first_name']; |
359 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
359 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
360 | 360 | $email_names['username'] = $user_info['first_name']; |
361 | 361 | } else { |
362 | 362 | $email_names['name'] = $user_info['email']; |
@@ -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 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @since 1.0 |
21 | 21 | */ |
22 | -class Give_Forms_Widget extends WP_Widget{ |
|
22 | +class Give_Forms_Widget extends WP_Widget { |
|
23 | 23 | /** |
24 | 24 | * The widget class name |
25 | 25 | * |
@@ -30,19 +30,19 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * Instantiate the class |
32 | 32 | */ |
33 | - public function __construct(){ |
|
34 | - $this->self = get_class( $this ); |
|
33 | + public function __construct() { |
|
34 | + $this->self = get_class($this); |
|
35 | 35 | |
36 | 36 | parent::__construct( |
37 | - strtolower( $this->self ), |
|
38 | - esc_html__( 'Give - Donation Form', 'give' ), |
|
37 | + strtolower($this->self), |
|
38 | + esc_html__('Give - Donation Form', 'give'), |
|
39 | 39 | array( |
40 | - 'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' ) |
|
40 | + 'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give') |
|
41 | 41 | ) |
42 | 42 | ); |
43 | 43 | |
44 | - add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
|
45 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) ); |
|
44 | + add_action('widgets_init', array($this, 'widget_init')); |
|
45 | + add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return void |
54 | 54 | */ |
55 | - public function admin_widget_scripts( $hook ){ |
|
55 | + public function admin_widget_scripts($hook) { |
|
56 | 56 | // Directories of assets |
57 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
58 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
59 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
57 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
58 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
59 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
60 | 60 | |
61 | 61 | // Use minified libraries if SCRIPT_DEBUG is turned off |
62 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
62 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
63 | 63 | |
64 | 64 | // Widget Script |
65 | - if ( $hook == 'widgets.php' ) { |
|
65 | + if ($hook == 'widgets.php') { |
|
66 | 66 | |
67 | - wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' ); |
|
67 | + wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css'); |
|
68 | 68 | |
69 | - wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
69 | + wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
70 | 70 | |
71 | - wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
71 | + wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * before_widget, and after_widget. |
80 | 80 | * @param array $instance The settings for the particular instance of the widget. |
81 | 81 | */ |
82 | - public function widget( $args, $instance ){ |
|
83 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
84 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
82 | + public function widget($args, $instance) { |
|
83 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
84 | + $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
|
85 | 85 | |
86 | 86 | echo $args['before_widget']; |
87 | 87 | |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @since 1.0 |
92 | 92 | */ |
93 | - do_action( 'give_before_forms_widget' ); |
|
93 | + do_action('give_before_forms_widget'); |
|
94 | 94 | |
95 | - echo $title ? $args['before_title'] . $title . $args['after_title'] : ''; |
|
95 | + echo $title ? $args['before_title'].$title.$args['after_title'] : ''; |
|
96 | 96 | |
97 | - give_get_donation_form( $instance ); |
|
97 | + give_get_donation_form($instance); |
|
98 | 98 | |
99 | 99 | echo $args['after_widget']; |
100 | 100 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @since 1.0 |
105 | 105 | */ |
106 | - do_action( 'give_after_forms_widget' ); |
|
106 | + do_action('give_after_forms_widget'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return string |
115 | 115 | */ |
116 | - public function form( $instance ){ |
|
116 | + public function form($instance) { |
|
117 | 117 | $defaults = array( |
118 | 118 | 'title' => '', |
119 | 119 | 'id' => '', |
@@ -122,76 +122,76 @@ discard block |
||
122 | 122 | 'show_content' => 'none', |
123 | 123 | ); |
124 | 124 | |
125 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
125 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
126 | 126 | |
127 | 127 | // Backward compatibility: Set float labels as default if, it was set as empty previous. |
128 | - $instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels']; |
|
128 | + $instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels']; |
|
129 | 129 | |
130 | 130 | // Query Give Forms |
131 | 131 | $args = array( |
132 | 132 | 'post_type' => 'give_forms', |
133 | - 'posts_per_page' => - 1, |
|
133 | + 'posts_per_page' => -1, |
|
134 | 134 | 'post_status' => 'publish', |
135 | 135 | ); |
136 | 136 | |
137 | - $give_forms = get_posts( $args ); |
|
137 | + $give_forms = get_posts($args); |
|
138 | 138 | |
139 | 139 | // Widget: Title |
140 | 140 | |
141 | 141 | ?><p> |
142 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label> |
|
143 | - <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php esc_attr_e( $instance['title'] ); ?>" /><br> |
|
144 | - <small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small> |
|
142 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label> |
|
143 | + <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php esc_attr_e($instance['title']); ?>" /><br> |
|
144 | + <small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small> |
|
145 | 145 | </p><?php |
146 | 146 | |
147 | 147 | // Widget: Give Form |
148 | 148 | |
149 | 149 | ?><p> |
150 | - <label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label> |
|
151 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"> |
|
152 | - <option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option> |
|
153 | - <?php foreach ( $give_forms as $give_form ) { ?> |
|
154 | - <option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $give_form->post_title; ?></option> |
|
150 | + <label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label> |
|
151 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>"> |
|
152 | + <option value="current"><?php esc_html_e('- Select -', 'give'); ?></option> |
|
153 | + <?php foreach ($give_forms as $give_form) { ?> |
|
154 | + <option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $give_form->post_title; ?></option> |
|
155 | 155 | <?php } ?> |
156 | 156 | </select><br> |
157 | - <small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small> |
|
157 | + <small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small> |
|
158 | 158 | </p> |
159 | 159 | |
160 | 160 | <?php // Widget: Display Style ?> |
161 | 161 | <p> |
162 | - <label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display Style:', 'give' ); ?></label><br> |
|
163 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label> |
|
164 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label> |
|
165 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-modal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label> |
|
166 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-button" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="button" <?php checked( $instance['display_style'], 'button' ); ?>> <?php echo esc_html__( 'Button', 'give' ); ?></label><br> |
|
162 | + <label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display Style:', 'give'); ?></label><br> |
|
163 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-onpage" name="<?php echo $this->get_field_name('display_style'); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label> |
|
164 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-reveal" name="<?php echo $this->get_field_name('display_style'); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label> |
|
165 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-modal" name="<?php echo $this->get_field_name('display_style'); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label> |
|
166 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-button" name="<?php echo $this->get_field_name('display_style'); ?>" value="button" <?php checked($instance['display_style'], 'button'); ?>> <?php echo esc_html__('Button', 'give'); ?></label><br> |
|
167 | 167 | <small class="give-field-description"> |
168 | - <?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?> |
|
168 | + <?php echo esc_html__('Select a Give Form style.', 'give'); ?> |
|
169 | 169 | </small> |
170 | 170 | </p> |
171 | 171 | |
172 | 172 | <?php // Widget: Floating Labels ?> |
173 | 173 | <p> |
174 | - <label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br> |
|
175 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-global" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label> |
|
176 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label> |
|
177 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br> |
|
174 | + <label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br> |
|
175 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-global" name="<?php echo $this->get_field_name('float_labels'); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label> |
|
176 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-enabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label> |
|
177 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-disabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br> |
|
178 | 178 | <small class="give-field-description"> |
179 | 179 | <?php |
180 | 180 | printf( |
181 | 181 | /* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */ |
182 | - __( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ), |
|
183 | - esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) |
|
182 | + __('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'), |
|
183 | + esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels') |
|
184 | 184 | ); |
185 | 185 | ?></small> |
186 | 186 | </p> |
187 | 187 | |
188 | 188 | <?php // Widget: Display Content ?> |
189 | 189 | <p> |
190 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php esc_html_e( 'Display Content (optional):', 'give' ); ?></label><br> |
|
191 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-none" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="none" <?php checked( $instance['show_content'], 'none' ); ?>> <?php echo esc_html__( 'None', 'give' ); ?></label> |
|
192 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-above" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="above" <?php checked( $instance['show_content'], 'above' ); ?>> <?php echo esc_html__( 'Above', 'give' ); ?></label> |
|
193 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-below" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="below" <?php checked( $instance['show_content'], 'below' ); ?>> <?php echo esc_html__( 'Below', 'give' ); ?></label><br> |
|
194 | - <small class="give-field-description"><?php esc_html_e( 'Override the display content setting for this Give form.', 'give' ); ?></small> |
|
190 | + <label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>"><?php esc_html_e('Display Content (optional):', 'give'); ?></label><br> |
|
191 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-none" name="<?php echo $this->get_field_name('show_content'); ?>" value="none" <?php checked($instance['show_content'], 'none'); ?>> <?php echo esc_html__('None', 'give'); ?></label> |
|
192 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-above" name="<?php echo $this->get_field_name('show_content'); ?>" value="above" <?php checked($instance['show_content'], 'above'); ?>> <?php echo esc_html__('Above', 'give'); ?></label> |
|
193 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-below" name="<?php echo $this->get_field_name('show_content'); ?>" value="below" <?php checked($instance['show_content'], 'below'); ?>> <?php echo esc_html__('Below', 'give'); ?></label><br> |
|
194 | + <small class="give-field-description"><?php esc_html_e('Override the display content setting for this Give form.', 'give'); ?></small> |
|
195 | 195 | <?php |
196 | 196 | } |
197 | 197 | |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return void |
202 | 202 | */ |
203 | - function widget_init(){ |
|
204 | - register_widget( $this->self ); |
|
203 | + function widget_init() { |
|
204 | + register_widget($this->self); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @return array |
214 | 214 | */ |
215 | - public function update( $new_instance, $old_instance ){ |
|
215 | + public function update($new_instance, $old_instance) { |
|
216 | 216 | $this->flush_widget_cache(); |
217 | 217 | |
218 | 218 | return $new_instance; |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @return void |
225 | 225 | */ |
226 | - public function flush_widget_cache(){ |
|
227 | - wp_cache_delete( $this->self, 'widget' ); |
|
226 | + public function flush_widget_cache() { |
|
227 | + wp_cache_delete($this->self, 'widget'); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 |
@@ -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 | |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | * @param bool $_id Post id. Default is false. |
337 | 337 | * @param array $_args Arguments passed. |
338 | 338 | */ |
339 | - public function __construct( $_id = false, $_args = array() ) { |
|
339 | + public function __construct($_id = false, $_args = array()) { |
|
340 | 340 | |
341 | - $donation_form = WP_Post::get_instance( $_id ); |
|
341 | + $donation_form = WP_Post::get_instance($_id); |
|
342 | 342 | |
343 | - return $this->setup_donation_form( $donation_form ); |
|
343 | + return $this->setup_donation_form($donation_form); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -353,23 +353,23 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @return bool If the setup was successful or not. |
355 | 355 | */ |
356 | - private function setup_donation_form( $donation_form ) { |
|
356 | + private function setup_donation_form($donation_form) { |
|
357 | 357 | |
358 | - if ( ! is_object( $donation_form ) ) { |
|
358 | + if ( ! is_object($donation_form)) { |
|
359 | 359 | return false; |
360 | 360 | } |
361 | 361 | |
362 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
362 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
363 | 363 | return false; |
364 | 364 | } |
365 | 365 | |
366 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
366 | + if ('give_forms' !== $donation_form->post_type) { |
|
367 | 367 | return false; |
368 | 368 | } |
369 | 369 | |
370 | - foreach ( $donation_form as $key => $value ) { |
|
370 | + foreach ($donation_form as $key => $value) { |
|
371 | 371 | |
372 | - switch ( $key ) { |
|
372 | + switch ($key) { |
|
373 | 373 | |
374 | 374 | default: |
375 | 375 | $this->$key = $value; |
@@ -393,16 +393,16 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @return mixed |
395 | 395 | */ |
396 | - public function __get( $key ) { |
|
396 | + public function __get($key) { |
|
397 | 397 | |
398 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
398 | + if (method_exists($this, 'get_'.$key)) { |
|
399 | 399 | |
400 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
400 | + return call_user_func(array($this, 'get_'.$key)); |
|
401 | 401 | |
402 | 402 | } else { |
403 | 403 | |
404 | 404 | /* translators: %s: property key */ |
405 | - return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
405 | + return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
406 | 406 | |
407 | 407 | } |
408 | 408 | |
@@ -418,30 +418,30 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @return bool|int False if data isn't passed and class not instantiated for creation, or New Form ID. |
420 | 420 | */ |
421 | - public function create( $data = array() ) { |
|
421 | + public function create($data = array()) { |
|
422 | 422 | |
423 | - if ( $this->id != 0 ) { |
|
423 | + if ($this->id != 0) { |
|
424 | 424 | return false; |
425 | 425 | } |
426 | 426 | |
427 | 427 | $defaults = array( |
428 | 428 | 'post_type' => 'give_forms', |
429 | 429 | 'post_status' => 'draft', |
430 | - 'post_title' => __( 'New Donation Form', 'give' ), |
|
430 | + 'post_title' => __('New Donation Form', 'give'), |
|
431 | 431 | ); |
432 | 432 | |
433 | - $args = wp_parse_args( $data, $defaults ); |
|
433 | + $args = wp_parse_args($data, $defaults); |
|
434 | 434 | |
435 | 435 | /** |
436 | 436 | * Fired before a donation form is created |
437 | 437 | * |
438 | 438 | * @param array $args The post object arguments used for creation. |
439 | 439 | */ |
440 | - do_action( 'give_form_pre_create', $args ); |
|
440 | + do_action('give_form_pre_create', $args); |
|
441 | 441 | |
442 | - $id = wp_insert_post( $args, true ); |
|
442 | + $id = wp_insert_post($args, true); |
|
443 | 443 | |
444 | - $donation_form = WP_Post::get_instance( $id ); |
|
444 | + $donation_form = WP_Post::get_instance($id); |
|
445 | 445 | |
446 | 446 | /** |
447 | 447 | * Fired after a donation form is created |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | * @param int $id The post ID of the created item. |
450 | 450 | * @param array $args The post object arguments used for creation. |
451 | 451 | */ |
452 | - do_action( 'give_form_post_create', $id, $args ); |
|
452 | + do_action('give_form_post_create', $id, $args); |
|
453 | 453 | |
454 | - return $this->setup_donation_form( $donation_form ); |
|
454 | + return $this->setup_donation_form($donation_form); |
|
455 | 455 | |
456 | 456 | } |
457 | 457 | |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | * @return string Donation form name. |
477 | 477 | */ |
478 | 478 | public function get_name() { |
479 | - return get_the_title( $this->ID ); |
|
479 | + return get_the_title($this->ID); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | /** |
@@ -489,13 +489,13 @@ discard block |
||
489 | 489 | */ |
490 | 490 | public function get_price() { |
491 | 491 | |
492 | - if ( ! isset( $this->price ) ) { |
|
492 | + if ( ! isset($this->price)) { |
|
493 | 493 | |
494 | - $this->price = get_post_meta( $this->ID, '_give_set_price', true ); |
|
494 | + $this->price = get_post_meta($this->ID, '_give_set_price', true); |
|
495 | 495 | |
496 | - if ( $this->price ) { |
|
496 | + if ($this->price) { |
|
497 | 497 | |
498 | - $this->price = give_sanitize_amount( $this->price ); |
|
498 | + $this->price = give_sanitize_amount($this->price); |
|
499 | 499 | |
500 | 500 | } else { |
501 | 501 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | * @param string $price The donation form price. |
514 | 514 | * @param string|int $id The form ID. |
515 | 515 | */ |
516 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
516 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | /** |
@@ -526,14 +526,14 @@ discard block |
||
526 | 526 | */ |
527 | 527 | public function get_minimum_price() { |
528 | 528 | |
529 | - if ( ! isset( $this->minimum_price ) ) { |
|
529 | + if ( ! isset($this->minimum_price)) { |
|
530 | 530 | |
531 | - $allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true ); |
|
532 | - $this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
531 | + $allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true); |
|
532 | + $this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true); |
|
533 | 533 | |
534 | - if ( give_is_setting_enabled( $allow_custom_amount ) && $this->minimum_price ) { |
|
534 | + if (give_is_setting_enabled($allow_custom_amount) && $this->minimum_price) { |
|
535 | 535 | |
536 | - $this->minimum_price = give_sanitize_amount( $this->minimum_price ); |
|
536 | + $this->minimum_price = give_sanitize_amount($this->minimum_price); |
|
537 | 537 | |
538 | 538 | } else { |
539 | 539 | |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | |
544 | 544 | } |
545 | 545 | |
546 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
546 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | /** |
@@ -556,9 +556,9 @@ discard block |
||
556 | 556 | */ |
557 | 557 | public function get_prices() { |
558 | 558 | |
559 | - if ( ! isset( $this->prices ) ) { |
|
559 | + if ( ! isset($this->prices)) { |
|
560 | 560 | |
561 | - $this->prices = get_post_meta( $this->ID, '_give_donation_levels', true ); |
|
561 | + $this->prices = get_post_meta($this->ID, '_give_donation_levels', true); |
|
562 | 562 | |
563 | 563 | } |
564 | 564 | |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @param array $prices The array of mulit-level prices. |
571 | 571 | * @param int|string $ID The ID of the form. |
572 | 572 | */ |
573 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
573 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
574 | 574 | |
575 | 575 | } |
576 | 576 | |
@@ -584,13 +584,13 @@ discard block |
||
584 | 584 | */ |
585 | 585 | public function get_goal() { |
586 | 586 | |
587 | - if ( ! isset( $this->goal ) ) { |
|
587 | + if ( ! isset($this->goal)) { |
|
588 | 588 | |
589 | - $this->goal = get_post_meta( $this->ID, '_give_set_goal', true ); |
|
589 | + $this->goal = get_post_meta($this->ID, '_give_set_goal', true); |
|
590 | 590 | |
591 | - if ( $this->goal ) { |
|
591 | + if ($this->goal) { |
|
592 | 592 | |
593 | - $this->goal = give_sanitize_amount( $this->goal ); |
|
593 | + $this->goal = give_sanitize_amount($this->goal); |
|
594 | 594 | |
595 | 595 | } else { |
596 | 596 | |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | |
601 | 601 | } |
602 | 602 | |
603 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
603 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
604 | 604 | |
605 | 605 | } |
606 | 606 | |
@@ -614,10 +614,10 @@ discard block |
||
614 | 614 | */ |
615 | 615 | public function is_single_price_mode() { |
616 | 616 | |
617 | - $option = get_post_meta( $this->ID, '_give_price_options_mode', true ); |
|
617 | + $option = get_post_meta($this->ID, '_give_price_options_mode', true); |
|
618 | 618 | $ret = 0; |
619 | 619 | |
620 | - if ( empty( $option ) || $option === 'set' ) { |
|
620 | + if (empty($option) || $option === 'set') { |
|
621 | 621 | $ret = 1; |
622 | 622 | } |
623 | 623 | |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | * @param bool $ret Is donation form in single price mode? |
630 | 630 | * @param int|string $ID The ID of the donation form. |
631 | 631 | */ |
632 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
632 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
633 | 633 | |
634 | 634 | } |
635 | 635 | |
@@ -643,10 +643,10 @@ discard block |
||
643 | 643 | */ |
644 | 644 | public function is_custom_price_mode() { |
645 | 645 | |
646 | - $option = get_post_meta( $this->ID, '_give_custom_amount', true ); |
|
646 | + $option = get_post_meta($this->ID, '_give_custom_amount', true); |
|
647 | 647 | $ret = 0; |
648 | 648 | |
649 | - if ( give_is_setting_enabled( $option ) ) { |
|
649 | + if (give_is_setting_enabled($option)) { |
|
650 | 650 | $ret = 1; |
651 | 651 | } |
652 | 652 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | * @param bool $ret Is donation form in custom price mode? |
659 | 659 | * @param int|string $ID The ID of the donation form. |
660 | 660 | */ |
661 | - return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID ); |
|
661 | + return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID); |
|
662 | 662 | |
663 | 663 | } |
664 | 664 | |
@@ -674,10 +674,10 @@ discard block |
||
674 | 674 | */ |
675 | 675 | public function has_variable_prices() { |
676 | 676 | |
677 | - $option = get_post_meta( $this->ID, '_give_price_option', true ); |
|
677 | + $option = get_post_meta($this->ID, '_give_price_option', true); |
|
678 | 678 | $ret = 0; |
679 | 679 | |
680 | - if ( $option === 'multi' ) { |
|
680 | + if ($option === 'multi') { |
|
681 | 681 | $ret = 1; |
682 | 682 | } |
683 | 683 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | * @param bool $ret Does donation form have variable prices? |
688 | 688 | * @param int|string $ID The ID of the donation form. |
689 | 689 | */ |
690 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
690 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
691 | 691 | |
692 | 692 | } |
693 | 693 | |
@@ -701,17 +701,17 @@ discard block |
||
701 | 701 | */ |
702 | 702 | public function get_type() { |
703 | 703 | |
704 | - if ( ! isset( $this->type ) ) { |
|
704 | + if ( ! isset($this->type)) { |
|
705 | 705 | |
706 | - $this->type = get_post_meta( $this->ID, '_give_price_option', true ); |
|
706 | + $this->type = get_post_meta($this->ID, '_give_price_option', true); |
|
707 | 707 | |
708 | - if ( empty( $this->type ) ) { |
|
708 | + if (empty($this->type)) { |
|
709 | 709 | $this->type = 'set'; |
710 | 710 | } |
711 | 711 | |
712 | 712 | } |
713 | 713 | |
714 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
714 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
715 | 715 | |
716 | 716 | } |
717 | 717 | |
@@ -727,23 +727,23 @@ discard block |
||
727 | 727 | * |
728 | 728 | * @return string |
729 | 729 | */ |
730 | - public function get_form_classes( $args ) { |
|
730 | + public function get_form_classes($args) { |
|
731 | 731 | |
732 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
732 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
733 | 733 | ? 'float-labels-enabled' |
734 | 734 | : ''; |
735 | 735 | |
736 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
736 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
737 | 737 | 'give-form', |
738 | - 'give-form-' . $this->ID, |
|
739 | - 'give-form-type-' . $this->get_type(), |
|
738 | + 'give-form-'.$this->ID, |
|
739 | + 'give-form-type-'.$this->get_type(), |
|
740 | 740 | $float_labels_option, |
741 | - ), $this->ID, $args ); |
|
741 | + ), $this->ID, $args); |
|
742 | 742 | |
743 | 743 | // Remove empty class names. |
744 | - $form_classes_array = array_filter( $form_classes_array ); |
|
744 | + $form_classes_array = array_filter($form_classes_array); |
|
745 | 745 | |
746 | - return implode( ' ', $form_classes_array ); |
|
746 | + return implode(' ', $form_classes_array); |
|
747 | 747 | |
748 | 748 | } |
749 | 749 | |
@@ -758,24 +758,24 @@ discard block |
||
758 | 758 | * |
759 | 759 | * @return string |
760 | 760 | */ |
761 | - public function get_form_wrap_classes( $args ) { |
|
761 | + public function get_form_wrap_classes($args) { |
|
762 | 762 | |
763 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
763 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
764 | 764 | ? $args['display_style'] |
765 | - : get_post_meta( $this->ID, '_give_payment_display', true ); |
|
765 | + : get_post_meta($this->ID, '_give_payment_display', true); |
|
766 | 766 | |
767 | 767 | // If admin want to show only button for form then user inbuilt modal functionality. |
768 | - if( 'button' === $display_option ) { |
|
768 | + if ('button' === $display_option) { |
|
769 | 769 | $display_option = 'modal give-display-button-only'; |
770 | 770 | } |
771 | 771 | |
772 | - $form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array( |
|
772 | + $form_wrap_classes_array = apply_filters('give_form_wrap_classes', array( |
|
773 | 773 | 'give-form-wrap', |
774 | - 'give-display-' . $display_option, |
|
775 | - ), $this->ID, $args ); |
|
774 | + 'give-display-'.$display_option, |
|
775 | + ), $this->ID, $args); |
|
776 | 776 | |
777 | 777 | |
778 | - return implode( ' ', $form_wrap_classes_array ); |
|
778 | + return implode(' ', $form_wrap_classes_array); |
|
779 | 779 | |
780 | 780 | } |
781 | 781 | |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | public function is_set_type_donation_form() { |
791 | 791 | $form_type = $this->get_type(); |
792 | 792 | |
793 | - return ( 'set' === $form_type ? true : false ); |
|
793 | + return ('set' === $form_type ? true : false); |
|
794 | 794 | } |
795 | 795 | |
796 | 796 | /** |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | public function is_multi_type_donation_form() { |
805 | 805 | $form_type = $this->get_type(); |
806 | 806 | |
807 | - return ( 'multi' === $form_type ? true : false ); |
|
807 | + return ('multi' === $form_type ? true : false); |
|
808 | 808 | |
809 | 809 | } |
810 | 810 | |
@@ -818,15 +818,15 @@ discard block |
||
818 | 818 | */ |
819 | 819 | public function get_sales() { |
820 | 820 | |
821 | - if ( ! isset( $this->sales ) ) { |
|
821 | + if ( ! isset($this->sales)) { |
|
822 | 822 | |
823 | - if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) { |
|
824 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
823 | + if ('' == get_post_meta($this->ID, '_give_form_sales', true)) { |
|
824 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
825 | 825 | } // End if |
826 | 826 | |
827 | - $this->sales = get_post_meta( $this->ID, '_give_form_sales', true ); |
|
827 | + $this->sales = get_post_meta($this->ID, '_give_form_sales', true); |
|
828 | 828 | |
829 | - if ( $this->sales < 0 ) { |
|
829 | + if ($this->sales < 0) { |
|
830 | 830 | // Never let sales be less than zero |
831 | 831 | $this->sales = 0; |
832 | 832 | } |
@@ -847,13 +847,13 @@ discard block |
||
847 | 847 | * |
848 | 848 | * @return int|false New number of total sales. |
849 | 849 | */ |
850 | - public function increase_sales( $quantity = 1 ) { |
|
850 | + public function increase_sales($quantity = 1) { |
|
851 | 851 | |
852 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
853 | - $quantity = absint( $quantity ); |
|
852 | + $sales = give_get_form_sales_stats($this->ID); |
|
853 | + $quantity = absint($quantity); |
|
854 | 854 | $total_sales = $sales + $quantity; |
855 | 855 | |
856 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
856 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
857 | 857 | |
858 | 858 | $this->sales = $total_sales; |
859 | 859 | |
@@ -874,17 +874,17 @@ discard block |
||
874 | 874 | * |
875 | 875 | * @return int|false New number of total sales. |
876 | 876 | */ |
877 | - public function decrease_sales( $quantity = 1 ) { |
|
877 | + public function decrease_sales($quantity = 1) { |
|
878 | 878 | |
879 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
879 | + $sales = give_get_form_sales_stats($this->ID); |
|
880 | 880 | |
881 | 881 | // Only decrease if not already zero |
882 | - if ( $sales > 0 ) { |
|
882 | + if ($sales > 0) { |
|
883 | 883 | |
884 | - $quantity = absint( $quantity ); |
|
884 | + $quantity = absint($quantity); |
|
885 | 885 | $total_sales = $sales - $quantity; |
886 | 886 | |
887 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
887 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
888 | 888 | |
889 | 889 | $this->sales = $sales; |
890 | 890 | |
@@ -908,15 +908,15 @@ discard block |
||
908 | 908 | */ |
909 | 909 | public function get_earnings() { |
910 | 910 | |
911 | - if ( ! isset( $this->earnings ) ) { |
|
911 | + if ( ! isset($this->earnings)) { |
|
912 | 912 | |
913 | - if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
914 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
913 | + if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) { |
|
914 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
915 | 915 | } |
916 | 916 | |
917 | - $this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true ); |
|
917 | + $this->earnings = get_post_meta($this->ID, '_give_form_earnings', true); |
|
918 | 918 | |
919 | - if ( $this->earnings < 0 ) { |
|
919 | + if ($this->earnings < 0) { |
|
920 | 920 | // Never let earnings be less than zero |
921 | 921 | $this->earnings = 0; |
922 | 922 | } |
@@ -937,12 +937,12 @@ discard block |
||
937 | 937 | * |
938 | 938 | * @return float|false |
939 | 939 | */ |
940 | - public function increase_earnings( $amount = 0 ) { |
|
940 | + public function increase_earnings($amount = 0) { |
|
941 | 941 | |
942 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
942 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
943 | 943 | $new_amount = $earnings + (float) $amount; |
944 | 944 | |
945 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
945 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
946 | 946 | |
947 | 947 | $this->earnings = $new_amount; |
948 | 948 | |
@@ -964,16 +964,16 @@ discard block |
||
964 | 964 | * |
965 | 965 | * @return float|false |
966 | 966 | */ |
967 | - public function decrease_earnings( $amount ) { |
|
967 | + public function decrease_earnings($amount) { |
|
968 | 968 | |
969 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
969 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
970 | 970 | |
971 | - if ( $earnings > 0 ) { |
|
971 | + if ($earnings > 0) { |
|
972 | 972 | // Only decrease if greater than zero |
973 | 973 | $new_amount = $earnings - (float) $amount; |
974 | 974 | |
975 | 975 | |
976 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
976 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
977 | 977 | |
978 | 978 | $this->earnings = $new_amount; |
979 | 979 | |
@@ -997,22 +997,22 @@ discard block |
||
997 | 997 | * |
998 | 998 | * @return bool |
999 | 999 | */ |
1000 | - public function is_free( $price_id = false ) { |
|
1000 | + public function is_free($price_id = false) { |
|
1001 | 1001 | |
1002 | 1002 | $is_free = false; |
1003 | - $variable_pricing = give_has_variable_prices( $this->ID ); |
|
1003 | + $variable_pricing = give_has_variable_prices($this->ID); |
|
1004 | 1004 | |
1005 | - if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) { |
|
1006 | - $price = give_get_price_option_amount( $this->ID, $price_id ); |
|
1007 | - } elseif ( ! $variable_pricing ) { |
|
1008 | - $price = get_post_meta( $this->ID, '_give_set_price', true ); |
|
1005 | + if ($variable_pricing && ! is_null($price_id) && $price_id !== false) { |
|
1006 | + $price = give_get_price_option_amount($this->ID, $price_id); |
|
1007 | + } elseif ( ! $variable_pricing) { |
|
1008 | + $price = get_post_meta($this->ID, '_give_set_price', true); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | - if ( isset( $price ) && (float) $price == 0 ) { |
|
1011 | + if (isset($price) && (float) $price == 0) { |
|
1012 | 1012 | $is_free = true; |
1013 | 1013 | } |
1014 | 1014 | |
1015 | - return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id ); |
|
1015 | + return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id); |
|
1016 | 1016 | |
1017 | 1017 | } |
1018 | 1018 | |
@@ -1039,9 +1039,9 @@ discard block |
||
1039 | 1039 | $is_close_form = apply_filters( |
1040 | 1040 | 'give_is_close_donation_form', |
1041 | 1041 | ( |
1042 | - give_is_setting_enabled( get_post_meta( $this->ID, '_give_goal_option', true ) ) ) |
|
1043 | - && give_is_setting_enabled( get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) |
|
1044 | - && ( $this->get_goal() <= $this->get_earnings() |
|
1042 | + give_is_setting_enabled(get_post_meta($this->ID, '_give_goal_option', true)) ) |
|
1043 | + && give_is_setting_enabled(get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true)) |
|
1044 | + && ($this->get_goal() <= $this->get_earnings() |
|
1045 | 1045 | ), |
1046 | 1046 | $this->ID |
1047 | 1047 | ); |
@@ -1060,29 +1060,29 @@ discard block |
||
1060 | 1060 | * |
1061 | 1061 | * @return bool The result of the update query. |
1062 | 1062 | */ |
1063 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
1063 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
1064 | 1064 | |
1065 | 1065 | /* @var WPDB $wpdb */ |
1066 | 1066 | global $wpdb; |
1067 | 1067 | |
1068 | - if ( empty( $meta_key ) ) { |
|
1068 | + if (empty($meta_key)) { |
|
1069 | 1069 | return false; |
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | // Make sure if it needs to be serialized, we do |
1073 | - $meta_value = maybe_serialize( $meta_value ); |
|
1073 | + $meta_value = maybe_serialize($meta_value); |
|
1074 | 1074 | |
1075 | - if ( is_numeric( $meta_value ) ) { |
|
1076 | - $value_type = is_float( $meta_value ) ? '%f' : '%d'; |
|
1075 | + if (is_numeric($meta_value)) { |
|
1076 | + $value_type = is_float($meta_value) ? '%f' : '%d'; |
|
1077 | 1077 | } else { |
1078 | 1078 | $value_type = "'%s'"; |
1079 | 1079 | } |
1080 | 1080 | |
1081 | - $sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key ); |
|
1081 | + $sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key); |
|
1082 | 1082 | |
1083 | - if ( $wpdb->query( $sql ) ) { |
|
1083 | + if ($wpdb->query($sql)) { |
|
1084 | 1084 | |
1085 | - clean_post_cache( $this->ID ); |
|
1085 | + clean_post_cache($this->ID); |
|
1086 | 1086 | |
1087 | 1087 | return true; |
1088 | 1088 |
@@ -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 | |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
58 | 58 | */ |
59 | - public function __construct( $args = array() ) { |
|
59 | + public function __construct($args = array()) { |
|
60 | 60 | $defaults = array( |
61 | 61 | 'output' => 'payments', // Use 'posts' to get standard post objects |
62 | - 'post_type' => array( 'give_payment' ), |
|
62 | + 'post_type' => array('give_payment'), |
|
63 | 63 | 'start_date' => false, |
64 | 64 | 'end_date' => false, |
65 | 65 | 'number' => 20, |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'give_forms' => null, |
80 | 80 | ); |
81 | 81 | |
82 | - $this->args = wp_parse_args( $args, $defaults ); |
|
82 | + $this->args = wp_parse_args($args, $defaults); |
|
83 | 83 | |
84 | 84 | $this->init(); |
85 | 85 | } |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | * @param $query_var |
94 | 94 | * @param $value |
95 | 95 | */ |
96 | - public function __set( $query_var, $value ) { |
|
97 | - if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) { |
|
98 | - $this->args[ $query_var ][] = $value; |
|
96 | + public function __set($query_var, $value) { |
|
97 | + if (in_array($query_var, array('meta_query', 'tax_query'))) { |
|
98 | + $this->args[$query_var][] = $value; |
|
99 | 99 | } else { |
100 | - $this->args[ $query_var ] = $value; |
|
100 | + $this->args[$query_var] = $value; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @param $query_var |
111 | 111 | */ |
112 | - public function __unset( $query_var ) { |
|
113 | - unset( $this->args[ $query_var ] ); |
|
112 | + public function __unset($query_var) { |
|
113 | + unset($this->args[$query_var]); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -123,20 +123,20 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function init() { |
125 | 125 | |
126 | - add_action( 'give_pre_get_payments', array( $this, 'date_filter_pre' ) ); |
|
127 | - add_action( 'give_post_get_payments', array( $this, 'date_filter_post' ) ); |
|
128 | - |
|
129 | - add_action( 'give_pre_get_payments', array( $this, 'orderby' ) ); |
|
130 | - add_filter( 'posts_orderby', array( $this, 'custom_orderby' ), 10, 2 ); |
|
131 | - add_action( 'give_pre_get_payments', array( $this, 'status' ) ); |
|
132 | - add_action( 'give_pre_get_payments', array( $this, 'month' ) ); |
|
133 | - add_action( 'give_pre_get_payments', array( $this, 'per_page' ) ); |
|
134 | - add_action( 'give_pre_get_payments', array( $this, 'page' ) ); |
|
135 | - add_action( 'give_pre_get_payments', array( $this, 'user' ) ); |
|
136 | - add_action( 'give_pre_get_payments', array( $this, 'search' ) ); |
|
137 | - add_action( 'give_pre_get_payments', array( $this, 'mode' ) ); |
|
138 | - add_action( 'give_pre_get_payments', array( $this, 'children' ) ); |
|
139 | - add_action( 'give_pre_get_payments', array( $this, 'give_forms' ) ); |
|
126 | + add_action('give_pre_get_payments', array($this, 'date_filter_pre')); |
|
127 | + add_action('give_post_get_payments', array($this, 'date_filter_post')); |
|
128 | + |
|
129 | + add_action('give_pre_get_payments', array($this, 'orderby')); |
|
130 | + add_filter('posts_orderby', array($this, 'custom_orderby'), 10, 2); |
|
131 | + add_action('give_pre_get_payments', array($this, 'status')); |
|
132 | + add_action('give_pre_get_payments', array($this, 'month')); |
|
133 | + add_action('give_pre_get_payments', array($this, 'per_page')); |
|
134 | + add_action('give_pre_get_payments', array($this, 'page')); |
|
135 | + add_action('give_pre_get_payments', array($this, 'user')); |
|
136 | + add_action('give_pre_get_payments', array($this, 'search')); |
|
137 | + add_action('give_pre_get_payments', array($this, 'mode')); |
|
138 | + add_action('give_pre_get_payments', array($this, 'children')); |
|
139 | + add_action('give_pre_get_payments', array($this, 'give_forms')); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -160,27 +160,27 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @param Give_Payments_Query $this Payments query object. |
162 | 162 | */ |
163 | - do_action( 'give_pre_get_payments', $this ); |
|
163 | + do_action('give_pre_get_payments', $this); |
|
164 | 164 | |
165 | - $query = new WP_Query( $this->args ); |
|
165 | + $query = new WP_Query($this->args); |
|
166 | 166 | |
167 | 167 | $custom_output = array( |
168 | 168 | 'payments', |
169 | 169 | 'give_payments', |
170 | 170 | ); |
171 | 171 | |
172 | - if ( ! in_array( $this->args['output'], $custom_output ) ) { |
|
172 | + if ( ! in_array($this->args['output'], $custom_output)) { |
|
173 | 173 | return $query->posts; |
174 | 174 | } |
175 | 175 | |
176 | - if ( $query->have_posts() ) { |
|
177 | - while ( $query->have_posts() ) { |
|
176 | + if ($query->have_posts()) { |
|
177 | + while ($query->have_posts()) { |
|
178 | 178 | $query->the_post(); |
179 | 179 | |
180 | 180 | $payment_id = get_post()->ID; |
181 | - $payment = new Give_Payment( $payment_id ); |
|
181 | + $payment = new Give_Payment($payment_id); |
|
182 | 182 | |
183 | - $this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this ); |
|
183 | + $this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | wp_reset_postdata(); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @param Give_Payments_Query $this Payments query object. |
195 | 195 | */ |
196 | - do_action( 'give_post_get_payments', $this ); |
|
196 | + do_action('give_post_get_payments', $this); |
|
197 | 197 | |
198 | 198 | return $this->payments; |
199 | 199 | } |
@@ -207,13 +207,13 @@ discard block |
||
207 | 207 | * @return void |
208 | 208 | */ |
209 | 209 | public function date_filter_pre() { |
210 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
210 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
211 | 211 | return; |
212 | 212 | } |
213 | 213 | |
214 | - $this->setup_dates( $this->args['start_date'], $this->args['end_date'] ); |
|
214 | + $this->setup_dates($this->args['start_date'], $this->args['end_date']); |
|
215 | 215 | |
216 | - add_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
216 | + add_filter('posts_where', array($this, 'payments_where')); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | * @return void |
227 | 227 | */ |
228 | 228 | public function date_filter_post() { |
229 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
229 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
230 | 230 | return; |
231 | 231 | } |
232 | 232 | |
233 | - remove_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
233 | + remove_filter('posts_where', array($this, 'payments_where')); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | public function status() { |
245 | - if ( ! isset ( $this->args['status'] ) ) { |
|
245 | + if ( ! isset ($this->args['status'])) { |
|
246 | 246 | return; |
247 | 247 | } |
248 | 248 | |
249 | - $this->__set( 'post_status', $this->args['status'] ); |
|
250 | - $this->__unset( 'status' ); |
|
249 | + $this->__set('post_status', $this->args['status']); |
|
250 | + $this->__unset('status'); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | * @return void |
260 | 260 | */ |
261 | 261 | public function page() { |
262 | - if ( ! isset ( $this->args['page'] ) ) { |
|
262 | + if ( ! isset ($this->args['page'])) { |
|
263 | 263 | return; |
264 | 264 | } |
265 | 265 | |
266 | - $this->__set( 'paged', $this->args['page'] ); |
|
267 | - $this->__unset( 'page' ); |
|
266 | + $this->__set('paged', $this->args['page']); |
|
267 | + $this->__unset('page'); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -277,17 +277,17 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function per_page() { |
279 | 279 | |
280 | - if ( ! isset( $this->args['number'] ) ) { |
|
280 | + if ( ! isset($this->args['number'])) { |
|
281 | 281 | return; |
282 | 282 | } |
283 | 283 | |
284 | - if ( $this->args['number'] == - 1 ) { |
|
285 | - $this->__set( 'nopaging', true ); |
|
284 | + if ($this->args['number'] == - 1) { |
|
285 | + $this->__set('nopaging', true); |
|
286 | 286 | } else { |
287 | - $this->__set( 'posts_per_page', $this->args['number'] ); |
|
287 | + $this->__set('posts_per_page', $this->args['number']); |
|
288 | 288 | } |
289 | 289 | |
290 | - $this->__unset( 'number' ); |
|
290 | + $this->__unset('number'); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | * @return void |
300 | 300 | */ |
301 | 301 | public function month() { |
302 | - if ( ! isset ( $this->args['month'] ) ) { |
|
302 | + if ( ! isset ($this->args['month'])) { |
|
303 | 303 | return; |
304 | 304 | } |
305 | 305 | |
306 | - $this->__set( 'monthnum', $this->args['month'] ); |
|
307 | - $this->__unset( 'month' ); |
|
306 | + $this->__set('monthnum', $this->args['month']); |
|
307 | + $this->__unset('month'); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -316,23 +316,23 @@ discard block |
||
316 | 316 | * @return void |
317 | 317 | */ |
318 | 318 | public function orderby() { |
319 | - switch ( $this->args['orderby'] ) { |
|
319 | + switch ($this->args['orderby']) { |
|
320 | 320 | case 'amount' : |
321 | - $this->__set( 'orderby', 'meta_value_num' ); |
|
322 | - $this->__set( 'meta_key', '_give_payment_total' ); |
|
321 | + $this->__set('orderby', 'meta_value_num'); |
|
322 | + $this->__set('meta_key', '_give_payment_total'); |
|
323 | 323 | break; |
324 | 324 | |
325 | 325 | case 'status' : |
326 | - $this->__set( 'orderby', 'post_status' ); |
|
326 | + $this->__set('orderby', 'post_status'); |
|
327 | 327 | break; |
328 | 328 | |
329 | 329 | case 'donation_form' : |
330 | - $this->__set( 'orderby', 'meta_value' ); |
|
331 | - $this->__set( 'meta_key', '_give_payment_form_title' ); |
|
330 | + $this->__set('orderby', 'meta_value'); |
|
331 | + $this->__set('meta_key', '_give_payment_form_title'); |
|
332 | 332 | break; |
333 | 333 | |
334 | 334 | default : |
335 | - $this->__set( 'orderby', $this->args['orderby'] ); |
|
335 | + $this->__set('orderby', $this->args['orderby']); |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | } |
@@ -349,15 +349,15 @@ discard block |
||
349 | 349 | * |
350 | 350 | * @return mixed |
351 | 351 | */ |
352 | - public function custom_orderby( $order, $query ) { |
|
353 | - $post_types = is_array( $query->query['post_type'] ) ? $query->query['post_type'] : array( $query->query['post_type'] ); |
|
354 | - if ( ! in_array( 'give_payment', $post_types ) || is_array( $query->query['orderby'] ) ) { |
|
352 | + public function custom_orderby($order, $query) { |
|
353 | + $post_types = is_array($query->query['post_type']) ? $query->query['post_type'] : array($query->query['post_type']); |
|
354 | + if ( ! in_array('give_payment', $post_types) || is_array($query->query['orderby'])) { |
|
355 | 355 | return $order; |
356 | 356 | } |
357 | 357 | |
358 | - switch ( $query->query['orderby'] ) { |
|
358 | + switch ($query->query['orderby']) { |
|
359 | 359 | case 'post_status': |
360 | - $order = 'wp_posts.post_status ' . strtoupper( $query->query['order'] ); |
|
360 | + $order = 'wp_posts.post_status '.strtoupper($query->query['order']); |
|
361 | 361 | break; |
362 | 362 | } |
363 | 363 | |
@@ -373,20 +373,20 @@ discard block |
||
373 | 373 | * @return void |
374 | 374 | */ |
375 | 375 | public function user() { |
376 | - if ( is_null( $this->args['user'] ) ) { |
|
376 | + if (is_null($this->args['user'])) { |
|
377 | 377 | return; |
378 | 378 | } |
379 | 379 | |
380 | - if ( is_numeric( $this->args['user'] ) ) { |
|
380 | + if (is_numeric($this->args['user'])) { |
|
381 | 381 | $user_key = '_give_payment_user_id'; |
382 | 382 | } else { |
383 | 383 | $user_key = '_give_payment_user_email'; |
384 | 384 | } |
385 | 385 | |
386 | - $this->__set( 'meta_query', array( |
|
386 | + $this->__set('meta_query', array( |
|
387 | 387 | 'key' => $user_key, |
388 | 388 | 'value' => $this->args['user'], |
389 | - ) ); |
|
389 | + )); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | /** |
@@ -399,33 +399,33 @@ discard block |
||
399 | 399 | */ |
400 | 400 | public function search() { |
401 | 401 | |
402 | - if ( ! isset( $this->args['s'] ) ) { |
|
402 | + if ( ! isset($this->args['s'])) { |
|
403 | 403 | return; |
404 | 404 | } |
405 | 405 | |
406 | - $search = trim( $this->args['s'] ); |
|
406 | + $search = trim($this->args['s']); |
|
407 | 407 | |
408 | - if ( empty( $search ) ) { |
|
408 | + if (empty($search)) { |
|
409 | 409 | return; |
410 | 410 | } |
411 | 411 | |
412 | - $is_email = is_email( $search ) || strpos( $search, '@' ) !== false; |
|
413 | - $is_user = strpos( $search, strtolower( 'user:' ) ) !== false; |
|
412 | + $is_email = is_email($search) || strpos($search, '@') !== false; |
|
413 | + $is_user = strpos($search, strtolower('user:')) !== false; |
|
414 | 414 | |
415 | - if ( ! empty( $this->args['search_in_notes'] ) ) { |
|
415 | + if ( ! empty($this->args['search_in_notes'])) { |
|
416 | 416 | |
417 | - $notes = give_get_payment_notes( 0, $search ); |
|
417 | + $notes = give_get_payment_notes(0, $search); |
|
418 | 418 | |
419 | - if ( ! empty( $notes ) ) { |
|
419 | + if ( ! empty($notes)) { |
|
420 | 420 | |
421 | - $payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' ); |
|
421 | + $payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID'); |
|
422 | 422 | |
423 | - $this->__set( 'post__in', $payment_ids ); |
|
423 | + $this->__set('post__in', $payment_ids); |
|
424 | 424 | } |
425 | 425 | |
426 | - $this->__unset( 's' ); |
|
426 | + $this->__unset('s'); |
|
427 | 427 | |
428 | - } elseif ( $is_email || strlen( $search ) == 32 ) { |
|
428 | + } elseif ($is_email || strlen($search) == 32) { |
|
429 | 429 | |
430 | 430 | $key = $is_email ? '_give_payment_user_email' : '_give_payment_purchase_key'; |
431 | 431 | $search_meta = array( |
@@ -434,19 +434,19 @@ discard block |
||
434 | 434 | 'compare' => 'LIKE', |
435 | 435 | ); |
436 | 436 | |
437 | - $this->__set( 'meta_query', $search_meta ); |
|
438 | - $this->__unset( 's' ); |
|
437 | + $this->__set('meta_query', $search_meta); |
|
438 | + $this->__unset('s'); |
|
439 | 439 | |
440 | - } elseif ( $is_user ) { |
|
440 | + } elseif ($is_user) { |
|
441 | 441 | |
442 | 442 | $search_meta = array( |
443 | 443 | 'key' => '_give_payment_user_id', |
444 | - 'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ), |
|
444 | + 'value' => trim(str_replace('user:', '', strtolower($search))), |
|
445 | 445 | ); |
446 | 446 | |
447 | - $this->__set( 'meta_query', $search_meta ); |
|
447 | + $this->__set('meta_query', $search_meta); |
|
448 | 448 | |
449 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
449 | + if (give_get_option('enable_sequential')) { |
|
450 | 450 | |
451 | 451 | $search_meta = array( |
452 | 452 | 'key' => '_give_payment_number', |
@@ -454,19 +454,19 @@ discard block |
||
454 | 454 | 'compare' => 'LIKE', |
455 | 455 | ); |
456 | 456 | |
457 | - $this->__set( 'meta_query', $search_meta ); |
|
457 | + $this->__set('meta_query', $search_meta); |
|
458 | 458 | |
459 | 459 | $this->args['meta_query']['relation'] = 'OR'; |
460 | 460 | |
461 | 461 | } |
462 | 462 | |
463 | - $this->__unset( 's' ); |
|
463 | + $this->__unset('s'); |
|
464 | 464 | |
465 | 465 | } elseif ( |
466 | - give_get_option( 'enable_sequential' ) && |
|
466 | + give_get_option('enable_sequential') && |
|
467 | 467 | ( |
468 | - false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) || |
|
469 | - false !== strpos( $search, give_get_option( 'sequential_postfix' ) ) |
|
468 | + false !== strpos($search, give_get_option('sequential_prefix')) || |
|
469 | + false !== strpos($search, give_get_option('sequential_postfix')) |
|
470 | 470 | ) |
471 | 471 | ) { |
472 | 472 | |
@@ -476,29 +476,29 @@ discard block |
||
476 | 476 | 'compare' => 'LIKE', |
477 | 477 | ); |
478 | 478 | |
479 | - $this->__set( 'meta_query', $search_meta ); |
|
480 | - $this->__unset( 's' ); |
|
479 | + $this->__set('meta_query', $search_meta); |
|
480 | + $this->__unset('s'); |
|
481 | 481 | |
482 | - } elseif ( is_numeric( $search ) ) { |
|
482 | + } elseif (is_numeric($search)) { |
|
483 | 483 | |
484 | - $post = get_post( $search ); |
|
484 | + $post = get_post($search); |
|
485 | 485 | |
486 | - if ( is_object( $post ) && $post->post_type == 'give_payment' ) { |
|
486 | + if (is_object($post) && $post->post_type == 'give_payment') { |
|
487 | 487 | |
488 | 488 | $arr = array(); |
489 | 489 | $arr[] = $search; |
490 | - $this->__set( 'post__in', $arr ); |
|
491 | - $this->__unset( 's' ); |
|
490 | + $this->__set('post__in', $arr); |
|
491 | + $this->__unset('s'); |
|
492 | 492 | } |
493 | - } elseif ( '#' == substr( $search, 0, 1 ) ) { |
|
493 | + } elseif ('#' == substr($search, 0, 1)) { |
|
494 | 494 | |
495 | - $search = str_replace( '#:', '', $search ); |
|
496 | - $search = str_replace( '#', '', $search ); |
|
497 | - $this->__set( 'give_forms', $search ); |
|
498 | - $this->__unset( 's' ); |
|
495 | + $search = str_replace('#:', '', $search); |
|
496 | + $search = str_replace('#', '', $search); |
|
497 | + $this->__set('give_forms', $search); |
|
498 | + $this->__unset('s'); |
|
499 | 499 | |
500 | 500 | } else { |
501 | - $this->__set( 's', $search ); |
|
501 | + $this->__set('s', $search); |
|
502 | 502 | |
503 | 503 | } |
504 | 504 | |
@@ -513,16 +513,16 @@ discard block |
||
513 | 513 | * @return void |
514 | 514 | */ |
515 | 515 | public function mode() { |
516 | - if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) { |
|
517 | - $this->__unset( 'mode' ); |
|
516 | + if (empty($this->args['mode']) || $this->args['mode'] == 'all') { |
|
517 | + $this->__unset('mode'); |
|
518 | 518 | |
519 | 519 | return; |
520 | 520 | } |
521 | 521 | |
522 | - $this->__set( 'meta_query', array( |
|
522 | + $this->__set('meta_query', array( |
|
523 | 523 | 'key' => '_give_payment_mode', |
524 | 524 | 'value' => $this->args['mode'], |
525 | - ) ); |
|
525 | + )); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | /** |
@@ -534,10 +534,10 @@ discard block |
||
534 | 534 | * @return void |
535 | 535 | */ |
536 | 536 | public function children() { |
537 | - if ( empty( $this->args['children'] ) ) { |
|
538 | - $this->__set( 'post_parent', 0 ); |
|
537 | + if (empty($this->args['children'])) { |
|
538 | + $this->__set('post_parent', 0); |
|
539 | 539 | } |
540 | - $this->__unset( 'children' ); |
|
540 | + $this->__unset('children'); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -550,25 +550,25 @@ discard block |
||
550 | 550 | */ |
551 | 551 | public function give_forms() { |
552 | 552 | |
553 | - if ( empty( $this->args['give_forms'] ) ) { |
|
553 | + if (empty($this->args['give_forms'])) { |
|
554 | 554 | return; |
555 | 555 | } |
556 | 556 | |
557 | 557 | $compare = '='; |
558 | 558 | |
559 | - if ( is_array( $this->args['give_forms'] ) ) { |
|
559 | + if (is_array($this->args['give_forms'])) { |
|
560 | 560 | $compare = 'IN'; |
561 | 561 | } |
562 | 562 | |
563 | - $this->__set( 'meta_query', array( |
|
563 | + $this->__set('meta_query', array( |
|
564 | 564 | array( |
565 | 565 | 'key' => '_give_payment_form_id', |
566 | 566 | 'value' => $this->args['give_forms'], |
567 | 567 | 'compare' => $compare, |
568 | 568 | ), |
569 | - ) ); |
|
569 | + )); |
|
570 | 570 | |
571 | - $this->__unset( 'give_forms' ); |
|
571 | + $this->__unset('give_forms'); |
|
572 | 572 | |
573 | 573 | } |
574 | 574 |
@@ -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,36 +26,36 @@ discard block |
||
26 | 26 | function give_donation_history() { |
27 | 27 | |
28 | 28 | // If payment_key query arg exists, return receipt instead of donation history. |
29 | - if ( isset( $_GET['payment_key'] ) ) { |
|
29 | + if (isset($_GET['payment_key'])) { |
|
30 | 30 | ob_start(); |
31 | - echo give_receipt_shortcode( array() ); |
|
32 | - echo '<a href="' . esc_url( give_get_history_page_uri() ) . '">« ' . esc_html__( 'Return to All Donations', 'give' ) . '</a>'; |
|
31 | + echo give_receipt_shortcode(array()); |
|
32 | + echo '<a href="'.esc_url(give_get_history_page_uri()).'">« '.esc_html__('Return to All Donations', 'give').'</a>'; |
|
33 | 33 | |
34 | 34 | return ob_get_clean(); |
35 | 35 | } |
36 | 36 | |
37 | - $email_access = give_get_option( 'email_access' ); |
|
37 | + $email_access = give_get_option('email_access'); |
|
38 | 38 | |
39 | 39 | //Is user logged in? Does a session exist? Does an email-access token exist? |
40 | - if ( is_user_logged_in() || Give()->session->get_session_expiration() !== false || ( $email_access == 'on' && Give()->email_access->token_exists ) ) { |
|
40 | + if (is_user_logged_in() || Give()->session->get_session_expiration() !== false || ($email_access == 'on' && Give()->email_access->token_exists)) { |
|
41 | 41 | ob_start(); |
42 | - give_get_template_part( 'history', 'donations' ); |
|
42 | + give_get_template_part('history', 'donations'); |
|
43 | 43 | |
44 | 44 | return ob_get_clean(); |
45 | 45 | } //Is Email-based access enabled? |
46 | - elseif ( $email_access == 'on' ) { |
|
46 | + elseif ($email_access == 'on') { |
|
47 | 47 | |
48 | 48 | ob_start(); |
49 | - give_get_template_part( 'email', 'login-form' ); |
|
49 | + give_get_template_part('email', 'login-form'); |
|
50 | 50 | |
51 | 51 | return ob_get_clean(); |
52 | 52 | } else { |
53 | - $message = esc_html__( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ); |
|
54 | - echo apply_filters( 'give_donation_history_nonuser_message', give_output_error( $message, false ), $message ); |
|
53 | + $message = esc_html__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'); |
|
54 | + echo apply_filters('give_donation_history_nonuser_message', give_output_error($message, false), $message); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | -add_shortcode( 'donation_history', 'give_donation_history' ); |
|
58 | +add_shortcode('donation_history', 'give_donation_history'); |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Donation Form Shortcode |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return string |
70 | 70 | */ |
71 | -function give_form_shortcode( $atts ) { |
|
72 | - $atts = shortcode_atts( array( |
|
71 | +function give_form_shortcode($atts) { |
|
72 | + $atts = shortcode_atts(array( |
|
73 | 73 | 'id' => '', |
74 | 74 | 'show_title' => true, |
75 | 75 | 'show_goal' => true, |
76 | 76 | 'show_content' => '', |
77 | 77 | 'float_labels' => '', |
78 | 78 | 'display_style' => '', |
79 | - ), $atts, 'give_form' ); |
|
79 | + ), $atts, 'give_form'); |
|
80 | 80 | |
81 | 81 | // Convert string to bool. |
82 | 82 | $atts['show_title'] = (bool) $atts['show_title']; |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | |
85 | 85 | //get the Give Form |
86 | 86 | ob_start(); |
87 | - give_get_donation_form( $atts ); |
|
87 | + give_get_donation_form($atts); |
|
88 | 88 | $final_output = ob_get_clean(); |
89 | 89 | |
90 | - return apply_filters( 'give_donate_form', $final_output, $atts ); |
|
90 | + return apply_filters('give_donate_form', $final_output, $atts); |
|
91 | 91 | } |
92 | 92 | |
93 | -add_shortcode( 'give_form', 'give_form_shortcode' ); |
|
93 | +add_shortcode('give_form', 'give_form_shortcode'); |
|
94 | 94 | |
95 | 95 | /** |
96 | 96 | * Donation Form Goal Shortcode. |
@@ -103,37 +103,37 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return string |
105 | 105 | */ |
106 | -function give_goal_shortcode( $atts ) { |
|
107 | - $atts = shortcode_atts( array( |
|
106 | +function give_goal_shortcode($atts) { |
|
107 | + $atts = shortcode_atts(array( |
|
108 | 108 | 'id' => '', |
109 | 109 | 'show_text' => true, |
110 | 110 | 'show_bar' => true, |
111 | - ), $atts, 'give_goal' ); |
|
111 | + ), $atts, 'give_goal'); |
|
112 | 112 | |
113 | 113 | |
114 | 114 | //get the Give Form. |
115 | 115 | ob_start(); |
116 | 116 | |
117 | 117 | //Sanity check 1: ensure there is an ID Provided. |
118 | - if ( empty( $atts['id'] ) ) { |
|
119 | - give_output_error( esc_html__( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true ); |
|
118 | + if (empty($atts['id'])) { |
|
119 | + give_output_error(esc_html__('The shortcode is missing Donation Form ID attribute.', 'give'), true); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | //Sanity check 2: Check the form even has Goals enabled. |
123 | - if ( ! give_is_setting_enabled( get_post_meta( $atts['id'], '_give_goal_option', true ) ) ) { |
|
123 | + if ( ! give_is_setting_enabled(get_post_meta($atts['id'], '_give_goal_option', true))) { |
|
124 | 124 | |
125 | - give_output_error( esc_html__( 'The form does not have Goals enabled.', 'give' ), true ); |
|
125 | + give_output_error(esc_html__('The form does not have Goals enabled.', 'give'), true); |
|
126 | 126 | } else { |
127 | 127 | //Passed all sanity checks: output Goal. |
128 | - give_show_goal_progress( $atts['id'], $atts ); |
|
128 | + give_show_goal_progress($atts['id'], $atts); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | $final_output = ob_get_clean(); |
132 | 132 | |
133 | - return apply_filters( 'give_goal_shortcode_output', $final_output, $atts ); |
|
133 | + return apply_filters('give_goal_shortcode_output', $final_output, $atts); |
|
134 | 134 | } |
135 | 135 | |
136 | -add_shortcode( 'give_goal', 'give_goal_shortcode' ); |
|
136 | +add_shortcode('give_goal', 'give_goal_shortcode'); |
|
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
@@ -150,22 +150,22 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return string |
152 | 152 | */ |
153 | -function give_login_form_shortcode( $atts ) { |
|
154 | - $atts = shortcode_atts( array( |
|
153 | +function give_login_form_shortcode($atts) { |
|
154 | + $atts = shortcode_atts(array( |
|
155 | 155 | // Add backward compatibility for redirect attribute. |
156 | 156 | 'redirect' => '', |
157 | 157 | |
158 | 158 | 'login-redirect' => '', |
159 | 159 | 'logout-redirect' => '', |
160 | - ), $atts, 'give_login' ); |
|
160 | + ), $atts, 'give_login'); |
|
161 | 161 | |
162 | 162 | // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute. |
163 | - $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' ); |
|
163 | + $atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : ''); |
|
164 | 164 | |
165 | - return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] ); |
|
165 | + return give_login_form($atts['login-redirect'], $atts['logout-redirect']); |
|
166 | 166 | } |
167 | 167 | |
168 | -add_shortcode( 'give_login', 'give_login_form_shortcode' ); |
|
168 | +add_shortcode('give_login', 'give_login_form_shortcode'); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Register Shortcode. |
@@ -180,15 +180,15 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return string |
182 | 182 | */ |
183 | -function give_register_form_shortcode( $atts ) { |
|
184 | - $atts = shortcode_atts( array( |
|
183 | +function give_register_form_shortcode($atts) { |
|
184 | + $atts = shortcode_atts(array( |
|
185 | 185 | 'redirect' => '', |
186 | - ), $atts, 'give_register' ); |
|
186 | + ), $atts, 'give_register'); |
|
187 | 187 | |
188 | - return give_register_form( $atts['redirect'] ); |
|
188 | + return give_register_form($atts['redirect']); |
|
189 | 189 | } |
190 | 190 | |
191 | -add_shortcode( 'give_register', 'give_register_form_shortcode' ); |
|
191 | +add_shortcode('give_register', 'give_register_form_shortcode'); |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * Receipt Shortcode. |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return string |
203 | 203 | */ |
204 | -function give_receipt_shortcode( $atts ) { |
|
204 | +function give_receipt_shortcode($atts) { |
|
205 | 205 | |
206 | 206 | global $give_receipt_args, $payment; |
207 | 207 | |
208 | - $give_receipt_args = shortcode_atts( array( |
|
209 | - 'error' => esc_html__( 'You are missing the payment key to view this donation receipt.', 'give' ), |
|
208 | + $give_receipt_args = shortcode_atts(array( |
|
209 | + 'error' => esc_html__('You are missing the payment key to view this donation receipt.', 'give'), |
|
210 | 210 | 'price' => true, |
211 | 211 | 'donor' => true, |
212 | 212 | 'date' => true, |
@@ -215,50 +215,50 @@ discard block |
||
215 | 215 | 'payment_id' => true, |
216 | 216 | 'payment_status' => false, |
217 | 217 | 'status_notice' => true, |
218 | - ), $atts, 'give_receipt' ); |
|
218 | + ), $atts, 'give_receipt'); |
|
219 | 219 | |
220 | 220 | //set $session var |
221 | 221 | $session = give_get_purchase_session(); |
222 | 222 | |
223 | 223 | //set payment key var |
224 | - if ( isset( $_GET['payment_key'] ) ) { |
|
225 | - $payment_key = urldecode( $_GET['payment_key'] ); |
|
226 | - } elseif ( $session ) { |
|
224 | + if (isset($_GET['payment_key'])) { |
|
225 | + $payment_key = urldecode($_GET['payment_key']); |
|
226 | + } elseif ($session) { |
|
227 | 227 | $payment_key = $session['purchase_key']; |
228 | - } elseif ( $give_receipt_args['payment_key'] ) { |
|
228 | + } elseif ($give_receipt_args['payment_key']) { |
|
229 | 229 | $payment_key = $give_receipt_args['payment_key']; |
230 | 230 | } |
231 | 231 | |
232 | - $email_access = give_get_option( 'email_access' ); |
|
232 | + $email_access = give_get_option('email_access'); |
|
233 | 233 | |
234 | 234 | // No payment_key found & Email Access is Turned on: |
235 | - if ( ! isset( $payment_key ) && $email_access == 'on' && ! Give()->email_access->token_exists ) { |
|
235 | + if ( ! isset($payment_key) && $email_access == 'on' && ! Give()->email_access->token_exists) { |
|
236 | 236 | |
237 | 237 | ob_start(); |
238 | 238 | |
239 | - give_get_template_part( 'email-login-form' ); |
|
239 | + give_get_template_part('email-login-form'); |
|
240 | 240 | |
241 | 241 | return ob_get_clean(); |
242 | 242 | |
243 | - } elseif ( ! isset( $payment_key ) ) { |
|
243 | + } elseif ( ! isset($payment_key)) { |
|
244 | 244 | |
245 | - return give_output_error( $give_receipt_args['error'], false, 'error' ); |
|
245 | + return give_output_error($give_receipt_args['error'], false, 'error'); |
|
246 | 246 | |
247 | 247 | } |
248 | 248 | |
249 | - $payment_id = give_get_purchase_id_by_key( $payment_key ); |
|
250 | - $user_can_view = give_can_view_receipt( $payment_key ); |
|
249 | + $payment_id = give_get_purchase_id_by_key($payment_key); |
|
250 | + $user_can_view = give_can_view_receipt($payment_key); |
|
251 | 251 | |
252 | 252 | // Key was provided, but user is logged out. Offer them the ability to login and view the receipt. |
253 | - if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists ) { |
|
253 | + if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists) { |
|
254 | 254 | |
255 | 255 | ob_start(); |
256 | 256 | |
257 | - give_get_template_part( 'email-login-form' ); |
|
257 | + give_get_template_part('email-login-form'); |
|
258 | 258 | |
259 | 259 | return ob_get_clean(); |
260 | 260 | |
261 | - } elseif ( ! $user_can_view ) { |
|
261 | + } elseif ( ! $user_can_view) { |
|
262 | 262 | |
263 | 263 | global $give_login_redirect; |
264 | 264 | |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | |
267 | 267 | ob_start(); |
268 | 268 | |
269 | - give_output_error( apply_filters( 'give_must_be_logged_in_error_message', esc_html__( 'You must be logged in to view this donation receipt.', 'give' ) ) ); |
|
269 | + give_output_error(apply_filters('give_must_be_logged_in_error_message', esc_html__('You must be logged in to view this donation receipt.', 'give'))); |
|
270 | 270 | |
271 | - give_get_template_part( 'shortcode', 'login' ); |
|
271 | + give_get_template_part('shortcode', 'login'); |
|
272 | 272 | |
273 | 273 | $login_form = ob_get_clean(); |
274 | 274 | |
@@ -283,20 +283,20 @@ discard block |
||
283 | 283 | * or if user is logged in and the user can view sensitive shop data. |
284 | 284 | * |
285 | 285 | */ |
286 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { |
|
287 | - return give_output_error( $give_receipt_args['error'], false, 'error' ); |
|
286 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { |
|
287 | + return give_output_error($give_receipt_args['error'], false, 'error'); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | ob_start(); |
291 | 291 | |
292 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
292 | + give_get_template_part('shortcode', 'receipt'); |
|
293 | 293 | |
294 | 294 | $display = ob_get_clean(); |
295 | 295 | |
296 | 296 | return $display; |
297 | 297 | } |
298 | 298 | |
299 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
299 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * Profile Editor Shortcode. |
@@ -315,18 +315,18 @@ discard block |
||
315 | 315 | * |
316 | 316 | * @return string Output generated from the profile editor |
317 | 317 | */ |
318 | -function give_profile_editor_shortcode( $atts ) { |
|
318 | +function give_profile_editor_shortcode($atts) { |
|
319 | 319 | |
320 | 320 | ob_start(); |
321 | 321 | |
322 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
322 | + give_get_template_part('shortcode', 'profile-editor'); |
|
323 | 323 | |
324 | 324 | $display = ob_get_clean(); |
325 | 325 | |
326 | 326 | return $display; |
327 | 327 | } |
328 | 328 | |
329 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
329 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
330 | 330 | |
331 | 331 | /** |
332 | 332 | * Process Profile Updater Form. |
@@ -339,30 +339,30 @@ discard block |
||
339 | 339 | * |
340 | 340 | * @return bool |
341 | 341 | */ |
342 | -function give_process_profile_editor_updates( $data ) { |
|
342 | +function give_process_profile_editor_updates($data) { |
|
343 | 343 | // Profile field change request |
344 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
344 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
345 | 345 | return false; |
346 | 346 | } |
347 | 347 | |
348 | 348 | // Nonce security |
349 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
349 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
350 | 350 | return false; |
351 | 351 | } |
352 | 352 | |
353 | 353 | $user_id = get_current_user_id(); |
354 | - $old_user_data = get_userdata( $user_id ); |
|
355 | - |
|
356 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
357 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
358 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
359 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
360 | - $line1 = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' ); |
|
361 | - $line2 = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' ); |
|
362 | - $city = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' ); |
|
363 | - $state = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' ); |
|
364 | - $zip = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' ); |
|
365 | - $country = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' ); |
|
354 | + $old_user_data = get_userdata($user_id); |
|
355 | + |
|
356 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
357 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
358 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
359 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
360 | + $line1 = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : ''); |
|
361 | + $line2 = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : ''); |
|
362 | + $city = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : ''); |
|
363 | + $state = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : ''); |
|
364 | + $zip = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : ''); |
|
365 | + $country = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : ''); |
|
366 | 366 | |
367 | 367 | $userdata = array( |
368 | 368 | 'ID' => $user_id, |
@@ -390,46 +390,46 @@ discard block |
||
390 | 390 | * @param int $user_id The ID of the user. |
391 | 391 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
392 | 392 | */ |
393 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
393 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
394 | 394 | |
395 | 395 | // New password |
396 | - if ( ! empty( $data['give_new_user_pass1'] ) ) { |
|
397 | - if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) { |
|
398 | - give_set_error( 'password_mismatch', esc_html__( 'The passwords you entered do not match. Please try again.', 'give' ) ); |
|
396 | + if ( ! empty($data['give_new_user_pass1'])) { |
|
397 | + if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) { |
|
398 | + give_set_error('password_mismatch', esc_html__('The passwords you entered do not match. Please try again.', 'give')); |
|
399 | 399 | } else { |
400 | 400 | $userdata['user_pass'] = $data['give_new_user_pass1']; |
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | - if ( empty( $email ) ) { |
|
404 | + if (empty($email)) { |
|
405 | 405 | // Make sure email should not be empty. |
406 | - give_set_error( 'email_empty', esc_html__( 'The email you entered is empty.', 'give' ) ); |
|
406 | + give_set_error('email_empty', esc_html__('The email you entered is empty.', 'give')); |
|
407 | 407 | |
408 | - } else if ( ! is_email( $email ) ) { |
|
408 | + } else if ( ! is_email($email)) { |
|
409 | 409 | // Make sure email should be valid. |
410 | - give_set_error( 'email_not_valid', esc_html__( 'The email you entered is not valid. Please use another', 'give' ) ); |
|
410 | + give_set_error('email_not_valid', esc_html__('The email you entered is not valid. Please use another', 'give')); |
|
411 | 411 | |
412 | - } else if ( $email != $old_user_data->user_email ) { |
|
412 | + } else if ($email != $old_user_data->user_email) { |
|
413 | 413 | // Make sure the new email doesn't belong to another user |
414 | - if ( email_exists( $email ) ) { |
|
415 | - give_set_error( 'email_exists', esc_html__( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
414 | + if (email_exists($email)) { |
|
415 | + give_set_error('email_exists', esc_html__('The email you entered belongs to another user. Please use another.', 'give')); |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 | |
419 | 419 | // Check for errors |
420 | 420 | $errors = give_get_errors(); |
421 | 421 | |
422 | - if ( $errors ) { |
|
422 | + if ($errors) { |
|
423 | 423 | // Send back to the profile editor if there are errors |
424 | - wp_redirect( $data['give_redirect'] ); |
|
424 | + wp_redirect($data['give_redirect']); |
|
425 | 425 | give_die(); |
426 | 426 | } |
427 | 427 | |
428 | 428 | // Update the user |
429 | - $meta = update_user_meta( $user_id, '_give_user_address', $address ); |
|
430 | - $updated = wp_update_user( $userdata ); |
|
429 | + $meta = update_user_meta($user_id, '_give_user_address', $address); |
|
430 | + $updated = wp_update_user($userdata); |
|
431 | 431 | |
432 | - if ( $updated ) { |
|
432 | + if ($updated) { |
|
433 | 433 | |
434 | 434 | /** |
435 | 435 | * Fires after updating user profile. |
@@ -439,12 +439,12 @@ discard block |
||
439 | 439 | * @param int $user_id The ID of the user. |
440 | 440 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
441 | 441 | */ |
442 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
443 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
442 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
443 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
444 | 444 | give_die(); |
445 | 445 | } |
446 | 446 | |
447 | 447 | return false; |
448 | 448 | } |
449 | 449 | |
450 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
450 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_System_Info' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_System_Info')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_System_Info. |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'system-info'; |
46 | - $this->label = esc_html__( 'System Info', 'give' ); |
|
46 | + $this->label = esc_html__('System Info', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | 50 | |
51 | 51 | // Do not use main form for this tab. |
52 | - if( give_get_current_setting_tab() === $this->id ) { |
|
53 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
54 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
52 | + if (give_get_current_setting_tab() === $this->id) { |
|
53 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
54 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param array $pages Lst of pages. |
63 | 63 | * @return array |
64 | 64 | */ |
65 | - public function add_settings_page( $pages ) { |
|
66 | - $pages[ $this->id ] = $this->label; |
|
65 | + public function add_settings_page($pages) { |
|
66 | + $pages[$this->id] = $this->label; |
|
67 | 67 | |
68 | 68 | return $pages; |
69 | 69 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function output() { |
78 | 78 | $GLOBALS['give_hide_save_button'] = true; |
79 | - include_once( 'views/html-admin-page-system-info.php' ); |
|
79 | + include_once('views/html-admin-page-system-info.php'); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 |
@@ -586,9 +586,9 @@ |
||
586 | 586 | } |
587 | 587 | |
588 | 588 | echo ' – ' |
589 | - . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
590 | - . ' – ' |
|
591 | - . esc_html( $plugin_data['Version'] ); |
|
589 | + . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
590 | + . ' – ' |
|
591 | + . esc_html( $plugin_data['Version'] ); |
|
592 | 592 | ?> |
593 | 593 | </td> |
594 | 594 | </tr> |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: System Info |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <div class="give-debug-report-wrapper updated"> |
25 | - <p><?php _e( 'Please copy and paste this information in your ticket when contacting support:', 'give' ); ?> </p> |
|
25 | + <p><?php _e('Please copy and paste this information in your ticket when contacting support:', 'give'); ?> </p> |
|
26 | 26 | <p class="submit"> |
27 | - <a class="button-primary js-give-debug-report-button" href="#"><?php _e( 'Get System Report', 'give' ); ?></a> |
|
28 | - <a class="button-secondary docs" href="https://givewp.com/documentation/core/settings/system-info/" target="_blank"><?php _e( 'Understanding the System Report', 'give' ); ?></a> |
|
27 | + <a class="button-primary js-give-debug-report-button" href="#"><?php _e('Get System Report', 'give'); ?></a> |
|
28 | + <a class="button-secondary docs" href="https://givewp.com/documentation/core/settings/system-info/" target="_blank"><?php _e('Understanding the System Report', 'give'); ?></a> |
|
29 | 29 | </p> |
30 | 30 | <div class="give-debug-report js-give-debug-report"> |
31 | 31 | <textarea readonly="readonly"></textarea> |
@@ -35,55 +35,55 @@ discard block |
||
35 | 35 | <table class="give-status-table widefat" cellspacing="0" id="status"> |
36 | 36 | <thead> |
37 | 37 | <tr> |
38 | - <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e( 'WordPress Environment', 'give' ); ?></h2></th> |
|
38 | + <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e('WordPress Environment', 'give'); ?></h2></th> |
|
39 | 39 | </tr> |
40 | 40 | </thead> |
41 | 41 | <tbody> |
42 | 42 | <tr> |
43 | - <td data-export-label="Home URL"><?php _e( 'Home URL', 'give' ); ?>:</td> |
|
44 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The URL of your site\'s homepage.', 'give' ) ); ?>"></span></td> |
|
45 | - <td><?php form_option( 'home' ); ?></td> |
|
43 | + <td data-export-label="Home URL"><?php _e('Home URL', 'give'); ?>:</td> |
|
44 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The URL of your site\'s homepage.', 'give')); ?>"></span></td> |
|
45 | + <td><?php form_option('home'); ?></td> |
|
46 | 46 | </tr> |
47 | 47 | <tr> |
48 | - <td data-export-label="Site URL"><?php _e( 'Site URL', 'give' ); ?>:</td> |
|
49 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The root URL of your site.', 'give' ) ); ?>"></span></td> |
|
50 | - <td><?php form_option( 'siteurl' ); ?></td> |
|
48 | + <td data-export-label="Site URL"><?php _e('Site URL', 'give'); ?>:</td> |
|
49 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The root URL of your site.', 'give')); ?>"></span></td> |
|
50 | + <td><?php form_option('siteurl'); ?></td> |
|
51 | 51 | </tr> |
52 | 52 | <tr> |
53 | - <td data-export-label="WP Version"><?php _e( 'WP Version', 'give' ); ?>:</td> |
|
54 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of WordPress installed on your site.', 'give' ) ); ?>"></span></td> |
|
53 | + <td data-export-label="WP Version"><?php _e('WP Version', 'give'); ?>:</td> |
|
54 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of WordPress installed on your site.', 'give')); ?>"></span></td> |
|
55 | 55 | <td><?php bloginfo('version'); ?></td> |
56 | 56 | </tr> |
57 | 57 | <tr> |
58 | - <td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td> |
|
59 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?>"></span></td> |
|
60 | - <td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
58 | + <td data-export-label="WP Multisite"><?php _e('WP Multisite', 'give'); ?>:</td> |
|
59 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether or not you have WordPress Multisite enabled.', 'give')); ?>"></span></td> |
|
60 | + <td><?php if (is_multisite()) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
61 | 61 | </tr> |
62 | 62 | <tr> |
63 | - <td data-export-label="WP Memory Limit"><?php _e( 'WP Memory Limit', 'give' ); ?>:</td> |
|
64 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The maximum amount of memory (RAM) that your site can use at one time.', 'give' ) ); ?>"></span></td> |
|
63 | + <td data-export-label="WP Memory Limit"><?php _e('WP Memory Limit', 'give'); ?>:</td> |
|
64 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The maximum amount of memory (RAM) that your site can use at one time.', 'give')); ?>"></span></td> |
|
65 | 65 | <td> |
66 | 66 | <?php |
67 | - $memory = give_let_to_num( WP_MEMORY_LIMIT ); |
|
67 | + $memory = give_let_to_num(WP_MEMORY_LIMIT); |
|
68 | 68 | |
69 | - if ( function_exists( 'memory_get_usage' ) ) { |
|
70 | - $system_memory = give_let_to_num( @ini_get( 'memory_limit' ) ); |
|
71 | - $memory = max( $memory, $system_memory ); |
|
69 | + if (function_exists('memory_get_usage')) { |
|
70 | + $system_memory = give_let_to_num(@ini_get('memory_limit')); |
|
71 | + $memory = max($memory, $system_memory); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ( $memory < 67108864 ) { |
|
75 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend setting memory to at least 64 MB. See: %s', 'give' ), size_format( $memory ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">' . __( 'Increasing memory allocated to PHP', 'give' ) . '</a>' ) . '</mark>'; |
|
74 | + if ($memory < 67108864) { |
|
75 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend setting memory to at least 64 MB. See: %s', 'give'), size_format($memory), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">'.__('Increasing memory allocated to PHP', 'give').'</a>').'</mark>'; |
|
76 | 76 | } else { |
77 | - echo '<mark class="yes">' . size_format( $memory ) . '</mark>'; |
|
77 | + echo '<mark class="yes">'.size_format($memory).'</mark>'; |
|
78 | 78 | } |
79 | 79 | ?> |
80 | 80 | </td> |
81 | 81 | </tr> |
82 | 82 | <tr> |
83 | - <td data-export-label="WP Debug Mode"><?php _e( 'WP Debug Mode', 'give' ); ?>:</td> |
|
84 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Displays whether or not WordPress is in Debug Mode.', 'give' ) ); ?>"></span></td> |
|
83 | + <td data-export-label="WP Debug Mode"><?php _e('WP Debug Mode', 'give'); ?>:</td> |
|
84 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Displays whether or not WordPress is in Debug Mode.', 'give')); ?>"></span></td> |
|
85 | 85 | <td> |
86 | - <?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?> |
|
86 | + <?php if (defined('WP_DEBUG') && WP_DEBUG) : ?> |
|
87 | 87 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
88 | 88 | <?php else : ?> |
89 | 89 | <mark class="no">–</mark> |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | </td> |
92 | 92 | </tr> |
93 | 93 | <tr> |
94 | - <td data-export-label="WP Cron"><?php _e( 'WP Cron', 'give' ); ?>:</td> |
|
95 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Displays whether or not WP Cron Jobs are enabled.', 'give' ) ); ?>"></span></td> |
|
94 | + <td data-export-label="WP Cron"><?php _e('WP Cron', 'give'); ?>:</td> |
|
95 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Displays whether or not WP Cron Jobs are enabled.', 'give')); ?>"></span></td> |
|
96 | 96 | <td> |
97 | - <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
|
97 | + <?php if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) : ?> |
|
98 | 98 | <mark class="no">–</mark> |
99 | 99 | <?php else : ?> |
100 | 100 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
@@ -102,55 +102,55 @@ discard block |
||
102 | 102 | </td> |
103 | 103 | </tr> |
104 | 104 | <tr> |
105 | - <td data-export-label="Language"><?php _e( 'Language', 'give' ); ?>:</td> |
|
106 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The current language used by WordPress. Default = English', 'give' ) ); ?>"></span></td> |
|
105 | + <td data-export-label="Language"><?php _e('Language', 'give'); ?>:</td> |
|
106 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The current language used by WordPress. Default = English', 'give')); ?>"></span></td> |
|
107 | 107 | <td><?php echo get_locale(); ?></td> |
108 | 108 | </tr> |
109 | 109 | <tr> |
110 | - <td data-export-label="Permalink Structure"><?php _e( 'Permalink Structure', 'give' ); ?>:</td> |
|
111 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The permalink structure as defined in Settings.', 'give' ) ); ?>"></span></td> |
|
112 | - <td><?php echo esc_html( get_option( 'permalink_structure', __( 'Default', 'give' ) ) ); ?></td> |
|
110 | + <td data-export-label="Permalink Structure"><?php _e('Permalink Structure', 'give'); ?>:</td> |
|
111 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The permalink structure as defined in Settings.', 'give')); ?>"></span></td> |
|
112 | + <td><?php echo esc_html(get_option('permalink_structure', __('Default', 'give'))); ?></td> |
|
113 | 113 | </tr> |
114 | 114 | <tr> |
115 | - <td data-export-label="Show on Front"><?php _e( 'Show on Front', 'give' ); ?>:</td> |
|
116 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether your front page is set to show posts or a static page.', 'give' ) ); ?>"></span></td> |
|
117 | - <td><?php echo esc_html( get_option( 'show_on_front', '–' ) ); ?></td> |
|
115 | + <td data-export-label="Show on Front"><?php _e('Show on Front', 'give'); ?>:</td> |
|
116 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether your front page is set to show posts or a static page.', 'give')); ?>"></span></td> |
|
117 | + <td><?php echo esc_html(get_option('show_on_front', '–')); ?></td> |
|
118 | 118 | </tr> |
119 | - <?php if ( 'page' === get_option( 'show_on_front' ) ) : ?> |
|
119 | + <?php if ('page' === get_option('show_on_front')) : ?> |
|
120 | 120 | <?php |
121 | - $front_page_id = absint( get_option( 'page_on_front' ) ); |
|
122 | - $blog_page_id = absint( get_option( 'page_for_posts' ) ); |
|
121 | + $front_page_id = absint(get_option('page_on_front')); |
|
122 | + $blog_page_id = absint(get_option('page_for_posts')); |
|
123 | 123 | ?> |
124 | 124 | <tr> |
125 | - <td data-export-label="Page on Front"><?php _e( 'Page on Front', 'give' ); ?>:</td> |
|
126 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page set to display as your front page.', 'give' ) ); ?>"></span></td> |
|
127 | - <td><?php echo 0 !== $front_page_id ? esc_html( get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
125 | + <td data-export-label="Page on Front"><?php _e('Page on Front', 'give'); ?>:</td> |
|
126 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page set to display as your front page.', 'give')); ?>"></span></td> |
|
127 | + <td><?php echo 0 !== $front_page_id ? esc_html(get_the_title($front_page_id).' (#'.$front_page_id.')') : __('Unset', 'give'); ?></td> |
|
128 | 128 | </tr> |
129 | 129 | <tr> |
130 | - <td data-export-label="Page for Posts"><?php _e( 'Page for Posts', 'give' ); ?>:</td> |
|
131 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page set to display your posts.', 'give' ) ); ?>"></span></td> |
|
132 | - <td><?php echo 0 !== $blog_page_id ? esc_html( get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
130 | + <td data-export-label="Page for Posts"><?php _e('Page for Posts', 'give'); ?>:</td> |
|
131 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page set to display your posts.', 'give')); ?>"></span></td> |
|
132 | + <td><?php echo 0 !== $blog_page_id ? esc_html(get_the_title($blog_page_id).' (#'.$blog_page_id.')') : __('Unset', 'give'); ?></td> |
|
133 | 133 | </tr> |
134 | - <?php endif;?> |
|
134 | + <?php endif; ?> |
|
135 | 135 | <tr> |
136 | - <td data-export-label="Table Prefix Length"><?php _e( 'Table Prefix Length', 'give' ); ?>:</td> |
|
137 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The length of the table prefix used in your WordPress database.', 'give' ) ); ?>"></span></td> |
|
138 | - <td><?php echo esc_html( strlen( $wpdb->prefix ) ); ?></td> |
|
136 | + <td data-export-label="Table Prefix Length"><?php _e('Table Prefix Length', 'give'); ?>:</td> |
|
137 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The length of the table prefix used in your WordPress database.', 'give')); ?>"></span></td> |
|
138 | + <td><?php echo esc_html(strlen($wpdb->prefix)); ?></td> |
|
139 | 139 | </tr> |
140 | 140 | <tr> |
141 | - <td data-export-label="Table Prefix Status"><?php _e( 'Table Prefix Status', 'give' ); ?>:</td> |
|
142 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The status of the table prefix used in your WordPress database.', 'give' ) ); ?>"></span></td> |
|
143 | - <td><?php echo strlen( $wpdb->prefix ) > 16 ? esc_html( 'Error: Too long', 'give' ) : esc_html( 'Acceptable', 'give' ); ?></td> |
|
141 | + <td data-export-label="Table Prefix Status"><?php _e('Table Prefix Status', 'give'); ?>:</td> |
|
142 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The status of the table prefix used in your WordPress database.', 'give')); ?>"></span></td> |
|
143 | + <td><?php echo strlen($wpdb->prefix) > 16 ? esc_html('Error: Too long', 'give') : esc_html('Acceptable', 'give'); ?></td> |
|
144 | 144 | </tr> |
145 | 145 | <tr> |
146 | - <td data-export-label="Admin AJAX"><?php _e( 'Admin AJAX', 'give' ); ?>:</td> |
|
147 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether Admin AJAX is accessible.', 'give' ) ); ?>"></span></td> |
|
148 | - <td><?php echo give_test_ajax_works() ? __( 'Accessible', 'give' ) : __( 'Inaccessible', 'give' ); ?></td> |
|
146 | + <td data-export-label="Admin AJAX"><?php _e('Admin AJAX', 'give'); ?>:</td> |
|
147 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether Admin AJAX is accessible.', 'give')); ?>"></span></td> |
|
148 | + <td><?php echo give_test_ajax_works() ? __('Accessible', 'give') : __('Inaccessible', 'give'); ?></td> |
|
149 | 149 | </tr> |
150 | 150 | <tr> |
151 | - <td data-export-label="Registered Post Stati"><?php _e( 'Registered Post Stati', 'give' ); ?>:</td> |
|
152 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'A list of all registered post stati.', 'give' ) ); ?>"></span></td> |
|
153 | - <td><?php echo esc_html( implode( ', ', get_post_stati() ) ); ?></td> |
|
151 | + <td data-export-label="Registered Post Stati"><?php _e('Registered Post Stati', 'give'); ?>:</td> |
|
152 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('A list of all registered post stati.', 'give')); ?>"></span></td> |
|
153 | + <td><?php echo esc_html(implode(', ', get_post_stati())); ?></td> |
|
154 | 154 | </tr> |
155 | 155 | </tbody> |
156 | 156 | </table> |
@@ -158,71 +158,71 @@ discard block |
||
158 | 158 | <table class="give-status-table widefat" cellspacing="0"> |
159 | 159 | <thead> |
160 | 160 | <tr> |
161 | - <th colspan="3" data-export-label="Server Environment"><h2><?php _e( 'Server Environment', 'give' ); ?></h2></th> |
|
161 | + <th colspan="3" data-export-label="Server Environment"><h2><?php _e('Server Environment', 'give'); ?></h2></th> |
|
162 | 162 | </tr> |
163 | 163 | </thead> |
164 | 164 | <tbody> |
165 | 165 | <tr> |
166 | - <td data-export-label="Hosting Provider"><?php _e( 'Hosting Provider', 'give' ); ?>:</td> |
|
167 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The hosting provider for this WordPress installation.', 'give' ) ); ?>"></span></td> |
|
168 | - <td><?php echo give_get_host() ? esc_html( give_get_host() ) : __( 'Unknown', 'give' ); ?></td> |
|
166 | + <td data-export-label="Hosting Provider"><?php _e('Hosting Provider', 'give'); ?>:</td> |
|
167 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The hosting provider for this WordPress installation.', 'give')); ?>"></span></td> |
|
168 | + <td><?php echo give_get_host() ? esc_html(give_get_host()) : __('Unknown', 'give'); ?></td> |
|
169 | 169 | </tr> |
170 | 170 | <tr> |
171 | - <td data-export-label="Server Info"><?php _e( 'Server Info', 'give' ); ?>:</td> |
|
172 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Information about the web server that is currently hosting your site.', 'give' ) ); ?>"></span></td> |
|
173 | - <td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td> |
|
171 | + <td data-export-label="Server Info"><?php _e('Server Info', 'give'); ?>:</td> |
|
172 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Information about the web server that is currently hosting your site.', 'give')); ?>"></span></td> |
|
173 | + <td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?></td> |
|
174 | 174 | </tr> |
175 | 175 | <tr> |
176 | - <td data-export-label="PHP Version"><?php _e( 'PHP Version', 'give' ); ?>:</td> |
|
177 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of PHP installed on your hosting server.', 'give' ) ); ?>"></span></td> |
|
176 | + <td data-export-label="PHP Version"><?php _e('PHP Version', 'give'); ?>:</td> |
|
177 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of PHP installed on your hosting server.', 'give')); ?>"></span></td> |
|
178 | 178 | <td><?php |
179 | 179 | // Check if phpversion function exists. |
180 | - if ( function_exists( 'phpversion' ) ) { |
|
180 | + if (function_exists('phpversion')) { |
|
181 | 181 | $php_version = phpversion(); |
182 | 182 | |
183 | - if ( version_compare( $php_version, '5.6', '<' ) ) { |
|
184 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum PHP version of 5.6. See: %s', 'give' ), esc_html( $php_version ), '<a href="https://givewp.com/documentation/core/settings/system-info/" target="_blank">' . __( 'PHP Requirements in Give', 'give' ) . '</a>' ) . '</mark>'; |
|
183 | + if (version_compare($php_version, '5.6', '<')) { |
|
184 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum PHP version of 5.6. See: %s', 'give'), esc_html($php_version), '<a href="https://givewp.com/documentation/core/settings/system-info/" target="_blank">'.__('PHP Requirements in Give', 'give').'</a>').'</mark>'; |
|
185 | 185 | } else { |
186 | - echo '<mark class="yes">' . esc_html( $php_version ) . '</mark>'; |
|
186 | + echo '<mark class="yes">'.esc_html($php_version).'</mark>'; |
|
187 | 187 | } |
188 | 188 | } else { |
189 | - _e( "Couldn't determine PHP version because phpversion() doesn't exist.", 'give' ); |
|
189 | + _e("Couldn't determine PHP version because phpversion() doesn't exist.", 'give'); |
|
190 | 190 | } |
191 | 191 | ?></td> |
192 | 192 | </tr> |
193 | - <?php if ( function_exists( 'ini_get' ) ) : ?> |
|
193 | + <?php if (function_exists('ini_get')) : ?> |
|
194 | 194 | <tr> |
195 | - <td data-export-label="PHP Post Max Size"><?php _e( 'PHP Post Max Size', 'give' ); ?>:</td> |
|
196 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The largest filesize that can be contained in one post.', 'give' ) ); ?>"></span></td> |
|
197 | - <td><?php echo size_format( give_let_to_num( ini_get( 'post_max_size' ) ) ); ?></td> |
|
195 | + <td data-export-label="PHP Post Max Size"><?php _e('PHP Post Max Size', 'give'); ?>:</td> |
|
196 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The largest filesize that can be contained in one post.', 'give')); ?>"></span></td> |
|
197 | + <td><?php echo size_format(give_let_to_num(ini_get('post_max_size'))); ?></td> |
|
198 | 198 | </tr> |
199 | 199 | <tr> |
200 | - <td data-export-label="PHP Time Limit"><?php _e( 'PHP Time Limit', 'give' ); ?>:</td> |
|
201 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give' ) ); ?>"></span></td> |
|
202 | - <td><?php echo ini_get( 'max_execution_time' ); ?></td> |
|
200 | + <td data-export-label="PHP Time Limit"><?php _e('PHP Time Limit', 'give'); ?>:</td> |
|
201 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give')); ?>"></span></td> |
|
202 | + <td><?php echo ini_get('max_execution_time'); ?></td> |
|
203 | 203 | </tr> |
204 | 204 | <tr> |
205 | - <td data-export-label="PHP Max Input Vars"><?php _e( 'PHP Max Input Vars', 'give' ); ?>:</td> |
|
206 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The maximum number of variables your server can use for a single function to avoid overloads.', 'give' ) ); ?>"></span></td> |
|
207 | - <td><?php echo ini_get( 'max_input_vars' ); ?></td> |
|
205 | + <td data-export-label="PHP Max Input Vars"><?php _e('PHP Max Input Vars', 'give'); ?>:</td> |
|
206 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The maximum number of variables your server can use for a single function to avoid overloads.', 'give')); ?>"></span></td> |
|
207 | + <td><?php echo ini_get('max_input_vars'); ?></td> |
|
208 | 208 | </tr> |
209 | 209 | <tr> |
210 | - <td data-export-label="PHP Max Upload Size"><?php _e( 'PHP Max Upload Size', 'give' ); ?>:</td> |
|
211 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The largest filesize that can be uploaded to your WordPress installation.', 'give' ) ); ?>"></span></td> |
|
212 | - <td><?php echo size_format( wp_max_upload_size() ); ?></td> |
|
210 | + <td data-export-label="PHP Max Upload Size"><?php _e('PHP Max Upload Size', 'give'); ?>:</td> |
|
211 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The largest filesize that can be uploaded to your WordPress installation.', 'give')); ?>"></span></td> |
|
212 | + <td><?php echo size_format(wp_max_upload_size()); ?></td> |
|
213 | 213 | </tr> |
214 | 214 | <tr> |
215 | - <td data-export-label="cURL Version"><?php _e( 'cURL Version', 'give' ); ?>:</td> |
|
216 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of cURL installed on your server.', 'give' ) ); ?>"></span></td> |
|
215 | + <td data-export-label="cURL Version"><?php _e('cURL Version', 'give'); ?>:</td> |
|
216 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of cURL installed on your server.', 'give')); ?>"></span></td> |
|
217 | 217 | <td> |
218 | 218 | <?php |
219 | - if ( function_exists( 'curl_version' ) ) { |
|
219 | + if (function_exists('curl_version')) { |
|
220 | 220 | $curl_version = curl_version(); |
221 | 221 | |
222 | - if ( version_compare( $curl_version['version'], '7.40', '<' ) ) { |
|
223 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum cURL version of 7.40.', 'give' ), esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) ) . '</mark>'; |
|
222 | + if (version_compare($curl_version['version'], '7.40', '<')) { |
|
223 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum cURL version of 7.40.', 'give'), esc_html($curl_version['version'].', '.$curl_version['ssl_version'])).'</mark>'; |
|
224 | 224 | } else { |
225 | - echo '<mark class="yes">' . esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) . '</mark>'; |
|
225 | + echo '<mark class="yes">'.esc_html($curl_version['version'].', '.$curl_version['ssl_version']).'</mark>'; |
|
226 | 226 | } |
227 | 227 | } else { |
228 | 228 | echo '&ndash'; |
@@ -231,42 +231,42 @@ discard block |
||
231 | 231 | </td> |
232 | 232 | </tr> |
233 | 233 | <tr> |
234 | - <td data-export-label="SUHOSIN Installed"><?php _e( 'SUHOSIN Installed', 'give' ); ?>:</td> |
|
235 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'give' ) ); ?>"></span></td> |
|
236 | - <td><?php echo extension_loaded( 'suhosin' ) ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
234 | + <td data-export-label="SUHOSIN Installed"><?php _e('SUHOSIN Installed', 'give'); ?>:</td> |
|
235 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'give')); ?>"></span></td> |
|
236 | + <td><?php echo extension_loaded('suhosin') ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
237 | 237 | </tr> |
238 | 238 | <?php endif; |
239 | 239 | |
240 | - if ( $wpdb->use_mysqli ) { |
|
241 | - $ver = mysqli_get_server_info( $wpdb->dbh ); |
|
240 | + if ($wpdb->use_mysqli) { |
|
241 | + $ver = mysqli_get_server_info($wpdb->dbh); |
|
242 | 242 | } else { |
243 | 243 | $ver = mysql_get_server_info(); |
244 | 244 | } |
245 | 245 | |
246 | - if ( ! empty( $wpdb->is_mysql ) && ! stristr( $ver, 'MariaDB' ) ) : ?> |
|
246 | + if ( ! empty($wpdb->is_mysql) && ! stristr($ver, 'MariaDB')) : ?> |
|
247 | 247 | <tr> |
248 | - <td data-export-label="MySQL Version"><?php _e( 'MySQL Version', 'give' ); ?>:</td> |
|
249 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of MySQL installed on your hosting server.', 'give' ) ); ?>"></span></td> |
|
248 | + <td data-export-label="MySQL Version"><?php _e('MySQL Version', 'give'); ?>:</td> |
|
249 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of MySQL installed on your hosting server.', 'give')); ?>"></span></td> |
|
250 | 250 | <td> |
251 | 251 | <?php |
252 | 252 | $mysql_version = $wpdb->db_version(); |
253 | 253 | |
254 | - if ( version_compare( $mysql_version, '5.6', '<' ) ) { |
|
255 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum MySQL version of 5.6. See: %s', 'give' ), esc_html( $mysql_version ), '<a href="https://wordpress.org/about/requirements/" target="_blank">' . __( 'WordPress Requirements', 'give' ) . '</a>' ) . '</mark>'; |
|
254 | + if (version_compare($mysql_version, '5.6', '<')) { |
|
255 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum MySQL version of 5.6. See: %s', 'give'), esc_html($mysql_version), '<a href="https://wordpress.org/about/requirements/" target="_blank">'.__('WordPress Requirements', 'give').'</a>').'</mark>'; |
|
256 | 256 | } else { |
257 | - echo '<mark class="yes">' . esc_html( $mysql_version ) . '</mark>'; |
|
257 | + echo '<mark class="yes">'.esc_html($mysql_version).'</mark>'; |
|
258 | 258 | } |
259 | 259 | ?> |
260 | 260 | </td> |
261 | 261 | </tr> |
262 | 262 | <?php endif; ?> |
263 | 263 | <tr> |
264 | - <td data-export-label="Default Timezone is UTC"><?php _e( 'Default Timezone is UTC', 'give' ); ?>:</td> |
|
265 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The default timezone for your server.', 'give' ) ); ?>"></span></td> |
|
264 | + <td data-export-label="Default Timezone is UTC"><?php _e('Default Timezone is UTC', 'give'); ?>:</td> |
|
265 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The default timezone for your server.', 'give')); ?>"></span></td> |
|
266 | 266 | <td><?php |
267 | 267 | $default_timezone = date_default_timezone_get(); |
268 | - if ( 'UTC' !== $default_timezone ) { |
|
269 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'give' ), $default_timezone ) . '</mark>'; |
|
268 | + if ('UTC' !== $default_timezone) { |
|
269 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('Default timezone is %s - it should be UTC', 'give'), $default_timezone).'</mark>'; |
|
270 | 270 | } else { |
271 | 271 | echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>'; |
272 | 272 | } ?> |
@@ -277,118 +277,118 @@ discard block |
||
277 | 277 | |
278 | 278 | // fsockopen/cURL. |
279 | 279 | $posting['fsockopen_curl']['name'] = 'fsockopen/cURL'; |
280 | - $posting['fsockopen_curl']['help'] = __( 'Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'give' ); |
|
280 | + $posting['fsockopen_curl']['help'] = __('Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'give'); |
|
281 | 281 | |
282 | - if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) { |
|
282 | + if (function_exists('fsockopen') || function_exists('curl_init')) { |
|
283 | 283 | $posting['fsockopen_curl']['success'] = true; |
284 | 284 | } else { |
285 | 285 | $posting['fsockopen_curl']['success'] = false; |
286 | - $posting['fsockopen_curl']['note'] = __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'give' ); |
|
286 | + $posting['fsockopen_curl']['note'] = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'give'); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // SOAP. |
290 | 290 | $posting['soap_client']['name'] = 'SoapClient'; |
291 | - $posting['soap_client']['help'] = __( 'Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'give' ); |
|
291 | + $posting['soap_client']['help'] = __('Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'give'); |
|
292 | 292 | |
293 | - if ( class_exists( 'SoapClient' ) ) { |
|
293 | + if (class_exists('SoapClient')) { |
|
294 | 294 | $posting['soap_client']['success'] = true; |
295 | 295 | } else { |
296 | 296 | $posting['soap_client']['success'] = false; |
297 | - $posting['soap_client']['note'] = sprintf( __( 'Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'give' ), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>' ); |
|
297 | + $posting['soap_client']['note'] = sprintf(__('Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'give'), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>'); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | // DOMDocument. |
301 | 301 | $posting['dom_document']['name'] = 'DOMDocument'; |
302 | - $posting['dom_document']['help'] = __( 'HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give' ); |
|
302 | + $posting['dom_document']['help'] = __('HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give'); |
|
303 | 303 | |
304 | - if ( class_exists( 'DOMDocument' ) ) { |
|
304 | + if (class_exists('DOMDocument')) { |
|
305 | 305 | $posting['dom_document']['success'] = true; |
306 | 306 | } else { |
307 | 307 | $posting['dom_document']['success'] = false; |
308 | - $posting['dom_document']['note'] = sprintf( __( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'give' ), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' ); |
|
308 | + $posting['dom_document']['note'] = sprintf(__('Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'give'), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>'); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | // gzip. |
312 | 312 | $posting['gzip']['name'] = 'gzip'; |
313 | - $posting['gzip']['help'] = __( 'gzip is used for file compression and decompression.', 'give' ); |
|
313 | + $posting['gzip']['help'] = __('gzip is used for file compression and decompression.', 'give'); |
|
314 | 314 | |
315 | - if ( is_callable( 'gzopen' ) ) { |
|
315 | + if (is_callable('gzopen')) { |
|
316 | 316 | $posting['gzip']['success'] = true; |
317 | 317 | } else { |
318 | 318 | $posting['gzip']['success'] = false; |
319 | - $posting['gzip']['note'] = sprintf( __( 'Your server does not support the %s function - this is used for file compression and decompression.', 'give' ), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' ); |
|
319 | + $posting['gzip']['note'] = sprintf(__('Your server does not support the %s function - this is used for file compression and decompression.', 'give'), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>'); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | // GD Graphics Library. |
323 | 323 | $posting['gd']['name'] = 'GD Graphics Library'; |
324 | - $posting['gd']['help'] = __( 'GD Graphics Library is used for dynamically manipulating images.', 'give' ); |
|
325 | - $posting['gd']['success'] = extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ? true : false; |
|
324 | + $posting['gd']['help'] = __('GD Graphics Library is used for dynamically manipulating images.', 'give'); |
|
325 | + $posting['gd']['success'] = extension_loaded('gd') && function_exists('gd_info') ? true : false; |
|
326 | 326 | |
327 | 327 | // Multibyte String. |
328 | 328 | $posting['mbstring']['name'] = 'Multibyte String'; |
329 | - $posting['mbstring']['help'] = __( 'Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give' ); |
|
329 | + $posting['mbstring']['help'] = __('Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give'); |
|
330 | 330 | |
331 | - if ( extension_loaded( 'mbstring' ) ) { |
|
331 | + if (extension_loaded('mbstring')) { |
|
332 | 332 | $posting['mbstring']['success'] = true; |
333 | 333 | } else { |
334 | 334 | $posting['mbstring']['success'] = false; |
335 | - $posting['mbstring']['note'] = sprintf( __( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'give' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' ); |
|
335 | + $posting['mbstring']['note'] = sprintf(__('Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'give'), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>'); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | // WP Remote Post Check. |
339 | - $posting['wp_remote_post']['name'] = __( 'Remote Post', 'give'); |
|
340 | - $posting['wp_remote_post']['help'] = __( 'PayPal uses this method of communicating when sending back transaction information.', 'give' ); |
|
339 | + $posting['wp_remote_post']['name'] = __('Remote Post', 'give'); |
|
340 | + $posting['wp_remote_post']['help'] = __('PayPal uses this method of communicating when sending back transaction information.', 'give'); |
|
341 | 341 | |
342 | - $response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array( |
|
342 | + $response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array( |
|
343 | 343 | 'timeout' => 60, |
344 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
344 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
345 | 345 | 'httpversion' => '1.1', |
346 | 346 | 'body' => array( |
347 | 347 | 'cmd' => '_notify-validate' |
348 | 348 | ) |
349 | - ) ); |
|
349 | + )); |
|
350 | 350 | |
351 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
351 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
352 | 352 | $posting['wp_remote_post']['success'] = true; |
353 | 353 | } else { |
354 | - $posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
355 | - if ( is_wp_error( $response ) ) { |
|
356 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), sanitize_text_field( $response->get_error_message() ) ); |
|
354 | + $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give'); |
|
355 | + if (is_wp_error($response)) { |
|
356 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Error: %s', 'give'), sanitize_text_field($response->get_error_message())); |
|
357 | 357 | } else { |
358 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), sanitize_text_field( $response['response']['code'] ) ); |
|
358 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), sanitize_text_field($response['response']['code'])); |
|
359 | 359 | } |
360 | 360 | $posting['wp_remote_post']['success'] = false; |
361 | 361 | } |
362 | 362 | |
363 | 363 | // WP Remote Get Check. |
364 | - $posting['wp_remote_get']['name'] = __( 'Remote Get', 'give'); |
|
365 | - $posting['wp_remote_get']['help'] = __( 'Give plugins may use this method of communication when checking for plugin updates.', 'give' ); |
|
364 | + $posting['wp_remote_get']['name'] = __('Remote Get', 'give'); |
|
365 | + $posting['wp_remote_get']['help'] = __('Give plugins may use this method of communication when checking for plugin updates.', 'give'); |
|
366 | 366 | |
367 | - $response = wp_safe_remote_get( 'https://woocommerce.com/wc-api/product-key-api?request=ping&network=' . ( is_multisite() ? '1' : '0' ) ); |
|
367 | + $response = wp_safe_remote_get('https://woocommerce.com/wc-api/product-key-api?request=ping&network='.(is_multisite() ? '1' : '0')); |
|
368 | 368 | |
369 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
369 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
370 | 370 | $posting['wp_remote_get']['success'] = true; |
371 | 371 | } else { |
372 | - $posting['wp_remote_get']['note'] = __( 'wp_remote_get() failed. The WooCommerce plugin updater won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
373 | - if ( is_wp_error( $response ) ) { |
|
374 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), give_clean( $response->get_error_message() ) ); |
|
372 | + $posting['wp_remote_get']['note'] = __('wp_remote_get() failed. The WooCommerce plugin updater won\'t work with your server. Contact your hosting provider.', 'give'); |
|
373 | + if (is_wp_error($response)) { |
|
374 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Error: %s', 'give'), give_clean($response->get_error_message())); |
|
375 | 375 | } else { |
376 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), give_clean( $response['response']['code'] ) ); |
|
376 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), give_clean($response['response']['code'])); |
|
377 | 377 | } |
378 | 378 | $posting['wp_remote_get']['success'] = false; |
379 | 379 | } |
380 | 380 | |
381 | - $posting = apply_filters( 'woocommerce_debug_posting', $posting ); |
|
381 | + $posting = apply_filters('woocommerce_debug_posting', $posting); |
|
382 | 382 | |
383 | - foreach ( $posting as $post ) { |
|
384 | - $mark = ! empty( $post['success'] ) ? 'yes' : 'error'; |
|
383 | + foreach ($posting as $post) { |
|
384 | + $mark = ! empty($post['success']) ? 'yes' : 'error'; |
|
385 | 385 | ?> |
386 | 386 | <tr> |
387 | - <td data-export-label="<?php echo esc_html( $post['name'] ); ?>"><?php echo esc_html( $post['name'] ); ?>:</td> |
|
388 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( isset( $post['help'] ) ? $post['help'] : '' ); ?>"></span></td> |
|
387 | + <td data-export-label="<?php echo esc_html($post['name']); ?>"><?php echo esc_html($post['name']); ?>:</td> |
|
388 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(isset($post['help']) ? $post['help'] : ''); ?>"></span></td> |
|
389 | 389 | <td> |
390 | 390 | <mark class="<?php echo $mark; ?>"> |
391 | - <?php echo ! empty( $post['success'] ) ? '<span class="dashicons dashicons-yes"></span>' : '<span class="dashicons dashicons-no-alt"></span>'; ?> <?php echo ! empty( $post['note'] ) ? wp_kses_data( $post['note'] ) : ''; ?> |
|
391 | + <?php echo ! empty($post['success']) ? '<span class="dashicons dashicons-yes"></span>' : '<span class="dashicons dashicons-no-alt"></span>'; ?> <?php echo ! empty($post['note']) ? wp_kses_data($post['note']) : ''; ?> |
|
392 | 392 | </mark> |
393 | 393 | </td> |
394 | 394 | </tr> |
@@ -401,102 +401,102 @@ discard block |
||
401 | 401 | <table class="give-status-table widefat" cellspacing="0"> |
402 | 402 | <thead> |
403 | 403 | <tr> |
404 | - <th colspan="3" data-export-label="Give Configuration"><h2><?php _e( 'Give Configuration', 'give' ); ?></h2></th> |
|
404 | + <th colspan="3" data-export-label="Give Configuration"><h2><?php _e('Give Configuration', 'give'); ?></h2></th> |
|
405 | 405 | </tr> |
406 | 406 | </thead> |
407 | 407 | <tbody> |
408 | 408 | <tr> |
409 | - <td data-export-label="Give Version"><?php _e( 'Give Version', 'give' ); ?>:</td> |
|
410 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of Give installed on your site.', 'give' ) ); ?>"></span></td> |
|
411 | - <td><?php echo esc_html( GIVE_VERSION ); ?></td> |
|
409 | + <td data-export-label="Give Version"><?php _e('Give Version', 'give'); ?>:</td> |
|
410 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of Give installed on your site.', 'give')); ?>"></span></td> |
|
411 | + <td><?php echo esc_html(GIVE_VERSION); ?></td> |
|
412 | 412 | </tr> |
413 | 413 | <tr> |
414 | - <td data-export-label="Upgraded From"><?php _e( 'Upgraded From', 'give' ); ?>:</td> |
|
415 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of Give installed prior to the last update.', 'give' ) ); ?>"></span></td> |
|
416 | - <td><?php echo esc_html( get_option( 'give_version_upgraded_from', '–' ) ); ?></td> |
|
414 | + <td data-export-label="Upgraded From"><?php _e('Upgraded From', 'give'); ?>:</td> |
|
415 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of Give installed prior to the last update.', 'give')); ?>"></span></td> |
|
416 | + <td><?php echo esc_html(get_option('give_version_upgraded_from', '–')); ?></td> |
|
417 | 417 | </tr> |
418 | 418 | <tr> |
419 | - <td data-export-label="Test Mode"><?php _e( 'Test Mode', 'give' ); ?>:</td> |
|
420 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether Test Mode is enabled in Give settings.', 'give' ) ); ?>"></span></td> |
|
421 | - <td><?php echo give_is_test_mode() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
419 | + <td data-export-label="Test Mode"><?php _e('Test Mode', 'give'); ?>:</td> |
|
420 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether Test Mode is enabled in Give settings.', 'give')); ?>"></span></td> |
|
421 | + <td><?php echo give_is_test_mode() ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
422 | 422 | </tr> |
423 | 423 | <tr> |
424 | - <td data-export-label="Currency Code"><?php _e( 'Currency Code', 'give' ); ?>:</td> |
|
425 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The currency code selected in Give settings.', 'give' ) ); ?>"></span></td> |
|
426 | - <td><?php echo esc_html( give_get_currency() ); ?></td> |
|
424 | + <td data-export-label="Currency Code"><?php _e('Currency Code', 'give'); ?>:</td> |
|
425 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The currency code selected in Give settings.', 'give')); ?>"></span></td> |
|
426 | + <td><?php echo esc_html(give_get_currency()); ?></td> |
|
427 | 427 | </tr> |
428 | 428 | <tr> |
429 | - <td data-export-label="Currency Position"><?php _e( 'Currency Position', 'give' ); ?>:</td> |
|
430 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The currency position selected in Give settings.', 'give' ) ); ?>"></span></td> |
|
431 | - <td><?php echo 'before' === give_get_option( 'currency_position' ) ? __( 'Before', 'give' ) : __( 'After', 'give' ); ?></td> |
|
429 | + <td data-export-label="Currency Position"><?php _e('Currency Position', 'give'); ?>:</td> |
|
430 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The currency position selected in Give settings.', 'give')); ?>"></span></td> |
|
431 | + <td><?php echo 'before' === give_get_option('currency_position') ? __('Before', 'give') : __('After', 'give'); ?></td> |
|
432 | 432 | </tr> |
433 | 433 | <tr> |
434 | - <td data-export-label="Decimal Separator"><?php _e( 'Decimal Separator', 'give' ); ?>:</td> |
|
435 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The decimal separator defined in Give settings.', 'give' ) ); ?>"></span></td> |
|
436 | - <td><?php echo esc_html( give_get_option( 'decimal_separator', '.' ) ); ?></td> |
|
434 | + <td data-export-label="Decimal Separator"><?php _e('Decimal Separator', 'give'); ?>:</td> |
|
435 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The decimal separator defined in Give settings.', 'give')); ?>"></span></td> |
|
436 | + <td><?php echo esc_html(give_get_option('decimal_separator', '.')); ?></td> |
|
437 | 437 | </tr> |
438 | 438 | <tr> |
439 | - <td data-export-label="Thousands Separator"><?php _e( 'Thousands Separator', 'give' ); ?>:</td> |
|
440 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The thousands separator defined in Give settings.', 'give' ) ); ?>"></span></td> |
|
441 | - <td><?php echo esc_html( give_get_option( 'thousands_separator', ',' ) ); ?></td> |
|
439 | + <td data-export-label="Thousands Separator"><?php _e('Thousands Separator', 'give'); ?>:</td> |
|
440 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The thousands separator defined in Give settings.', 'give')); ?>"></span></td> |
|
441 | + <td><?php echo esc_html(give_get_option('thousands_separator', ',')); ?></td> |
|
442 | 442 | </tr> |
443 | 443 | <tr> |
444 | - <td data-export-label="Success Page"><?php _e( 'Success Page', 'give' ); ?>:</td> |
|
445 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page where donors land following a successful transaction.', 'give' ) ); ?>"></span></td> |
|
446 | - <td><?php echo ! empty( $give_options['success_page'] ) ? esc_url( get_permalink( $give_options['success_page'] ) ) : '–'; ?></td> |
|
444 | + <td data-export-label="Success Page"><?php _e('Success Page', 'give'); ?>:</td> |
|
445 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page where donors land following a successful transaction.', 'give')); ?>"></span></td> |
|
446 | + <td><?php echo ! empty($give_options['success_page']) ? esc_url(get_permalink($give_options['success_page'])) : '–'; ?></td> |
|
447 | 447 | </tr> |
448 | 448 | <tr> |
449 | - <td data-export-label="Failure Page"><?php _e( 'Failure Page', 'give' ); ?>:</td> |
|
450 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page where donors land following a failed transaction.', 'give' ) ); ?>"></span></td> |
|
451 | - <td><?php echo ! empty( $give_options['failure_page'] ) ? esc_url( get_permalink( $give_options['failure_page'] ) ) : '–'; ?></td> |
|
449 | + <td data-export-label="Failure Page"><?php _e('Failure Page', 'give'); ?>:</td> |
|
450 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page where donors land following a failed transaction.', 'give')); ?>"></span></td> |
|
451 | + <td><?php echo ! empty($give_options['failure_page']) ? esc_url(get_permalink($give_options['failure_page'])) : '–'; ?></td> |
|
452 | 452 | </tr> |
453 | 453 | <tr> |
454 | - <td data-export-label="Give Forms Slug"><?php _e( 'Give Forms Slug', 'give' ); ?>:</td> |
|
455 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The slug used for Give donation forms.', 'give' ) ); ?>"></span></td> |
|
456 | - <td><?php echo esc_html( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . '/' : '/donations/' ); ?></td> |
|
454 | + <td data-export-label="Give Forms Slug"><?php _e('Give Forms Slug', 'give'); ?>:</td> |
|
455 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The slug used for Give donation forms.', 'give')); ?>"></span></td> |
|
456 | + <td><?php echo esc_html(defined('GIVE_SLUG') ? '/'.GIVE_SLUG.'/' : '/donations/'); ?></td> |
|
457 | 457 | </tr> |
458 | 458 | <?php |
459 | 459 | $active_gateways = give_get_enabled_payment_gateways(); |
460 | 460 | $enabled_gateways = $default_gateway = ''; |
461 | 461 | |
462 | - if ( $active_gateways ) { |
|
463 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); |
|
462 | + if ($active_gateways) { |
|
463 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
464 | 464 | |
465 | - if ( $default_gateway_is_active ) { |
|
466 | - $default_gateway = give_get_default_gateway( null ); |
|
467 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
465 | + if ($default_gateway_is_active) { |
|
466 | + $default_gateway = give_get_default_gateway(null); |
|
467 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
468 | 468 | } else { |
469 | - $default_gateway = __( 'Test Donation', 'give' ); |
|
469 | + $default_gateway = __('Test Donation', 'give'); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | $gateways = array(); |
473 | 473 | |
474 | - foreach ( $active_gateways as $gateway ) { |
|
474 | + foreach ($active_gateways as $gateway) { |
|
475 | 475 | $gateways[] = $gateway['admin_label']; |
476 | 476 | } |
477 | 477 | |
478 | - $enabled_gateways = implode( ', ', $gateways ); |
|
478 | + $enabled_gateways = implode(', ', $gateways); |
|
479 | 479 | } |
480 | 480 | ?> |
481 | 481 | <tr> |
482 | - <td data-export-label="Enabled Payment Gateways"><?php _e( 'Enabled Payment Gateways', 'give' ); ?>:</td> |
|
483 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'All payment gateways enabled in Give settings.', 'give' ) ); ?>"></span></td> |
|
484 | - <td><?php echo esc_html( ! empty( $enabled_gateways ) ? $enabled_gateways : '–' ); ?></td> |
|
482 | + <td data-export-label="Enabled Payment Gateways"><?php _e('Enabled Payment Gateways', 'give'); ?>:</td> |
|
483 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('All payment gateways enabled in Give settings.', 'give')); ?>"></span></td> |
|
484 | + <td><?php echo esc_html( ! empty($enabled_gateways) ? $enabled_gateways : '–'); ?></td> |
|
485 | 485 | </tr> |
486 | 486 | <tr> |
487 | - <td data-export-label="Default Payment Gateway"><?php _e( 'Default Payment Gateway', 'give' ); ?>:</td> |
|
488 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The default payment gateway selected in Give settings.', 'give' ) ); ?>"></span></td> |
|
489 | - <td><?php echo esc_html( ! empty( $default_gateway ) ? $default_gateway : '–' ); ?></td> |
|
487 | + <td data-export-label="Default Payment Gateway"><?php _e('Default Payment Gateway', 'give'); ?>:</td> |
|
488 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The default payment gateway selected in Give settings.', 'give')); ?>"></span></td> |
|
489 | + <td><?php echo esc_html( ! empty($default_gateway) ? $default_gateway : '–'); ?></td> |
|
490 | 490 | </tr> |
491 | 491 | <tr> |
492 | - <td data-export-label="Admin Email Notifications"><?php _e( 'Admin Email Notifications', 'give' ); ?>:</td> |
|
493 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether admins receive email notifications of transactions.', 'give' ) ); ?>"></span></td> |
|
494 | - <td><?php echo 'enabled' === give_get_option( 'admin_notices' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
492 | + <td data-export-label="Admin Email Notifications"><?php _e('Admin Email Notifications', 'give'); ?>:</td> |
|
493 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether admins receive email notifications of transactions.', 'give')); ?>"></span></td> |
|
494 | + <td><?php echo 'enabled' === give_get_option('admin_notices') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
495 | 495 | </tr> |
496 | 496 | <tr> |
497 | - <td data-export-label="Donor Email Access"><?php _e( 'Donor Email Access', 'give' ); ?>:</td> |
|
498 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether donors can access their donation history using only email.', 'give' ) ); ?>"></span></td> |
|
499 | - <td><?php echo 'enabled' === give_get_option( 'email_access' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
497 | + <td data-export-label="Donor Email Access"><?php _e('Donor Email Access', 'give'); ?>:</td> |
|
498 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether donors can access their donation history using only email.', 'give')); ?>"></span></td> |
|
499 | + <td><?php echo 'enabled' === give_get_option('email_access') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
500 | 500 | </tr> |
501 | 501 | </tbody> |
502 | 502 | </table> |
@@ -504,45 +504,45 @@ discard block |
||
504 | 504 | <table class="give-status-table widefat" cellspacing="0"> |
505 | 505 | <thead> |
506 | 506 | <tr> |
507 | - <th colspan="3" data-export-label="Session Configuration"><h2><?php _e( 'Session Configuration', 'give' ); ?></h2></th> |
|
507 | + <th colspan="3" data-export-label="Session Configuration"><h2><?php _e('Session Configuration', 'give'); ?></h2></th> |
|
508 | 508 | </tr> |
509 | 509 | </thead> |
510 | 510 | <tbody> |
511 | 511 | <tr> |
512 | - <td data-export-label="Give Use Sessions"><?php _e( 'Give Use Sessions', 'give' ); ?>:</td> |
|
513 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether PHP sessions are enforced, enabled, or disabled.', 'give' ) ); ?>"></span></td> |
|
514 | - <td><?php echo defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? __( 'Enforced', 'give' ) : ( Give()->session->use_php_sessions() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ) ); ?></td> |
|
512 | + <td data-export-label="Give Use Sessions"><?php _e('Give Use Sessions', 'give'); ?>:</td> |
|
513 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether PHP sessions are enforced, enabled, or disabled.', 'give')); ?>"></span></td> |
|
514 | + <td><?php echo defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? __('Enforced', 'give') : (Give()->session->use_php_sessions() ? __('Enabled', 'give') : __('Disabled', 'give')); ?></td> |
|
515 | 515 | </tr> |
516 | 516 | <tr> |
517 | - <td data-export-label="Session"><?php _e( 'Session', 'give' ); ?>:</td> |
|
518 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether a PHP session is currently set.', 'give' ) ); ?>"></span></td> |
|
519 | - <td><?php echo isset( $_SESSION ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
517 | + <td data-export-label="Session"><?php _e('Session', 'give'); ?>:</td> |
|
518 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether a PHP session is currently set.', 'give')); ?>"></span></td> |
|
519 | + <td><?php echo isset($_SESSION) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
520 | 520 | </tr> |
521 | - <?php if ( isset( $_SESSION ) ) { ?> |
|
521 | + <?php if (isset($_SESSION)) { ?> |
|
522 | 522 | <tr> |
523 | - <td data-export-label="Session Name"><?php _e( 'Session Name', 'give' ); ?>:</td> |
|
524 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The name of the current PHP session.', 'give' ) ); ?>"></span></td> |
|
525 | - <td><?php echo esc_html( ini_get( 'session.name' ) ); ?></td> |
|
523 | + <td data-export-label="Session Name"><?php _e('Session Name', 'give'); ?>:</td> |
|
524 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The name of the current PHP session.', 'give')); ?>"></span></td> |
|
525 | + <td><?php echo esc_html(ini_get('session.name')); ?></td> |
|
526 | 526 | </tr> |
527 | 527 | <tr> |
528 | - <td data-export-label="Cookie Path"><?php _e( 'Cookie Path', 'give' ); ?>:</td> |
|
529 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The cookie path of the current PHP session.', 'give' ) ); ?>"></span></td> |
|
530 | - <td><?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?></td> |
|
528 | + <td data-export-label="Cookie Path"><?php _e('Cookie Path', 'give'); ?>:</td> |
|
529 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The cookie path of the current PHP session.', 'give')); ?>"></span></td> |
|
530 | + <td><?php echo esc_html(ini_get('session.cookie_path')); ?></td> |
|
531 | 531 | </tr> |
532 | 532 | <tr> |
533 | - <td data-export-label="Save Path"><?php _e( 'Save Path', 'give' ); ?>:</td> |
|
534 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The save path of the current PHP session.', 'give' ) ); ?>"></span></td> |
|
535 | - <td><?php echo esc_html( ini_get( 'session.save_path' ) ); ?></td> |
|
533 | + <td data-export-label="Save Path"><?php _e('Save Path', 'give'); ?>:</td> |
|
534 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The save path of the current PHP session.', 'give')); ?>"></span></td> |
|
535 | + <td><?php echo esc_html(ini_get('session.save_path')); ?></td> |
|
536 | 536 | </tr> |
537 | 537 | <tr> |
538 | - <td data-export-label="Use Cookies"><?php _e( 'Use Cookies', 'give' ); ?>:</td> |
|
539 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether the current PHP session is set to use cookies.', 'give' ) ); ?>"></span></td> |
|
540 | - <td><?php echo ini_get( 'session.use_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
538 | + <td data-export-label="Use Cookies"><?php _e('Use Cookies', 'give'); ?>:</td> |
|
539 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether the current PHP session is set to use cookies.', 'give')); ?>"></span></td> |
|
540 | + <td><?php echo ini_get('session.use_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
541 | 541 | </tr> |
542 | 542 | <tr> |
543 | - <td data-export-label="Use Only Cookies"><?php _e( 'Use Only Cookies', 'give' ); ?>:</td> |
|
544 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether the current PHP session is set to use only cookies.', 'give' ) ); ?>"></span></td> |
|
545 | - <td><?php echo ini_get( 'session.use_only_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
543 | + <td data-export-label="Use Only Cookies"><?php _e('Use Only Cookies', 'give'); ?>:</td> |
|
544 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether the current PHP session is set to use only cookies.', 'give')); ?>"></span></td> |
|
545 | + <td><?php echo ini_get('session.use_only_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
546 | 546 | </tr> |
547 | 547 | <?php } ?> |
548 | 548 | </tbody> |
@@ -551,13 +551,13 @@ discard block |
||
551 | 551 | <table class="give-status-table widefat" cellspacing="0"> |
552 | 552 | <thead> |
553 | 553 | <tr> |
554 | - <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e( 'Active Give Add-ons', 'give' ); ?></h2></th> |
|
554 | + <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e('Active Give Add-ons', 'give'); ?></h2></th> |
|
555 | 555 | </tr> |
556 | 556 | </thead> |
557 | 557 | <tbody> |
558 | 558 | <?php |
559 | - foreach ( $plugins as $plugin_data ) { |
|
560 | - if ( 'active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type'] ) { |
|
559 | + foreach ($plugins as $plugin_data) { |
|
560 | + if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) { |
|
561 | 561 | continue; |
562 | 562 | } |
563 | 563 | |
@@ -565,30 +565,30 @@ discard block |
||
565 | 565 | $author_name = $plugin_data['Author']; |
566 | 566 | |
567 | 567 | // Link the plugin name to the plugin URL if available. |
568 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
569 | - $plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
568 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
569 | + $plugin_name = '<a href="'.esc_url($plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | // Link the author name to the author URL if available. |
573 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
574 | - $author_name = '<a href="' . esc_url( $plugin_data['AuthorURI'] ) . '" title="' . esc_attr__( 'Visit author homepage' , 'give' ) . '">' . $author_name . '</a>'; |
|
573 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
574 | + $author_name = '<a href="'.esc_url($plugin_data['AuthorURI']).'" title="'.esc_attr__('Visit author homepage', 'give').'">'.$author_name.'</a>'; |
|
575 | 575 | } |
576 | 576 | ?> |
577 | 577 | <tr> |
578 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
578 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
579 | 579 | <td class="help"> </td> |
580 | 580 | <td> |
581 | 581 | <?php |
582 | - if ( true === $plugin_data['License'] ) { |
|
583 | - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> ' . __( 'Licensed', 'give' ); |
|
582 | + if (true === $plugin_data['License']) { |
|
583 | + echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> '.__('Licensed', 'give'); |
|
584 | 584 | } else { |
585 | - echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> ' . __( 'Unlicensed', 'give' ); |
|
585 | + echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> '.__('Unlicensed', 'give'); |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | echo ' – ' |
589 | - . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
589 | + . sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))) |
|
590 | 590 | . ' – ' |
591 | - . esc_html( $plugin_data['Version'] ); |
|
591 | + . esc_html($plugin_data['Version']); |
|
592 | 592 | ?> |
593 | 593 | </td> |
594 | 594 | </tr> |
@@ -601,18 +601,18 @@ discard block |
||
601 | 601 | <table class="give-status-table widefat" cellspacing="0"> |
602 | 602 | <thead> |
603 | 603 | <tr> |
604 | - <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e( 'Other Active Plugins', 'give' ); ?></h2></th> |
|
604 | + <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e('Other Active Plugins', 'give'); ?></h2></th> |
|
605 | 605 | </tr> |
606 | 606 | </thead> |
607 | 607 | <tbody> |
608 | 608 | <?php |
609 | - foreach ( $plugins as $plugin_data ) { |
|
610 | - if ( 'active' != $plugin_data['Status'] || 'other' != $plugin_data['Type'] ) { |
|
609 | + foreach ($plugins as $plugin_data) { |
|
610 | + if ('active' != $plugin_data['Status'] || 'other' != $plugin_data['Type']) { |
|
611 | 611 | continue; |
612 | 612 | } |
613 | 613 | |
614 | 614 | // Do not show Give core plugin. |
615 | - if ( 'Give - Donation Plugin' === $plugin_data['Name'] ) { |
|
615 | + if ('Give - Donation Plugin' === $plugin_data['Name']) { |
|
616 | 616 | continue; |
617 | 617 | } |
618 | 618 | |
@@ -620,19 +620,19 @@ discard block |
||
620 | 620 | $author_name = $plugin_data['Author']; |
621 | 621 | |
622 | 622 | // Link the plugin name to the plugin URL if available. |
623 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
624 | - $plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
623 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
624 | + $plugin_name = '<a href="'.esc_url($plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | // Link the author name to the author URL if available. |
628 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
629 | - $author_name = '<a href="' . esc_url( $plugin_data['AuthorURI'] ) . '" title="' . esc_attr__( 'Visit author homepage' , 'give' ) . '">' . $author_name . '</a>'; |
|
628 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
629 | + $author_name = '<a href="'.esc_url($plugin_data['AuthorURI']).'" title="'.esc_attr__('Visit author homepage', 'give').'">'.$author_name.'</a>'; |
|
630 | 630 | } |
631 | 631 | ?> |
632 | 632 | <tr> |
633 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
633 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
634 | 634 | <td class="help"> </td> |
635 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' – ' . esc_html( $plugin_data['Version'] ); ?></td> |
|
635 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))).' – '.esc_html($plugin_data['Version']); ?></td> |
|
636 | 636 | </tr> |
637 | 637 | <?php |
638 | 638 | } |
@@ -643,13 +643,13 @@ discard block |
||
643 | 643 | <table class="give-status-table widefat" cellspacing="0"> |
644 | 644 | <thead> |
645 | 645 | <tr> |
646 | - <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e( 'Inactive Plugins', 'give' ); ?></h2></th> |
|
646 | + <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e('Inactive Plugins', 'give'); ?></h2></th> |
|
647 | 647 | </tr> |
648 | 648 | </thead> |
649 | 649 | <tbody> |
650 | 650 | <?php |
651 | - foreach ( $plugins as $plugin_data ) { |
|
652 | - if ( 'inactive' != $plugin_data['Status'] ) { |
|
651 | + foreach ($plugins as $plugin_data) { |
|
652 | + if ('inactive' != $plugin_data['Status']) { |
|
653 | 653 | continue; |
654 | 654 | } |
655 | 655 | |
@@ -657,19 +657,19 @@ discard block |
||
657 | 657 | $author_name = $plugin_data['Author']; |
658 | 658 | |
659 | 659 | // Link the plugin name to the plugin URL if available. |
660 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
661 | - $plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
660 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
661 | + $plugin_name = '<a href="'.esc_url($plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | // Link the author name to the author URL if available. |
665 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
666 | - $author_name = '<a href="' . esc_url( $plugin_data['AuthorURI'] ) . '" title="' . esc_attr__( 'Visit author homepage' , 'give' ) . '">' . $author_name . '</a>'; |
|
665 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
666 | + $author_name = '<a href="'.esc_url($plugin_data['AuthorURI']).'" title="'.esc_attr__('Visit author homepage', 'give').'">'.$author_name.'</a>'; |
|
667 | 667 | } |
668 | 668 | ?> |
669 | 669 | <tr> |
670 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
670 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
671 | 671 | <td class="help"> </td> |
672 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' – ' . esc_html( $plugin_data['Version'] ); ?></td> |
|
672 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))).' – '.esc_html($plugin_data['Version']); ?></td> |
|
673 | 673 | </tr> |
674 | 674 | <?php |
675 | 675 | } |
@@ -679,37 +679,37 @@ discard block |
||
679 | 679 | |
680 | 680 | <?php |
681 | 681 | $active_mu_plugins = (array) get_mu_plugins(); |
682 | -if ( ! empty( $active_mu_plugins ) ) { |
|
682 | +if ( ! empty($active_mu_plugins)) { |
|
683 | 683 | ?> |
684 | 684 | <table class="give-status-table widefat" cellspacing="0"> |
685 | 685 | <thead> |
686 | 686 | <tr> |
687 | - <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e( 'Active MU Plugins', 'give' ); ?></h2></th> |
|
687 | + <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e('Active MU Plugins', 'give'); ?></h2></th> |
|
688 | 688 | </tr> |
689 | 689 | </thead> |
690 | 690 | <tbody> |
691 | 691 | <?php |
692 | 692 | |
693 | - foreach ( $active_mu_plugins as $mu_plugin_data ) { |
|
694 | - if ( ! empty( $mu_plugin_data['Name'] ) ) { |
|
693 | + foreach ($active_mu_plugins as $mu_plugin_data) { |
|
694 | + if ( ! empty($mu_plugin_data['Name'])) { |
|
695 | 695 | // Link the plugin name to the plugin URL if available. |
696 | - $plugin_name = esc_html( $mu_plugin_data['Name'] ); |
|
696 | + $plugin_name = esc_html($mu_plugin_data['Name']); |
|
697 | 697 | |
698 | - if ( ! empty( $mu_plugin_data['PluginURI'] ) ) { |
|
699 | - $plugin_name = '<a href="' . esc_url( $mu_plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
698 | + if ( ! empty($mu_plugin_data['PluginURI'])) { |
|
699 | + $plugin_name = '<a href="'.esc_url($mu_plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | // Link the author name to the author URL if available. |
703 | - $author_name = esc_html( $mu_plugin_data['Author'] ); |
|
703 | + $author_name = esc_html($mu_plugin_data['Author']); |
|
704 | 704 | |
705 | - if ( ! empty( $mu_plugin_data['AuthorURI'] ) ) { |
|
706 | - $author_name = '<a href="' . esc_url( $mu_plugin_data['AuthorURI'] ) . '">' . $author_name . '</a>'; |
|
705 | + if ( ! empty($mu_plugin_data['AuthorURI'])) { |
|
706 | + $author_name = '<a href="'.esc_url($mu_plugin_data['AuthorURI']).'">'.$author_name.'</a>'; |
|
707 | 707 | } |
708 | 708 | ?> |
709 | 709 | <tr> |
710 | 710 | <td><?php echo $plugin_name; ?></td> |
711 | 711 | <td class="help"> </td> |
712 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), $author_name ) . ' – ' . esc_html( $mu_plugin_data['Version'] ); ?></td> |
|
712 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), $author_name).' – '.esc_html($mu_plugin_data['Version']); ?></td> |
|
713 | 713 | </tr> |
714 | 714 | <?php |
715 | 715 | } |
@@ -722,53 +722,53 @@ discard block |
||
722 | 722 | <table class="give-status-table widefat" cellspacing="0"> |
723 | 723 | <thead> |
724 | 724 | <tr> |
725 | - <th colspan="3" data-export-label="Theme"><h2><?php _e( 'Theme', 'give' ); ?></h2></th> |
|
725 | + <th colspan="3" data-export-label="Theme"><h2><?php _e('Theme', 'give'); ?></h2></th> |
|
726 | 726 | </tr> |
727 | 727 | </thead> |
728 | 728 | <?php |
729 | - include_once( ABSPATH . 'wp-admin/includes/theme-install.php' ); |
|
729 | + include_once(ABSPATH.'wp-admin/includes/theme-install.php'); |
|
730 | 730 | $active_theme = wp_get_theme(); |
731 | 731 | ?> |
732 | 732 | <tbody> |
733 | 733 | <tr> |
734 | - <td data-export-label="Name"><?php _e( 'Name', 'give' ); ?>:</td> |
|
735 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The name of the current active theme.', 'give' ) ); ?>"></span></td> |
|
736 | - <td><?php echo esc_html( $active_theme->Name ); ?></td> |
|
734 | + <td data-export-label="Name"><?php _e('Name', 'give'); ?>:</td> |
|
735 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The name of the current active theme.', 'give')); ?>"></span></td> |
|
736 | + <td><?php echo esc_html($active_theme->Name); ?></td> |
|
737 | 737 | </tr> |
738 | 738 | <tr> |
739 | - <td data-export-label="Version"><?php _e( 'Version', 'give' ); ?>:</td> |
|
740 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The installed version of the current active theme.', 'give' ) ); ?>"></span></td> |
|
741 | - <td><?php echo esc_html( $active_theme->Version ); ?></td> |
|
739 | + <td data-export-label="Version"><?php _e('Version', 'give'); ?>:</td> |
|
740 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The installed version of the current active theme.', 'give')); ?>"></span></td> |
|
741 | + <td><?php echo esc_html($active_theme->Version); ?></td> |
|
742 | 742 | </tr> |
743 | 743 | <tr> |
744 | - <td data-export-label="Author URL"><?php _e( 'Author URL', 'give' ); ?>:</td> |
|
745 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The theme developer\'s URL.', 'give' ) ); ?>"></span></td> |
|
744 | + <td data-export-label="Author URL"><?php _e('Author URL', 'give'); ?>:</td> |
|
745 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The theme developer\'s URL.', 'give')); ?>"></span></td> |
|
746 | 746 | <td><?php echo $active_theme->{'Author URI'}; ?></td> |
747 | 747 | </tr> |
748 | 748 | <tr> |
749 | - <td data-export-label="Child Theme"><?php _e( 'Child Theme', 'give' ); ?>:</td> |
|
750 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether the current theme is a child theme.', 'give' ) ); ?>"></span></td> |
|
749 | + <td data-export-label="Child Theme"><?php _e('Child Theme', 'give'); ?>:</td> |
|
750 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether the current theme is a child theme.', 'give')); ?>"></span></td> |
|
751 | 751 | <td><?php |
752 | - echo is_child_theme() ? __( 'Yes', 'give' ) : __( 'No', 'give' ) . ' – ' . sprintf( __( 'If you\'re modifying Give on a parent theme you didn\'t build personally, then we recommend using a child theme. See: <a href="%s" target="_blank">How to Create a Child Theme</a>', 'give' ), 'https://codex.wordpress.org/Child_Themes' ); |
|
752 | + echo is_child_theme() ? __('Yes', 'give') : __('No', 'give').' – '.sprintf(__('If you\'re modifying Give on a parent theme you didn\'t build personally, then we recommend using a child theme. See: <a href="%s" target="_blank">How to Create a Child Theme</a>', 'give'), 'https://codex.wordpress.org/Child_Themes'); |
|
753 | 753 | ?></td> |
754 | 754 | </tr> |
755 | 755 | <?php |
756 | - if( is_child_theme() ) { |
|
757 | - $parent_theme = wp_get_theme( $active_theme->Template ); |
|
756 | + if (is_child_theme()) { |
|
757 | + $parent_theme = wp_get_theme($active_theme->Template); |
|
758 | 758 | ?> |
759 | 759 | <tr> |
760 | - <td data-export-label="Parent Theme Name"><?php _e( 'Parent Theme Name', 'give' ); ?>:</td> |
|
761 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The name of the parent theme.', 'give' ) ); ?>"></span></td> |
|
762 | - <td><?php echo esc_html( $parent_theme->Name ); ?></td> |
|
760 | + <td data-export-label="Parent Theme Name"><?php _e('Parent Theme Name', 'give'); ?>:</td> |
|
761 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The name of the parent theme.', 'give')); ?>"></span></td> |
|
762 | + <td><?php echo esc_html($parent_theme->Name); ?></td> |
|
763 | 763 | </tr> |
764 | 764 | <tr> |
765 | - <td data-export-label="Parent Theme Version"><?php _e( 'Parent Theme Version', 'give' ); ?>:</td> |
|
766 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The installed version of the parent theme.', 'give' ) ); ?>"></span></td> |
|
767 | - <td><?php echo esc_html( $parent_theme->Version ); ?></td> |
|
765 | + <td data-export-label="Parent Theme Version"><?php _e('Parent Theme Version', 'give'); ?>:</td> |
|
766 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The installed version of the parent theme.', 'give')); ?>"></span></td> |
|
767 | + <td><?php echo esc_html($parent_theme->Version); ?></td> |
|
768 | 768 | </tr> |
769 | 769 | <tr> |
770 | - <td data-export-label="Parent Theme Author URL"><?php _e( 'Parent Theme Author URL', 'give' ); ?>:</td> |
|
771 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The parent theme developers URL.', 'give' ) ); ?>"></span></td> |
|
770 | + <td data-export-label="Parent Theme Author URL"><?php _e('Parent Theme Author URL', 'give'); ?>:</td> |
|
771 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The parent theme developers URL.', 'give')); ?>"></span></td> |
|
772 | 772 | <td><?php echo $parent_theme->{'Author URI'}; ?></td> |
773 | 773 | </tr> |
774 | 774 | <?php } ?> |
@@ -57,7 +57,12 @@ discard block |
||
57 | 57 | <tr> |
58 | 58 | <td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td> |
59 | 59 | <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?>"></span></td> |
60 | - <td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
60 | + <td><?php if ( is_multisite() ) { |
|
61 | + echo '<span class="dashicons dashicons-yes"></span>'; |
|
62 | +} else { |
|
63 | + echo '–'; |
|
64 | +} |
|
65 | +?></td> |
|
61 | 66 | </tr> |
62 | 67 | <tr> |
63 | 68 | <td data-export-label="WP Memory Limit"><?php _e( 'WP Memory Limit', 'give' ); ?>:</td> |
@@ -85,9 +90,12 @@ discard block |
||
85 | 90 | <td> |
86 | 91 | <?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?> |
87 | 92 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
88 | - <?php else : ?> |
|
93 | + <?php else { |
|
94 | + : ?> |
|
89 | 95 | <mark class="no">–</mark> |
90 | - <?php endif; ?> |
|
96 | + <?php endif; |
|
97 | +} |
|
98 | +?> |
|
91 | 99 | </td> |
92 | 100 | </tr> |
93 | 101 | <tr> |
@@ -96,9 +104,12 @@ discard block |
||
96 | 104 | <td> |
97 | 105 | <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
98 | 106 | <mark class="no">–</mark> |
99 | - <?php else : ?> |
|
107 | + <?php else { |
|
108 | + : ?> |
|
100 | 109 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
101 | - <?php endif; ?> |
|
110 | + <?php endif; |
|
111 | +} |
|
112 | +?> |
|
102 | 113 | </td> |
103 | 114 | </tr> |
104 | 115 | <tr> |