@@ -270,7 +270,7 @@ |
||
270 | 270 | * @access public |
271 | 271 | * @since 1.0 |
272 | 272 | * |
273 | - * @param $username string - the username to validate |
|
273 | + * @param string $username string - the username to validate |
|
274 | 274 | * |
275 | 275 | * @return bool |
276 | 276 | */ |
@@ -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 purchases |
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_purchases_args', array( |
|
55 | + $args = apply_filters('give_get_users_purchases_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_purchases_args', $args ) ); |
|
82 | + $purchases = give_get_payments(apply_filters('give_get_users_purchases_args', $args)); |
|
83 | 83 | |
84 | 84 | // No purchases |
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 purchased 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 purchased |
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 purchased 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 product purchased 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 purchased, 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 purchase |
185 | 185 | } |
186 | 186 | |
@@ -200,32 +200,32 @@ 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 | |
227 | 227 | |
228 | - return (array) apply_filters( 'give_purchase_stats_by_user', $stats, $user ); |
|
228 | + return (array) apply_filters('give_purchase_stats_by_user', $stats, $user); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | |
@@ -241,22 +241,22 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @return int - the total number of purchases |
243 | 243 | */ |
244 | -function give_count_purchases_of_customer( $user = null ) { |
|
244 | +function give_count_purchases_of_customer($user = null) { |
|
245 | 245 | |
246 | 246 | //Logged in? |
247 | - if ( empty( $user ) ) { |
|
247 | + if (empty($user)) { |
|
248 | 248 | $user = get_current_user_id(); |
249 | 249 | } |
250 | 250 | |
251 | 251 | //Email access? |
252 | - if ( empty( $user ) && Give()->email_access->token_email ) { |
|
252 | + if (empty($user) && Give()->email_access->token_email) { |
|
253 | 253 | $user = Give()->email_access->token_email; |
254 | 254 | } |
255 | 255 | |
256 | 256 | |
257 | - $stats = ! empty( $user ) ? give_get_purchase_stats_by_user( $user ) : false; |
|
257 | + $stats = ! empty($user) ? give_get_purchase_stats_by_user($user) : false; |
|
258 | 258 | |
259 | - return isset( $stats['purchases'] ) ? $stats['purchases'] : 0; |
|
259 | + return isset($stats['purchases']) ? $stats['purchases'] : 0; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -269,9 +269,9 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return float - the total amount the user has spent |
271 | 271 | */ |
272 | -function give_purchase_total_of_user( $user = null ) { |
|
272 | +function give_purchase_total_of_user($user = null) { |
|
273 | 273 | |
274 | - $stats = give_get_purchase_stats_by_user( $user ); |
|
274 | + $stats = give_get_purchase_stats_by_user($user); |
|
275 | 275 | |
276 | 276 | return $stats['total_spent']; |
277 | 277 | } |
@@ -287,11 +287,11 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @return bool |
289 | 289 | */ |
290 | -function give_validate_username( $username ) { |
|
291 | - $sanitized = sanitize_user( $username, false ); |
|
292 | - $valid = ( $sanitized == $username ); |
|
290 | +function give_validate_username($username) { |
|
291 | + $sanitized = sanitize_user($username, false); |
|
292 | + $valid = ($sanitized == $username); |
|
293 | 293 | |
294 | - return (bool) apply_filters( 'give_validate_username', $valid, $username ); |
|
294 | + return (bool) apply_filters('give_validate_username', $valid, $username); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
@@ -308,32 +308,32 @@ discard block |
||
308 | 308 | * |
309 | 309 | * @return void |
310 | 310 | */ |
311 | -function give_add_past_purchases_to_new_user( $user_id ) { |
|
311 | +function give_add_past_purchases_to_new_user($user_id) { |
|
312 | 312 | |
313 | - $email = get_the_author_meta( 'user_email', $user_id ); |
|
313 | + $email = get_the_author_meta('user_email', $user_id); |
|
314 | 314 | |
315 | - $payments = give_get_payments( array( 's' => $email ) ); |
|
315 | + $payments = give_get_payments(array('s' => $email)); |
|
316 | 316 | |
317 | - if ( $payments ) { |
|
318 | - foreach ( $payments as $payment ) { |
|
319 | - if ( intval( give_get_payment_user_id( $payment->ID ) ) > 0 ) { |
|
317 | + if ($payments) { |
|
318 | + foreach ($payments as $payment) { |
|
319 | + if (intval(give_get_payment_user_id($payment->ID)) > 0) { |
|
320 | 320 | continue; |
321 | 321 | } // This payment already associated with an account |
322 | 322 | |
323 | - $meta = give_get_payment_meta( $payment->ID ); |
|
324 | - $meta['user_info'] = maybe_unserialize( $meta['user_info'] ); |
|
323 | + $meta = give_get_payment_meta($payment->ID); |
|
324 | + $meta['user_info'] = maybe_unserialize($meta['user_info']); |
|
325 | 325 | $meta['user_info']['id'] = $user_id; |
326 | 326 | $meta['user_info'] = $meta['user_info']; |
327 | 327 | |
328 | 328 | // Store the updated user ID in the payment meta |
329 | - give_update_payment_meta( $payment->ID, '_give_payment_meta', $meta ); |
|
330 | - give_update_payment_meta( $payment->ID, '_give_payment_user_id', $user_id ); |
|
329 | + give_update_payment_meta($payment->ID, '_give_payment_meta', $meta); |
|
330 | + give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id); |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | |
334 | 334 | } |
335 | 335 | |
336 | -add_action( 'user_register', 'give_add_past_purchases_to_new_user' ); |
|
336 | +add_action('user_register', 'give_add_past_purchases_to_new_user'); |
|
337 | 337 | |
338 | 338 | |
339 | 339 | /** |
@@ -355,34 +355,34 @@ discard block |
||
355 | 355 | * @since 1.0 |
356 | 356 | * @return array - The donor's address, if any |
357 | 357 | */ |
358 | -function give_get_donor_address( $user_id = 0 ) { |
|
359 | - if ( empty( $user_id ) ) { |
|
358 | +function give_get_donor_address($user_id = 0) { |
|
359 | + if (empty($user_id)) { |
|
360 | 360 | $user_id = get_current_user_id(); |
361 | 361 | } |
362 | 362 | |
363 | - $address = get_user_meta( $user_id, '_give_user_address', true ); |
|
363 | + $address = get_user_meta($user_id, '_give_user_address', true); |
|
364 | 364 | |
365 | - if ( ! isset( $address['line1'] ) ) { |
|
365 | + if ( ! isset($address['line1'])) { |
|
366 | 366 | $address['line1'] = ''; |
367 | 367 | } |
368 | 368 | |
369 | - if ( ! isset( $address['line2'] ) ) { |
|
369 | + if ( ! isset($address['line2'])) { |
|
370 | 370 | $address['line2'] = ''; |
371 | 371 | } |
372 | 372 | |
373 | - if ( ! isset( $address['city'] ) ) { |
|
373 | + if ( ! isset($address['city'])) { |
|
374 | 374 | $address['city'] = ''; |
375 | 375 | } |
376 | 376 | |
377 | - if ( ! isset( $address['zip'] ) ) { |
|
377 | + if ( ! isset($address['zip'])) { |
|
378 | 378 | $address['zip'] = ''; |
379 | 379 | } |
380 | 380 | |
381 | - if ( ! isset( $address['country'] ) ) { |
|
381 | + if ( ! isset($address['country'])) { |
|
382 | 382 | $address['country'] = ''; |
383 | 383 | } |
384 | 384 | |
385 | - if ( ! isset( $address['state'] ) ) { |
|
385 | + if ( ! isset($address['state'])) { |
|
386 | 386 | $address['state'] = ''; |
387 | 387 | } |
388 | 388 | |
@@ -402,53 +402,53 @@ discard block |
||
402 | 402 | * |
403 | 403 | * @return void |
404 | 404 | */ |
405 | -function give_new_user_notification( $user_id = 0, $user_data = array() ) { |
|
405 | +function give_new_user_notification($user_id = 0, $user_data = array()) { |
|
406 | 406 | |
407 | - if ( empty( $user_id ) || empty( $user_data ) ) { |
|
407 | + if (empty($user_id) || empty($user_data)) { |
|
408 | 408 | return; |
409 | 409 | } |
410 | - $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); |
|
410 | + $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
|
411 | 411 | |
412 | 412 | /* translators: %s: site name */ |
413 | - $message = sprintf( esc_html__( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n"; |
|
413 | + $message = sprintf(esc_html__('New user registration on your site %s:'), $blogname)."\r\n\r\n"; |
|
414 | 414 | /* translators: %s: user login */ |
415 | - $message .= sprintf( esc_html__( 'Username: %s' ), $user_data['user_login'] ) . "\r\n\r\n"; |
|
415 | + $message .= sprintf(esc_html__('Username: %s'), $user_data['user_login'])."\r\n\r\n"; |
|
416 | 416 | /* translators: %s: user email */ |
417 | - $message .= sprintf( esc_html__( 'E-mail: %s' ), $user_data['user_email'] ) . "\r\n"; |
|
417 | + $message .= sprintf(esc_html__('E-mail: %s'), $user_data['user_email'])."\r\n"; |
|
418 | 418 | |
419 | 419 | @wp_mail( |
420 | - get_option( 'admin_email' ), |
|
420 | + get_option('admin_email'), |
|
421 | 421 | sprintf( |
422 | 422 | /* translators: %s: site name */ |
423 | - esc_html__( '[%s] New User Registration' ), |
|
423 | + esc_html__('[%s] New User Registration'), |
|
424 | 424 | $blogname |
425 | 425 | ), |
426 | 426 | $message |
427 | 427 | ); |
428 | 428 | |
429 | 429 | /* translators: %s: user login */ |
430 | - $message = sprintf( |
|
431 | - esc_html__( 'Username: %s' ), |
|
430 | + $message = sprintf( |
|
431 | + esc_html__('Username: %s'), |
|
432 | 432 | $user_data['user_login'] |
433 | - ) . "\r\n"; |
|
433 | + )."\r\n"; |
|
434 | 434 | |
435 | 435 | /* translators: %s: paswword */ |
436 | 436 | $message .= sprintf( |
437 | - esc_html__( 'Password: %s' ), |
|
438 | - esc_html__( '[Password entered during donation]', 'give' ) |
|
439 | - ) . "\r\n"; |
|
437 | + esc_html__('Password: %s'), |
|
438 | + esc_html__('[Password entered during donation]', 'give') |
|
439 | + )."\r\n"; |
|
440 | 440 | |
441 | 441 | $message .= sprintf( |
442 | 442 | '<a href="%1$s">%2$s</a>', |
443 | 443 | wp_login_url(), |
444 | - esc_html__( 'Click Here to Login', 'give' ) |
|
445 | - ) . "\r\n"; |
|
444 | + esc_html__('Click Here to Login', 'give') |
|
445 | + )."\r\n"; |
|
446 | 446 | |
447 | 447 | wp_mail( |
448 | 448 | $user_data['user_email'], |
449 | 449 | sprintf( |
450 | 450 | /* translators: %s: site name */ |
451 | - esc_html__( '[%s] Your username and password' ), |
|
451 | + esc_html__('[%s] Your username and password'), |
|
452 | 452 | $blogname |
453 | 453 | ), |
454 | 454 | $message |
@@ -456,4 +456,4 @@ discard block |
||
456 | 456 | |
457 | 457 | } |
458 | 458 | |
459 | -add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
459 | +add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | * @return void |
24 | 24 | */ |
25 | 25 | function give_get_actions() { |
26 | - if ( isset( $_GET['give_action'] ) ) { |
|
27 | - do_action( 'give_' . $_GET['give_action'], $_GET ); |
|
26 | + if (isset($_GET['give_action'])) { |
|
27 | + do_action('give_'.$_GET['give_action'], $_GET); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | -add_action( 'init', 'give_get_actions' ); |
|
31 | +add_action('init', 'give_get_actions'); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Hooks Give actions, when present in the $_POST superglobal. Every give_action |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @return void |
40 | 40 | */ |
41 | 41 | function give_post_actions() { |
42 | - if ( isset( $_POST['give_action'] ) ) { |
|
43 | - do_action( 'give_' . $_POST['give_action'], $_POST ); |
|
42 | + if (isset($_POST['give_action'])) { |
|
43 | + do_action('give_'.$_POST['give_action'], $_POST); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | -add_action( 'init', 'give_post_actions' ); |
|
48 | 47 | \ No newline at end of file |
48 | +add_action('init', 'give_post_actions'); |
|
49 | 49 | \ 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 | |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | * @return void |
23 | 23 | */ |
24 | 24 | function give_process_actions() { |
25 | - if ( isset( $_POST['give-action'] ) ) { |
|
26 | - do_action( 'give_' . $_POST['give-action'], $_POST ); |
|
25 | + if (isset($_POST['give-action'])) { |
|
26 | + do_action('give_'.$_POST['give-action'], $_POST); |
|
27 | 27 | } |
28 | 28 | |
29 | - if ( isset( $_GET['give-action'] ) ) { |
|
30 | - do_action( 'give_' . $_GET['give-action'], $_GET ); |
|
29 | + if (isset($_GET['give-action'])) { |
|
30 | + do_action('give_'.$_GET['give-action'], $_GET); |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | -add_action( 'admin_init', 'give_process_actions' ); |
|
35 | 34 | \ No newline at end of file |
35 | +add_action('admin_init', 'give_process_actions'); |
|
36 | 36 | \ 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' ) ) exit; |
|
13 | +if ( ! defined('ABSPATH')) exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Payment History Page |
@@ -24,19 +24,19 @@ discard block |
||
24 | 24 | function give_payment_history_page() { |
25 | 25 | global $give_options; |
26 | 26 | |
27 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
27 | + $give_payment = get_post_type_object('give_payment'); |
|
28 | 28 | |
29 | - if ( isset( $_GET['view'] ) && 'view-order-details' == $_GET['view'] ) { |
|
30 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-order-details.php'; |
|
29 | + if (isset($_GET['view']) && 'view-order-details' == $_GET['view']) { |
|
30 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-order-details.php'; |
|
31 | 31 | } else { |
32 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
32 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
33 | 33 | $payments_table = new Give_Payment_History_Table(); |
34 | 34 | $payments_table->prepare_items(); |
35 | 35 | ?> |
36 | 36 | <div class="wrap"> |
37 | 37 | <h2><?php echo $give_payment->labels->menu_name ?></h2> |
38 | - <?php do_action( 'give_payments_page_top' ); ?> |
|
39 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
38 | + <?php do_action('give_payments_page_top'); ?> |
|
39 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
40 | 40 | <input type="hidden" name="post_type" value="give_forms" /> |
41 | 41 | <input type="hidden" name="page" value="give-payment-history" /> |
42 | 42 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | <?php $payments_table->display() ?> |
48 | 48 | </form> |
49 | - <?php do_action( 'give_payments_page_bottom' ); ?> |
|
49 | + <?php do_action('give_payments_page_bottom'); ?> |
|
50 | 50 | </div> |
51 | 51 | <?php |
52 | 52 | } |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | * @param $title |
62 | 62 | * @return string |
63 | 63 | */ |
64 | -function give_view_order_details_title( $admin_title, $title ) { |
|
64 | +function give_view_order_details_title($admin_title, $title) { |
|
65 | 65 | |
66 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) |
|
66 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) |
|
67 | 67 | return $admin_title; |
68 | 68 | |
69 | - if( ! isset( $_GET['give-action'] ) ) |
|
69 | + if ( ! isset($_GET['give-action'])) |
|
70 | 70 | return $admin_title; |
71 | 71 | |
72 | - switch( $_GET['give-action'] ) : |
|
72 | + switch ($_GET['give-action']) : |
|
73 | 73 | |
74 | 74 | case 'view-order-details' : |
75 | - $title = __( 'View Donation Details', 'give' ) . ' - ' . $admin_title; |
|
75 | + $title = __('View Donation Details', 'give').' - '.$admin_title; |
|
76 | 76 | break; |
77 | 77 | case 'edit-payment' : |
78 | - $title = __( 'Edit Payment', 'give' ) . ' - ' . $admin_title; |
|
78 | + $title = __('Edit Payment', 'give').' - '.$admin_title; |
|
79 | 79 | break; |
80 | 80 | default: |
81 | 81 | $title = $admin_title; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | return $title; |
86 | 86 | } |
87 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
87 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | * @param $context |
97 | 97 | * @return string |
98 | 98 | */ |
99 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
99 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
100 | 100 | |
101 | - $post = get_post( $post_id ); |
|
102 | - if( ! $post ) |
|
101 | + $post = get_post($post_id); |
|
102 | + if ( ! $post) |
|
103 | 103 | return $url; |
104 | 104 | |
105 | - if( 'give_payment' != $post->post_type ) |
|
105 | + if ('give_payment' != $post->post_type) |
|
106 | 106 | return $url; |
107 | 107 | |
108 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id ); |
|
108 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$post_id); |
|
109 | 109 | |
110 | 110 | return $url; |
111 | 111 | } |
112 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
112 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
@@ -10,7 +10,9 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
14 | + exit; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | /** |
16 | 18 | * Payment History Page |
@@ -63,11 +65,13 @@ discard block |
||
63 | 65 | */ |
64 | 66 | function give_view_order_details_title( $admin_title, $title ) { |
65 | 67 | |
66 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) |
|
67 | - return $admin_title; |
|
68 | + if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
69 | + return $admin_title; |
|
70 | + } |
|
68 | 71 | |
69 | - if( ! isset( $_GET['give-action'] ) ) |
|
70 | - return $admin_title; |
|
72 | + if( ! isset( $_GET['give-action'] ) ) { |
|
73 | + return $admin_title; |
|
74 | + } |
|
71 | 75 | |
72 | 76 | switch( $_GET['give-action'] ) : |
73 | 77 | |
@@ -99,11 +103,13 @@ discard block |
||
99 | 103 | function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
100 | 104 | |
101 | 105 | $post = get_post( $post_id ); |
102 | - if( ! $post ) |
|
103 | - return $url; |
|
106 | + if( ! $post ) { |
|
107 | + return $url; |
|
108 | + } |
|
104 | 109 | |
105 | - if( 'give_payment' != $post->post_type ) |
|
106 | - return $url; |
|
110 | + if( 'give_payment' != $post->post_type ) { |
|
111 | + return $url; |
|
112 | + } |
|
107 | 113 | |
108 | 114 | $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id ); |
109 | 115 |
@@ -440,8 +440,10 @@ |
||
440 | 440 | echo give_get_payment_note_html( $note, $payment_id ); |
441 | 441 | |
442 | 442 | endforeach; |
443 | - else : |
|
443 | + else { |
|
444 | + : |
|
444 | 445 | $no_notes_display = ''; |
446 | + } |
|
445 | 447 | endif; |
446 | 448 | echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>'; |
447 | 449 | ?> |
@@ -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 | |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
24 | - wp_die( esc_html__( 'Donation ID not supplied. Please try again', 'give' ), esc_html__( 'Error', 'give' ) ); |
|
23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
24 | + wp_die(esc_html__('Donation ID not supplied. Please try again', 'give'), esc_html__('Error', 'give')); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // Setup the variables |
28 | -$payment_id = absint( $_GET['id'] ); |
|
29 | -$payment = new Give_Payment( $payment_id ); |
|
28 | +$payment_id = absint($_GET['id']); |
|
29 | +$payment = new Give_Payment($payment_id); |
|
30 | 30 | |
31 | 31 | // Sanity check... fail if purchase ID is invalid |
32 | 32 | $payment_exists = $payment->ID; |
33 | -if ( empty( $payment_exists ) ) { |
|
34 | - wp_die( esc_html__( 'The specified ID does not belong to a payment. Please try again', 'give' ), esc_html__( 'Error', 'give' ) ); |
|
33 | +if (empty($payment_exists)) { |
|
34 | + wp_die(esc_html__('The specified ID does not belong to a payment. Please try again', 'give'), esc_html__('Error', 'give')); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $number = $payment->number; |
38 | 38 | $payment_meta = $payment->get_meta(); |
39 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
39 | +$transaction_id = esc_attr($payment->transaction_id); |
|
40 | 40 | $user_id = $payment->user_id; |
41 | 41 | $customer_id = $payment->customer_id; |
42 | -$payment_date = strtotime( $payment->date ); |
|
43 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
42 | +$payment_date = strtotime($payment->date); |
|
43 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
44 | 44 | $address = $payment->address; |
45 | 45 | $gateway = $payment->gateway; |
46 | 46 | $currency_code = $payment->currency; |
@@ -52,76 +52,76 @@ discard block |
||
52 | 52 | <h1 id="transaction-details-heading"><?php |
53 | 53 | printf( |
54 | 54 | /* translators: %s: payment number */ |
55 | - esc_html__( 'Payment %s', 'give' ), |
|
55 | + esc_html__('Payment %s', 'give'), |
|
56 | 56 | $number |
57 | 57 | ); |
58 | - if ( $payment_mode == 'test' ) { |
|
59 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This payment was made in Test Mode', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Payment', 'give' ) . '</span>'; |
|
58 | + if ($payment_mode == 'test') { |
|
59 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This payment was made in Test Mode', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Payment', 'give').'</span>'; |
|
60 | 60 | } |
61 | 61 | ?></h1> |
62 | 62 | |
63 | - <?php do_action( 'give_view_order_details_before', $payment_id ); ?> |
|
63 | + <?php do_action('give_view_order_details_before', $payment_id); ?> |
|
64 | 64 | <form id="give-edit-order-form" method="post"> |
65 | - <?php do_action( 'give_view_order_details_form_top', $payment_id ); ?> |
|
65 | + <?php do_action('give_view_order_details_form_top', $payment_id); ?> |
|
66 | 66 | <div id="poststuff"> |
67 | 67 | <div id="give-dashboard-widgets-wrap"> |
68 | 68 | <div id="post-body" class="metabox-holder columns-2"> |
69 | 69 | <div id="postbox-container-1" class="postbox-container"> |
70 | 70 | <div id="side-sortables" class="meta-box-sortables ui-sortable"> |
71 | 71 | |
72 | - <?php do_action( 'give_view_order_details_sidebar_before', $payment_id ); ?> |
|
72 | + <?php do_action('give_view_order_details_sidebar_before', $payment_id); ?> |
|
73 | 73 | |
74 | 74 | |
75 | 75 | <div id="give-order-update" class="postbox give-order-data"> |
76 | 76 | |
77 | 77 | <h3 class="hndle"> |
78 | - <span><?php esc_html_e( 'Update Payment', 'give' ); ?></span> |
|
78 | + <span><?php esc_html_e('Update Payment', 'give'); ?></span> |
|
79 | 79 | </h3> |
80 | 80 | |
81 | 81 | <div class="inside"> |
82 | 82 | <div class="give-admin-box"> |
83 | 83 | |
84 | - <?php do_action( 'give_view_order_details_totals_before', $payment_id ); ?> |
|
84 | + <?php do_action('give_view_order_details_totals_before', $payment_id); ?> |
|
85 | 85 | |
86 | 86 | <div class="give-admin-box-inside"> |
87 | 87 | <p> |
88 | - <span class="label"><?php esc_html_e( 'Status:', 'give' ); ?></span> |
|
88 | + <span class="label"><?php esc_html_e('Status:', 'give'); ?></span> |
|
89 | 89 | <select name="give-payment-status" class="medium-text"> |
90 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
91 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
90 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
91 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
92 | 92 | <?php endforeach; ?> |
93 | 93 | </select> |
94 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
94 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
95 | 95 | </p> |
96 | 96 | </div> |
97 | 97 | |
98 | 98 | <div class="give-admin-box-inside"> |
99 | 99 | <p> |
100 | - <span class="label"><?php esc_html_e( 'Date:', 'give' ); ?></span> |
|
101 | - <input type="text" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
100 | + <span class="label"><?php esc_html_e('Date:', 'give'); ?></span> |
|
101 | + <input type="text" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
102 | 102 | </p> |
103 | 103 | </div> |
104 | 104 | |
105 | 105 | <div class="give-admin-box-inside"> |
106 | 106 | <p> |
107 | - <span class="label"><?php esc_html_e( 'Time:', 'give' ); ?></span> |
|
108 | - <input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
109 | - <input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
107 | + <span class="label"><?php esc_html_e('Time:', 'give'); ?></span> |
|
108 | + <input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
109 | + <input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
110 | 110 | </p> |
111 | 111 | </div> |
112 | 112 | |
113 | - <?php do_action( 'give_view_order_details_update_inner', $payment_id ); ?> |
|
113 | + <?php do_action('give_view_order_details_update_inner', $payment_id); ?> |
|
114 | 114 | |
115 | 115 | <?php |
116 | 116 | //@TODO: Fees |
117 | - $fees = give_get_payment_fees( $payment_id ); |
|
118 | - if ( ! empty( $fees ) ) : ?> |
|
117 | + $fees = give_get_payment_fees($payment_id); |
|
118 | + if ( ! empty($fees)) : ?> |
|
119 | 119 | <div class="give-order-fees give-admin-box-inside"> |
120 | - <p class="strong"><?php esc_html_e( 'Fees', 'give' ); ?>:</p> |
|
120 | + <p class="strong"><?php esc_html_e('Fees', 'give'); ?>:</p> |
|
121 | 121 | <ul class="give-payment-fees"> |
122 | - <?php foreach ( $fees as $fee ) : ?> |
|
122 | + <?php foreach ($fees as $fee) : ?> |
|
123 | 123 | <li> |
124 | - <span class="fee-label"><?php echo $fee['label'] . ':</span> ' . '<span class="fee-amount" data-fee="' . esc_attr( $fee['amount'] ) . '">' . give_currency_filter( $fee['amount'], $currency_code ); ?></span> |
|
124 | + <span class="fee-label"><?php echo $fee['label'].':</span> '.'<span class="fee-amount" data-fee="'.esc_attr($fee['amount']).'">'.give_currency_filter($fee['amount'], $currency_code); ?></span> |
|
125 | 125 | </li> |
126 | 126 | <?php endforeach; ?> |
127 | 127 | </ul> |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | |
132 | 132 | <div class="give-order-payment give-admin-box-inside"> |
133 | 133 | <p> |
134 | - <span class="label"><?php esc_html_e( 'Total Donation', 'give' ); ?>:</span> |
|
135 | - <?php echo give_currency_symbol( $payment->currency ); ?> <input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
134 | + <span class="label"><?php esc_html_e('Total Donation', 'give'); ?>:</span> |
|
135 | + <?php echo give_currency_symbol($payment->currency); ?> <input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/> |
|
136 | 136 | </p> |
137 | 137 | </div> |
138 | 138 | |
139 | - <?php do_action( 'give_view_order_details_totals_after', $payment_id ); ?> |
|
139 | + <?php do_action('give_view_order_details_totals_after', $payment_id); ?> |
|
140 | 140 | |
141 | 141 | </div> |
142 | 142 | <!-- /.give-admin-box --> |
@@ -145,20 +145,20 @@ discard block |
||
145 | 145 | <!-- /.inside --> |
146 | 146 | |
147 | 147 | <div class="give-order-update-box give-admin-box"> |
148 | - <?php do_action( 'give_view_order_details_update_before', $payment_id ); ?> |
|
148 | + <?php do_action('give_view_order_details_update_before', $payment_id); ?> |
|
149 | 149 | <div id="major-publishing-actions"> |
150 | 150 | <div id="publishing-action"> |
151 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Payment', 'give' ); ?>"/> |
|
152 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
153 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
151 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Payment', 'give'); ?>"/> |
|
152 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
153 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
154 | 154 | 'give-action' => 'email_links', |
155 | 155 | 'purchase_id' => $payment_id |
156 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a> |
|
156 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a> |
|
157 | 157 | <?php endif; ?> |
158 | 158 | </div> |
159 | 159 | <div class="clear"></div> |
160 | 160 | </div> |
161 | - <?php do_action( 'give_view_order_details_update_after', $payment_id ); ?> |
|
161 | + <?php do_action('give_view_order_details_update_after', $payment_id); ?> |
|
162 | 162 | </div> |
163 | 163 | <!-- /.give-order-update-box --> |
164 | 164 | |
@@ -168,55 +168,55 @@ discard block |
||
168 | 168 | <div id="give-order-details" class="postbox give-order-data"> |
169 | 169 | |
170 | 170 | <h3 class="hndle"> |
171 | - <span><?php esc_html_e( 'Payment Meta', 'give' ); ?></span> |
|
171 | + <span><?php esc_html_e('Payment Meta', 'give'); ?></span> |
|
172 | 172 | </h3> |
173 | 173 | |
174 | 174 | <div class="inside"> |
175 | 175 | <div class="give-admin-box"> |
176 | 176 | |
177 | - <?php do_action( 'give_view_order_details_payment_meta_before', $payment_id ); ?> |
|
177 | + <?php do_action('give_view_order_details_payment_meta_before', $payment_id); ?> |
|
178 | 178 | |
179 | 179 | <?php |
180 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
181 | - if ( $gateway ) : ?> |
|
180 | + $gateway = give_get_payment_gateway($payment_id); |
|
181 | + if ($gateway) : ?> |
|
182 | 182 | <div class="give-order-gateway give-admin-box-inside"> |
183 | 183 | <p> |
184 | - <span class="label"><?php esc_html_e( 'Gateway:', 'give' ); ?></span> |
|
185 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
184 | + <span class="label"><?php esc_html_e('Gateway:', 'give'); ?></span> |
|
185 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
186 | 186 | </p> |
187 | 187 | </div> |
188 | 188 | <?php endif; ?> |
189 | 189 | |
190 | 190 | <div class="give-order-payment-key give-admin-box-inside"> |
191 | 191 | <p> |
192 | - <span class="label"><?php esc_html_e( 'Key:', 'give' ); ?></span> |
|
193 | - <span><?php echo give_get_payment_key( $payment_id ); ?></span> |
|
192 | + <span class="label"><?php esc_html_e('Key:', 'give'); ?></span> |
|
193 | + <span><?php echo give_get_payment_key($payment_id); ?></span> |
|
194 | 194 | </p> |
195 | 195 | </div> |
196 | 196 | |
197 | 197 | <div class="give-order-ip give-admin-box-inside"> |
198 | 198 | <p> |
199 | - <span class="label"><?php esc_html_e( 'IP:', 'give' ); ?></span> |
|
200 | - <span><?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?></span> |
|
199 | + <span class="label"><?php esc_html_e('IP:', 'give'); ?></span> |
|
200 | + <span><?php echo esc_html(give_get_payment_user_ip($payment_id)); ?></span> |
|
201 | 201 | </p> |
202 | 202 | </div> |
203 | 203 | |
204 | - <?php if ( $transaction_id ) : ?> |
|
204 | + <?php if ($transaction_id) : ?> |
|
205 | 205 | <div class="give-order-tx-id give-admin-box-inside"> |
206 | 206 | <p> |
207 | - <span class="label"><?php esc_html_e( 'Transaction ID:', 'give' ); ?></span> |
|
208 | - <span><?php echo apply_filters( 'give_payment_details_transaction_id-' . $gateway, $transaction_id, $payment_id ); ?></span> |
|
207 | + <span class="label"><?php esc_html_e('Transaction ID:', 'give'); ?></span> |
|
208 | + <span><?php echo apply_filters('give_payment_details_transaction_id-'.$gateway, $transaction_id, $payment_id); ?></span> |
|
209 | 209 | </p> |
210 | 210 | </div> |
211 | 211 | <?php endif; ?> |
212 | 212 | |
213 | 213 | <div class="give-admin-box-inside"> |
214 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?> |
|
215 | - <a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor', 'give' ); ?> »</a> |
|
214 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?> |
|
215 | + <a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor', 'give'); ?> »</a> |
|
216 | 216 | </p> |
217 | 217 | </div> |
218 | 218 | |
219 | - <?php do_action( 'give_view_order_details_payment_meta_after', $payment_id ); ?> |
|
219 | + <?php do_action('give_view_order_details_payment_meta_after', $payment_id); ?> |
|
220 | 220 | |
221 | 221 | </div> |
222 | 222 | <!-- /.column-container --> |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | </div> |
228 | 228 | <!-- /#give-order-data --> |
229 | 229 | |
230 | - <?php do_action( 'give_view_order_details_sidebar_after', $payment_id ); ?> |
|
230 | + <?php do_action('give_view_order_details_sidebar_after', $payment_id); ?> |
|
231 | 231 | |
232 | 232 | </div> |
233 | 233 | <!-- /#side-sortables --> |
@@ -238,12 +238,12 @@ discard block |
||
238 | 238 | |
239 | 239 | <div id="normal-sortables" class="meta-box-sortables ui-sortable"> |
240 | 240 | |
241 | - <?php do_action( 'give_view_order_details_main_before', $payment_id ); ?> |
|
241 | + <?php do_action('give_view_order_details_main_before', $payment_id); ?> |
|
242 | 242 | |
243 | 243 | <?php $column_count = 'columns-3'; ?> |
244 | 244 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
245 | 245 | <h3 class="hndle"> |
246 | - <span><?php esc_html_e( 'Donation Information', 'give' ); ?></span> |
|
246 | + <span><?php esc_html_e('Donation Information', 'give'); ?></span> |
|
247 | 247 | </h3> |
248 | 248 | |
249 | 249 | <div class="inside"> |
@@ -251,31 +251,31 @@ discard block |
||
251 | 251 | <table style="width:100%;"> |
252 | 252 | <thead> |
253 | 253 | <tr> |
254 | - <?php do_action( 'give_donation_details_thead_before', $payment_id ); ?> |
|
255 | - <th><?php esc_html_e( 'Donation Form ID', 'give' ) ?></th> |
|
256 | - <th><?php esc_html_e( 'Donation Form Title', 'give' ) ?></th> |
|
257 | - <th><?php esc_html_e( 'Donation Level', 'give' ) ?></th> |
|
258 | - <th><?php esc_html_e( 'Donation Date', 'give' ) ?></th> |
|
259 | - <th><?php esc_html_e( 'Total Donation', 'give' ) ?></th> |
|
260 | - <?php do_action( 'give_donation_details_thead_after', $payment_id ); ?> |
|
254 | + <?php do_action('give_donation_details_thead_before', $payment_id); ?> |
|
255 | + <th><?php esc_html_e('Donation Form ID', 'give') ?></th> |
|
256 | + <th><?php esc_html_e('Donation Form Title', 'give') ?></th> |
|
257 | + <th><?php esc_html_e('Donation Level', 'give') ?></th> |
|
258 | + <th><?php esc_html_e('Donation Date', 'give') ?></th> |
|
259 | + <th><?php esc_html_e('Total Donation', 'give') ?></th> |
|
260 | + <?php do_action('give_donation_details_thead_after', $payment_id); ?> |
|
261 | 261 | </tr> |
262 | 262 | </thead> |
263 | 263 | <tr> |
264 | - <?php do_action( 'give_donation_details_tbody_before', $payment_id ); ?> |
|
264 | + <?php do_action('give_donation_details_tbody_before', $payment_id); ?> |
|
265 | 265 | <td> |
266 | 266 | <?php echo $payment_meta['form_id']; ?> |
267 | 267 | </td> |
268 | 268 | <td> |
269 | - <?php give_get_form_dropdown( array( |
|
269 | + <?php give_get_form_dropdown(array( |
|
270 | 270 | 'id' => $payment_meta['form_id'], |
271 | 271 | 'selected' => $payment_meta['form_id'], |
272 | 272 | 'chosen' => true |
273 | - ), true ); ?> |
|
273 | + ), true); ?> |
|
274 | 274 | </td> |
275 | 275 | <td> |
276 | 276 | <?php |
277 | - if ( empty( give_has_variable_prices( $payment_meta['form_id'] ) ) ) { |
|
278 | - echo esc_html__( 'n/a', 'give' ); |
|
277 | + if (empty(give_has_variable_prices($payment_meta['form_id']))) { |
|
278 | + echo esc_html__('n/a', 'give'); |
|
279 | 279 | } else { |
280 | 280 | // Variable price dropdown options. |
281 | 281 | $variable_price_dropdown_option = array( |
@@ -287,20 +287,20 @@ discard block |
||
287 | 287 | ); |
288 | 288 | |
289 | 289 | // Render variable prices select tag html. |
290 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
290 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
291 | 291 | } |
292 | 292 | ?> |
293 | 293 | </td> |
294 | 294 | <td> |
295 | 295 | <?php |
296 | 296 | //Transaction Date |
297 | - $date_format = get_option( 'date_format' ); |
|
298 | - echo date_i18n( $date_format, strtotime( $payment_date ) ); |
|
297 | + $date_format = get_option('date_format'); |
|
298 | + echo date_i18n($date_format, strtotime($payment_date)); |
|
299 | 299 | ?> |
300 | 300 | </td> |
301 | 301 | <td> |
302 | - <?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?></td> |
|
303 | - <?php do_action( 'give_donation_details_tbody_after', $payment_id ); ?> |
|
302 | + <?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?></td> |
|
303 | + <?php do_action('give_donation_details_tbody_after', $payment_id); ?> |
|
304 | 304 | |
305 | 305 | </tr> |
306 | 306 | </table> |
@@ -312,64 +312,64 @@ discard block |
||
312 | 312 | </div> |
313 | 313 | <!-- /#give-donation-overview --> |
314 | 314 | |
315 | - <?php do_action( 'give_view_order_details_files_after', $payment_id ); ?> |
|
315 | + <?php do_action('give_view_order_details_files_after', $payment_id); ?> |
|
316 | 316 | |
317 | - <?php do_action( 'give_view_order_details_billing_before', $payment_id ); ?> |
|
317 | + <?php do_action('give_view_order_details_billing_before', $payment_id); ?> |
|
318 | 318 | |
319 | 319 | |
320 | 320 | <div id="give-customer-details" class="postbox"> |
321 | 321 | <h3 class="hndle"> |
322 | - <span><?php esc_html_e( 'Donor Details', 'give' ); ?></span> |
|
322 | + <span><?php esc_html_e('Donor Details', 'give'); ?></span> |
|
323 | 323 | </h3> |
324 | 324 | |
325 | 325 | <div class="inside give-clearfix"> |
326 | 326 | |
327 | - <?php $customer = new Give_Customer( $customer_id ); ?> |
|
327 | + <?php $customer = new Give_Customer($customer_id); ?> |
|
328 | 328 | |
329 | 329 | <div class="column-container customer-info"> |
330 | 330 | <div class="column"> |
331 | - <?php echo Give()->html->donor_dropdown( array( |
|
331 | + <?php echo Give()->html->donor_dropdown(array( |
|
332 | 332 | 'selected' => $customer->id, |
333 | 333 | 'name' => 'customer-id' |
334 | - ) ); ?> |
|
334 | + )); ?> |
|
335 | 335 | </div> |
336 | 336 | <div class="column"> |
337 | 337 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/> |
338 | 338 | </div> |
339 | 339 | <div class="column"> |
340 | - <?php if ( ! empty( $customer->id ) ) : ?> |
|
341 | - <?php $customer_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?> |
|
342 | - <a href="<?php echo $customer_url; ?>" title="<?php esc_attr_e( 'View Donor Details', 'give' ); ?>"><?php esc_html_e( 'View Donor Details', 'give' ); ?></a> |
|
340 | + <?php if ( ! empty($customer->id)) : ?> |
|
341 | + <?php $customer_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?> |
|
342 | + <a href="<?php echo $customer_url; ?>" title="<?php esc_attr_e('View Donor Details', 'give'); ?>"><?php esc_html_e('View Donor Details', 'give'); ?></a> |
|
343 | 343 | | |
344 | 344 | <?php endif; ?> |
345 | - <a href="#new" class="give-payment-new-customer" title="<?php esc_attr_e( 'New Donor', 'give' ); ?>"><?php esc_html_e( 'New Donor', 'give' ); ?></a> |
|
345 | + <a href="#new" class="give-payment-new-customer" title="<?php esc_attr_e('New Donor', 'give'); ?>"><?php esc_html_e('New Donor', 'give'); ?></a> |
|
346 | 346 | </div> |
347 | 347 | </div> |
348 | 348 | |
349 | 349 | <div class="column-container new-customer" style="display: none"> |
350 | 350 | <div class="column"> |
351 | - <label for="give-new-customer-name"><?php esc_html_e( 'Name:', 'give' ); ?></label> |
|
351 | + <label for="give-new-customer-name"><?php esc_html_e('Name:', 'give'); ?></label> |
|
352 | 352 | <input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/> |
353 | 353 | </div> |
354 | 354 | <div class="column"> |
355 | - <label for="give-new-customer-email"><?php esc_html_e( 'Email:', 'give' ); ?></label> |
|
355 | + <label for="give-new-customer-email"><?php esc_html_e('Email:', 'give'); ?></label> |
|
356 | 356 | <input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/> |
357 | 357 | </div> |
358 | 358 | <div class="column"> |
359 | 359 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/> |
360 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a> |
|
360 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a> |
|
361 | 361 | </div> |
362 | 362 | <div class="column"> |
363 | 363 | <small> |
364 | - <em>*<?php esc_html_e( 'Click "Save Payment" to create new donor', 'give' ); ?></em> |
|
364 | + <em>*<?php esc_html_e('Click "Save Payment" to create new donor', 'give'); ?></em> |
|
365 | 365 | </small> |
366 | 366 | </div> |
367 | 367 | </div> |
368 | 368 | |
369 | 369 | <?php |
370 | 370 | // The give_payment_personal_details_list hook is left here for backwards compatibility |
371 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
372 | - do_action( 'give_payment_view_details', $payment_id ); |
|
371 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
372 | + do_action('give_payment_view_details', $payment_id); |
|
373 | 373 | ?> |
374 | 374 | |
375 | 375 | </div> |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | |
381 | 381 | <div id="give-billing-details" class="postbox"> |
382 | 382 | <h3 class="hndle"> |
383 | - <span><?php esc_html_e( 'Billing Address', 'give' ); ?></span> |
|
383 | + <span><?php esc_html_e('Billing Address', 'give'); ?></span> |
|
384 | 384 | </h3> |
385 | 385 | |
386 | 386 | <div class="inside give-clearfix"> |
@@ -391,62 +391,62 @@ discard block |
||
391 | 391 | <div class="data column-container"> |
392 | 392 | <div class="column"> |
393 | 393 | <div class="give-wrap-address-line1"> |
394 | - <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Street Address Line 1:', 'give' ); ?></label> |
|
395 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
394 | + <label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Street Address Line 1:', 'give'); ?></label> |
|
395 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
396 | 396 | </div> |
397 | 397 | |
398 | 398 | <div class="give-wrap-address-line2"> |
399 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Street Address Line 2:', 'give' ); ?></label> |
|
400 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
399 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Street Address Line 2:', 'give'); ?></label> |
|
400 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
401 | 401 | </div> |
402 | 402 | |
403 | 403 | </div> |
404 | 404 | <div class="column"> |
405 | 405 | <div class="give-wrap-address-city"> |
406 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
407 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
406 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
407 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
408 | 408 | |
409 | 409 | </div> |
410 | 410 | |
411 | 411 | <div class="give-wrap-address-zip"> |
412 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
413 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
412 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
413 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
414 | 414 | |
415 | 415 | </div> |
416 | 416 | </div> |
417 | 417 | <div class="column"> |
418 | 418 | <div id="give-order-address-country-wrap"> |
419 | - <label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
419 | + <label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label> |
|
420 | 420 | <?php |
421 | - echo Give()->html->select( array( |
|
421 | + echo Give()->html->select(array( |
|
422 | 422 | 'options' => give_get_country_list(), |
423 | 423 | 'name' => 'give-payment-address[0][country]', |
424 | 424 | 'selected' => $address['country'], |
425 | 425 | 'show_option_all' => false, |
426 | 426 | 'show_option_none' => false, |
427 | 427 | 'chosen' => true, |
428 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ) |
|
429 | - ) ); |
|
428 | + 'placeholder' => esc_attr__('Select a country', 'give') |
|
429 | + )); |
|
430 | 430 | ?> |
431 | 431 | </div> |
432 | 432 | |
433 | 433 | <div id="give-order-address-state-wrap"> |
434 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label> |
|
434 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label> |
|
435 | 435 | <?php |
436 | - $states = give_get_states( $address['country'] ); |
|
437 | - if ( ! empty( $states ) ) { |
|
438 | - echo Give()->html->select( array( |
|
436 | + $states = give_get_states($address['country']); |
|
437 | + if ( ! empty($states)) { |
|
438 | + echo Give()->html->select(array( |
|
439 | 439 | 'options' => $states, |
440 | 440 | 'name' => 'give-payment-address[0][state]', |
441 | 441 | 'selected' => $address['state'], |
442 | 442 | 'show_option_all' => false, |
443 | 443 | 'show_option_none' => false, |
444 | 444 | 'chosen' => true, |
445 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ) |
|
446 | - ) ); |
|
445 | + 'placeholder' => esc_attr__('Select a state', 'give') |
|
446 | + )); |
|
447 | 447 | } else { |
448 | 448 | ?> |
449 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
449 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
450 | 450 | <?php |
451 | 451 | } ?> |
452 | 452 | </div> |
@@ -456,38 +456,38 @@ discard block |
||
456 | 456 | </div> |
457 | 457 | <!-- /#give-order-address --> |
458 | 458 | |
459 | - <?php do_action( 'give_payment_billing_details', $payment_id ); ?> |
|
459 | + <?php do_action('give_payment_billing_details', $payment_id); ?> |
|
460 | 460 | |
461 | 461 | </div> |
462 | 462 | <!-- /.inside --> |
463 | 463 | </div> |
464 | 464 | <!-- /#give-billing-details --> |
465 | 465 | |
466 | - <?php do_action( 'give_view_order_details_billing_after', $payment_id ); ?> |
|
466 | + <?php do_action('give_view_order_details_billing_after', $payment_id); ?> |
|
467 | 467 | |
468 | 468 | <div id="give-payment-notes" class="postbox"> |
469 | - <h3 class="hndle"><span><?php esc_html_e( 'Payment Notes', 'give' ); ?></span></h3> |
|
469 | + <h3 class="hndle"><span><?php esc_html_e('Payment Notes', 'give'); ?></span></h3> |
|
470 | 470 | |
471 | 471 | <div class="inside"> |
472 | 472 | <div id="give-payment-notes-inner"> |
473 | 473 | <?php |
474 | - $notes = give_get_payment_notes( $payment_id ); |
|
475 | - if ( ! empty( $notes ) ) : |
|
474 | + $notes = give_get_payment_notes($payment_id); |
|
475 | + if ( ! empty($notes)) : |
|
476 | 476 | $no_notes_display = ' style="display:none;"'; |
477 | - foreach ( $notes as $note ) : |
|
477 | + foreach ($notes as $note) : |
|
478 | 478 | |
479 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
479 | + echo give_get_payment_note_html($note, $payment_id); |
|
480 | 480 | |
481 | 481 | endforeach; |
482 | 482 | else : |
483 | 483 | $no_notes_display = ''; |
484 | 484 | endif; |
485 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No payment notes', 'give' ) . '</p>'; ?> |
|
485 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No payment notes', 'give').'</p>'; ?> |
|
486 | 486 | </div> |
487 | 487 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
488 | 488 | |
489 | 489 | <div class="give-clearfix"> |
490 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button> |
|
490 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button> |
|
491 | 491 | </div> |
492 | 492 | |
493 | 493 | </div> |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | </div> |
496 | 496 | <!-- /#give-payment-notes --> |
497 | 497 | |
498 | - <?php do_action( 'give_view_order_details_main_after', $payment_id ); ?> |
|
498 | + <?php do_action('give_view_order_details_main_after', $payment_id); ?> |
|
499 | 499 | </div> |
500 | 500 | <!-- /#normal-sortables --> |
501 | 501 | </div> |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | <!-- #give-dashboard-widgets-wrap --> |
507 | 507 | </div> |
508 | 508 | <!-- /#post-stuff --> |
509 | - <?php do_action( 'give_view_order_details_form_bottom', $payment_id ); ?> |
|
510 | - <?php wp_nonce_field( 'give_update_payment_details_nonce' ); ?> |
|
511 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
509 | + <?php do_action('give_view_order_details_form_bottom', $payment_id); ?> |
|
510 | + <?php wp_nonce_field('give_update_payment_details_nonce'); ?> |
|
511 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
512 | 512 | <input type="hidden" name="give_action" value="update_payment_details"/> |
513 | 513 | </form> |
514 | - <?php do_action( 'give_view_order_details_after', $payment_id ); ?> |
|
514 | + <?php do_action('give_view_order_details_after', $payment_id); ?> |
|
515 | 515 | </div><!-- /.wrap --> |
@@ -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 | |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @since 1.0 |
80 | 80 | */ |
81 | - public function __construct( $_data ) { |
|
81 | + public function __construct($_data) { |
|
82 | 82 | |
83 | 83 | $this->data = $_data; |
84 | 84 | |
85 | 85 | // Generate unique ID |
86 | - $this->id = md5( rand() ); |
|
86 | + $this->id = md5(rand()); |
|
87 | 87 | |
88 | 88 | // Setup default options; |
89 | - $this->options = apply_filters( 'give_graph_args', array( |
|
89 | + $this->options = apply_filters('give_graph_args', array( |
|
90 | 90 | 'y_mode' => null, |
91 | 91 | 'x_mode' => null, |
92 | 92 | 'y_decimals' => 0, |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | 'bars' => true, |
104 | 104 | 'lines' => false, |
105 | 105 | 'points' => true |
106 | - ) ); |
|
106 | + )); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @since 1.0 |
117 | 117 | */ |
118 | - public function set( $key, $value ) { |
|
119 | - $this->options[ $key ] = $value; |
|
118 | + public function set($key, $value) { |
|
119 | + $this->options[$key] = $value; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 1.0 |
128 | 128 | */ |
129 | - public function get( $key ) { |
|
130 | - return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false; |
|
129 | + public function get($key) { |
|
130 | + return isset($this->options[$key]) ? $this->options[$key] : false; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @since 1.0 |
137 | 137 | */ |
138 | 138 | public function get_data() { |
139 | - return apply_filters( 'give_get_graph_data', $this->data, $this ); |
|
139 | + return apply_filters('give_get_graph_data', $this->data, $this); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function load_scripts() { |
148 | 148 | // Use minified libraries if SCRIPT_DEBUG is turned off |
149 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
149 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
150 | 150 | |
151 | - wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
152 | - wp_enqueue_script( 'jquery-flot-orderbars' ); |
|
151 | + wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
152 | + wp_enqueue_script('jquery-flot-orderbars'); |
|
153 | 153 | |
154 | - wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
155 | - wp_enqueue_script( 'jquery-flot-time' ); |
|
154 | + wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
155 | + wp_enqueue_script('jquery-flot-time'); |
|
156 | 156 | |
157 | - wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION ); |
|
158 | - wp_enqueue_script( 'jquery-flot-resize' ); |
|
157 | + wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION); |
|
158 | + wp_enqueue_script('jquery-flot-resize'); |
|
159 | 159 | |
160 | - wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION ); |
|
161 | - wp_enqueue_script( 'jquery-flot' ); |
|
160 | + wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION); |
|
161 | + wp_enqueue_script('jquery-flot'); |
|
162 | 162 | |
163 | 163 | } |
164 | 164 | |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | [ |
186 | 186 | <?php |
187 | 187 | $order = 0; |
188 | - foreach( $this->get_data() as $label => $data ) : |
|
188 | + foreach ($this->get_data() as $label => $data) : |
|
189 | 189 | ?> |
190 | 190 | { |
191 | - label : "<?php echo esc_attr( $label ); ?>", |
|
192 | - id : "<?php echo sanitize_key( $label ); ?>", |
|
191 | + label : "<?php echo esc_attr($label); ?>", |
|
192 | + id : "<?php echo sanitize_key($label); ?>", |
|
193 | 193 | // data format is: [ point on x, value on y ] |
194 | - data : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>], |
|
194 | + data : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>], |
|
195 | 195 | points: { |
196 | 196 | show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>, |
197 | 197 | }, |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | fill : true, |
207 | 207 | fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]} |
208 | 208 | }, |
209 | - <?php if( $this->options[ 'multiple_y_axes' ] ) : ?> |
|
209 | + <?php if ($this->options['multiple_y_axes']) : ?> |
|
210 | 210 | yaxis : <?php echo $yaxis_count; ?> |
211 | 211 | <?php endif; ?> |
212 | 212 | |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | grid: { |
221 | 221 | show : true, |
222 | 222 | aboveData : false, |
223 | - color : "<?php echo $this->options[ 'color' ]; ?>", |
|
224 | - backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>", |
|
225 | - borderColor : "<?php echo $this->options[ 'bordercolor' ]; ?>", |
|
226 | - borderWidth : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>, |
|
223 | + color : "<?php echo $this->options['color']; ?>", |
|
224 | + backgroundColor: "<?php echo $this->options['bgcolor']; ?>", |
|
225 | + borderColor : "<?php echo $this->options['bordercolor']; ?>", |
|
226 | + borderWidth : <?php echo absint($this->options['borderwidth']); ?>, |
|
227 | 227 | clickable : false, |
228 | 228 | hoverable : true |
229 | 229 | }, |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | mode : "<?php echo $this->options['x_mode']; ?>", |
235 | 235 | timeFormat : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
236 | 236 | tickSize : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>", |
237 | - <?php if( $this->options['x_mode'] != 'time' ) : ?> |
|
237 | + <?php if ($this->options['x_mode'] != 'time') : ?> |
|
238 | 238 | tickDecimals: <?php echo $this->options['x_decimals']; ?> |
239 | 239 | <?php endif; ?> |
240 | 240 | }, |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | min : 0, |
244 | 244 | mode : "<?php echo $this->options['y_mode']; ?>", |
245 | 245 | timeFormat : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>", |
246 | - <?php if( $this->options['y_mode'] != 'time' ) : ?> |
|
246 | + <?php if ($this->options['y_mode'] != 'time') : ?> |
|
247 | 247 | tickDecimals: <?php echo $this->options['y_decimals']; ?> |
248 | 248 | <?php endif; ?> |
249 | 249 | } |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | * @since 1.0 |
304 | 304 | */ |
305 | 305 | public function display() { |
306 | - do_action( 'give_before_graph', $this ); |
|
306 | + do_action('give_before_graph', $this); |
|
307 | 307 | echo $this->build_graph(); |
308 | - do_action( 'give_after_graph', $this ); |
|
308 | + do_action('give_after_graph', $this); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | } |
@@ -124,8 +124,10 @@ |
||
124 | 124 | |
125 | 125 | $pdf->Row( array( $title, $price, $categories, $tags, $sales, $earnings ) ); |
126 | 126 | endforeach; |
127 | - else: |
|
127 | + else { |
|
128 | + : |
|
128 | 129 | $pdf->SetWidths( array( 280 ) ); |
130 | + } |
|
129 | 131 | $title = utf8_decode( sprintf( __( 'No %s found.', 'give' ), give_get_forms_label_plural() ) ); |
130 | 132 | $pdf->Row( array( $title ) ); |
131 | 133 | endif; |
@@ -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 | |
@@ -25,82 +25,82 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @uses give_pdf |
27 | 27 | */ |
28 | -function give_generate_pdf( $data ) { |
|
28 | +function give_generate_pdf($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to generate PDF sales reports.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('view_give_reports')) { |
|
31 | + wp_die(esc_html__('You do not have permission to generate PDF sales reports.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) { |
|
35 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
34 | + if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) { |
|
35 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
36 | 36 | } |
37 | 37 | |
38 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php'; |
|
39 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/give_pdf.php'; |
|
38 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/fpdf.php'; |
|
39 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/give_pdf.php'; |
|
40 | 40 | |
41 | 41 | $daterange = utf8_decode( |
42 | 42 | sprintf( |
43 | 43 | /* translators: 1: start date 2: end date */ |
44 | - __( '%1$s to %2$s', 'give' ), |
|
45 | - date_i18n( get_option( 'date_format' ), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ), |
|
46 | - date_i18n( get_option( 'date_format' ) ) |
|
44 | + __('%1$s to %2$s', 'give'), |
|
45 | + date_i18n(get_option('date_format'), mktime(0, 0, 0, 1, 1, date('Y'))), |
|
46 | + date_i18n(get_option('date_format')) |
|
47 | 47 | ) |
48 | 48 | ); |
49 | 49 | |
50 | 50 | $pdf = new give_pdf(); |
51 | - $pdf->AddPage( 'L', 'A4' ); |
|
51 | + $pdf->AddPage('L', 'A4'); |
|
52 | 52 | |
53 | - $pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) ); |
|
54 | - $pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
55 | - $pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
53 | + $pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give'))); |
|
54 | + $pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
55 | + $pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
56 | 56 | |
57 | - $pdf->Image( GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png', 247, 8 ); |
|
57 | + $pdf->Image(GIVE_PLUGIN_URL.'assets/images/give-logo-small.png', 247, 8); |
|
58 | 58 | |
59 | - $pdf->SetMargins( 8, 8, 8 ); |
|
60 | - $pdf->SetX( 8 ); |
|
59 | + $pdf->SetMargins(8, 8, 8); |
|
60 | + $pdf->SetX(8); |
|
61 | 61 | |
62 | - $pdf->SetFont( 'Helvetica', '', 16 ); |
|
63 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
64 | - $pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false ); |
|
62 | + $pdf->SetFont('Helvetica', '', 16); |
|
63 | + $pdf->SetTextColor(50, 50, 50); |
|
64 | + $pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false); |
|
65 | 65 | |
66 | - $pdf->SetFont( 'Helvetica', '', 13 ); |
|
66 | + $pdf->SetFont('Helvetica', '', 13); |
|
67 | 67 | $pdf->Ln(); |
68 | - $pdf->SetTextColor( 150, 150, 150 ); |
|
69 | - $pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false ); |
|
68 | + $pdf->SetTextColor(150, 150, 150); |
|
69 | + $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false); |
|
70 | 70 | $pdf->Ln(); |
71 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
72 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
73 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false ); |
|
74 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
71 | + $pdf->SetTextColor(50, 50, 50); |
|
72 | + $pdf->SetFont('Helvetica', '', 14); |
|
73 | + $pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false); |
|
74 | + $pdf->SetFont('Helvetica', '', 12); |
|
75 | 75 | |
76 | - $pdf->SetFillColor( 238, 238, 238 ); |
|
77 | - $pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
|
78 | - $pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
|
79 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
|
80 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
|
81 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
|
82 | - $pdf->Cell( 35, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
|
76 | + $pdf->SetFillColor(238, 238, 238); |
|
77 | + $pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true); |
|
78 | + $pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true); |
|
79 | + $pdf->Cell(50, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true); |
|
80 | + $pdf->Cell(50, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true); |
|
81 | + $pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true); |
|
82 | + $pdf->Cell(35, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true); |
|
83 | 83 | |
84 | - $year = date( 'Y' ); |
|
85 | - $give_forms = get_posts( array( 'post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => - 1 ) ); |
|
84 | + $year = date('Y'); |
|
85 | + $give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1)); |
|
86 | 86 | |
87 | - if ( $give_forms ): |
|
88 | - $pdf->SetWidths( array( 70, 30, 50, 50, 45, 35 ) ); |
|
87 | + if ($give_forms): |
|
88 | + $pdf->SetWidths(array(70, 30, 50, 50, 45, 35)); |
|
89 | 89 | |
90 | - foreach ( $give_forms as $form ): |
|
91 | - $pdf->SetFillColor( 255, 255, 255 ); |
|
90 | + foreach ($give_forms as $form): |
|
91 | + $pdf->SetFillColor(255, 255, 255); |
|
92 | 92 | |
93 | 93 | $title = $form->post_title; |
94 | 94 | |
95 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
95 | + if (give_has_variable_prices($form->ID)) { |
|
96 | 96 | |
97 | - $prices = give_get_variable_prices( $form->ID ); |
|
97 | + $prices = give_get_variable_prices($form->ID); |
|
98 | 98 | |
99 | 99 | $first = $prices[0]['_give_amount']; |
100 | - $last = array_pop( $prices ); |
|
100 | + $last = array_pop($prices); |
|
101 | 101 | $last = $last['_give_amount']; |
102 | 102 | |
103 | - if ( $first < $last ) { |
|
103 | + if ($first < $last) { |
|
104 | 104 | $min = $first; |
105 | 105 | $max = $last; |
106 | 106 | } else { |
@@ -108,57 +108,57 @@ discard block |
||
108 | 108 | $max = $first; |
109 | 109 | } |
110 | 110 | |
111 | - $price = html_entity_decode( give_currency_filter( give_format_amount( $min ) ) . ' - ' . give_currency_filter( give_format_amount( $max ) ) ); |
|
111 | + $price = html_entity_decode(give_currency_filter(give_format_amount($min)).' - '.give_currency_filter(give_format_amount($max))); |
|
112 | 112 | } else { |
113 | - $price = html_entity_decode( give_currency_filter( give_get_form_price( $form->ID ) ) ); |
|
113 | + $price = html_entity_decode(give_currency_filter(give_get_form_price($form->ID))); |
|
114 | 114 | } |
115 | 115 | |
116 | - $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
117 | - $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
116 | + $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', ''); |
|
117 | + $categories = ! is_wp_error($categories) ? strip_tags($categories) : ''; |
|
118 | 118 | |
119 | - $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
120 | - $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
119 | + $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', ''); |
|
120 | + $tags = ! is_wp_error($tags) ? strip_tags($tags) : ''; |
|
121 | 121 | |
122 | - $sales = give_get_form_sales_stats( $form->ID ); |
|
123 | - $link = get_permalink( $form->ID ); |
|
124 | - $earnings = html_entity_decode( give_currency_filter( give_get_form_earnings_stats( $form->ID ) ) ); |
|
122 | + $sales = give_get_form_sales_stats($form->ID); |
|
123 | + $link = get_permalink($form->ID); |
|
124 | + $earnings = html_entity_decode(give_currency_filter(give_get_form_earnings_stats($form->ID))); |
|
125 | 125 | |
126 | - if ( function_exists( 'iconv' ) ) { |
|
126 | + if (function_exists('iconv')) { |
|
127 | 127 | // Ensure characters like euro; are properly converted. |
128 | - $price = iconv( 'UTF-8', 'windows-1252', utf8_encode( $price ) ); |
|
129 | - $earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) ); |
|
128 | + $price = iconv('UTF-8', 'windows-1252', utf8_encode($price)); |
|
129 | + $earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings)); |
|
130 | 130 | } |
131 | 131 | |
132 | - $pdf->Row( array( $title, $price, $categories, $tags, $sales, $earnings ) ); |
|
132 | + $pdf->Row(array($title, $price, $categories, $tags, $sales, $earnings)); |
|
133 | 133 | endforeach; |
134 | 134 | else: |
135 | - $pdf->SetWidths( array( 280 ) ); |
|
135 | + $pdf->SetWidths(array(280)); |
|
136 | 136 | $title = utf8_decode( |
137 | 137 | sprintf( |
138 | 138 | /* translators: %s: form plural label */ |
139 | - esc_html__( 'No %s found.', 'give' ), |
|
139 | + esc_html__('No %s found.', 'give'), |
|
140 | 140 | give_get_forms_label_plural() |
141 | 141 | ) |
142 | 142 | ); |
143 | - $pdf->Row( array( $title ) ); |
|
143 | + $pdf->Row(array($title)); |
|
144 | 144 | endif; |
145 | 145 | |
146 | 146 | $pdf->Ln(); |
147 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
148 | - $pdf->SetFont( 'Helvetica', '', 14 ); |
|
149 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false ); |
|
150 | - $pdf->SetFont( 'Helvetica', '', 12 ); |
|
151 | - |
|
152 | - $image = html_entity_decode( urldecode( give_draw_chart_image() ) ); |
|
153 | - $image = str_replace( ' ', '%20', $image ); |
|
154 | - |
|
155 | - $pdf->SetX( 25 ); |
|
156 | - $pdf->Image( $image . '&file=.png' ); |
|
157 | - $pdf->Ln( 7 ); |
|
158 | - $pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' ); |
|
147 | + $pdf->SetTextColor(50, 50, 50); |
|
148 | + $pdf->SetFont('Helvetica', '', 14); |
|
149 | + $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false); |
|
150 | + $pdf->SetFont('Helvetica', '', 12); |
|
151 | + |
|
152 | + $image = html_entity_decode(urldecode(give_draw_chart_image())); |
|
153 | + $image = str_replace(' ', '%20', $image); |
|
154 | + |
|
155 | + $pdf->SetX(25); |
|
156 | + $pdf->Image($image.'&file=.png'); |
|
157 | + $pdf->Ln(7); |
|
158 | + $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D'); |
|
159 | 159 | } |
160 | 160 | |
161 | -add_action( 'give_generate_pdf', 'give_generate_pdf' ); |
|
161 | +add_action('give_generate_pdf', 'give_generate_pdf'); |
|
162 | 162 | |
163 | 163 | /** |
164 | 164 | * Draws Chart for PDF Report |
@@ -175,38 +175,38 @@ discard block |
||
175 | 175 | * @return string $chart->getUrl() URL for the Google Chart |
176 | 176 | */ |
177 | 177 | function give_draw_chart_image() { |
178 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php'; |
|
179 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
180 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
178 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php'; |
|
179 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
180 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
181 | 181 | |
182 | - $chart = new GoogleChart( 'lc', 900, 330 ); |
|
182 | + $chart = new GoogleChart('lc', 900, 330); |
|
183 | 183 | |
184 | 184 | $i = 1; |
185 | 185 | $earnings = ""; |
186 | 186 | $sales = ""; |
187 | 187 | |
188 | - while ( $i <= 12 ) : |
|
189 | - $earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ","; |
|
190 | - $sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ","; |
|
191 | - $i ++; |
|
188 | + while ($i <= 12) : |
|
189 | + $earnings .= give_get_earnings_by_date(null, $i, date('Y')).","; |
|
190 | + $sales .= give_get_sales_by_date(null, $i, date('Y')).","; |
|
191 | + $i++; |
|
192 | 192 | endwhile; |
193 | 193 | |
194 | - $earnings_array = explode( ",", $earnings ); |
|
195 | - $sales_array = explode( ",", $sales ); |
|
194 | + $earnings_array = explode(",", $earnings); |
|
195 | + $sales_array = explode(",", $sales); |
|
196 | 196 | |
197 | 197 | $i = 0; |
198 | - while ( $i <= 11 ) { |
|
199 | - if ( empty( $sales_array[ $i ] ) ) { |
|
200 | - $sales_array[ $i ] = 0; |
|
198 | + while ($i <= 11) { |
|
199 | + if (empty($sales_array[$i])) { |
|
200 | + $sales_array[$i] = 0; |
|
201 | 201 | } |
202 | - $i ++; |
|
202 | + $i++; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | $min_earnings = 0; |
206 | - $max_earnings = max( $earnings_array ); |
|
207 | - $earnings_scale = round( $max_earnings, - 1 ); |
|
206 | + $max_earnings = max($earnings_array); |
|
207 | + $earnings_scale = round($max_earnings, - 1); |
|
208 | 208 | |
209 | - $data = new GoogleChartData( array( |
|
209 | + $data = new GoogleChartData(array( |
|
210 | 210 | $earnings_array[0], |
211 | 211 | $earnings_array[1], |
212 | 212 | $earnings_array[2], |
@@ -219,25 +219,25 @@ discard block |
||
219 | 219 | $earnings_array[9], |
220 | 220 | $earnings_array[10], |
221 | 221 | $earnings_array[11] |
222 | - ) ); |
|
222 | + )); |
|
223 | 223 | |
224 | - $data->setLegend( esc_html__( 'Income', 'give' ) ); |
|
225 | - $data->setColor( '1b58a3' ); |
|
226 | - $chart->addData( $data ); |
|
224 | + $data->setLegend(esc_html__('Income', 'give')); |
|
225 | + $data->setColor('1b58a3'); |
|
226 | + $chart->addData($data); |
|
227 | 227 | |
228 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
229 | - $shape_marker->setColor( '000000' ); |
|
230 | - $shape_marker->setSize( 7 ); |
|
231 | - $shape_marker->setBorder( 2 ); |
|
232 | - $shape_marker->setData( $data ); |
|
233 | - $chart->addMarker( $shape_marker ); |
|
228 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
229 | + $shape_marker->setColor('000000'); |
|
230 | + $shape_marker->setSize(7); |
|
231 | + $shape_marker->setBorder(2); |
|
232 | + $shape_marker->setData($data); |
|
233 | + $chart->addMarker($shape_marker); |
|
234 | 234 | |
235 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
236 | - $value_marker->setColor( '000000' ); |
|
237 | - $value_marker->setData( $data ); |
|
238 | - $chart->addMarker( $value_marker ); |
|
235 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
236 | + $value_marker->setColor('000000'); |
|
237 | + $value_marker->setData($data); |
|
238 | + $chart->addMarker($value_marker); |
|
239 | 239 | |
240 | - $data = new GoogleChartData( array( |
|
240 | + $data = new GoogleChartData(array( |
|
241 | 241 | $sales_array[0], |
242 | 242 | $sales_array[1], |
243 | 243 | $sales_array[2], |
@@ -250,46 +250,46 @@ discard block |
||
250 | 250 | $sales_array[9], |
251 | 251 | $sales_array[10], |
252 | 252 | $sales_array[11] |
253 | - ) ); |
|
254 | - $data->setLegend( esc_html__( 'Donations', 'give' ) ); |
|
255 | - $data->setColor( 'ff6c1c' ); |
|
256 | - $chart->addData( $data ); |
|
257 | - |
|
258 | - $chart->setTitle( esc_html__( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 ); |
|
259 | - |
|
260 | - $chart->setScale( 0, $max_earnings ); |
|
261 | - |
|
262 | - $y_axis = new GoogleChartAxis( 'y' ); |
|
263 | - $y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) ); |
|
264 | - $chart->addAxis( $y_axis ); |
|
265 | - |
|
266 | - $x_axis = new GoogleChartAxis( 'x' ); |
|
267 | - $x_axis->setTickMarks( 5 ); |
|
268 | - $x_axis->setLabels( array( |
|
269 | - esc_html__( 'Jan', 'give' ), |
|
270 | - esc_html__( 'Feb', 'give' ), |
|
271 | - esc_html__( 'Mar', 'give' ), |
|
272 | - esc_html__( 'Apr', 'give' ), |
|
273 | - esc_html__( 'May', 'give' ), |
|
274 | - esc_html__( 'June', 'give' ), |
|
275 | - esc_html__( 'July', 'give' ), |
|
276 | - esc_html__( 'Aug', 'give' ), |
|
277 | - esc_html__( 'Sept', 'give' ), |
|
278 | - esc_html__( 'Oct', 'give' ), |
|
279 | - esc_html__( 'Nov', 'give' ), |
|
280 | - esc_html__( 'Dec', 'give' ) |
|
281 | - ) ); |
|
282 | - $chart->addAxis( $x_axis ); |
|
283 | - |
|
284 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
285 | - $shape_marker->setSize( 6 ); |
|
286 | - $shape_marker->setBorder( 2 ); |
|
287 | - $shape_marker->setData( $data ); |
|
288 | - $chart->addMarker( $shape_marker ); |
|
289 | - |
|
290 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
291 | - $value_marker->setData( $data ); |
|
292 | - $chart->addMarker( $value_marker ); |
|
253 | + )); |
|
254 | + $data->setLegend(esc_html__('Donations', 'give')); |
|
255 | + $data->setColor('ff6c1c'); |
|
256 | + $chart->addData($data); |
|
257 | + |
|
258 | + $chart->setTitle(esc_html__('Donations by Month for all Give Forms', 'give'), '336699', 18); |
|
259 | + |
|
260 | + $chart->setScale(0, $max_earnings); |
|
261 | + |
|
262 | + $y_axis = new GoogleChartAxis('y'); |
|
263 | + $y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings)); |
|
264 | + $chart->addAxis($y_axis); |
|
265 | + |
|
266 | + $x_axis = new GoogleChartAxis('x'); |
|
267 | + $x_axis->setTickMarks(5); |
|
268 | + $x_axis->setLabels(array( |
|
269 | + esc_html__('Jan', 'give'), |
|
270 | + esc_html__('Feb', 'give'), |
|
271 | + esc_html__('Mar', 'give'), |
|
272 | + esc_html__('Apr', 'give'), |
|
273 | + esc_html__('May', 'give'), |
|
274 | + esc_html__('June', 'give'), |
|
275 | + esc_html__('July', 'give'), |
|
276 | + esc_html__('Aug', 'give'), |
|
277 | + esc_html__('Sept', 'give'), |
|
278 | + esc_html__('Oct', 'give'), |
|
279 | + esc_html__('Nov', 'give'), |
|
280 | + esc_html__('Dec', 'give') |
|
281 | + )); |
|
282 | + $chart->addAxis($x_axis); |
|
283 | + |
|
284 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
285 | + $shape_marker->setSize(6); |
|
286 | + $shape_marker->setBorder(2); |
|
287 | + $shape_marker->setData($data); |
|
288 | + $chart->addMarker($shape_marker); |
|
289 | + |
|
290 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
291 | + $value_marker->setData($data); |
|
292 | + $chart->addMarker($value_marker); |
|
293 | 293 | |
294 | 294 | return $chart->getUrl(); |
295 | 295 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined('ABSPATH')) exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Give_API_V1 Class |
@@ -10,7 +10,9 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
14 | + exit; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | /** |
16 | 18 | * Give_API_V1 Class |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | public function __construct() { |
15 | 15 | |
16 | - add_filter( 'template_include', array( __CLASS__, 'template_loader' ) ); |
|
16 | + add_filter('template_include', array(__CLASS__, 'template_loader')); |
|
17 | 17 | |
18 | 18 | |
19 | 19 | /** |
@@ -28,19 +28,19 @@ discard block |
||
28 | 28 | * @see 3give_output_content_wrapper() |
29 | 29 | * @see give_output_content_wrapper_end() |
30 | 30 | */ |
31 | - add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 ); |
|
32 | - add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 ); |
|
31 | + add_action('give_before_main_content', 'give_output_content_wrapper', 10); |
|
32 | + add_action('give_after_main_content', 'give_output_content_wrapper_end', 10); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Entry Summary Classes |
36 | 36 | */ |
37 | - add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) ); |
|
37 | + add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes')); |
|
38 | 38 | |
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Sidebar |
42 | 42 | */ |
43 | - add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 ); |
|
43 | + add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1); |
|
44 | 44 | |
45 | 45 | |
46 | 46 | /** |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @see give_template_single_title() |
50 | 50 | */ |
51 | - add_action( 'give_single_form_summary', 'give_template_single_title', 5 ); |
|
52 | - add_action( 'give_single_form_summary', 'give_get_donation_form', 10 ); |
|
51 | + add_action('give_single_form_summary', 'give_template_single_title', 5); |
|
52 | + add_action('give_single_form_summary', 'give_get_donation_form', 10); |
|
53 | 53 | |
54 | 54 | |
55 | 55 | } |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string |
66 | 66 | */ |
67 | - public function give_set_single_summary_classes( $classes ) { |
|
67 | + public function give_set_single_summary_classes($classes) { |
|
68 | 68 | |
69 | - $sidebar_option = give_get_option( 'disable_form_sidebar' ); |
|
69 | + $sidebar_option = give_get_option('disable_form_sidebar'); |
|
70 | 70 | |
71 | 71 | //Add full width class when feature image is disabled AND no widgets are present |
72 | - if ( $sidebar_option == 'on' ) { |
|
72 | + if ($sidebar_option == 'on') { |
|
73 | 73 | $classes .= ' give-full-width'; |
74 | 74 | } |
75 | 75 | |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | * |
87 | 87 | */ |
88 | 88 | public function give_output_sidebar_option() { |
89 | - $sidebar_option = give_get_option( 'disable_form_sidebar' ); |
|
89 | + $sidebar_option = give_get_option('disable_form_sidebar'); |
|
90 | 90 | //Add full width class when feature image is disabled AND no widgets are present |
91 | - if ( $sidebar_option !== 'on' ) { |
|
92 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 ); |
|
93 | - add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 ); |
|
94 | - add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 ); |
|
95 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 ); |
|
91 | + if ($sidebar_option !== 'on') { |
|
92 | + add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5); |
|
93 | + add_action('give_before_single_form_summary', 'give_show_form_images', 10); |
|
94 | + add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20); |
|
95 | + add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | } |
@@ -114,22 +114,22 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return string |
116 | 116 | */ |
117 | - public static function template_loader( $template ) { |
|
118 | - $find = array( 'give.php' ); |
|
117 | + public static function template_loader($template) { |
|
118 | + $find = array('give.php'); |
|
119 | 119 | $file = ''; |
120 | 120 | |
121 | - if ( is_single() && get_post_type() == 'give_forms' ) { |
|
121 | + if (is_single() && get_post_type() == 'give_forms') { |
|
122 | 122 | |
123 | 123 | $file = 'single-give-form.php'; |
124 | 124 | $find[] = $file; |
125 | - $find[] = apply_filters( 'give_template_path', 'give/' ) . $file; |
|
125 | + $find[] = apply_filters('give_template_path', 'give/').$file; |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
129 | - if ( $file ) { |
|
130 | - $template = locate_template( array_unique( $find ) ); |
|
131 | - if ( ! $template ) { |
|
132 | - $template = GIVE_PLUGIN_DIR . '/templates/' . $file; |
|
129 | + if ($file) { |
|
130 | + $template = locate_template(array_unique($find)); |
|
131 | + if ( ! $template) { |
|
132 | + $template = GIVE_PLUGIN_DIR.'/templates/'.$file; |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 |