@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Exit if accessed directly |
26 | -if ( ! defined( 'ABSPATH' ) ) { |
|
26 | +if ( ! defined('ABSPATH')) { |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * @param string $tag Email tag to be replace in email |
55 | 55 | * @param callable $func Hook to run when email tag is found |
56 | 56 | */ |
57 | - public function add( $tag, $description, $func ) { |
|
58 | - if ( is_callable( $func ) ) { |
|
59 | - $this->tags[ $tag ] = array( |
|
57 | + public function add($tag, $description, $func) { |
|
58 | + if (is_callable($func)) { |
|
59 | + $this->tags[$tag] = array( |
|
60 | 60 | 'tag' => $tag, |
61 | 61 | 'description' => $description, |
62 | 62 | 'func' => $func |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @param string $tag Email tag to remove hook from |
73 | 73 | */ |
74 | - public function remove( $tag ) { |
|
75 | - unset( $this->tags[ $tag ] ); |
|
74 | + public function remove($tag) { |
|
75 | + unset($this->tags[$tag]); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return bool |
86 | 86 | */ |
87 | - public function email_tag_exists( $tag ) { |
|
88 | - return array_key_exists( $tag, $this->tags ); |
|
87 | + public function email_tag_exists($tag) { |
|
88 | + return array_key_exists($tag, $this->tags); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @return string Content with email tags filtered out. |
111 | 111 | */ |
112 | - public function do_tags( $content, $payment_id ) { |
|
112 | + public function do_tags($content, $payment_id) { |
|
113 | 113 | |
114 | 114 | // Check if there is atleast one tag added |
115 | - if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { |
|
115 | + if (empty($this->tags) || ! is_array($this->tags)) { |
|
116 | 116 | return $content; |
117 | 117 | } |
118 | 118 | |
119 | 119 | $this->payment_id = $payment_id; |
120 | 120 | |
121 | - $new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content ); |
|
121 | + $new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content); |
|
122 | 122 | |
123 | 123 | $this->payment_id = null; |
124 | 124 | |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @return mixed |
136 | 136 | */ |
137 | - public function do_tag( $m ) { |
|
137 | + public function do_tag($m) { |
|
138 | 138 | |
139 | 139 | // Get tag |
140 | 140 | $tag = $m[1]; |
141 | 141 | |
142 | 142 | // Return tag if tag not set |
143 | - if ( ! $this->email_tag_exists( $tag ) ) { |
|
143 | + if ( ! $this->email_tag_exists($tag)) { |
|
144 | 144 | return $m[0]; |
145 | 145 | } |
146 | 146 | |
147 | - return call_user_func( $this->tags[ $tag ]['func'], $this->payment_id, $tag ); |
|
147 | + return call_user_func($this->tags[$tag]['func'], $this->payment_id, $tag); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | * @param string $description Description of the email tag added |
159 | 159 | * @param callable $func Hook to run when email tag is found |
160 | 160 | */ |
161 | -function give_add_email_tag( $tag, $description, $func ) { |
|
162 | - Give()->email_tags->add( $tag, $description, $func ); |
|
161 | +function give_add_email_tag($tag, $description, $func) { |
|
162 | + Give()->email_tags->add($tag, $description, $func); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @param string $tag Email tag to remove hook from |
171 | 171 | */ |
172 | -function give_remove_email_tag( $tag ) { |
|
173 | - Give()->email_tags->remove( $tag ); |
|
172 | +function give_remove_email_tag($tag) { |
|
173 | + Give()->email_tags->remove($tag); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @return bool |
184 | 184 | */ |
185 | -function give_email_tag_exists( $tag ) { |
|
186 | - return Give()->email_tags->email_tag_exists( $tag ); |
|
185 | +function give_email_tag_exists($tag) { |
|
186 | + return Give()->email_tags->email_tag_exists($tag); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -212,13 +212,13 @@ discard block |
||
212 | 212 | $email_tags = give_get_email_tags(); |
213 | 213 | |
214 | 214 | // Check |
215 | - if ( count( $email_tags ) > 0 ) { |
|
215 | + if (count($email_tags) > 0) { |
|
216 | 216 | |
217 | 217 | // Loop |
218 | - foreach ( $email_tags as $email_tag ) { |
|
218 | + foreach ($email_tags as $email_tag) { |
|
219 | 219 | |
220 | 220 | // Add email tag to list |
221 | - $list .= '<code>{' . $email_tag['tag'] . '}</code> - ' . $email_tag['description'] . '<br/>'; |
|
221 | + $list .= '<code>{'.$email_tag['tag'].'}</code> - '.$email_tag['description'].'<br/>'; |
|
222 | 222 | |
223 | 223 | } |
224 | 224 | |
@@ -238,13 +238,13 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return string Content with email tags filtered out. |
240 | 240 | */ |
241 | -function give_do_email_tags( $content, $payment_id ) { |
|
241 | +function give_do_email_tags($content, $payment_id) { |
|
242 | 242 | |
243 | 243 | // Replace all tags |
244 | - $content = Give()->email_tags->do_tags( $content, $payment_id ); |
|
244 | + $content = Give()->email_tags->do_tags($content, $payment_id); |
|
245 | 245 | |
246 | 246 | // Maintaining backwards compatibility |
247 | - $content = apply_filters( 'give_email_template_tags', $content, give_get_payment_meta( $payment_id ), $payment_id ); |
|
247 | + $content = apply_filters('give_email_template_tags', $content, give_get_payment_meta($payment_id), $payment_id); |
|
248 | 248 | |
249 | 249 | // Return content |
250 | 250 | return $content; |
@@ -256,10 +256,10 @@ discard block |
||
256 | 256 | * @since 1.0 |
257 | 257 | */ |
258 | 258 | function give_load_email_tags() { |
259 | - do_action( 'give_add_email_tags' ); |
|
259 | + do_action('give_add_email_tags'); |
|
260 | 260 | } |
261 | 261 | |
262 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
262 | +add_action('init', 'give_load_email_tags', - 999); |
|
263 | 263 | |
264 | 264 | /** |
265 | 265 | * Add default Give email template tags |
@@ -272,82 +272,82 @@ discard block |
||
272 | 272 | $email_tags = array( |
273 | 273 | array( |
274 | 274 | 'tag' => 'donation', |
275 | - 'description' => __( 'The name of completed donation form', 'give' ), |
|
275 | + 'description' => __('The name of completed donation form', 'give'), |
|
276 | 276 | 'function' => 'give_email_tag_donation' |
277 | 277 | ), |
278 | 278 | array( |
279 | 279 | 'tag' => 'name', |
280 | - 'description' => __( 'The donor\'s first name', 'give' ), |
|
280 | + 'description' => __('The donor\'s first name', 'give'), |
|
281 | 281 | 'function' => 'give_email_tag_first_name' |
282 | 282 | ), |
283 | 283 | array( |
284 | 284 | 'tag' => 'fullname', |
285 | - 'description' => __( 'The donor\'s full name, first and last', 'give' ), |
|
285 | + 'description' => __('The donor\'s full name, first and last', 'give'), |
|
286 | 286 | 'function' => 'give_email_tag_fullname' |
287 | 287 | ), |
288 | 288 | array( |
289 | 289 | 'tag' => 'username', |
290 | - 'description' => __( 'The donor\'s user name on the site, if they registered an account', 'give' ), |
|
290 | + 'description' => __('The donor\'s user name on the site, if they registered an account', 'give'), |
|
291 | 291 | 'function' => 'give_email_tag_username' |
292 | 292 | ), |
293 | 293 | array( |
294 | 294 | 'tag' => 'user_email', |
295 | - 'description' => __( 'The donor\'s email address', 'give' ), |
|
295 | + 'description' => __('The donor\'s email address', 'give'), |
|
296 | 296 | 'function' => 'give_email_tag_user_email' |
297 | 297 | ), |
298 | 298 | array( |
299 | 299 | 'tag' => 'billing_address', |
300 | - 'description' => __( 'The donor\'s billing address', 'give' ), |
|
300 | + 'description' => __('The donor\'s billing address', 'give'), |
|
301 | 301 | 'function' => 'give_email_tag_billing_address' |
302 | 302 | ), |
303 | 303 | array( |
304 | 304 | 'tag' => 'date', |
305 | - 'description' => __( 'The date of the donation', 'give' ), |
|
305 | + 'description' => __('The date of the donation', 'give'), |
|
306 | 306 | 'function' => 'give_email_tag_date' |
307 | 307 | ), |
308 | 308 | array( |
309 | 309 | 'tag' => 'price', |
310 | - 'description' => __( 'The total price of the donation', 'give' ), |
|
310 | + 'description' => __('The total price of the donation', 'give'), |
|
311 | 311 | 'function' => 'give_email_tag_price' |
312 | 312 | ), |
313 | 313 | array( |
314 | 314 | 'tag' => 'payment_id', |
315 | - 'description' => __( 'The unique ID number for this donation', 'give' ), |
|
315 | + 'description' => __('The unique ID number for this donation', 'give'), |
|
316 | 316 | 'function' => 'give_email_tag_payment_id' |
317 | 317 | ), |
318 | 318 | array( |
319 | 319 | 'tag' => 'receipt_id', |
320 | - 'description' => __( 'The unique ID number for this donation receipt', 'give' ), |
|
320 | + 'description' => __('The unique ID number for this donation receipt', 'give'), |
|
321 | 321 | 'function' => 'give_email_tag_receipt_id' |
322 | 322 | ), |
323 | 323 | array( |
324 | 324 | 'tag' => 'payment_method', |
325 | - 'description' => __( 'The method of payment used for this donation', 'give' ), |
|
325 | + 'description' => __('The method of payment used for this donation', 'give'), |
|
326 | 326 | 'function' => 'give_email_tag_payment_method' |
327 | 327 | ), |
328 | 328 | array( |
329 | 329 | 'tag' => 'sitename', |
330 | - 'description' => __( 'Your site name', 'give' ), |
|
330 | + 'description' => __('Your site name', 'give'), |
|
331 | 331 | 'function' => 'give_email_tag_sitename' |
332 | 332 | ), |
333 | 333 | array( |
334 | 334 | 'tag' => 'receipt_link', |
335 | - 'description' => __( 'Adds a link so users can view their receipt directly on your website if they are unable to view it in the browser correctly.', 'give' ), |
|
335 | + 'description' => __('Adds a link so users can view their receipt directly on your website if they are unable to view it in the browser correctly.', 'give'), |
|
336 | 336 | 'function' => 'give_email_tag_receipt_link' |
337 | 337 | ), |
338 | 338 | ); |
339 | 339 | |
340 | 340 | // Apply give_email_tags filter |
341 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
341 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
342 | 342 | |
343 | 343 | // Add email tags |
344 | - foreach ( $email_tags as $email_tag ) { |
|
345 | - give_add_email_tag( $email_tag['tag'], $email_tag['description'], $email_tag['function'] ); |
|
344 | + foreach ($email_tags as $email_tag) { |
|
345 | + give_add_email_tag($email_tag['tag'], $email_tag['description'], $email_tag['function']); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | } |
349 | 349 | |
350 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
350 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
351 | 351 | |
352 | 352 | |
353 | 353 | /** |
@@ -358,15 +358,15 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @return string name |
360 | 360 | */ |
361 | -function give_email_tag_first_name( $payment_id ) { |
|
362 | - $payment = new Give_Payment( $payment_id ); |
|
361 | +function give_email_tag_first_name($payment_id) { |
|
362 | + $payment = new Give_Payment($payment_id); |
|
363 | 363 | $user_info = $payment->user_info; |
364 | 364 | |
365 | - if ( empty( $user_info ) ) { |
|
365 | + if (empty($user_info)) { |
|
366 | 366 | return ''; |
367 | 367 | } |
368 | 368 | |
369 | - $email_name = give_get_email_names( $user_info ); |
|
369 | + $email_name = give_get_email_names($user_info); |
|
370 | 370 | |
371 | 371 | return $email_name['name']; |
372 | 372 | } |
@@ -379,15 +379,15 @@ discard block |
||
379 | 379 | * |
380 | 380 | * @return string fullname |
381 | 381 | */ |
382 | -function give_email_tag_fullname( $payment_id ) { |
|
383 | - $payment = new Give_Payment( $payment_id ); |
|
382 | +function give_email_tag_fullname($payment_id) { |
|
383 | + $payment = new Give_Payment($payment_id); |
|
384 | 384 | $user_info = $payment->user_info; |
385 | 385 | |
386 | - if ( empty( $user_info ) ) { |
|
386 | + if (empty($user_info)) { |
|
387 | 387 | return ''; |
388 | 388 | } |
389 | 389 | |
390 | - $email_name = give_get_email_names( $user_info ); |
|
390 | + $email_name = give_get_email_names($user_info); |
|
391 | 391 | |
392 | 392 | return $email_name['fullname']; |
393 | 393 | } |
@@ -400,15 +400,15 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @return string username |
402 | 402 | */ |
403 | -function give_email_tag_username( $payment_id ) { |
|
404 | - $payment = new Give_Payment( $payment_id ); |
|
403 | +function give_email_tag_username($payment_id) { |
|
404 | + $payment = new Give_Payment($payment_id); |
|
405 | 405 | $user_info = $payment->user_info; |
406 | 406 | |
407 | - if ( empty( $user_info ) ) { |
|
407 | + if (empty($user_info)) { |
|
408 | 408 | return ''; |
409 | 409 | } |
410 | 410 | |
411 | - $email_name = give_get_email_names( $user_info ); |
|
411 | + $email_name = give_get_email_names($user_info); |
|
412 | 412 | |
413 | 413 | return $email_name['username']; |
414 | 414 | } |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @return string user_email |
423 | 423 | */ |
424 | -function give_email_tag_user_email( $payment_id ) { |
|
425 | - $payment = new Give_Payment( $payment_id ); |
|
424 | +function give_email_tag_user_email($payment_id) { |
|
425 | + $payment = new Give_Payment($payment_id); |
|
426 | 426 | |
427 | 427 | return $payment->email; |
428 | 428 | } |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | * |
436 | 436 | * @return string billing_address |
437 | 437 | */ |
438 | -function give_email_tag_billing_address( $payment_id ) { |
|
438 | +function give_email_tag_billing_address($payment_id) { |
|
439 | 439 | |
440 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
441 | - $user_address = ! empty( $user_info['address'] ) ? $user_info['address'] : array( |
|
440 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
441 | + $user_address = ! empty($user_info['address']) ? $user_info['address'] : array( |
|
442 | 442 | 'line1' => '', |
443 | 443 | 'line2' => '', |
444 | 444 | 'city' => '', |
@@ -447,11 +447,11 @@ discard block |
||
447 | 447 | 'zip' => '' |
448 | 448 | ); |
449 | 449 | |
450 | - $return = $user_address['line1'] . "\n"; |
|
451 | - if ( ! empty( $user_address['line2'] ) ) { |
|
452 | - $return .= $user_address['line2'] . "\n"; |
|
450 | + $return = $user_address['line1']."\n"; |
|
451 | + if ( ! empty($user_address['line2'])) { |
|
452 | + $return .= $user_address['line2']."\n"; |
|
453 | 453 | } |
454 | - $return .= $user_address['city'] . ' ' . $user_address['zip'] . ' ' . $user_address['state'] . "\n"; |
|
454 | + $return .= $user_address['city'].' '.$user_address['zip'].' '.$user_address['state']."\n"; |
|
455 | 455 | $return .= $user_address['country']; |
456 | 456 | |
457 | 457 | return $return; |
@@ -465,10 +465,10 @@ discard block |
||
465 | 465 | * |
466 | 466 | * @return string date |
467 | 467 | */ |
468 | -function give_email_tag_date( $payment_id ) { |
|
469 | - $payment = new Give_Payment( $payment_id ); |
|
468 | +function give_email_tag_date($payment_id) { |
|
469 | + $payment = new Give_Payment($payment_id); |
|
470 | 470 | |
471 | - return date_i18n( get_option( 'date_format' ), strtotime( $payment->date ) ); |
|
471 | + return date_i18n(get_option('date_format'), strtotime($payment->date)); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | /** |
@@ -479,11 +479,11 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @return string price |
481 | 481 | */ |
482 | -function give_email_tag_price( $payment_id ) { |
|
483 | - $payment = new Give_Payment( $payment_id ); |
|
484 | - $price = give_currency_filter( give_format_amount( $payment->total ), $payment->currency ); |
|
482 | +function give_email_tag_price($payment_id) { |
|
483 | + $payment = new Give_Payment($payment_id); |
|
484 | + $price = give_currency_filter(give_format_amount($payment->total), $payment->currency); |
|
485 | 485 | |
486 | - return html_entity_decode( $price, ENT_COMPAT, 'UTF-8' ); |
|
486 | + return html_entity_decode($price, ENT_COMPAT, 'UTF-8'); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
@@ -494,8 +494,8 @@ discard block |
||
494 | 494 | * |
495 | 495 | * @return int payment_id |
496 | 496 | */ |
497 | -function give_email_tag_payment_id( $payment_id ) { |
|
498 | - $payment = new Give_Payment( $payment_id ); |
|
497 | +function give_email_tag_payment_id($payment_id) { |
|
498 | + $payment = new Give_Payment($payment_id); |
|
499 | 499 | |
500 | 500 | return $payment->number; |
501 | 501 | } |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | * |
509 | 509 | * @return string receipt_id |
510 | 510 | */ |
511 | -function give_email_tag_receipt_id( $payment_id ) { |
|
512 | - $payment = new Give_Payment( $payment_id ); |
|
511 | +function give_email_tag_receipt_id($payment_id) { |
|
512 | + $payment = new Give_Payment($payment_id); |
|
513 | 513 | |
514 | 514 | return $payment->key; |
515 | 515 | } |
@@ -522,11 +522,11 @@ discard block |
||
522 | 522 | * |
523 | 523 | * @return string $form_title |
524 | 524 | */ |
525 | -function give_email_tag_donation( $payment_id ) { |
|
526 | - $payment = new Give_Payment( $payment_id ); |
|
527 | - $form_title = get_the_title( $payment->form_id ); |
|
525 | +function give_email_tag_donation($payment_id) { |
|
526 | + $payment = new Give_Payment($payment_id); |
|
527 | + $form_title = get_the_title($payment->form_id); |
|
528 | 528 | |
529 | - return ! empty( $form_title ) ? $form_title : __( 'There was an error retrieving this donation title', 'give' ); |
|
529 | + return ! empty($form_title) ? $form_title : __('There was an error retrieving this donation title', 'give'); |
|
530 | 530 | |
531 | 531 | } |
532 | 532 | |
@@ -538,9 +538,9 @@ discard block |
||
538 | 538 | * |
539 | 539 | * @return string gateway |
540 | 540 | */ |
541 | -function give_email_tag_payment_method( $payment_id ) { |
|
542 | - $payment = new Give_Payment( $payment_id ); |
|
543 | - return give_get_gateway_checkout_label( $payment->gateway ); |
|
541 | +function give_email_tag_payment_method($payment_id) { |
|
542 | + $payment = new Give_Payment($payment_id); |
|
543 | + return give_get_gateway_checkout_label($payment->gateway); |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | /** |
@@ -551,8 +551,8 @@ discard block |
||
551 | 551 | * |
552 | 552 | * @return string sitename |
553 | 553 | */ |
554 | -function give_email_tag_sitename( $payment_id ) { |
|
555 | - return wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
554 | +function give_email_tag_sitename($payment_id) { |
|
555 | + return wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | /** |
@@ -564,15 +564,15 @@ discard block |
||
564 | 564 | * |
565 | 565 | * @return string receipt_link |
566 | 566 | */ |
567 | -function give_email_tag_receipt_link( $payment_id ) { |
|
567 | +function give_email_tag_receipt_link($payment_id) { |
|
568 | 568 | |
569 | - $receipt_url = esc_url( add_query_arg( array( |
|
570 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
569 | + $receipt_url = esc_url(add_query_arg(array( |
|
570 | + 'payment_key' => give_get_payment_key($payment_id), |
|
571 | 571 | 'give_action' => 'view_receipt' |
572 | - ), home_url() ) ); |
|
573 | - $formatted = sprintf( __( '%1$sView it in your browser %2$s', 'give' ), '<a href="' . $receipt_url . '">', '»</a>' ); |
|
572 | + ), home_url())); |
|
573 | + $formatted = sprintf(__('%1$sView it in your browser %2$s', 'give'), '<a href="'.$receipt_url.'">', '»</a>'); |
|
574 | 574 | |
575 | - if ( give_get_option( 'email_template' ) !== 'none' ) { |
|
575 | + if (give_get_option('email_template') !== 'none') { |
|
576 | 576 | return $formatted; |
577 | 577 | } else { |
578 | 578 | return $receipt_url; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,39 +26,39 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | |
31 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
31 | + $payment_data = give_get_payment_meta($payment_id); |
|
32 | 32 | |
33 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
34 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
35 | 35 | |
36 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
37 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
36 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
37 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
38 | 38 | |
39 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
39 | + $to_email = give_get_payment_user_email($payment_id); |
|
40 | 40 | |
41 | - $subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) ); |
|
42 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
43 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
41 | + $subject = give_get_option('donation_subject', __('Donation Receipt', 'give')); |
|
42 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
43 | + $subject = give_do_email_tags($subject, $payment_id); |
|
44 | 44 | |
45 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
46 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
45 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
46 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
47 | 47 | |
48 | 48 | $emails = Give()->emails; |
49 | 49 | |
50 | - $emails->__set( 'from_name', $from_name ); |
|
51 | - $emails->__set( 'from_email', $from_email ); |
|
52 | - $emails->__set( 'heading', __( 'Donation Receipt', 'give' ) ); |
|
50 | + $emails->__set('from_name', $from_name); |
|
51 | + $emails->__set('from_email', $from_email); |
|
52 | + $emails->__set('heading', __('Donation Receipt', 'give')); |
|
53 | 53 | |
54 | 54 | |
55 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
56 | - $emails->__set( 'headers', $headers ); |
|
55 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
56 | + $emails->__set('headers', $headers); |
|
57 | 57 | |
58 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
58 | + $emails->send($to_email, $subject, $message, $attachments); |
|
59 | 59 | |
60 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
61 | - do_action( 'give_admin_sale_notice', $payment_id, $payment_data ); |
|
60 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
61 | + do_action('give_admin_sale_notice', $payment_id, $payment_data); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -71,29 +71,29 @@ discard block |
||
71 | 71 | */ |
72 | 72 | function give_email_test_donation_receipt() { |
73 | 73 | |
74 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
75 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() ); |
|
74 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
75 | + $from_name = apply_filters('give_purchase_from_name', $from_name, 0, array()); |
|
76 | 76 | |
77 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
78 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() ); |
|
77 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
78 | + $from_email = apply_filters('give_purchase_from_address', $from_email, 0, array()); |
|
79 | 79 | |
80 | - $subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) ); |
|
81 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
82 | - $subject = give_do_email_tags( $subject, 0 ); |
|
80 | + $subject = give_get_option('donation_subject', __('Donation Receipt', 'give')); |
|
81 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
82 | + $subject = give_do_email_tags($subject, 0); |
|
83 | 83 | |
84 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
84 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
85 | 85 | |
86 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
86 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
87 | 87 | |
88 | 88 | $emails = Give()->emails; |
89 | - $emails->__set( 'from_name', $from_name ); |
|
90 | - $emails->__set( 'from_email', $from_email ); |
|
91 | - $emails->__set( 'heading', __( 'Donation Receipt', 'give' ) ); |
|
89 | + $emails->__set('from_name', $from_name); |
|
90 | + $emails->__set('from_email', $from_email); |
|
91 | + $emails->__set('heading', __('Donation Receipt', 'give')); |
|
92 | 92 | |
93 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
94 | - $emails->__set( 'headers', $headers ); |
|
93 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
94 | + $emails->__set('headers', $headers); |
|
95 | 95 | |
96 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
96 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -107,49 +107,49 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return void |
109 | 109 | */ |
110 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
110 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
111 | 111 | |
112 | - $payment_id = absint( $payment_id ); |
|
112 | + $payment_id = absint($payment_id); |
|
113 | 113 | |
114 | - if ( empty( $payment_id ) ) { |
|
114 | + if (empty($payment_id)) { |
|
115 | 115 | return; |
116 | 116 | } |
117 | 117 | |
118 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
118 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
123 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
122 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
123 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
124 | 124 | |
125 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
126 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
125 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
126 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
127 | 127 | |
128 | - $subject = give_get_option( 'donation_notification_subject', sprintf( __( 'New Donation - Payment #%1$s', 'give' ), $payment_id ) ); |
|
129 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
130 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
128 | + $subject = give_get_option('donation_notification_subject', sprintf(__('New Donation - Payment #%1$s', 'give'), $payment_id)); |
|
129 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
130 | + $subject = give_do_email_tags($subject, $payment_id); |
|
131 | 131 | |
132 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
133 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
132 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
133 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
134 | 134 | //$headers .= "MIME-Version: 1.0\r\n"; |
135 | 135 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
136 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
136 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
137 | 137 | |
138 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
138 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
139 | 139 | |
140 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
140 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
141 | 141 | |
142 | 142 | $emails = Give()->emails; |
143 | - $emails->__set( 'from_name', $from_name ); |
|
144 | - $emails->__set( 'from_email', $from_email ); |
|
145 | - $emails->__set( 'headers', $headers ); |
|
146 | - $emails->__set( 'heading', __( 'New Donation!', 'give' ) ); |
|
143 | + $emails->__set('from_name', $from_name); |
|
144 | + $emails->__set('from_email', $from_email); |
|
145 | + $emails->__set('headers', $headers); |
|
146 | + $emails->__set('heading', __('New Donation!', 'give')); |
|
147 | 147 | |
148 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
148 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
149 | 149 | |
150 | 150 | } |
151 | 151 | |
152 | -add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 ); |
|
152 | +add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2); |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Retrieves the emails for which admin notifications are sent to (these can be |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | function give_get_admin_notice_emails() { |
163 | 163 | global $give_options; |
164 | 164 | |
165 | - $emails = isset( $give_options['admin_notice_emails'] ) && strlen( trim( $give_options['admin_notice_emails'] ) ) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo( 'admin_email' ); |
|
166 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
165 | + $emails = isset($give_options['admin_notice_emails']) && strlen(trim($give_options['admin_notice_emails'])) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo('admin_email'); |
|
166 | + $emails = array_map('trim', explode("\n", $emails)); |
|
167 | 167 | |
168 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
168 | + return apply_filters('give_admin_notice_emails', $emails); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return mixed |
179 | 179 | */ |
180 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
180 | +function give_admin_notices_disabled($payment_id = 0) { |
|
181 | 181 | global $give_options; |
182 | - $retval = isset( $give_options['disable_admin_notices'] ); |
|
182 | + $retval = isset($give_options['disable_admin_notices']); |
|
183 | 183 | |
184 | - return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id ); |
|
184 | + return apply_filters('give_admin_notices_disabled', $retval, $payment_id); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -195,16 +195,16 @@ discard block |
||
195 | 195 | function give_get_default_donation_notification_email() { |
196 | 196 | global $give_options; |
197 | 197 | |
198 | - $default_email_body = __( 'Hi there,', 'give' ) . "\n\n" . __( 'This email is to inform you that a new donation has been made on your website: ', 'give' ) . '<a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n"; |
|
199 | - $default_email_body .= '<strong>' . __( 'Donor: ', 'give' ) . '</strong> ' . ' {name}' . "\n"; |
|
200 | - $default_email_body .= '<strong>' . __( 'Donation: ', 'give' ) . '</strong> ' . ' {donation}' . "\n"; |
|
201 | - $default_email_body .= '<strong>' . __( 'Amount: ', 'give' ) . '</strong> ' . ' {price}' . "\n"; |
|
202 | - $default_email_body .= '<strong>' . __( 'Payment Method: ', 'give' ) . '</strong> ' . ' {payment_method}' . "\n\n"; |
|
203 | - $default_email_body .= __( 'Thank you,', 'give' ) . "\n\n" . '{sitename}'; |
|
198 | + $default_email_body = __('Hi there,', 'give')."\n\n".__('This email is to inform you that a new donation has been made on your website: ', 'give').'<a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n"; |
|
199 | + $default_email_body .= '<strong>'.__('Donor: ', 'give').'</strong> '.' {name}'."\n"; |
|
200 | + $default_email_body .= '<strong>'.__('Donation: ', 'give').'</strong> '.' {donation}'."\n"; |
|
201 | + $default_email_body .= '<strong>'.__('Amount: ', 'give').'</strong> '.' {price}'."\n"; |
|
202 | + $default_email_body .= '<strong>'.__('Payment Method: ', 'give').'</strong> '.' {payment_method}'."\n\n"; |
|
203 | + $default_email_body .= __('Thank you,', 'give')."\n\n".'{sitename}'; |
|
204 | 204 | |
205 | - $message = ( isset( $give_options['donation_notification'] ) && ! empty( $give_options['donation_notification'] ) ) ? $give_options['donation_notification'] : $default_email_body; |
|
205 | + $message = (isset($give_options['donation_notification']) && ! empty($give_options['donation_notification'])) ? $give_options['donation_notification'] : $default_email_body; |
|
206 | 206 | |
207 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
207 | + return apply_filters('give_default_donation_notification_email', $message); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -219,24 +219,24 @@ discard block |
||
219 | 219 | function give_get_default_donation_receipt_email() { |
220 | 220 | global $give_options; |
221 | 221 | |
222 | - $default_email_body = __( 'Dear', 'give' ) . " {name},\n\n"; |
|
223 | - $default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
224 | - $default_email_body .= '<strong>' . __( 'Donor', 'give' ) . ':</strong> ' . '{fullname}' . "\n"; |
|
225 | - $default_email_body .= '<strong>' . __( 'Donation', 'give' ) . ':</strong> ' . '{donation}' . "\n"; |
|
226 | - $default_email_body .= '<strong>' . __( 'Donation Date', 'give' ) . ':</strong> ' . '{date}' . "\n"; |
|
227 | - $default_email_body .= '<strong>' . __( 'Amount', 'give' ) . ':</strong> ' . '{price}' . "\n"; |
|
228 | - $default_email_body .= '<strong>' . __( 'Payment Method', 'give' ) . ':</strong> ' . '{payment_method}' . "\n"; |
|
229 | - $default_email_body .= '<strong>' . __( 'Payment ID', 'give' ) . ':</strong> ' . '{payment_id}' . "\n"; |
|
230 | - $default_email_body .= '<strong>' . __( 'Receipt ID', 'give' ) . ':</strong> ' . '{receipt_id}' . "\n\n"; |
|
231 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
222 | + $default_email_body = __('Dear', 'give')." {name},\n\n"; |
|
223 | + $default_email_body .= __('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
224 | + $default_email_body .= '<strong>'.__('Donor', 'give').':</strong> '.'{fullname}'."\n"; |
|
225 | + $default_email_body .= '<strong>'.__('Donation', 'give').':</strong> '.'{donation}'."\n"; |
|
226 | + $default_email_body .= '<strong>'.__('Donation Date', 'give').':</strong> '.'{date}'."\n"; |
|
227 | + $default_email_body .= '<strong>'.__('Amount', 'give').':</strong> '.'{price}'."\n"; |
|
228 | + $default_email_body .= '<strong>'.__('Payment Method', 'give').':</strong> '.'{payment_method}'."\n"; |
|
229 | + $default_email_body .= '<strong>'.__('Payment ID', 'give').':</strong> '.'{payment_id}'."\n"; |
|
230 | + $default_email_body .= '<strong>'.__('Receipt ID', 'give').':</strong> '.'{receipt_id}'."\n\n"; |
|
231 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
232 | 232 | |
233 | 233 | $default_email_body .= "\n\n"; |
234 | - $default_email_body .= __( 'Sincerely,', 'give' ); |
|
235 | - $default_email_body .= "\n" . '{sitename}' . "\n"; |
|
234 | + $default_email_body .= __('Sincerely,', 'give'); |
|
235 | + $default_email_body .= "\n".'{sitename}'."\n"; |
|
236 | 236 | |
237 | - $message = ( isset( $give_options['donation_receipt'] ) && ! empty( $give_options['donation_receipt'] ) ) ? $give_options['donation_receipt'] : $default_email_body; |
|
237 | + $message = (isset($give_options['donation_receipt']) && ! empty($give_options['donation_receipt'])) ? $give_options['donation_receipt'] : $default_email_body; |
|
238 | 238 | |
239 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
239 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -248,19 +248,19 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @return array $email_names |
250 | 250 | */ |
251 | -function give_get_email_names( $user_info ) { |
|
251 | +function give_get_email_names($user_info) { |
|
252 | 252 | $email_names = array(); |
253 | - $user_info = maybe_unserialize( $user_info ); |
|
253 | + $user_info = maybe_unserialize($user_info); |
|
254 | 254 | |
255 | 255 | $email_names['fullname'] = ''; |
256 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
257 | - $user_data = get_userdata( $user_info['id'] ); |
|
256 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
257 | + $user_data = get_userdata($user_info['id']); |
|
258 | 258 | $email_names['name'] = $user_info['first_name']; |
259 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
259 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
260 | 260 | $email_names['username'] = $user_data->user_login; |
261 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
261 | + } elseif (isset($user_info['first_name'])) { |
|
262 | 262 | $email_names['name'] = $user_info['first_name']; |
263 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
263 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
264 | 264 | $email_names['username'] = $user_info['first_name']; |
265 | 265 | } else { |
266 | 266 | $email_names['name'] = $user_info['email']; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -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( __( 'Donation ID not supplied. Please try again', 'give' ), __( 'Error', 'give' ) ); |
|
23 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
24 | + wp_die(__('Donation ID not supplied. Please try again', 'give'), __('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( __( 'The specified ID does not belong to a payment. Please try again', 'give' ), __( 'Error', 'give' ) ); |
|
33 | +if (empty($payment_exists)) { |
|
34 | + wp_die(__('The specified ID does not belong to a payment. Please try again', 'give'), __('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; |
@@ -49,72 +49,72 @@ discard block |
||
49 | 49 | $payment_mode = $payment->mode; |
50 | 50 | ?> |
51 | 51 | <div class="wrap give-wrap"> |
52 | - <h1 id="transaction-details-heading"><?php printf( __( 'Payment %s', 'give' ), $number ); ?><?php if ( $payment_mode == 'test' ) { |
|
53 | - echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . __( 'This payment was made in Test Mode', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . __( 'Test Payment', 'give' ) . '</span>'; |
|
52 | + <h1 id="transaction-details-heading"><?php printf(__('Payment %s', 'give'), $number); ?><?php if ($payment_mode == 'test') { |
|
53 | + echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.__('This payment was made in Test Mode', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.__('Test Payment', 'give').'</span>'; |
|
54 | 54 | } ?></h1> |
55 | 55 | |
56 | - <?php do_action( 'give_view_order_details_before', $payment_id ); ?> |
|
56 | + <?php do_action('give_view_order_details_before', $payment_id); ?> |
|
57 | 57 | <form id="give-edit-order-form" method="post"> |
58 | - <?php do_action( 'give_view_order_details_form_top', $payment_id ); ?> |
|
58 | + <?php do_action('give_view_order_details_form_top', $payment_id); ?> |
|
59 | 59 | <div id="poststuff"> |
60 | 60 | <div id="give-dashboard-widgets-wrap"> |
61 | 61 | <div id="post-body" class="metabox-holder columns-2"> |
62 | 62 | <div id="postbox-container-1" class="postbox-container"> |
63 | 63 | <div id="side-sortables" class="meta-box-sortables ui-sortable"> |
64 | 64 | |
65 | - <?php do_action( 'give_view_order_details_sidebar_before', $payment_id ); ?> |
|
65 | + <?php do_action('give_view_order_details_sidebar_before', $payment_id); ?> |
|
66 | 66 | |
67 | 67 | |
68 | 68 | <div id="give-order-update" class="postbox give-order-data"> |
69 | 69 | |
70 | 70 | <h3 class="hndle"> |
71 | - <span><?php _e( 'Update Payment', 'give' ); ?></span> |
|
71 | + <span><?php _e('Update Payment', 'give'); ?></span> |
|
72 | 72 | </h3> |
73 | 73 | |
74 | 74 | <div class="inside"> |
75 | 75 | <div class="give-admin-box"> |
76 | 76 | |
77 | - <?php do_action( 'give_view_order_details_totals_before', $payment_id ); ?> |
|
77 | + <?php do_action('give_view_order_details_totals_before', $payment_id); ?> |
|
78 | 78 | |
79 | 79 | <div class="give-admin-box-inside"> |
80 | 80 | <p> |
81 | - <span class="label"><?php _e( 'Status:', 'give' ); ?></span> |
|
81 | + <span class="label"><?php _e('Status:', 'give'); ?></span> |
|
82 | 82 | <select name="give-payment-status" class="medium-text"> |
83 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
84 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
83 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
84 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
85 | 85 | <?php endforeach; ?> |
86 | 86 | </select> |
87 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
87 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | |
91 | 91 | <div class="give-admin-box-inside"> |
92 | 92 | <p> |
93 | - <span class="label"><?php _e( 'Date:', 'give' ); ?></span> |
|
94 | - <input type="text" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
93 | + <span class="label"><?php _e('Date:', 'give'); ?></span> |
|
94 | + <input type="text" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
95 | 95 | </p> |
96 | 96 | </div> |
97 | 97 | |
98 | 98 | <div class="give-admin-box-inside"> |
99 | 99 | <p> |
100 | - <span class="label"><?php _e( 'Time:', 'give' ); ?></span> |
|
101 | - <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"/> : |
|
102 | - <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"/> |
|
100 | + <span class="label"><?php _e('Time:', 'give'); ?></span> |
|
101 | + <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"/> : |
|
102 | + <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"/> |
|
103 | 103 | </p> |
104 | 104 | </div> |
105 | 105 | |
106 | - <?php do_action( 'give_view_order_details_update_inner', $payment_id ); ?> |
|
106 | + <?php do_action('give_view_order_details_update_inner', $payment_id); ?> |
|
107 | 107 | |
108 | 108 | <?php |
109 | 109 | //@TODO: Fees |
110 | - $fees = give_get_payment_fees( $payment_id ); |
|
111 | - if ( ! empty( $fees ) ) : ?> |
|
110 | + $fees = give_get_payment_fees($payment_id); |
|
111 | + if ( ! empty($fees)) : ?> |
|
112 | 112 | <div class="give-order-fees give-admin-box-inside"> |
113 | - <p class="strong"><?php _e( 'Fees', 'give' ); ?>:</p> |
|
113 | + <p class="strong"><?php _e('Fees', 'give'); ?>:</p> |
|
114 | 114 | <ul class="give-payment-fees"> |
115 | - <?php foreach ( $fees as $fee ) : ?> |
|
115 | + <?php foreach ($fees as $fee) : ?> |
|
116 | 116 | <li> |
117 | - <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> |
|
117 | + <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> |
|
118 | 118 | </li> |
119 | 119 | <?php endforeach; ?> |
120 | 120 | </ul> |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | |
125 | 125 | <div class="give-order-payment give-admin-box-inside"> |
126 | 126 | <p> |
127 | - <span class="label"><?php _e( 'Total Donation', 'give' ); ?>:</span> |
|
128 | - <?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_amount( give_get_payment_amount( $payment_id ) ) ); ?>"/> |
|
127 | + <span class="label"><?php _e('Total Donation', 'give'); ?>:</span> |
|
128 | + <?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_amount(give_get_payment_amount($payment_id))); ?>"/> |
|
129 | 129 | </p> |
130 | 130 | </div> |
131 | 131 | |
132 | - <?php do_action( 'give_view_order_details_totals_after', $payment_id ); ?> |
|
132 | + <?php do_action('give_view_order_details_totals_after', $payment_id); ?> |
|
133 | 133 | |
134 | 134 | </div> |
135 | 135 | <!-- /.give-admin-box --> |
@@ -138,20 +138,20 @@ discard block |
||
138 | 138 | <!-- /.inside --> |
139 | 139 | |
140 | 140 | <div class="give-order-update-box give-admin-box"> |
141 | - <?php do_action( 'give_view_order_details_update_before', $payment_id ); ?> |
|
141 | + <?php do_action('give_view_order_details_update_before', $payment_id); ?> |
|
142 | 142 | <div id="major-publishing-actions"> |
143 | 143 | <div id="publishing-action"> |
144 | - <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Payment', 'give' ); ?>"/> |
|
145 | - <?php if ( give_is_payment_complete( $payment_id ) ) : ?> |
|
146 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
144 | + <input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Payment', 'give'); ?>"/> |
|
145 | + <?php if (give_is_payment_complete($payment_id)) : ?> |
|
146 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
147 | 147 | 'give-action' => 'email_links', |
148 | 148 | 'purchase_id' => $payment_id |
149 | - ) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e( 'Resend Receipt', 'give' ); ?></a> |
|
149 | + ))); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e('Resend Receipt', 'give'); ?></a> |
|
150 | 150 | <?php endif; ?> |
151 | 151 | </div> |
152 | 152 | <div class="clear"></div> |
153 | 153 | </div> |
154 | - <?php do_action( 'give_view_order_details_update_after', $payment_id ); ?> |
|
154 | + <?php do_action('give_view_order_details_update_after', $payment_id); ?> |
|
155 | 155 | </div> |
156 | 156 | <!-- /.give-order-update-box --> |
157 | 157 | |
@@ -161,55 +161,55 @@ discard block |
||
161 | 161 | <div id="give-order-details" class="postbox give-order-data"> |
162 | 162 | |
163 | 163 | <h3 class="hndle"> |
164 | - <span><?php _e( 'Payment Meta', 'give' ); ?></span> |
|
164 | + <span><?php _e('Payment Meta', 'give'); ?></span> |
|
165 | 165 | </h3> |
166 | 166 | |
167 | 167 | <div class="inside"> |
168 | 168 | <div class="give-admin-box"> |
169 | 169 | |
170 | - <?php do_action( 'give_view_order_details_payment_meta_before', $payment_id ); ?> |
|
170 | + <?php do_action('give_view_order_details_payment_meta_before', $payment_id); ?> |
|
171 | 171 | |
172 | 172 | <?php |
173 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
174 | - if ( $gateway ) : ?> |
|
173 | + $gateway = give_get_payment_gateway($payment_id); |
|
174 | + if ($gateway) : ?> |
|
175 | 175 | <div class="give-order-gateway give-admin-box-inside"> |
176 | 176 | <p> |
177 | - <span class="label"><?php _e( 'Gateway:', 'give' ); ?></span> |
|
178 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
177 | + <span class="label"><?php _e('Gateway:', 'give'); ?></span> |
|
178 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
179 | 179 | </p> |
180 | 180 | </div> |
181 | 181 | <?php endif; ?> |
182 | 182 | |
183 | 183 | <div class="give-order-payment-key give-admin-box-inside"> |
184 | 184 | <p> |
185 | - <span class="label"><?php _e( 'Key:', 'give' ); ?></span> |
|
186 | - <span><?php echo give_get_payment_key( $payment_id ); ?></span> |
|
185 | + <span class="label"><?php _e('Key:', 'give'); ?></span> |
|
186 | + <span><?php echo give_get_payment_key($payment_id); ?></span> |
|
187 | 187 | </p> |
188 | 188 | </div> |
189 | 189 | |
190 | 190 | <div class="give-order-ip give-admin-box-inside"> |
191 | 191 | <p> |
192 | - <span class="label"><?php _e( 'IP:', 'give' ); ?></span> |
|
193 | - <span><?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?></span> |
|
192 | + <span class="label"><?php _e('IP:', 'give'); ?></span> |
|
193 | + <span><?php echo esc_html(give_get_payment_user_ip($payment_id)); ?></span> |
|
194 | 194 | </p> |
195 | 195 | </div> |
196 | 196 | |
197 | - <?php if ( $transaction_id ) : ?> |
|
197 | + <?php if ($transaction_id) : ?> |
|
198 | 198 | <div class="give-order-tx-id give-admin-box-inside"> |
199 | 199 | <p> |
200 | - <span class="label"><?php _e( 'Transaction ID:', 'give' ); ?></span> |
|
201 | - <span><?php echo apply_filters( 'give_payment_details_transaction_id-' . $gateway, $transaction_id, $payment_id ); ?></span> |
|
200 | + <span class="label"><?php _e('Transaction ID:', 'give'); ?></span> |
|
201 | + <span><?php echo apply_filters('give_payment_details_transaction_id-'.$gateway, $transaction_id, $payment_id); ?></span> |
|
202 | 202 | </p> |
203 | 203 | </div> |
204 | 204 | <?php endif; ?> |
205 | 205 | |
206 | 206 | <div class="give-admin-box-inside"> |
207 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . esc_attr( give_get_payment_user_email( $payment_id ) ) ); ?> |
|
208 | - <a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor', 'give' ); ?> »</a> |
|
207 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.esc_attr(give_get_payment_user_email($payment_id))); ?> |
|
208 | + <a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor', 'give'); ?> »</a> |
|
209 | 209 | </p> |
210 | 210 | </div> |
211 | 211 | |
212 | - <?php do_action( 'give_view_order_details_payment_meta_after', $payment_id ); ?> |
|
212 | + <?php do_action('give_view_order_details_payment_meta_after', $payment_id); ?> |
|
213 | 213 | |
214 | 214 | </div> |
215 | 215 | <!-- /.column-container --> |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | </div> |
221 | 221 | <!-- /#give-order-data --> |
222 | 222 | |
223 | - <?php do_action( 'give_view_order_details_sidebar_after', $payment_id ); ?> |
|
223 | + <?php do_action('give_view_order_details_sidebar_after', $payment_id); ?> |
|
224 | 224 | |
225 | 225 | </div> |
226 | 226 | <!-- /#side-sortables --> |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | |
232 | 232 | <div id="normal-sortables" class="meta-box-sortables ui-sortable"> |
233 | 233 | |
234 | - <?php do_action( 'give_view_order_details_main_before', $payment_id ); ?> |
|
234 | + <?php do_action('give_view_order_details_main_before', $payment_id); ?> |
|
235 | 235 | |
236 | 236 | <?php $column_count = 'columns-3'; ?> |
237 | 237 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
238 | 238 | <h3 class="hndle"> |
239 | - <span><?php _e( 'Donation Information', 'give' ); ?></span> |
|
239 | + <span><?php _e('Donation Information', 'give'); ?></span> |
|
240 | 240 | </h3> |
241 | 241 | |
242 | 242 | <div class="inside"> |
@@ -244,29 +244,29 @@ discard block |
||
244 | 244 | <table style="width:100%;text-align:left;"> |
245 | 245 | <thead> |
246 | 246 | <tr> |
247 | - <?php do_action( 'give_donation_details_thead_before', $payment_id ); ?> |
|
248 | - <th><?php _e( 'Donation Form ID', 'give' ) ?></th> |
|
249 | - <th><?php _e( 'Donation Form Title', 'give' ) ?></th> |
|
250 | - <th><?php _e( 'Donation Level', 'give' ) ?></th> |
|
251 | - <th><?php _e( 'Donation Date', 'give' ) ?></th> |
|
252 | - <th><?php _e( 'Total Donation', 'give' ) ?></th> |
|
253 | - <?php do_action( 'give_donation_details_thead_after', $payment_id ); ?> |
|
247 | + <?php do_action('give_donation_details_thead_before', $payment_id); ?> |
|
248 | + <th><?php _e('Donation Form ID', 'give') ?></th> |
|
249 | + <th><?php _e('Donation Form Title', 'give') ?></th> |
|
250 | + <th><?php _e('Donation Level', 'give') ?></th> |
|
251 | + <th><?php _e('Donation Date', 'give') ?></th> |
|
252 | + <th><?php _e('Total Donation', 'give') ?></th> |
|
253 | + <?php do_action('give_donation_details_thead_after', $payment_id); ?> |
|
254 | 254 | </tr> |
255 | 255 | </thead> |
256 | 256 | <tr> |
257 | - <?php do_action( 'give_donation_details_tbody_before', $payment_id ); ?> |
|
257 | + <?php do_action('give_donation_details_tbody_before', $payment_id); ?> |
|
258 | 258 | <td> |
259 | 259 | <?php echo $payment_meta['form_id']; ?> |
260 | 260 | </td> |
261 | 261 | <td> |
262 | - <a href="<?php echo get_permalink( $payment_meta['form_id'] ); ?>"><?php echo $payment_meta['form_title']; ?></a> |
|
262 | + <a href="<?php echo get_permalink($payment_meta['form_id']); ?>"><?php echo $payment_meta['form_title']; ?></a> |
|
263 | 263 | </td> |
264 | 264 | <td> |
265 | 265 | <?php |
266 | 266 | //Level ID |
267 | - $level_title = give_get_payment_form_title( $payment_meta, true ); |
|
268 | - if ( empty( $level_title ) ) { |
|
269 | - echo __( 'n/a', 'give' ); |
|
267 | + $level_title = give_get_payment_form_title($payment_meta, true); |
|
268 | + if (empty($level_title)) { |
|
269 | + echo __('n/a', 'give'); |
|
270 | 270 | } else { |
271 | 271 | echo $level_title; |
272 | 272 | } ?> |
@@ -274,13 +274,13 @@ discard block |
||
274 | 274 | <td> |
275 | 275 | <?php |
276 | 276 | //Transaction Date |
277 | - $date_format = get_option( 'date_format' ); |
|
278 | - echo date_i18n( $date_format, strtotime( $payment_date ) ); |
|
277 | + $date_format = get_option('date_format'); |
|
278 | + echo date_i18n($date_format, strtotime($payment_date)); |
|
279 | 279 | ?> |
280 | 280 | </td> |
281 | 281 | <td> |
282 | - <?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?></td> |
|
283 | - <?php do_action( 'give_donation_details_tbody_after', $payment_id ); ?> |
|
282 | + <?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?></td> |
|
283 | + <?php do_action('give_donation_details_tbody_after', $payment_id); ?> |
|
284 | 284 | |
285 | 285 | </tr> |
286 | 286 | </table> |
@@ -292,64 +292,64 @@ discard block |
||
292 | 292 | </div> |
293 | 293 | <!-- /#give-donation-overview --> |
294 | 294 | |
295 | - <?php do_action( 'give_view_order_details_files_after', $payment_id ); ?> |
|
295 | + <?php do_action('give_view_order_details_files_after', $payment_id); ?> |
|
296 | 296 | |
297 | - <?php do_action( 'give_view_order_details_billing_before', $payment_id ); ?> |
|
297 | + <?php do_action('give_view_order_details_billing_before', $payment_id); ?> |
|
298 | 298 | |
299 | 299 | |
300 | 300 | <div id="give-customer-details" class="postbox"> |
301 | 301 | <h3 class="hndle"> |
302 | - <span><?php _e( 'Donor Details', 'give' ); ?></span> |
|
302 | + <span><?php _e('Donor Details', 'give'); ?></span> |
|
303 | 303 | </h3> |
304 | 304 | |
305 | 305 | <div class="inside give-clearfix"> |
306 | 306 | |
307 | - <?php $customer = new Give_Customer( $customer_id ); ?> |
|
307 | + <?php $customer = new Give_Customer($customer_id); ?> |
|
308 | 308 | |
309 | 309 | <div class="column-container customer-info"> |
310 | 310 | <div class="column"> |
311 | - <?php echo Give()->html->donor_dropdown( array( |
|
311 | + <?php echo Give()->html->donor_dropdown(array( |
|
312 | 312 | 'selected' => $customer->id, |
313 | 313 | 'name' => 'customer-id' |
314 | - ) ); ?> |
|
314 | + )); ?> |
|
315 | 315 | </div> |
316 | 316 | <div class="column"> |
317 | 317 | <input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/> |
318 | 318 | </div> |
319 | 319 | <div class="column"> |
320 | - <?php if ( ! empty( $customer->id ) ) : ?> |
|
321 | - <?php $customer_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?> |
|
322 | - <a href="<?php echo $customer_url; ?>" title="<?php _e( 'View Donor Details', 'give' ); ?>"><?php _e( 'View Donor Details', 'give' ); ?></a> |
|
320 | + <?php if ( ! empty($customer->id)) : ?> |
|
321 | + <?php $customer_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?> |
|
322 | + <a href="<?php echo $customer_url; ?>" title="<?php _e('View Donor Details', 'give'); ?>"><?php _e('View Donor Details', 'give'); ?></a> |
|
323 | 323 | | |
324 | 324 | <?php endif; ?> |
325 | - <a href="#new" class="give-payment-new-customer" title="<?php _e( 'New Donor', 'give' ); ?>"><?php _e( 'New Donor', 'give' ); ?></a> |
|
325 | + <a href="#new" class="give-payment-new-customer" title="<?php _e('New Donor', 'give'); ?>"><?php _e('New Donor', 'give'); ?></a> |
|
326 | 326 | </div> |
327 | 327 | </div> |
328 | 328 | |
329 | 329 | <div class="column-container new-customer" style="display: none"> |
330 | 330 | <div class="column"> |
331 | - <strong><?php _e( 'Name:', 'give' ); ?></strong> |
|
331 | + <strong><?php _e('Name:', 'give'); ?></strong> |
|
332 | 332 | <input type="text" name="give-new-customer-name" value="" class="medium-text"/> |
333 | 333 | </div> |
334 | 334 | <div class="column"> |
335 | - <strong><?php _e( 'Email:', 'give' ); ?></strong> |
|
335 | + <strong><?php _e('Email:', 'give'); ?></strong> |
|
336 | 336 | <input type="email" name="give-new-customer-email" value="" class="medium-text"/> |
337 | 337 | </div> |
338 | 338 | <div class="column"> |
339 | 339 | <input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/> |
340 | - <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
340 | + <a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e('Cancel', 'give'); ?></a> |
|
341 | 341 | </div> |
342 | 342 | <div class="column"> |
343 | 343 | <small> |
344 | - <em>*<?php _e( 'Click "Save Payment" to create new donor', 'give' ); ?></em> |
|
344 | + <em>*<?php _e('Click "Save Payment" to create new donor', 'give'); ?></em> |
|
345 | 345 | </small> |
346 | 346 | </div> |
347 | 347 | </div> |
348 | 348 | |
349 | 349 | <?php |
350 | 350 | // The give_payment_personal_details_list hook is left here for backwards compatibility |
351 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
352 | - do_action( 'give_payment_view_details', $payment_id ); |
|
351 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
352 | + do_action('give_payment_view_details', $payment_id); |
|
353 | 353 | ?> |
354 | 354 | |
355 | 355 | </div> |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | <div id="give-billing-details" class="postbox"> |
362 | 362 | <h3 class="hndle"> |
363 | - <span><?php _e( 'Billing Address', 'give' ); ?></span> |
|
363 | + <span><?php _e('Billing Address', 'give'); ?></span> |
|
364 | 364 | </h3> |
365 | 365 | |
366 | 366 | <div class="inside give-clearfix"> |
@@ -371,62 +371,62 @@ discard block |
||
371 | 371 | <div class="data column-container"> |
372 | 372 | <div class="column"> |
373 | 373 | <p> |
374 | - <strong class="order-data-address-line"><?php _e( 'Street Address Line 1:', 'give' ); ?></strong><br/> |
|
375 | - <input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
374 | + <strong class="order-data-address-line"><?php _e('Street Address Line 1:', 'give'); ?></strong><br/> |
|
375 | + <input type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
376 | 376 | </p> |
377 | 377 | |
378 | 378 | <p> |
379 | - <strong class="order-data-address-line"><?php _e( 'Street Address Line 2:', 'give' ); ?></strong><br/> |
|
380 | - <input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
379 | + <strong class="order-data-address-line"><?php _e('Street Address Line 2:', 'give'); ?></strong><br/> |
|
380 | + <input type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
381 | 381 | </p> |
382 | 382 | |
383 | 383 | </div> |
384 | 384 | <div class="column"> |
385 | 385 | <p> |
386 | - <strong class="order-data-address-line"><?php echo _x( 'City:', 'Address City', 'give' ); ?></strong><br/> |
|
387 | - <input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
386 | + <strong class="order-data-address-line"><?php echo _x('City:', 'Address City', 'give'); ?></strong><br/> |
|
387 | + <input type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
388 | 388 | |
389 | 389 | </p> |
390 | 390 | |
391 | 391 | <p> |
392 | - <strong class="order-data-address-line"><?php echo _x( 'Zip / Postal Code:', 'Zip / Postal code of address', 'give' ); ?></strong><br/> |
|
393 | - <input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
392 | + <strong class="order-data-address-line"><?php echo _x('Zip / Postal Code:', 'Zip / Postal code of address', 'give'); ?></strong><br/> |
|
393 | + <input type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
394 | 394 | |
395 | 395 | </p> |
396 | 396 | </div> |
397 | 397 | <div class="column"> |
398 | 398 | <p id="give-order-address-country-wrap"> |
399 | - <strong class="order-data-address-line"><?php echo _x( 'Country:', 'Address country', 'give' ); ?></strong><br/> |
|
399 | + <strong class="order-data-address-line"><?php echo _x('Country:', 'Address country', 'give'); ?></strong><br/> |
|
400 | 400 | <?php |
401 | - echo Give()->html->select( array( |
|
401 | + echo Give()->html->select(array( |
|
402 | 402 | 'options' => give_get_country_list(), |
403 | 403 | 'name' => 'give-payment-address[0][country]', |
404 | 404 | 'selected' => $address['country'], |
405 | 405 | 'show_option_all' => false, |
406 | 406 | 'show_option_none' => false, |
407 | 407 | 'chosen' => true, |
408 | - 'placeholder' => __( 'Select a country', 'give' ) |
|
409 | - ) ); |
|
408 | + 'placeholder' => __('Select a country', 'give') |
|
409 | + )); |
|
410 | 410 | ?> |
411 | 411 | </p> |
412 | 412 | |
413 | 413 | <p id="give-order-address-state-wrap"> |
414 | - <strong class="order-data-address-line"><?php echo _x( 'State / Province:', 'State / province of address', 'give' ); ?></strong><br/> |
|
414 | + <strong class="order-data-address-line"><?php echo _x('State / Province:', 'State / province of address', 'give'); ?></strong><br/> |
|
415 | 415 | <?php |
416 | - $states = give_get_states( $address['country'] ); |
|
417 | - if ( ! empty( $states ) ) { |
|
418 | - echo Give()->html->select( array( |
|
416 | + $states = give_get_states($address['country']); |
|
417 | + if ( ! empty($states)) { |
|
418 | + echo Give()->html->select(array( |
|
419 | 419 | 'options' => $states, |
420 | 420 | 'name' => 'give-payment-address[0][state]', |
421 | 421 | 'selected' => $address['state'], |
422 | 422 | 'show_option_all' => false, |
423 | 423 | 'show_option_none' => false, |
424 | 424 | 'chosen' => true, |
425 | - 'placeholder' => __( 'Select a state', 'give' ) |
|
426 | - ) ); |
|
425 | + 'placeholder' => __('Select a state', 'give') |
|
426 | + )); |
|
427 | 427 | } else { |
428 | 428 | ?> |
429 | - <input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
429 | + <input type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
430 | 430 | <?php |
431 | 431 | } ?> |
432 | 432 | </p> |
@@ -436,39 +436,39 @@ discard block |
||
436 | 436 | </div> |
437 | 437 | <!-- /#give-order-address --> |
438 | 438 | |
439 | - <?php do_action( 'give_payment_billing_details', $payment_id ); ?> |
|
439 | + <?php do_action('give_payment_billing_details', $payment_id); ?> |
|
440 | 440 | |
441 | 441 | </div> |
442 | 442 | <!-- /.inside --> |
443 | 443 | </div> |
444 | 444 | <!-- /#give-billing-details --> |
445 | 445 | |
446 | - <?php do_action( 'give_view_order_details_billing_after', $payment_id ); ?> |
|
446 | + <?php do_action('give_view_order_details_billing_after', $payment_id); ?> |
|
447 | 447 | |
448 | 448 | <div id="give-payment-notes" class="postbox"> |
449 | - <h3 class="hndle"><span><?php _e( 'Payment Notes', 'give' ); ?></span></h3> |
|
449 | + <h3 class="hndle"><span><?php _e('Payment Notes', 'give'); ?></span></h3> |
|
450 | 450 | |
451 | 451 | <div class="inside"> |
452 | 452 | <div id="give-payment-notes-inner"> |
453 | 453 | <?php |
454 | - $notes = give_get_payment_notes( $payment_id ); |
|
455 | - if ( ! empty( $notes ) ) : |
|
454 | + $notes = give_get_payment_notes($payment_id); |
|
455 | + if ( ! empty($notes)) : |
|
456 | 456 | $no_notes_display = ' style="display:none;"'; |
457 | - foreach ( $notes as $note ) : |
|
457 | + foreach ($notes as $note) : |
|
458 | 458 | |
459 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
459 | + echo give_get_payment_note_html($note, $payment_id); |
|
460 | 460 | |
461 | 461 | endforeach; |
462 | 462 | else : |
463 | 463 | $no_notes_display = ''; |
464 | 464 | endif; |
465 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>'; |
|
465 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.__('No payment notes', 'give').'</p>'; |
|
466 | 466 | ?> |
467 | 467 | </div> |
468 | 468 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
469 | 469 | |
470 | 470 | <p class="give-clearfix"> |
471 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button> |
|
471 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button> |
|
472 | 472 | </p> |
473 | 473 | |
474 | 474 | <div class="clear"></div> |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | </div> |
478 | 478 | <!-- /#give-payment-notes --> |
479 | 479 | |
480 | - <?php do_action( 'give_view_order_details_main_after', $payment_id ); ?> |
|
480 | + <?php do_action('give_view_order_details_main_after', $payment_id); ?> |
|
481 | 481 | </div> |
482 | 482 | <!-- /#normal-sortables --> |
483 | 483 | </div> |
@@ -488,10 +488,10 @@ discard block |
||
488 | 488 | <!-- #give-dashboard-widgets-wrap --> |
489 | 489 | </div> |
490 | 490 | <!-- /#post-stuff --> |
491 | - <?php do_action( 'give_view_order_details_form_bottom', $payment_id ); ?> |
|
492 | - <?php wp_nonce_field( 'give_update_payment_details_nonce' ); ?> |
|
493 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
491 | + <?php do_action('give_view_order_details_form_bottom', $payment_id); ?> |
|
492 | + <?php wp_nonce_field('give_update_payment_details_nonce'); ?> |
|
493 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
494 | 494 | <input type="hidden" name="give_action" value="update_payment_details"/> |
495 | 495 | </form> |
496 | - <?php do_action( 'give_view_order_details_after', $payment_id ); ?> |
|
496 | + <?php do_action('give_view_order_details_after', $payment_id); ?> |
|
497 | 497 | </div><!-- /.wrap --> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,106 +26,106 @@ discard block |
||
26 | 26 | * @return void |
27 | 27 | * |
28 | 28 | */ |
29 | -function give_update_payment_details( $data ) { |
|
29 | +function give_update_payment_details($data) { |
|
30 | 30 | |
31 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
32 | - wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
31 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
32 | + wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403)); |
|
33 | 33 | } |
34 | 34 | |
35 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
35 | + check_admin_referer('give_update_payment_details_nonce'); |
|
36 | 36 | |
37 | 37 | // Retrieve the payment ID |
38 | - $payment_id = absint( $data['edd_payment_id'] ); |
|
39 | - $payment = new Give_Payment( $payment_id ); |
|
38 | + $payment_id = absint($data['edd_payment_id']); |
|
39 | + $payment = new Give_Payment($payment_id); |
|
40 | 40 | |
41 | 41 | // Retrieve existing payment meta |
42 | 42 | $meta = $payment->get_meta(); |
43 | 43 | $user_info = $payment->user_info; |
44 | 44 | |
45 | 45 | $status = $data['give-payment-status']; |
46 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
47 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
46 | + $date = sanitize_text_field($data['give-payment-date']); |
|
47 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
48 | 48 | |
49 | 49 | // Restrict to our high and low |
50 | - if ( $hour > 23 ) { |
|
50 | + if ($hour > 23) { |
|
51 | 51 | $hour = 23; |
52 | - } elseif ( $hour < 0 ) { |
|
52 | + } elseif ($hour < 0) { |
|
53 | 53 | $hour = 00; |
54 | 54 | } |
55 | 55 | |
56 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
56 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
57 | 57 | |
58 | 58 | // Restrict to our high and low |
59 | - if ( $minute > 59 ) { |
|
59 | + if ($minute > 59) { |
|
60 | 60 | $minute = 59; |
61 | - } elseif ( $minute < 0 ) { |
|
61 | + } elseif ($minute < 0) { |
|
62 | 62 | $minute = 00; |
63 | 63 | } |
64 | 64 | |
65 | - $address = array_map( 'trim', $data['give-payment-address'][0] ); |
|
65 | + $address = array_map('trim', $data['give-payment-address'][0]); |
|
66 | 66 | |
67 | - $curr_total = give_sanitize_amount( $payment->total ); |
|
68 | - $new_total = give_sanitize_amount( $_POST['give-payment-total'] ); |
|
69 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
67 | + $curr_total = give_sanitize_amount($payment->total); |
|
68 | + $new_total = give_sanitize_amount($_POST['give-payment-total']); |
|
69 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
70 | 70 | |
71 | - $curr_customer_id = sanitize_text_field( $data['give-current-customer'] ); |
|
72 | - $new_customer_id = sanitize_text_field( $data['customer-id'] ); |
|
71 | + $curr_customer_id = sanitize_text_field($data['give-current-customer']); |
|
72 | + $new_customer_id = sanitize_text_field($data['customer-id']); |
|
73 | 73 | |
74 | - do_action( 'give_update_edited_purchase', $payment_id ); |
|
74 | + do_action('give_update_edited_purchase', $payment_id); |
|
75 | 75 | |
76 | 76 | $payment->date = $date; |
77 | 77 | $updated = $payment->save(); |
78 | 78 | |
79 | - if ( 0 === $updated ) { |
|
80 | - wp_die( esc_attr__( 'Error Updating Payment', 'give' ), esc_attr__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
79 | + if (0 === $updated) { |
|
80 | + wp_die(esc_attr__('Error Updating Payment', 'give'), esc_attr__('Error', 'give'), array('response' => 400)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | $customer_changed = false; |
84 | 84 | |
85 | - if ( isset( $data['give-new-customer'] ) && $data['give-new-customer'] == '1' ) { |
|
85 | + if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') { |
|
86 | 86 | |
87 | - $email = isset( $data['give-new-customer-email'] ) ? sanitize_text_field( $data['give-new-customer-email'] ) : ''; |
|
88 | - $names = isset( $data['give-new-customer-name'] ) ? sanitize_text_field( $data['give-new-customer-name'] ) : ''; |
|
87 | + $email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : ''; |
|
88 | + $names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : ''; |
|
89 | 89 | |
90 | - if ( empty( $email ) || empty( $names ) ) { |
|
91 | - wp_die( esc_attr__( 'New Customers require a name and email address', 'give' ) ); |
|
90 | + if (empty($email) || empty($names)) { |
|
91 | + wp_die(esc_attr__('New Customers require a name and email address', 'give')); |
|
92 | 92 | } |
93 | 93 | |
94 | - $customer = new Give_Customer( $email ); |
|
95 | - if ( empty( $customer->id ) ) { |
|
96 | - $customer_data = array( 'name' => $names, 'email' => $email ); |
|
97 | - $user_id = email_exists( $email ); |
|
98 | - if ( false !== $user_id ) { |
|
94 | + $customer = new Give_Customer($email); |
|
95 | + if (empty($customer->id)) { |
|
96 | + $customer_data = array('name' => $names, 'email' => $email); |
|
97 | + $user_id = email_exists($email); |
|
98 | + if (false !== $user_id) { |
|
99 | 99 | $customer_data['user_id'] = $user_id; |
100 | 100 | } |
101 | 101 | |
102 | - if ( ! $customer->create( $customer_data ) ) { |
|
102 | + if ( ! $customer->create($customer_data)) { |
|
103 | 103 | // Failed to crete the new donor, assume the previous donor |
104 | 104 | $customer_changed = false; |
105 | - $customer = new Give_Customer( $curr_customer_id ); |
|
106 | - give_set_error( 'give-payment-new-customer-fail', __( 'Error creating new donor', 'give' ) ); |
|
105 | + $customer = new Give_Customer($curr_customer_id); |
|
106 | + give_set_error('give-payment-new-customer-fail', __('Error creating new donor', 'give')); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | 110 | $new_customer_id = $customer->id; |
111 | 111 | |
112 | - $previous_customer = new Give_Customer( $curr_customer_id ); |
|
112 | + $previous_customer = new Give_Customer($curr_customer_id); |
|
113 | 113 | |
114 | 114 | $customer_changed = true; |
115 | 115 | |
116 | - } elseif ( $curr_customer_id !== $new_customer_id ) { |
|
116 | + } elseif ($curr_customer_id !== $new_customer_id) { |
|
117 | 117 | |
118 | - $customer = new Give_Customer( $new_customer_id ); |
|
118 | + $customer = new Give_Customer($new_customer_id); |
|
119 | 119 | $email = $customer->email; |
120 | 120 | $names = $customer->name; |
121 | 121 | |
122 | - $previous_customer = new Give_Customer( $curr_customer_id ); |
|
122 | + $previous_customer = new Give_Customer($curr_customer_id); |
|
123 | 123 | |
124 | 124 | $customer_changed = true; |
125 | 125 | |
126 | 126 | } else { |
127 | 127 | |
128 | - $customer = new Give_Customer( $curr_customer_id ); |
|
128 | + $customer = new Give_Customer($curr_customer_id); |
|
129 | 129 | $email = $customer->email; |
130 | 130 | $names = $customer->name; |
131 | 131 | |
@@ -133,29 +133,29 @@ discard block |
||
133 | 133 | |
134 | 134 | |
135 | 135 | // Setup first and last name from input values |
136 | - $names = explode( ' ', $names ); |
|
137 | - $first_name = ! empty( $names[0] ) ? $names[0] : ''; |
|
136 | + $names = explode(' ', $names); |
|
137 | + $first_name = ! empty($names[0]) ? $names[0] : ''; |
|
138 | 138 | $last_name = ''; |
139 | - if ( ! empty( $names[1] ) ) { |
|
140 | - unset( $names[0] ); |
|
141 | - $last_name = implode( ' ', $names ); |
|
139 | + if ( ! empty($names[1])) { |
|
140 | + unset($names[0]); |
|
141 | + $last_name = implode(' ', $names); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
145 | - if ( $customer_changed ) { |
|
145 | + if ($customer_changed) { |
|
146 | 146 | |
147 | 147 | // Remove the stats and payment from the previous customer and attach it to the new customer |
148 | - $previous_customer->remove_payment( $payment_id, false ); |
|
149 | - $customer->attach_payment( $payment_id, false ); |
|
148 | + $previous_customer->remove_payment($payment_id, false); |
|
149 | + $customer->attach_payment($payment_id, false); |
|
150 | 150 | |
151 | 151 | // If purchase was completed and not ever refunded, adjust stats of customers |
152 | - if ( 'revoked' == $status || 'publish' == $status ) { |
|
152 | + if ('revoked' == $status || 'publish' == $status) { |
|
153 | 153 | |
154 | 154 | $previous_customer->decrease_purchase_count(); |
155 | - $previous_customer->decrease_value( $new_total ); |
|
155 | + $previous_customer->decrease_value($new_total); |
|
156 | 156 | |
157 | 157 | $customer->increase_purchase_count(); |
158 | - $customer->increase_value( $new_total ); |
|
158 | + $customer->increase_value($new_total); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | $payment->customer_id = $customer->id; |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | |
172 | 172 | |
173 | 173 | // Check for payment notes |
174 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
174 | + if ( ! empty($data['give-payment-note'])) { |
|
175 | 175 | |
176 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
177 | - give_insert_payment_note( $payment_id, $note ); |
|
176 | + $note = wp_kses($data['give-payment-note'], array()); |
|
177 | + give_insert_payment_note($payment_id, $note); |
|
178 | 178 | |
179 | 179 | } |
180 | 180 | |
@@ -182,17 +182,17 @@ discard block |
||
182 | 182 | $payment->status = $status; |
183 | 183 | |
184 | 184 | // Adjust total store earnings if the payment total has been changed |
185 | - if ( $new_total !== $curr_total && ( 'publish' == $status || 'revoked' == $status ) ) { |
|
185 | + if ($new_total !== $curr_total && ('publish' == $status || 'revoked' == $status)) { |
|
186 | 186 | |
187 | - if ( $new_total > $curr_total ) { |
|
187 | + if ($new_total > $curr_total) { |
|
188 | 188 | // Increase if our new total is higher |
189 | 189 | $difference = $new_total - $curr_total; |
190 | - give_increase_total_earnings( $difference ); |
|
190 | + give_increase_total_earnings($difference); |
|
191 | 191 | |
192 | - } elseif ( $curr_total > $new_total ) { |
|
192 | + } elseif ($curr_total > $new_total) { |
|
193 | 193 | // Decrease if our new total is lower |
194 | 194 | $difference = $curr_total - $new_total; |
195 | - give_decrease_total_earnings( $difference ); |
|
195 | + give_decrease_total_earnings($difference); |
|
196 | 196 | |
197 | 197 | } |
198 | 198 | |
@@ -200,13 +200,13 @@ discard block |
||
200 | 200 | |
201 | 201 | $payment->save(); |
202 | 202 | |
203 | - do_action( 'give_updated_edited_purchase', $payment_id ); |
|
203 | + do_action('give_updated_edited_purchase', $payment_id); |
|
204 | 204 | |
205 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
205 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id='.$payment_id)); |
|
206 | 206 | exit; |
207 | 207 | } |
208 | 208 | |
209 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
209 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
210 | 210 | |
211 | 211 | /** |
212 | 212 | * Trigger a Purchase Deletion |
@@ -217,48 +217,48 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return void |
219 | 219 | */ |
220 | -function give_trigger_purchase_delete( $data ) { |
|
221 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_payment_nonce' ) ) { |
|
220 | +function give_trigger_purchase_delete($data) { |
|
221 | + if (wp_verify_nonce($data['_wpnonce'], 'give_payment_nonce')) { |
|
222 | 222 | |
223 | - $payment_id = absint( $data['purchase_id'] ); |
|
223 | + $payment_id = absint($data['purchase_id']); |
|
224 | 224 | |
225 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
226 | - wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
225 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
226 | + wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403)); |
|
227 | 227 | } |
228 | 228 | |
229 | - give_delete_purchase( $payment_id ); |
|
230 | - wp_redirect( admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted' ) ); |
|
229 | + give_delete_purchase($payment_id); |
|
230 | + wp_redirect(admin_url('/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted')); |
|
231 | 231 | give_die(); |
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
235 | -add_action( 'give_delete_payment', 'give_trigger_purchase_delete' ); |
|
235 | +add_action('give_delete_payment', 'give_trigger_purchase_delete'); |
|
236 | 236 | |
237 | 237 | /** |
238 | 238 | * AJAX Store Payment Note |
239 | 239 | */ |
240 | 240 | function give_ajax_store_payment_note() { |
241 | 241 | |
242 | - $payment_id = absint( $_POST['payment_id'] ); |
|
243 | - $note = wp_kses( $_POST['note'], array() ); |
|
242 | + $payment_id = absint($_POST['payment_id']); |
|
243 | + $note = wp_kses($_POST['note'], array()); |
|
244 | 244 | |
245 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
246 | - wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
245 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
246 | + wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403)); |
|
247 | 247 | } |
248 | 248 | |
249 | - if ( empty( $payment_id ) ) { |
|
250 | - die( '-1' ); |
|
249 | + if (empty($payment_id)) { |
|
250 | + die('-1'); |
|
251 | 251 | } |
252 | 252 | |
253 | - if ( empty( $note ) ) { |
|
254 | - die( '-1' ); |
|
253 | + if (empty($note)) { |
|
254 | + die('-1'); |
|
255 | 255 | } |
256 | 256 | |
257 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
258 | - die( give_get_payment_note_html( $note_id ) ); |
|
257 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
258 | + die(give_get_payment_note_html($note_id)); |
|
259 | 259 | } |
260 | 260 | |
261 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
261 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
262 | 262 | |
263 | 263 | /** |
264 | 264 | * Triggers a payment note deletion without ajax |
@@ -269,24 +269,24 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return void |
271 | 271 | */ |
272 | -function give_trigger_payment_note_deletion( $data ) { |
|
272 | +function give_trigger_payment_note_deletion($data) { |
|
273 | 273 | |
274 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
274 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
275 | 275 | return; |
276 | 276 | } |
277 | 277 | |
278 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
279 | - wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
278 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
279 | + wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403)); |
|
280 | 280 | } |
281 | 281 | |
282 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
282 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id='.absint($data['payment_id'])); |
|
283 | 283 | |
284 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
284 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
285 | 285 | |
286 | - wp_redirect( $edit_order_url ); |
|
286 | + wp_redirect($edit_order_url); |
|
287 | 287 | } |
288 | 288 | |
289 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
289 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
290 | 290 | |
291 | 291 | /** |
292 | 292 | * Delete a payment note deletion with ajax |
@@ -299,16 +299,16 @@ discard block |
||
299 | 299 | */ |
300 | 300 | function give_ajax_delete_payment_note() { |
301 | 301 | |
302 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
303 | - wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
302 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
303 | + wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403)); |
|
304 | 304 | } |
305 | 305 | |
306 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
307 | - die( '1' ); |
|
306 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
307 | + die('1'); |
|
308 | 308 | } else { |
309 | - die( '-1' ); |
|
309 | + die('-1'); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | } |
313 | 313 | |
314 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
315 | 314 | \ No newline at end of file |
315 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
|
316 | 316 | \ No newline at end of file |
@@ -10,11 +10,11 @@ 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 | |
17 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes'); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Define the metabox and field configurations. |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array |
25 | 25 | */ |
26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) { |
|
26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) { |
|
27 | 27 | |
28 | 28 | $post_id = give_get_admin_post_id(); |
29 | - $price = give_get_form_price( $post_id ); |
|
30 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
31 | - $goal = give_get_form_goal( $post_id ); |
|
32 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
33 | - $prices = give_get_variable_prices( $post_id ); |
|
29 | + $price = give_get_form_price($post_id); |
|
30 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
31 | + $goal = give_get_form_goal($post_id); |
|
32 | + $variable_pricing = give_has_variable_prices($post_id); |
|
33 | + $prices = give_get_variable_prices($post_id); |
|
34 | 34 | |
35 | 35 | //No empty prices - min. 1.00 for new forms |
36 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
37 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
36 | + if (empty($price) && is_null($post_id)) { |
|
37 | + $price = esc_attr(give_format_amount('1.00')); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | //Min. $1.00 for new forms |
41 | - if ( empty( $custom_amount_minimum ) ) { |
|
42 | - $custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) ); |
|
41 | + if (empty($custom_amount_minimum)) { |
|
42 | + $custom_amount_minimum = esc_attr(give_format_amount('1.00')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // Start with an underscore to hide fields from custom fields list |
@@ -48,302 +48,302 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * Repeatable Field Groups |
50 | 50 | */ |
51 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
51 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array( |
|
52 | 52 | 'id' => 'form_field_options', |
53 | - 'title' => __( 'Donation Options', 'give' ), |
|
54 | - 'object_types' => array( 'give_forms' ), |
|
53 | + 'title' => __('Donation Options', 'give'), |
|
54 | + 'object_types' => array('give_forms'), |
|
55 | 55 | 'context' => 'normal', |
56 | 56 | 'priority' => 'high', //Show above Content WYSIWYG |
57 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
57 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
58 | 58 | //Donation Option |
59 | 59 | array( |
60 | - 'name' => __( 'Donation Option', 'give' ), |
|
61 | - 'description' => __( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
62 | - 'id' => $prefix . 'price_option', |
|
60 | + 'name' => __('Donation Option', 'give'), |
|
61 | + 'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
62 | + 'id' => $prefix.'price_option', |
|
63 | 63 | 'type' => 'radio_inline', |
64 | 64 | 'default' => 'set', |
65 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
66 | - 'set' => __( 'Set Donation', 'give' ), |
|
67 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
68 | - ) ), |
|
65 | + 'options' => apply_filters('give_forms_price_options', array( |
|
66 | + 'set' => __('Set Donation', 'give'), |
|
67 | + 'multi' => __('Multi-level Donation', 'give'), |
|
68 | + )), |
|
69 | 69 | ), |
70 | 70 | array( |
71 | - 'name' => __( 'Set Donation', 'give' ), |
|
72 | - 'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
73 | - 'id' => $prefix . 'set_price', |
|
71 | + 'name' => __('Set Donation', 'give'), |
|
72 | + 'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
73 | + 'id' => $prefix.'set_price', |
|
74 | 74 | 'type' => 'text_small', |
75 | 75 | 'row_classes' => 'give-subfield', |
76 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
77 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
76 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
77 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
78 | 78 | 'attributes' => array( |
79 | - 'placeholder' => give_format_amount( '1.00' ), |
|
80 | - 'value' => give_format_amount( $price ), |
|
79 | + 'placeholder' => give_format_amount('1.00'), |
|
80 | + 'value' => give_format_amount($price), |
|
81 | 81 | 'class' => 'cmb-type-text-small give-money-field', |
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | //Donation levels: Header |
85 | 85 | array( |
86 | - 'id' => $prefix . 'levels_header', |
|
86 | + 'id' => $prefix.'levels_header', |
|
87 | 87 | 'type' => 'levels_repeater_header', |
88 | 88 | ), |
89 | 89 | //Donation Levels: Repeatable CMB2 Group |
90 | 90 | array( |
91 | - 'id' => $prefix . 'donation_levels', |
|
91 | + 'id' => $prefix.'donation_levels', |
|
92 | 92 | 'type' => 'group', |
93 | 93 | 'row_classes' => 'give-subfield', |
94 | 94 | 'options' => array( |
95 | - 'add_button' => __( 'Add Level', 'give' ), |
|
96 | - 'remove_button' => __( '<span class="dashicons dashicons-no"></span>', 'give' ), |
|
95 | + 'add_button' => __('Add Level', 'give'), |
|
96 | + 'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'), |
|
97 | 97 | 'sortable' => true, // beta |
98 | 98 | ), |
99 | 99 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
100 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
100 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
101 | 101 | array( |
102 | - 'name' => __( 'ID', 'give' ), |
|
103 | - 'id' => $prefix . 'id', |
|
102 | + 'name' => __('ID', 'give'), |
|
103 | + 'id' => $prefix.'id', |
|
104 | 104 | 'type' => 'levels_id', |
105 | 105 | ), |
106 | 106 | array( |
107 | - 'name' => __( 'Amount', 'give' ), |
|
108 | - 'id' => $prefix . 'amount', |
|
107 | + 'name' => __('Amount', 'give'), |
|
108 | + 'id' => $prefix.'amount', |
|
109 | 109 | 'type' => 'text_small', |
110 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
111 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
110 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
111 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
112 | 112 | 'attributes' => array( |
113 | - 'placeholder' => give_format_amount( '1.00' ), |
|
113 | + 'placeholder' => give_format_amount('1.00'), |
|
114 | 114 | 'class' => 'cmb-type-text-small give-money-field', |
115 | 115 | ), |
116 | 116 | 'before' => 'give_format_admin_multilevel_amount', |
117 | 117 | ), |
118 | 118 | array( |
119 | - 'name' => __( 'Text', 'give' ), |
|
120 | - 'id' => $prefix . 'text', |
|
119 | + 'name' => __('Text', 'give'), |
|
120 | + 'id' => $prefix.'text', |
|
121 | 121 | 'type' => 'text', |
122 | 122 | 'attributes' => array( |
123 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
123 | + 'placeholder' => __('Donation Level', 'give'), |
|
124 | 124 | 'class' => 'give-multilevel-text-field', |
125 | 125 | ), |
126 | 126 | ), |
127 | 127 | array( |
128 | - 'name' => __( 'Default', 'give' ), |
|
129 | - 'id' => $prefix . 'default', |
|
128 | + 'name' => __('Default', 'give'), |
|
129 | + 'id' => $prefix.'default', |
|
130 | 130 | 'type' => 'give_default_radio_inline' |
131 | 131 | ), |
132 | - ) ), |
|
132 | + )), |
|
133 | 133 | ), |
134 | 134 | //Display Style |
135 | 135 | array( |
136 | - 'name' => __( 'Display Style', 'give' ), |
|
137 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
138 | - 'id' => $prefix . 'display_style', |
|
136 | + 'name' => __('Display Style', 'give'), |
|
137 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
138 | + 'id' => $prefix.'display_style', |
|
139 | 139 | 'type' => 'radio_inline', |
140 | 140 | 'default' => 'buttons', |
141 | 141 | 'options' => array( |
142 | - 'buttons' => __( 'Buttons', 'give' ), |
|
143 | - 'radios' => __( 'Radios', 'give' ), |
|
144 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
142 | + 'buttons' => __('Buttons', 'give'), |
|
143 | + 'radios' => __('Radios', 'give'), |
|
144 | + 'dropdown' => __('Dropdown', 'give'), |
|
145 | 145 | ), |
146 | 146 | ), |
147 | 147 | //Custom Amount |
148 | 148 | array( |
149 | - 'name' => __( 'Custom Amount', 'give' ), |
|
150 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
151 | - 'id' => $prefix . 'custom_amount', |
|
149 | + 'name' => __('Custom Amount', 'give'), |
|
150 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
151 | + 'id' => $prefix.'custom_amount', |
|
152 | 152 | 'type' => 'radio_inline', |
153 | 153 | 'default' => 'no', |
154 | 154 | 'options' => array( |
155 | - 'yes' => __( 'Yes', 'give' ), |
|
156 | - 'no' => __( 'No', 'give' ), |
|
155 | + 'yes' => __('Yes', 'give'), |
|
156 | + 'no' => __('No', 'give'), |
|
157 | 157 | ), |
158 | 158 | ), |
159 | 159 | array( |
160 | - 'name' => __( 'Custom Amount Minimum', 'give' ), |
|
161 | - 'description' => __( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
162 | - 'id' => $prefix . 'custom_amount_minimum', |
|
160 | + 'name' => __('Custom Amount Minimum', 'give'), |
|
161 | + 'description' => __('If you would like to set a minimum custom donation amount please enter it here.', 'give'), |
|
162 | + 'id' => $prefix.'custom_amount_minimum', |
|
163 | 163 | 'type' => 'text_small', |
164 | 164 | 'row_classes' => 'give-subfield', |
165 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
166 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
165 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
166 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
167 | 167 | 'attributes' => array( |
168 | - 'placeholder' => give_format_amount( '1.00' ), |
|
169 | - 'value' => give_format_amount( $custom_amount_minimum ), |
|
168 | + 'placeholder' => give_format_amount('1.00'), |
|
169 | + 'value' => give_format_amount($custom_amount_minimum), |
|
170 | 170 | 'class' => 'cmb-type-text-small give-money-field', |
171 | 171 | ), |
172 | 172 | ), |
173 | 173 | array( |
174 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
175 | - 'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
176 | - 'id' => $prefix . 'custom_amount_text', |
|
174 | + 'name' => __('Custom Amount Text', 'give'), |
|
175 | + 'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
176 | + 'id' => $prefix.'custom_amount_text', |
|
177 | 177 | 'type' => 'text', |
178 | 178 | 'row_classes' => 'give-subfield', |
179 | 179 | 'attributes' => array( |
180 | 180 | 'rows' => 3, |
181 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
181 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
182 | 182 | ), |
183 | 183 | ), |
184 | 184 | //Goals |
185 | 185 | array( |
186 | - 'name' => __( 'Goal', 'give' ), |
|
187 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
188 | - 'id' => $prefix . 'goal_option', |
|
186 | + 'name' => __('Goal', 'give'), |
|
187 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
188 | + 'id' => $prefix.'goal_option', |
|
189 | 189 | 'type' => 'radio_inline', |
190 | 190 | 'default' => 'no', |
191 | 191 | 'options' => array( |
192 | - 'yes' => __( 'Yes', 'give' ), |
|
193 | - 'no' => __( 'No', 'give' ), |
|
192 | + 'yes' => __('Yes', 'give'), |
|
193 | + 'no' => __('No', 'give'), |
|
194 | 194 | ), |
195 | 195 | ), |
196 | 196 | array( |
197 | - 'name' => __( 'Goal Amount', 'give' ), |
|
198 | - 'description' => __( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
199 | - 'id' => $prefix . 'set_goal', |
|
197 | + 'name' => __('Goal Amount', 'give'), |
|
198 | + 'description' => __('This is the monetary goal amount you want to reach for this donation form.', 'give'), |
|
199 | + 'id' => $prefix.'set_goal', |
|
200 | 200 | 'type' => 'text_small', |
201 | 201 | 'row_classes' => 'give-subfield', |
202 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
203 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
202 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
203 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
204 | 204 | 'attributes' => array( |
205 | - 'placeholder' => give_format_amount( '0.00' ), |
|
206 | - 'value' => isset( $goal ) ? esc_attr( give_format_amount( $goal ) ) : '', |
|
205 | + 'placeholder' => give_format_amount('0.00'), |
|
206 | + 'value' => isset($goal) ? esc_attr(give_format_amount($goal)) : '', |
|
207 | 207 | 'class' => 'cmb-type-text-small give-money-field', |
208 | 208 | ), |
209 | 209 | ), |
210 | 210 | |
211 | 211 | array( |
212 | - 'name' => __( 'Goal Format', 'give' ), |
|
213 | - 'description' => __( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
214 | - 'id' => $prefix . 'goal_format', |
|
212 | + 'name' => __('Goal Format', 'give'), |
|
213 | + 'description' => __('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
214 | + 'id' => $prefix.'goal_format', |
|
215 | 215 | 'type' => 'radio_inline', |
216 | 216 | 'default' => 'amount', |
217 | 217 | 'row_classes' => 'give-subfield', |
218 | 218 | 'options' => array( |
219 | - 'amount' => __( 'Amount ', 'give' ), |
|
220 | - 'percentage' => __( 'Percentage', 'give' ), |
|
219 | + 'amount' => __('Amount ', 'give'), |
|
220 | + 'percentage' => __('Percentage', 'give'), |
|
221 | 221 | ), |
222 | 222 | ), |
223 | 223 | array( |
224 | - 'name' => __( 'Goal Progress Bar Color', 'give' ), |
|
225 | - 'id' => $prefix . 'goal_color', |
|
224 | + 'name' => __('Goal Progress Bar Color', 'give'), |
|
225 | + 'id' => $prefix.'goal_color', |
|
226 | 226 | 'type' => 'colorpicker', |
227 | 227 | 'row_classes' => 'give-subfield', |
228 | 228 | 'default' => '#2bc253', |
229 | 229 | ), |
230 | 230 | ) |
231 | 231 | ) |
232 | - ) ); |
|
232 | + )); |
|
233 | 233 | |
234 | 234 | |
235 | 235 | /** |
236 | 236 | * Content Field |
237 | 237 | */ |
238 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
238 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array( |
|
239 | 239 | 'id' => 'form_content_options', |
240 | - 'title' => __( 'Form Content', 'give' ), |
|
241 | - 'object_types' => array( 'give_forms' ), |
|
240 | + 'title' => __('Form Content', 'give'), |
|
241 | + 'object_types' => array('give_forms'), |
|
242 | 242 | 'context' => 'normal', |
243 | 243 | 'priority' => 'high', //Show above Content WYSIWYG |
244 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
244 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
245 | 245 | //Donation Option |
246 | 246 | array( |
247 | - 'name' => __( 'Display Content', 'give' ), |
|
248 | - 'description' => __( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
249 | - 'id' => $prefix . 'content_option', |
|
247 | + 'name' => __('Display Content', 'give'), |
|
248 | + 'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'), |
|
249 | + 'id' => $prefix.'content_option', |
|
250 | 250 | 'type' => 'select', |
251 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
252 | - 'none' => __( 'No content', 'give' ), |
|
253 | - 'give_pre_form' => __( 'Yes, display content ABOVE the form fields', 'give' ), |
|
254 | - 'give_post_form' => __( 'Yes, display content BELOW the form fields', 'give' ), |
|
251 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
252 | + 'none' => __('No content', 'give'), |
|
253 | + 'give_pre_form' => __('Yes, display content ABOVE the form fields', 'give'), |
|
254 | + 'give_post_form' => __('Yes, display content BELOW the form fields', 'give'), |
|
255 | 255 | ) |
256 | 256 | ), |
257 | 257 | 'default' => 'none', |
258 | 258 | ), |
259 | 259 | array( |
260 | - 'name' => __( 'Content', 'give' ), |
|
261 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
262 | - 'id' => $prefix . 'form_content', |
|
260 | + 'name' => __('Content', 'give'), |
|
261 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
262 | + 'id' => $prefix.'form_content', |
|
263 | 263 | 'row_classes' => 'give-subfield', |
264 | 264 | 'type' => 'wysiwyg' |
265 | 265 | ), |
266 | 266 | ) |
267 | 267 | ) |
268 | - ) ); |
|
268 | + )); |
|
269 | 269 | |
270 | 270 | |
271 | 271 | /** |
272 | 272 | * Display Options |
273 | 273 | */ |
274 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
274 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array( |
|
275 | 275 | 'id' => 'form_display_options', |
276 | - 'title' => __( 'Form Display Options', 'give' ), |
|
277 | - 'object_types' => array( 'give_forms' ), |
|
276 | + 'title' => __('Form Display Options', 'give'), |
|
277 | + 'object_types' => array('give_forms'), |
|
278 | 278 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
279 | 279 | 'priority' => 'high', //Show above Content WYSIWYG |
280 | 280 | 'show_names' => true, // Show field names on the left |
281 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
281 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
282 | 282 | array( |
283 | - 'name' => __( 'Payment Fields', 'give' ), |
|
284 | - 'desc' => __( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
285 | - 'id' => $prefix . 'payment_display', |
|
283 | + 'name' => __('Payment Fields', 'give'), |
|
284 | + 'desc' => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), |
|
285 | + 'id' => $prefix.'payment_display', |
|
286 | 286 | 'type' => 'select', |
287 | 287 | 'options' => array( |
288 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
289 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
290 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
288 | + 'onpage' => __('Show on Page', 'give'), |
|
289 | + 'reveal' => __('Reveal Upon Click', 'give'), |
|
290 | + 'modal' => __('Modal Window Upon Click', 'give'), |
|
291 | 291 | ), |
292 | 292 | 'default' => 'onpage', |
293 | 293 | ), |
294 | 294 | array( |
295 | - 'id' => $prefix . 'reveal_label', |
|
296 | - 'name' => __( 'Reveal / Modal Open Text', 'give' ), |
|
297 | - 'desc' => __( 'The button label for completing the donation.', 'give' ), |
|
295 | + 'id' => $prefix.'reveal_label', |
|
296 | + 'name' => __('Reveal / Modal Open Text', 'give'), |
|
297 | + 'desc' => __('The button label for completing the donation.', 'give'), |
|
298 | 298 | 'type' => 'text_small', |
299 | 299 | 'row_classes' => 'give-subfield', |
300 | 300 | 'attributes' => array( |
301 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
301 | + 'placeholder' => __('Donate Now', 'give'), |
|
302 | 302 | ), |
303 | 303 | ), |
304 | 304 | array( |
305 | - 'id' => $prefix . 'checkout_label', |
|
306 | - 'name' => __( 'Complete Donation Text', 'give' ), |
|
307 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
305 | + 'id' => $prefix.'checkout_label', |
|
306 | + 'name' => __('Complete Donation Text', 'give'), |
|
307 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
308 | 308 | 'type' => 'text_small', |
309 | 309 | 'attributes' => array( |
310 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
310 | + 'placeholder' => __('Donate Now', 'give'), |
|
311 | 311 | ), |
312 | 312 | ), |
313 | 313 | array( |
314 | - 'name' => __( 'Default Gateway', 'give' ), |
|
315 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
316 | - 'id' => $prefix . 'default_gateway', |
|
314 | + 'name' => __('Default Gateway', 'give'), |
|
315 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
316 | + 'id' => $prefix.'default_gateway', |
|
317 | 317 | 'type' => 'default_gateway' |
318 | 318 | ), |
319 | 319 | array( |
320 | - 'name' => __( 'Disable Guest Donations', 'give' ), |
|
321 | - 'desc' => __( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
322 | - 'id' => $prefix . 'logged_in_only', |
|
320 | + 'name' => __('Disable Guest Donations', 'give'), |
|
321 | + 'desc' => __('Do you want to require users be logged-in to make donations?', 'give'), |
|
322 | + 'id' => $prefix.'logged_in_only', |
|
323 | 323 | 'type' => 'checkbox' |
324 | 324 | ), |
325 | 325 | array( |
326 | - 'name' => __( 'Register / Login Form', 'give' ), |
|
327 | - 'desc' => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
328 | - 'id' => $prefix . 'show_register_form', |
|
326 | + 'name' => __('Register / Login Form', 'give'), |
|
327 | + 'desc' => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
328 | + 'id' => $prefix.'show_register_form', |
|
329 | 329 | 'type' => 'select', |
330 | 330 | 'options' => array( |
331 | - 'both' => __( 'Registration and Login Forms', 'give' ), |
|
332 | - 'registration' => __( 'Registration Form Only', 'give' ), |
|
333 | - 'login' => __( 'Login Form Only', 'give' ), |
|
334 | - 'none' => __( 'None', 'give' ), |
|
331 | + 'both' => __('Registration and Login Forms', 'give'), |
|
332 | + 'registration' => __('Registration Form Only', 'give'), |
|
333 | + 'login' => __('Login Form Only', 'give'), |
|
334 | + 'none' => __('None', 'give'), |
|
335 | 335 | ), |
336 | 336 | 'default' => 'none', |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'name' => __( 'Floating Labels', 'give' ), |
|
340 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ), |
|
341 | - 'id' => $prefix . 'form_floating_labels', |
|
339 | + 'name' => __('Floating Labels', 'give'), |
|
340 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")), |
|
341 | + 'id' => $prefix.'form_floating_labels', |
|
342 | 342 | 'type' => 'select', |
343 | 343 | 'options' => array( |
344 | - '' => __( 'Use the global setting', 'give' ), |
|
345 | - 'enabled' => __( 'Enabled', 'give' ), |
|
346 | - 'disabled' => __( 'Disabled', 'give' ), |
|
344 | + '' => __('Use the global setting', 'give'), |
|
345 | + 'enabled' => __('Enabled', 'give'), |
|
346 | + 'disabled' => __('Disabled', 'give'), |
|
347 | 347 | ), |
348 | 348 | 'default' => 'none', |
349 | 349 | ) |
@@ -355,47 +355,47 @@ discard block |
||
355 | 355 | /** |
356 | 356 | * Terms & Conditions |
357 | 357 | */ |
358 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
358 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array( |
|
359 | 359 | 'id' => 'form_terms_options', |
360 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
361 | - 'object_types' => array( 'give_forms' ), |
|
360 | + 'title' => __('Terms and Conditions', 'give'), |
|
361 | + 'object_types' => array('give_forms'), |
|
362 | 362 | 'context' => 'normal', |
363 | 363 | 'priority' => 'high', //Show above Content WYSIWYG |
364 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
364 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
365 | 365 | //Donation Option |
366 | 366 | array( |
367 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
368 | - 'description' => __( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
369 | - 'id' => $prefix . 'terms_option', |
|
367 | + 'name' => __('Terms and Conditions', 'give'), |
|
368 | + 'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), |
|
369 | + 'id' => $prefix.'terms_option', |
|
370 | 370 | 'type' => 'select', |
371 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
372 | - 'none' => __( 'No', 'give' ), |
|
373 | - 'yes' => __( 'Yes', 'give' ), |
|
371 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
372 | + 'none' => __('No', 'give'), |
|
373 | + 'yes' => __('Yes', 'give'), |
|
374 | 374 | ) |
375 | 375 | ), |
376 | 376 | 'default' => 'none', |
377 | 377 | ), |
378 | 378 | array( |
379 | - 'id' => $prefix . 'agree_label', |
|
380 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
381 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
379 | + 'id' => $prefix.'agree_label', |
|
380 | + 'name' => __('Agree to Terms Label', 'give'), |
|
381 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
382 | 382 | 'type' => 'text', |
383 | 383 | 'row_classes' => 'give-subfield', |
384 | 384 | 'size' => 'regular', |
385 | 385 | 'attributes' => array( |
386 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
386 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
387 | 387 | ), |
388 | 388 | ), |
389 | 389 | array( |
390 | - 'id' => $prefix . 'agree_text', |
|
390 | + 'id' => $prefix.'agree_text', |
|
391 | 391 | 'row_classes' => 'give-subfield', |
392 | - 'name' => __( 'Agreement Text', 'give' ), |
|
393 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
392 | + 'name' => __('Agreement Text', 'give'), |
|
393 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
394 | 394 | 'type' => 'wysiwyg' |
395 | 395 | ), |
396 | 396 | ) |
397 | 397 | ) |
398 | - ) ); |
|
398 | + )); |
|
399 | 399 | |
400 | 400 | return $meta_boxes; |
401 | 401 | |
@@ -409,18 +409,18 @@ discard block |
||
409 | 409 | |
410 | 410 | <div class="table-container"> |
411 | 411 | <div class="table-row"> |
412 | - <div class="table-cell col-amount"><?php _e( 'Amount', 'give' ); ?></div> |
|
413 | - <div class="table-cell col-text"><?php _e( 'Text', 'give' ); ?></div> |
|
414 | - <div class="table-cell col-default"><?php _e( 'Default', 'give' ); ?></div> |
|
415 | - <?php do_action( 'give_donation_levels_table_head' ); ?> |
|
416 | - <div class="table-cell col-sort"><?php _e( 'Sort', 'give' ); ?></div> |
|
412 | + <div class="table-cell col-amount"><?php _e('Amount', 'give'); ?></div> |
|
413 | + <div class="table-cell col-text"><?php _e('Text', 'give'); ?></div> |
|
414 | + <div class="table-cell col-default"><?php _e('Default', 'give'); ?></div> |
|
415 | + <?php do_action('give_donation_levels_table_head'); ?> |
|
416 | + <div class="table-cell col-sort"><?php _e('Sort', 'give'); ?></div> |
|
417 | 417 | |
418 | 418 | </div> |
419 | 419 | </div> |
420 | 420 | |
421 | 421 | <?php |
422 | 422 | } |
423 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
423 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10); |
|
424 | 424 | |
425 | 425 | |
426 | 426 | /** |
@@ -437,24 +437,24 @@ discard block |
||
437 | 437 | * @param $object_type |
438 | 438 | * @param $field_type_object |
439 | 439 | */ |
440 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
440 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
441 | 441 | |
442 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
442 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
443 | 443 | |
444 | 444 | $field_options_array = array( |
445 | 445 | 'class' => 'give-hidden give-level-id-input', |
446 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
447 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
446 | + 'name' => $field_type_object->_name('[level_id]'), |
|
447 | + 'id' => $field_type_object->_id('_level_id'), |
|
448 | 448 | 'value' => $escaped_value, |
449 | 449 | 'type' => 'number', |
450 | 450 | 'desc' => '', |
451 | 451 | ); |
452 | 452 | |
453 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
454 | - echo $field_type_object->input( $field_options_array ); |
|
453 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
454 | + echo $field_type_object->input($field_options_array); |
|
455 | 455 | |
456 | 456 | } |
457 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
457 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5); |
|
458 | 458 | |
459 | 459 | |
460 | 460 | /** |
@@ -466,13 +466,13 @@ discard block |
||
466 | 466 | * @param $object_type |
467 | 467 | * @param $field_type_object |
468 | 468 | */ |
469 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
470 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
471 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
469 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
470 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>'; |
|
471 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
472 | 472 | |
473 | 473 | } |
474 | 474 | |
475 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
475 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5); |
|
476 | 476 | |
477 | 477 | |
478 | 478 | /** |
@@ -482,20 +482,20 @@ discard block |
||
482 | 482 | */ |
483 | 483 | function give_add_shortcode_to_publish_metabox() { |
484 | 484 | |
485 | - if ( 'give_forms' !== get_post_type() ) { |
|
485 | + if ('give_forms' !== get_post_type()) { |
|
486 | 486 | return false; |
487 | 487 | } |
488 | 488 | |
489 | 489 | global $post; |
490 | 490 | |
491 | 491 | //Only enqueue scripts for CPT on post type screen |
492 | - if ( 'give_forms' === $post->post_type ) { |
|
492 | + if ('give_forms' === $post->post_type) { |
|
493 | 493 | //Shortcode column with select all input |
494 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
495 | - echo '<div class="shortcode-wrap box-sizing"><label>' . __( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
494 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
495 | + echo '<div class="shortcode-wrap box-sizing"><label>'.__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
496 | 496 | |
497 | 497 | } |
498 | 498 | |
499 | 499 | } |
500 | 500 | |
501 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
501 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,36 +29,36 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'reports'; |
|
34 | 34 | ?> |
35 | 35 | <div class="wrap"> |
36 | 36 | <h1 class="nav-tab-wrapper"> |
37 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
37 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
38 | 38 | 'tab' => 'reports', |
39 | 39 | 'settings-updated' => false |
40 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Reports', 'give' ); ?></a> |
|
41 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
40 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e('Reports', 'give'); ?></a> |
|
41 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => 'export', |
44 | 44 | 'settings-updated' => false |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Export', 'give' ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e('Export', 'give'); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
48 | 48 | 'tab' => 'logs', |
49 | 49 | 'settings-updated' => false |
50 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Logs', 'give' ); ?></a> |
|
51 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
50 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e('Logs', 'give'); ?></a> |
|
51 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
52 | 52 | 'tab' => 'tools', |
53 | 53 | 'settings-updated' => false |
54 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Tools', 'give' ); ?></a> |
|
55 | - <?php do_action( 'give_reports_tabs' ); ?> |
|
54 | + ), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e('Tools', 'give'); ?></a> |
|
55 | + <?php do_action('give_reports_tabs'); ?> |
|
56 | 56 | </h1> |
57 | 57 | |
58 | 58 | <?php |
59 | - do_action( 'give_reports_page_top' ); |
|
60 | - do_action( 'give_reports_tab_' . $active_tab ); |
|
61 | - do_action( 'give_reports_page_bottom' ); |
|
59 | + do_action('give_reports_page_top'); |
|
60 | + do_action('give_reports_tab_'.$active_tab); |
|
61 | + do_action('give_reports_page_bottom'); |
|
62 | 62 | ?> |
63 | 63 | </div><!-- .wrap --> |
64 | 64 | <?php |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | */ |
73 | 73 | function give_reports_default_views() { |
74 | 74 | $views = array( |
75 | - 'earnings' => __( 'Income', 'give' ), |
|
75 | + 'earnings' => __('Income', 'give'), |
|
76 | 76 | 'forms' => give_get_forms_label_plural(), |
77 | - 'donors' => __( 'Donors', 'give' ), |
|
78 | - 'gateways' => __( 'Payment Methods', 'give' ) |
|
77 | + 'donors' => __('Donors', 'give'), |
|
78 | + 'gateways' => __('Payment Methods', 'give') |
|
79 | 79 | ); |
80 | 80 | |
81 | - $views = apply_filters( 'give_report_views', $views ); |
|
81 | + $views = apply_filters('give_report_views', $views); |
|
82 | 82 | |
83 | 83 | return $views; |
84 | 84 | } |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | * @return string $view Report View |
95 | 95 | * |
96 | 96 | */ |
97 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
97 | +function give_get_reporting_view($default = 'earnings') { |
|
98 | 98 | |
99 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
99 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
100 | 100 | $view = $default; |
101 | 101 | } else { |
102 | 102 | $view = $_GET['view']; |
103 | 103 | } |
104 | 104 | |
105 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
105 | + return apply_filters('give_get_reporting_view', $view); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | $current_view = 'earnings'; |
116 | 116 | $views = give_reports_default_views(); |
117 | 117 | |
118 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) { |
|
118 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) { |
|
119 | 119 | $current_view = $_GET['view']; |
120 | 120 | } |
121 | 121 | |
122 | - do_action( 'give_reports_view_' . $current_view ); |
|
122 | + do_action('give_reports_view_'.$current_view); |
|
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
125 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Renders the Reports Page Views Drop Downs |
@@ -132,25 +132,25 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function give_report_views() { |
134 | 134 | $views = give_reports_default_views(); |
135 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
136 | - do_action( 'give_report_view_actions_before' ); |
|
135 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
136 | + do_action('give_report_view_actions_before'); |
|
137 | 137 | ?> |
138 | 138 | <form id="give-reports-filter" method="get"> |
139 | 139 | <select id="give-reports-view" name="view"> |
140 | - <option value="-1"><?php _e( 'Report Type', 'give' ); ?></option> |
|
141 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
142 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
140 | + <option value="-1"><?php _e('Report Type', 'give'); ?></option> |
|
141 | + <?php foreach ($views as $view_id => $label) : ?> |
|
142 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
143 | 143 | <?php endforeach; ?> |
144 | 144 | </select> |
145 | 145 | |
146 | - <?php do_action( 'give_report_view_actions' ); ?> |
|
146 | + <?php do_action('give_report_view_actions'); ?> |
|
147 | 147 | |
148 | 148 | <input type="hidden" name="post_type" value="give_forms"/> |
149 | 149 | <input type="hidden" name="page" value="give-reports"/> |
150 | - <?php submit_button( __( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
150 | + <?php submit_button(__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
151 | 151 | </form> |
152 | 152 | <?php |
153 | - do_action( 'give_report_view_actions_after' ); |
|
153 | + do_action('give_report_view_actions_after'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -163,18 +163,18 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function give_reports_forms_table() { |
165 | 165 | |
166 | - if ( isset( $_GET['form-id'] ) ) { |
|
166 | + if (isset($_GET['form-id'])) { |
|
167 | 167 | return; |
168 | 168 | } |
169 | 169 | |
170 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
170 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
171 | 171 | |
172 | 172 | $give_table = new Give_Form_Reports_Table(); |
173 | 173 | $give_table->prepare_items(); |
174 | 174 | $give_table->display(); |
175 | 175 | } |
176 | 176 | |
177 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
177 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * Renders the detailed report for a specific give form |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return void |
184 | 184 | */ |
185 | 185 | function give_reports_form_details() { |
186 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
186 | + if ( ! isset($_GET['form-id'])) { |
|
187 | 187 | return; |
188 | 188 | } |
189 | 189 | ?> |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | <div class="actions bulkactions"> |
192 | 192 | <?php give_report_views(); ?> |
193 | 193 | |
194 | - <button onclick="history.go(-1);" class="button-secondary"><?php _e( 'Go Back', 'give' ); ?></button> |
|
194 | + <button onclick="history.go(-1);" class="button-secondary"><?php _e('Go Back', 'give'); ?></button> |
|
195 | 195 | </div> |
196 | 196 | </div> |
197 | 197 | <?php |
198 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
198 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
199 | 199 | } |
200 | 200 | |
201 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
201 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Renders the Reports Donors Table |
@@ -209,28 +209,28 @@ discard block |
||
209 | 209 | * @return void |
210 | 210 | */ |
211 | 211 | function give_reports_donors_table() { |
212 | - include( dirname( __FILE__ ) . '/class-donor-reports-table.php' ); |
|
212 | + include(dirname(__FILE__).'/class-donor-reports-table.php'); |
|
213 | 213 | |
214 | 214 | $give_table = new Give_Donor_Reports_Table(); |
215 | 215 | $give_table->prepare_items(); |
216 | 216 | ?> |
217 | 217 | <div class="wrap give-reports-donors-wrap"> |
218 | - <?php do_action( 'give_logs_donors_table_top' ); ?> |
|
219 | - <form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>"> |
|
218 | + <?php do_action('give_logs_donors_table_top'); ?> |
|
219 | + <form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>"> |
|
220 | 220 | <?php |
221 | - $give_table->search_box( __( 'Search', 'give' ), 'give-donors' ); |
|
221 | + $give_table->search_box(__('Search', 'give'), 'give-donors'); |
|
222 | 222 | $give_table->display(); |
223 | 223 | ?> |
224 | 224 | <input type="hidden" name="post_type" value="give_forms"/> |
225 | 225 | <input type="hidden" name="page" value="give-reports"/> |
226 | 226 | <input type="hidden" name="view" value="donors"/> |
227 | 227 | </form> |
228 | - <?php do_action( 'give_logs_donors_table_bottom' ); ?> |
|
228 | + <?php do_action('give_logs_donors_table_bottom'); ?> |
|
229 | 229 | </div> |
230 | 230 | <?php |
231 | 231 | } |
232 | 232 | |
233 | -add_action( 'give_reports_view_donors', 'give_reports_donors_table' ); |
|
233 | +add_action('give_reports_view_donors', 'give_reports_donors_table'); |
|
234 | 234 | |
235 | 235 | |
236 | 236 | /** |
@@ -242,14 +242,14 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | function give_reports_gateways_table() { |
245 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
245 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
246 | 246 | |
247 | 247 | $give_table = new Give_Gateawy_Reports_Table(); |
248 | 248 | $give_table->prepare_items(); |
249 | 249 | $give_table->display(); |
250 | 250 | } |
251 | 251 | |
252 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
252 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
253 | 253 | |
254 | 254 | |
255 | 255 | /** |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | function give_reports_earnings() { |
262 | 262 | ?> |
263 | 263 | <div class="tablenav top reports-table-nav"> |
264 | - <h3 class="alignleft reports-earnings-title"><span><?php _e( 'Income Over Time', 'give' ); ?></span></h3> |
|
264 | + <h3 class="alignleft reports-earnings-title"><span><?php _e('Income Over Time', 'give'); ?></span></h3> |
|
265 | 265 | |
266 | 266 | <div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div> |
267 | 267 | </div> |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | give_reports_graph(); |
270 | 270 | } |
271 | 271 | |
272 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
272 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
273 | 273 | |
274 | 274 | |
275 | 275 | /** |
@@ -284,51 +284,51 @@ discard block |
||
284 | 284 | <div id="post-body"> |
285 | 285 | <div id="post-body-content"> |
286 | 286 | |
287 | - <?php do_action( 'give_reports_tab_export_content_top' ); ?> |
|
287 | + <?php do_action('give_reports_tab_export_content_top'); ?> |
|
288 | 288 | |
289 | 289 | |
290 | 290 | <table class="widefat export-options-table give-table"> |
291 | 291 | <thead> |
292 | 292 | <tr> |
293 | - <th class="row-title"><?php _e( 'Export Type', 'give' ); ?></th> |
|
294 | - <th><?php _e( 'Export Options', 'give' ); ?></th> |
|
293 | + <th class="row-title"><?php _e('Export Type', 'give'); ?></th> |
|
294 | + <th><?php _e('Export Options', 'give'); ?></th> |
|
295 | 295 | </tr> |
296 | 296 | </thead> |
297 | 297 | <tbody> |
298 | - <?php do_action( 'give_reports_tab_export_table_top' ); ?> |
|
298 | + <?php do_action('give_reports_tab_export_table_top'); ?> |
|
299 | 299 | <tr class="give-export-pdf-sales-earnings"> |
300 | 300 | <td class="row-title"> |
301 | - <h3><span><?php _e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3> |
|
301 | + <h3><span><?php _e('Export PDF of Donations and Income', 'give'); ?></span></h3> |
|
302 | 302 | |
303 | - <p><?php _e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
303 | + <p><?php _e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
304 | 304 | </td> |
305 | 305 | <td> |
306 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php _e( 'Generate PDF', 'give' ); ?></a> |
|
306 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php _e('Generate PDF', 'give'); ?></a> |
|
307 | 307 | </td> |
308 | 308 | </tr> |
309 | 309 | <tr class="alternate give-export-sales-earnings"> |
310 | 310 | <td class="row-title"> |
311 | - <h3><span><?php _e( 'Export Income and Donation Stats', 'give' ); ?></span></h3> |
|
311 | + <h3><span><?php _e('Export Income and Donation Stats', 'give'); ?></span></h3> |
|
312 | 312 | |
313 | - <p><?php _e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
313 | + <p><?php _e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
314 | 314 | </td> |
315 | 315 | <td> |
316 | 316 | <form method="post"> |
317 | - <?php echo Give()->html->year_dropdown( 'start_year' ); ?> |
|
318 | - <?php echo Give()->html->month_dropdown( 'start_month' ); ?> |
|
319 | - <?php echo _x( 'to', 'Date one to date two', 'give' ); ?> |
|
320 | - <?php echo Give()->html->year_dropdown( 'end_year' ); ?> |
|
321 | - <?php echo Give()->html->month_dropdown( 'end_month' ); ?> |
|
317 | + <?php echo Give()->html->year_dropdown('start_year'); ?> |
|
318 | + <?php echo Give()->html->month_dropdown('start_month'); ?> |
|
319 | + <?php echo _x('to', 'Date one to date two', 'give'); ?> |
|
320 | + <?php echo Give()->html->year_dropdown('end_year'); ?> |
|
321 | + <?php echo Give()->html->month_dropdown('end_month'); ?> |
|
322 | 322 | <input type="hidden" name="give-action" value="earnings_export"/> |
323 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
323 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
324 | 324 | </form> |
325 | 325 | </td> |
326 | 326 | </tr> |
327 | 327 | <tr class="give-export-payment-history"> |
328 | 328 | <td class="row-title"> |
329 | - <h3><span><?php _e( 'Export Donation History', 'give' ); ?></span></h3> |
|
329 | + <h3><span><?php _e('Export Donation History', 'give'); ?></span></h3> |
|
330 | 330 | |
331 | - <p><?php _e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
331 | + <p><?php _e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
332 | 332 | </td> |
333 | 333 | <td> |
334 | 334 | <form id="give-export-payments" class="give-export-form" method="post"> |
@@ -336,29 +336,29 @@ discard block |
||
336 | 336 | $args = array( |
337 | 337 | 'id' => 'give-payment-export-start', |
338 | 338 | 'name' => 'start', |
339 | - 'placeholder' => __( 'Start date', 'give' ) |
|
339 | + 'placeholder' => __('Start date', 'give') |
|
340 | 340 | ); |
341 | - echo Give()->html->date_field( $args ); ?> |
|
341 | + echo Give()->html->date_field($args); ?> |
|
342 | 342 | <?php |
343 | 343 | $args = array( |
344 | 344 | 'id' => 'give-payment-export-end', |
345 | 345 | 'name' => 'end', |
346 | - 'placeholder' => __( 'End date', 'give' ) |
|
346 | + 'placeholder' => __('End date', 'give') |
|
347 | 347 | ); |
348 | - echo Give()->html->date_field( $args ); ?> |
|
348 | + echo Give()->html->date_field($args); ?> |
|
349 | 349 | <select name="status"> |
350 | - <option value="any"><?php _e( 'All Statuses', 'give' ); ?></option> |
|
350 | + <option value="any"><?php _e('All Statuses', 'give'); ?></option> |
|
351 | 351 | <?php |
352 | 352 | $statuses = give_get_payment_statuses(); |
353 | - foreach ( $statuses as $status => $label ) { |
|
354 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
353 | + foreach ($statuses as $status => $label) { |
|
354 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
355 | 355 | } |
356 | 356 | ?> |
357 | 357 | </select> |
358 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
358 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
359 | 359 | <input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/> |
360 | 360 | <span> |
361 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary" /> |
|
361 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary" /> |
|
362 | 362 | <span class="spinner"></span> |
363 | 363 | </span> |
364 | 364 | </form> |
@@ -367,41 +367,41 @@ discard block |
||
367 | 367 | </tr> |
368 | 368 | <tr class="alternate give-export-donors"> |
369 | 369 | <td class="row-title"> |
370 | - <h3><span><?php _e( 'Export Donors in CSV', 'give' ); ?></span></h3> |
|
370 | + <h3><span><?php _e('Export Donors in CSV', 'give'); ?></span></h3> |
|
371 | 371 | |
372 | - <p><?php _e( 'Download a CSV of all donors\' emails. Optionally export only donors that have donated to a particular form. Note: if you have a large number of donors, exporting the donation stats may fail.', 'give' ); ?></p> |
|
372 | + <p><?php _e('Download a CSV of all donors\' emails. Optionally export only donors that have donated to a particular form. Note: if you have a large number of donors, exporting the donation stats may fail.', 'give'); ?></p> |
|
373 | 373 | </td> |
374 | 374 | <td> |
375 | 375 | <form method="post" id="give_donor_export"> |
376 | 376 | <select name="give_export_download" id="give_donor_export_download"> |
377 | - <option value="0"><?php printf( __( 'All %s', 'give' ), give_get_forms_label_plural() ); ?></option> |
|
377 | + <option value="0"><?php printf(__('All %s', 'give'), give_get_forms_label_plural()); ?></option> |
|
378 | 378 | <?php |
379 | - $forms = get_posts( array( |
|
379 | + $forms = get_posts(array( |
|
380 | 380 | 'post_type' => 'give_forms', |
381 | - 'posts_per_page' => - 1 |
|
382 | - ) ); |
|
383 | - if ( $forms ) { |
|
384 | - foreach ( $forms as $form ) { |
|
385 | - echo '<option value="' . $form->ID . '">' . get_the_title( $form->ID ) . '</option>'; |
|
381 | + 'posts_per_page' => -1 |
|
382 | + )); |
|
383 | + if ($forms) { |
|
384 | + foreach ($forms as $form) { |
|
385 | + echo '<option value="'.$form->ID.'">'.get_the_title($form->ID).'</option>'; |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | ?> |
389 | 389 | </select> |
390 | 390 | <select name="give_export_option" id="give_donor_export_option"> |
391 | - <option value="emails"><?php _e( 'Emails', 'give' ); ?></option> |
|
392 | - <option value="emails_and_names"><?php _e( 'Emails and Names', 'give' ); ?></option> |
|
393 | - <option value="full"><?php _e( 'Emails, Names, and Purchase Stats', 'give' ); ?></option> |
|
391 | + <option value="emails"><?php _e('Emails', 'give'); ?></option> |
|
392 | + <option value="emails_and_names"><?php _e('Emails and Names', 'give'); ?></option> |
|
393 | + <option value="full"><?php _e('Emails, Names, and Purchase Stats', 'give'); ?></option> |
|
394 | 394 | </select> |
395 | 395 | <input type="hidden" name="give-action" value="email_export"/> |
396 | - <input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
396 | + <input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
397 | 397 | </form> |
398 | 398 | </td> |
399 | 399 | </tr> |
400 | - <?php do_action( 'give_reports_tab_export_table_bottom' ); ?> |
|
400 | + <?php do_action('give_reports_tab_export_table_bottom'); ?> |
|
401 | 401 | </tbody> |
402 | 402 | </table> |
403 | 403 | |
404 | - <?php do_action( 'give_reports_tab_export_content_bottom' ); ?> |
|
404 | + <?php do_action('give_reports_tab_export_content_bottom'); ?> |
|
405 | 405 | |
406 | 406 | </div> |
407 | 407 | <!-- .post-body-content --> |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | <?php |
412 | 412 | } |
413 | 413 | |
414 | -add_action( 'give_reports_tab_export', 'give_reports_tab_export' ); |
|
414 | +add_action('give_reports_tab_export', 'give_reports_tab_export'); |
|
415 | 415 | |
416 | 416 | /** |
417 | 417 | * Renders the Reports page |
@@ -420,19 +420,19 @@ discard block |
||
420 | 420 | * @return void |
421 | 421 | */ |
422 | 422 | function give_reports_tab_logs() { |
423 | - require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' ); |
|
423 | + require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php'); |
|
424 | 424 | |
425 | 425 | $current_view = 'sales'; |
426 | 426 | $log_views = give_log_default_views(); |
427 | 427 | |
428 | - if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) { |
|
428 | + if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) { |
|
429 | 429 | $current_view = $_GET['view']; |
430 | 430 | } |
431 | 431 | |
432 | - do_action( 'give_logs_view_' . $current_view ); |
|
432 | + do_action('give_logs_view_'.$current_view); |
|
433 | 433 | } |
434 | 434 | |
435 | -add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' ); |
|
435 | +add_action('give_reports_tab_logs', 'give_reports_tab_logs'); |
|
436 | 436 | |
437 | 437 | /** |
438 | 438 | * Retrieves estimated monthly earnings and sales |
@@ -442,9 +442,9 @@ discard block |
||
442 | 442 | */ |
443 | 443 | function give_estimated_monthly_stats() { |
444 | 444 | |
445 | - $estimated = get_transient( 'give_estimated_monthly_stats' ); |
|
445 | + $estimated = get_transient('give_estimated_monthly_stats'); |
|
446 | 446 | |
447 | - if ( false === $estimated ) { |
|
447 | + if (false === $estimated) { |
|
448 | 448 | |
449 | 449 | $estimated = array( |
450 | 450 | 'earnings' => 0, |
@@ -453,20 +453,20 @@ discard block |
||
453 | 453 | |
454 | 454 | $stats = new Give_Payment_Stats; |
455 | 455 | |
456 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
457 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
456 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
457 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
458 | 458 | |
459 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
460 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
461 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
462 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
459 | + $current_day = date('d', current_time('timestamp')); |
|
460 | + $current_month = date('n', current_time('timestamp')); |
|
461 | + $current_year = date('Y', current_time('timestamp')); |
|
462 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
463 | 463 | |
464 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
465 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
464 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
465 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
466 | 466 | |
467 | 467 | // Cache for one day |
468 | - set_transient( 'give_estimated_monthly_stats', $estimated, 86400 ); |
|
468 | + set_transient('give_estimated_monthly_stats', $estimated, 86400); |
|
469 | 469 | } |
470 | 470 | |
471 | - return maybe_unserialize( $estimated ); |
|
471 | + return maybe_unserialize($estimated); |
|
472 | 472 | } |
@@ -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 | |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | public function csv_cols() { |
42 | 42 | |
43 | 43 | $cols = array( |
44 | - 'ID' => __( 'ID', 'give' ), |
|
45 | - 'post_name' => __( 'Slug', 'give' ), |
|
46 | - 'post_title' => __( 'Name', 'give' ), |
|
47 | - 'post_date' => __( 'Date Created', 'give' ), |
|
48 | - 'post_author' => __( 'Author', 'give' ), |
|
49 | - 'post_content' => __( 'Description', 'give' ), |
|
50 | - 'post_excerpt' => __( 'Excerpt', 'give' ), |
|
51 | - 'post_status' => __( 'Status', 'give' ), |
|
52 | - 'categories' => __( 'Categories', 'give' ), |
|
53 | - 'tags' => __( 'Tags', 'give' ), |
|
54 | - 'give_price' => __( 'Price', 'give' ), |
|
55 | - '_thumbnail_id' => __( 'Featured Image', 'give' ), |
|
56 | - '_give_form_sales' => __( 'Donations', 'give' ), |
|
57 | - '_give_download_earnings' => __( 'Income', 'give' ), |
|
44 | + 'ID' => __('ID', 'give'), |
|
45 | + 'post_name' => __('Slug', 'give'), |
|
46 | + 'post_title' => __('Name', 'give'), |
|
47 | + 'post_date' => __('Date Created', 'give'), |
|
48 | + 'post_author' => __('Author', 'give'), |
|
49 | + 'post_content' => __('Description', 'give'), |
|
50 | + 'post_excerpt' => __('Excerpt', 'give'), |
|
51 | + 'post_status' => __('Status', 'give'), |
|
52 | + 'categories' => __('Categories', 'give'), |
|
53 | + 'tags' => __('Tags', 'give'), |
|
54 | + 'give_price' => __('Price', 'give'), |
|
55 | + '_thumbnail_id' => __('Featured Image', 'give'), |
|
56 | + '_give_form_sales' => __('Donations', 'give'), |
|
57 | + '_give_download_earnings' => __('Income', 'give'), |
|
58 | 58 | ); |
59 | 59 | |
60 | 60 | return $cols; |
@@ -86,43 +86,43 @@ discard block |
||
86 | 86 | 'paged' => $this->step |
87 | 87 | ); |
88 | 88 | |
89 | - $downloads = new WP_Query( $args ); |
|
89 | + $downloads = new WP_Query($args); |
|
90 | 90 | |
91 | - if ( $downloads->posts ) { |
|
92 | - foreach ( $downloads->posts as $download ) { |
|
91 | + if ($downloads->posts) { |
|
92 | + foreach ($downloads->posts as $download) { |
|
93 | 93 | |
94 | 94 | $row = array(); |
95 | 95 | |
96 | - foreach ( $this->csv_cols() as $key => $value ) { |
|
96 | + foreach ($this->csv_cols() as $key => $value) { |
|
97 | 97 | |
98 | 98 | // Setup default value |
99 | - $row[ $key ] = ''; |
|
99 | + $row[$key] = ''; |
|
100 | 100 | |
101 | - if ( in_array( $key, $meta ) ) { |
|
101 | + if (in_array($key, $meta)) { |
|
102 | 102 | |
103 | - switch ( $key ) { |
|
103 | + switch ($key) { |
|
104 | 104 | |
105 | 105 | case '_thumbnail_id' : |
106 | 106 | |
107 | - $image_id = get_post_thumbnail_id( $download->ID ); |
|
108 | - $row[ $key ] = wp_get_attachment_url( $image_id ); |
|
107 | + $image_id = get_post_thumbnail_id($download->ID); |
|
108 | + $row[$key] = wp_get_attachment_url($image_id); |
|
109 | 109 | |
110 | 110 | break; |
111 | 111 | |
112 | 112 | case 'give_price' : |
113 | 113 | |
114 | - if ( give_has_variable_prices( $download->ID ) ) { |
|
114 | + if (give_has_variable_prices($download->ID)) { |
|
115 | 115 | |
116 | 116 | $prices = array(); |
117 | - foreach ( give_get_variable_prices( $download->ID ) as $price ) { |
|
118 | - $prices[] = $price['name'] . ': ' . $price['amount']; |
|
117 | + foreach (give_get_variable_prices($download->ID) as $price) { |
|
118 | + $prices[] = $price['name'].': '.$price['amount']; |
|
119 | 119 | } |
120 | 120 | |
121 | - $row[ $key ] = implode( ' | ', $prices ); |
|
121 | + $row[$key] = implode(' | ', $prices); |
|
122 | 122 | |
123 | 123 | } else { |
124 | 124 | |
125 | - $row[ $key ] = give_get_download_price( $download->ID ); |
|
125 | + $row[$key] = give_get_download_price($download->ID); |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
@@ -132,54 +132,54 @@ discard block |
||
132 | 132 | |
133 | 133 | |
134 | 134 | $files = array(); |
135 | - foreach ( give_get_download_files( $download->ID ) as $file ) { |
|
135 | + foreach (give_get_download_files($download->ID) as $file) { |
|
136 | 136 | $files[] = $file['file']; |
137 | 137 | } |
138 | 138 | |
139 | - $row[ $key ] = implode( ' | ', $files ); |
|
139 | + $row[$key] = implode(' | ', $files); |
|
140 | 140 | |
141 | 141 | break; |
142 | 142 | |
143 | 143 | default : |
144 | 144 | |
145 | - $row[ $key ] = get_post_meta( $download->ID, $key, true ); |
|
145 | + $row[$key] = get_post_meta($download->ID, $key, true); |
|
146 | 146 | |
147 | 147 | break; |
148 | 148 | |
149 | 149 | } |
150 | 150 | |
151 | - } elseif ( isset( $download->$key ) ) { |
|
151 | + } elseif (isset($download->$key)) { |
|
152 | 152 | |
153 | - switch ( $key ) { |
|
153 | + switch ($key) { |
|
154 | 154 | |
155 | 155 | case 'post_author' : |
156 | 156 | |
157 | - $row[ $key ] = get_the_author_meta( 'user_login', $download->post_author ); |
|
157 | + $row[$key] = get_the_author_meta('user_login', $download->post_author); |
|
158 | 158 | |
159 | 159 | break; |
160 | 160 | |
161 | 161 | default : |
162 | 162 | |
163 | - $row[ $key ] = $download->$key; |
|
163 | + $row[$key] = $download->$key; |
|
164 | 164 | |
165 | 165 | break; |
166 | 166 | } |
167 | 167 | |
168 | - } elseif ( 'tags' == $key ) { |
|
168 | + } elseif ('tags' == $key) { |
|
169 | 169 | |
170 | - $terms = get_the_terms( $download->ID, 'download_tag' ); |
|
171 | - if ( $terms ) { |
|
172 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
173 | - $row[ $key ] = implode( ' | ', $terms ); |
|
170 | + $terms = get_the_terms($download->ID, 'download_tag'); |
|
171 | + if ($terms) { |
|
172 | + $terms = wp_list_pluck($terms, 'name'); |
|
173 | + $row[$key] = implode(' | ', $terms); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
177 | - } elseif ( 'categories' == $key ) { |
|
177 | + } elseif ('categories' == $key) { |
|
178 | 178 | |
179 | - $terms = get_the_terms( $download->ID, 'download_category' ); |
|
180 | - if ( $terms ) { |
|
181 | - $terms = wp_list_pluck( $terms, 'name' ); |
|
182 | - $row[ $key ] = implode( ' | ', $terms ); |
|
179 | + $terms = get_the_terms($download->ID, 'download_category'); |
|
180 | + if ($terms) { |
|
181 | + $terms = wp_list_pluck($terms, 'name'); |
|
182 | + $row[$key] = implode(' | ', $terms); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | } |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | |
191 | 191 | } |
192 | 192 | |
193 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
194 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
193 | + $data = apply_filters('give_export_get_data', $data); |
|
194 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
195 | 195 | |
196 | 196 | return $data; |
197 | 197 | } |
@@ -210,20 +210,20 @@ discard block |
||
210 | 210 | |
211 | 211 | $args = array( |
212 | 212 | 'post_type' => 'give_forms', |
213 | - 'posts_per_page' => - 1, |
|
213 | + 'posts_per_page' => -1, |
|
214 | 214 | 'post_status' => 'any', |
215 | 215 | 'fields' => 'ids', |
216 | 216 | ); |
217 | 217 | |
218 | - $downloads = new WP_Query( $args ); |
|
218 | + $downloads = new WP_Query($args); |
|
219 | 219 | $total = (int) $downloads->post_count; |
220 | 220 | $percentage = 100; |
221 | 221 | |
222 | - if ( $total > 0 ) { |
|
223 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
222 | + if ($total > 0) { |
|
223 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
224 | 224 | } |
225 | 225 | |
226 | - if ( $percentage > 100 ) { |
|
226 | + if ($percentage > 100) { |
|
227 | 227 | $percentage = 100; |
228 | 228 | } |
229 | 229 |
@@ -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 | |
@@ -39,29 +39,29 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function csv_cols() { |
41 | 41 | $cols = array( |
42 | - 'id' => __( 'ID', 'give' ), // unaltered payment ID (use for querying) |
|
43 | - 'seq_id' => __( 'Payment Number', 'give' ), // sequential payment ID |
|
44 | - 'email' => __( 'Email', 'give' ), |
|
45 | - 'first' => __( 'First Name', 'give' ), |
|
46 | - 'last' => __( 'Last Name', 'give' ), |
|
47 | - 'address1' => __( 'Address', 'give' ), |
|
48 | - 'address2' => __( 'Address (Line 2)', 'give' ), |
|
49 | - 'city' => __( 'City', 'give' ), |
|
50 | - 'state' => __( 'State', 'give' ), |
|
51 | - 'country' => __( 'Country', 'give' ), |
|
52 | - 'zip' => __( 'Zip / Postal Code', 'give' ), |
|
53 | - 'products' => __( 'Products', 'give' ), |
|
54 | - 'amount' => __( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')', |
|
55 | - 'gateway' => __( 'Payment Method', 'give' ), |
|
56 | - 'trans_id' => __( 'Transaction ID', 'give' ), |
|
57 | - 'key' => __( 'Purchase Key', 'give' ), |
|
58 | - 'date' => __( 'Date', 'give' ), |
|
59 | - 'user' => __( 'User', 'give' ), |
|
60 | - 'status' => __( 'Status', 'give' ) |
|
42 | + 'id' => __('ID', 'give'), // unaltered payment ID (use for querying) |
|
43 | + 'seq_id' => __('Payment Number', 'give'), // sequential payment ID |
|
44 | + 'email' => __('Email', 'give'), |
|
45 | + 'first' => __('First Name', 'give'), |
|
46 | + 'last' => __('Last Name', 'give'), |
|
47 | + 'address1' => __('Address', 'give'), |
|
48 | + 'address2' => __('Address (Line 2)', 'give'), |
|
49 | + 'city' => __('City', 'give'), |
|
50 | + 'state' => __('State', 'give'), |
|
51 | + 'country' => __('Country', 'give'), |
|
52 | + 'zip' => __('Zip / Postal Code', 'give'), |
|
53 | + 'products' => __('Products', 'give'), |
|
54 | + 'amount' => __('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')', |
|
55 | + 'gateway' => __('Payment Method', 'give'), |
|
56 | + 'trans_id' => __('Transaction ID', 'give'), |
|
57 | + 'key' => __('Purchase Key', 'give'), |
|
58 | + 'date' => __('Date', 'give'), |
|
59 | + 'user' => __('User', 'give'), |
|
60 | + 'status' => __('Status', 'give') |
|
61 | 61 | ); |
62 | 62 | |
63 | - if ( ! give_get_option( 'enable_sequential' ) ) { |
|
64 | - unset( $cols['seq_id'] ); |
|
63 | + if ( ! give_get_option('enable_sequential')) { |
|
64 | + unset($cols['seq_id']); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | return $cols; |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | 'status' => $this->status |
88 | 88 | ); |
89 | 89 | |
90 | - if ( ! empty( $this->start ) || ! empty( $this->end ) ) { |
|
90 | + if ( ! empty($this->start) || ! empty($this->end)) { |
|
91 | 91 | |
92 | 92 | $args['date_query'] = array( |
93 | 93 | array( |
94 | - 'after' => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ), |
|
95 | - 'before' => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ), |
|
94 | + 'after' => date('Y-n-d 00:00:00', strtotime($this->start)), |
|
95 | + 'before' => date('Y-n-d 23:59:59', strtotime($this->end)), |
|
96 | 96 | 'inclusive' => true |
97 | 97 | ) |
98 | 98 | ); |
@@ -101,104 +101,104 @@ discard block |
||
101 | 101 | |
102 | 102 | //echo json_encode($args ); exit; |
103 | 103 | |
104 | - $payments = give_get_payments( $args ); |
|
104 | + $payments = give_get_payments($args); |
|
105 | 105 | |
106 | - if ( $payments ) { |
|
106 | + if ($payments) { |
|
107 | 107 | |
108 | - foreach ( $payments as $payment ) { |
|
109 | - $payment_meta = give_get_payment_meta( $payment->ID ); |
|
110 | - $user_info = give_get_payment_meta_user_info( $payment->ID ); |
|
111 | - $total = give_get_payment_amount( $payment->ID ); |
|
112 | - $user_id = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
108 | + foreach ($payments as $payment) { |
|
109 | + $payment_meta = give_get_payment_meta($payment->ID); |
|
110 | + $user_info = give_get_payment_meta_user_info($payment->ID); |
|
111 | + $total = give_get_payment_amount($payment->ID); |
|
112 | + $user_id = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email']; |
|
113 | 113 | $products = ''; |
114 | 114 | $skus = ''; |
115 | 115 | |
116 | - if ( $downloads ) { |
|
117 | - foreach ( $downloads as $key => $download ) { |
|
116 | + if ($downloads) { |
|
117 | + foreach ($downloads as $key => $download) { |
|
118 | 118 | |
119 | 119 | // Form ID |
120 | - $id = isset( $payment_meta['cart_details'] ) ? $download['id'] : $download; |
|
121 | - $qty = isset( $download['quantity'] ) ? $download['quantity'] : 1; |
|
120 | + $id = isset($payment_meta['cart_details']) ? $download['id'] : $download; |
|
121 | + $qty = isset($download['quantity']) ? $download['quantity'] : 1; |
|
122 | 122 | |
123 | - if ( isset( $download['price'] ) ) { |
|
123 | + if (isset($download['price'])) { |
|
124 | 124 | $price = $download['price']; |
125 | 125 | } else { |
126 | 126 | // If the download has variable prices, override the default price |
127 | - $price_override = isset( $payment_meta['cart_details'] ) ? $download['price'] : null; |
|
128 | - $price = give_get_download_final_price( $id, $user_info, $price_override ); |
|
127 | + $price_override = isset($payment_meta['cart_details']) ? $download['price'] : null; |
|
128 | + $price = give_get_download_final_price($id, $user_info, $price_override); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | 132 | // Display the Downoad Name |
133 | - $products .= html_entity_decode( get_the_title( $id ) ); |
|
133 | + $products .= html_entity_decode(get_the_title($id)); |
|
134 | 134 | |
135 | - if ( $qty > 1 ) { |
|
136 | - $products .= html_entity_decode( ' (' . $qty . ')' ); |
|
135 | + if ($qty > 1) { |
|
136 | + $products .= html_entity_decode(' ('.$qty.')'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | $products .= ' - '; |
140 | 140 | |
141 | - if ( give_use_skus() ) { |
|
142 | - $sku = give_get_download_sku( $id ); |
|
141 | + if (give_use_skus()) { |
|
142 | + $sku = give_get_download_sku($id); |
|
143 | 143 | |
144 | - if ( ! empty( $sku ) ) { |
|
144 | + if ( ! empty($sku)) { |
|
145 | 145 | $skus .= $sku; |
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - if ( isset( $downloads[ $key ]['item_number'] ) && isset( $downloads[ $key ]['item_number']['options'] ) ) { |
|
150 | - $price_options = $downloads[ $key ]['item_number']['options']; |
|
149 | + if (isset($downloads[$key]['item_number']) && isset($downloads[$key]['item_number']['options'])) { |
|
150 | + $price_options = $downloads[$key]['item_number']['options']; |
|
151 | 151 | |
152 | - if ( isset( $price_options['price_id'] ) ) { |
|
153 | - $products .= html_entity_decode( give_get_price_option_name( $id, $price_options['price_id'], $payment->ID ) ) . ' - '; |
|
152 | + if (isset($price_options['price_id'])) { |
|
153 | + $products .= html_entity_decode(give_get_price_option_name($id, $price_options['price_id'], $payment->ID)).' - '; |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | - $products .= html_entity_decode( give_currency_filter( give_format_amount( $price ) ) ); |
|
157 | + $products .= html_entity_decode(give_currency_filter(give_format_amount($price))); |
|
158 | 158 | |
159 | - if ( $key != ( count( $downloads ) - 1 ) ) { |
|
159 | + if ($key != (count($downloads) - 1)) { |
|
160 | 160 | $products .= ' / '; |
161 | 161 | |
162 | - if ( give_use_skus() ) { |
|
162 | + if (give_use_skus()) { |
|
163 | 163 | $skus .= ' / '; |
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - if ( is_numeric( $user_id ) ) { |
|
170 | - $user = get_userdata( $user_id ); |
|
169 | + if (is_numeric($user_id)) { |
|
170 | + $user = get_userdata($user_id); |
|
171 | 171 | } else { |
172 | 172 | $user = false; |
173 | 173 | } |
174 | 174 | |
175 | 175 | $data[] = array( |
176 | 176 | 'id' => $payment->ID, |
177 | - 'seq_id' => give_get_payment_number( $payment->ID ), |
|
177 | + 'seq_id' => give_get_payment_number($payment->ID), |
|
178 | 178 | 'email' => $payment_meta['email'], |
179 | 179 | 'first' => $user_info['first_name'], |
180 | 180 | 'last' => $user_info['last_name'], |
181 | - 'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '', |
|
182 | - 'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '', |
|
183 | - 'city' => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '', |
|
184 | - 'state' => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '', |
|
185 | - 'country' => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '', |
|
186 | - 'zip' => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '', |
|
181 | + 'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '', |
|
182 | + 'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '', |
|
183 | + 'city' => isset($user_info['address']['city']) ? $user_info['address']['city'] : '', |
|
184 | + 'state' => isset($user_info['address']['state']) ? $user_info['address']['state'] : '', |
|
185 | + 'country' => isset($user_info['address']['country']) ? $user_info['address']['country'] : '', |
|
186 | + 'zip' => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '', |
|
187 | 187 | 'products' => $products, |
188 | 188 | 'skus' => $skus, |
189 | - 'amount' => html_entity_decode( give_format_amount( $total ) ), |
|
190 | - 'gateway' => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ), |
|
191 | - 'trans_id' => give_get_payment_transaction_id( $payment->ID ), |
|
189 | + 'amount' => html_entity_decode(give_format_amount($total)), |
|
190 | + 'gateway' => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)), |
|
191 | + 'trans_id' => give_get_payment_transaction_id($payment->ID), |
|
192 | 192 | 'key' => $payment_meta['key'], |
193 | 193 | 'date' => $payment->post_date, |
194 | - 'user' => $user ? $user->display_name : __( 'guest', 'give' ), |
|
195 | - 'status' => give_get_payment_status( $payment, true ) |
|
194 | + 'user' => $user ? $user->display_name : __('guest', 'give'), |
|
195 | + 'status' => give_get_payment_status($payment, true) |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | } |
199 | 199 | |
200 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
201 | - $data = apply_filters( 'give_export_get_data_' . $this->export_type, $data ); |
|
200 | + $data = apply_filters('give_export_get_data', $data); |
|
201 | + $data = apply_filters('give_export_get_data_'.$this->export_type, $data); |
|
202 | 202 | |
203 | 203 | return $data; |
204 | 204 | |
@@ -218,27 +218,27 @@ discard block |
||
218 | 218 | |
219 | 219 | $status = $this->status; |
220 | 220 | $args = array( |
221 | - 'start-date' => date( 'n/d/Y', strtotime( $this->start ) ), |
|
222 | - 'end-date' => date( 'n/d/Y', strtotime( $this->end ) ), |
|
221 | + 'start-date' => date('n/d/Y', strtotime($this->start)), |
|
222 | + 'end-date' => date('n/d/Y', strtotime($this->end)), |
|
223 | 223 | ); |
224 | 224 | |
225 | - if ( 'any' == $status ) { |
|
225 | + if ('any' == $status) { |
|
226 | 226 | |
227 | - $total = array_sum( (array) give_count_payments( $args ) ); |
|
227 | + $total = array_sum((array) give_count_payments($args)); |
|
228 | 228 | |
229 | 229 | } else { |
230 | 230 | |
231 | - $total = give_count_payments( $args )->$status; |
|
231 | + $total = give_count_payments($args)->$status; |
|
232 | 232 | |
233 | 233 | } |
234 | 234 | |
235 | 235 | $percentage = 100; |
236 | 236 | |
237 | - if ( $total > 0 ) { |
|
238 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
237 | + if ($total > 0) { |
|
238 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
239 | 239 | } |
240 | 240 | |
241 | - if ( $percentage > 100 ) { |
|
241 | + if ($percentage > 100) { |
|
242 | 242 | $percentage = 100; |
243 | 243 | } |
244 | 244 | |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @param array $request The Form Data passed into the batch processing |
254 | 254 | */ |
255 | - public function set_properties( $request ) { |
|
256 | - $this->start = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : ''; |
|
257 | - $this->end = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : ''; |
|
258 | - $this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete'; |
|
255 | + public function set_properties($request) { |
|
256 | + $this->start = isset($request['start']) ? sanitize_text_field($request['start']) : ''; |
|
257 | + $this->end = isset($request['end']) ? sanitize_text_field($request['end']) : ''; |
|
258 | + $this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete'; |
|
259 | 259 | } |
260 | 260 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,20 +22,20 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_process_batch_export_form() { |
24 | 24 | |
25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
26 | - wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
26 | + wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array('response' => 403)); |
|
27 | 27 | } |
28 | 28 | |
29 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php'; |
|
29 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php'; |
|
30 | 30 | |
31 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
31 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
32 | 32 | |
33 | 33 | $export = new $_REQUEST['class']; |
34 | 34 | $export->export(); |
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
38 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Exports earnings for a specified time period |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | * @return void |
47 | 47 | */ |
48 | 48 | function give_export_earnings() { |
49 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php'; |
|
49 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php'; |
|
50 | 50 | |
51 | 51 | $earnings_export = new Give_Earnings_Export(); |
52 | 52 | |
53 | 53 | $earnings_export->export(); |
54 | 54 | } |
55 | 55 | |
56 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
56 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
57 | 57 | |
58 | 58 | |
59 | 59 | /** |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | * @return void |
67 | 67 | */ |
68 | 68 | function give_export_all_customers() { |
69 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php'; |
|
69 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-customers.php'; |
|
70 | 70 | |
71 | 71 | $customer_export = new Give_Customers_Export(); |
72 | 72 | |
73 | 73 | $customer_export->export(); |
74 | 74 | } |
75 | 75 | |
76 | -add_action( 'give_email_export', 'give_export_all_customers' ); |
|
76 | +add_action('give_email_export', 'give_export_all_customers'); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * Exports all the downloads to a CSV file using the Give_Export class. |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | function give_export_all_downloads_history() { |
85 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-download-history.php'; |
|
85 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-download-history.php'; |
|
86 | 86 | |
87 | 87 | $file_download_export = new Give_Download_History_Export(); |
88 | 88 | |
89 | 89 | $file_download_export->export(); |
90 | 90 | } |
91 | 91 | |
92 | -add_action( 'give_downloads_history_export', 'give_export_all_downloads_history' ); |
|
92 | +add_action('give_downloads_history_export', 'give_export_all_downloads_history'); |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Add a hook allowing extensions to register a hook on the batch export process |
@@ -98,22 +98,22 @@ discard block |
||
98 | 98 | * @return void |
99 | 99 | */ |
100 | 100 | function give_register_batch_exporters() { |
101 | - if ( is_admin() ) { |
|
102 | - do_action( 'give_register_batch_exporter' ); |
|
101 | + if (is_admin()) { |
|
102 | + do_action('give_register_batch_exporter'); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
106 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Register the payments batch exporter |
110 | 110 | * @since 1.5 |
111 | 111 | */ |
112 | 112 | function give_register_payments_batch_export() { |
113 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processer', 10, 1 ); |
|
113 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processer', 10, 1); |
|
114 | 114 | } |
115 | 115 | |
116 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
116 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Loads the payments batch process if needed |
@@ -124,10 +124,10 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return void |
126 | 126 | */ |
127 | -function give_include_payments_batch_processer( $class ) { |
|
127 | +function give_include_payments_batch_processer($class) { |
|
128 | 128 | |
129 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
130 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
129 | + if ('Give_Batch_Payments_Export' === $class) { |
|
130 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-payments.php'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | } |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | * @since 1.5.2 |
138 | 138 | */ |
139 | 139 | function give_register_customers_batch_export() { |
140 | - add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processer', 10, 1 ); |
|
140 | + add_action('give_batch_export_class_include', 'give_include_customers_batch_processer', 10, 1); |
|
141 | 141 | } |
142 | 142 | |
143 | -add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 ); |
|
143 | +add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10); |
|
144 | 144 | |
145 | 145 | /** |
146 | 146 | * Loads the customers batch process if needed |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @return void |
153 | 153 | */ |
154 | -function give_include_customers_batch_processer( $class ) { |
|
154 | +function give_include_customers_batch_processer($class) { |
|
155 | 155 | |
156 | - if ( 'Give_Batch_Customers_Export' === $class ) { |
|
157 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
156 | + if ('Give_Batch_Customers_Export' === $class) { |
|
157 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-customers.php'; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | } |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | * @since 1.5 |
166 | 166 | */ |
167 | 167 | function give_register_forms_batch_export() { |
168 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
168 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
169 | 169 | } |
170 | 170 | |
171 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
171 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
172 | 172 | |
173 | 173 | /** |
174 | 174 | * Loads the file downloads batch process if needed |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return void |
181 | 181 | */ |
182 | -function give_include_forms_batch_processor( $class ) { |
|
182 | +function give_include_forms_batch_processor($class) { |
|
183 | 183 | |
184 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
185 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
184 | + if ('Give_Batch_Forms_Export' === $class) { |
|
185 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-forms.php'; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | } |
189 | 189 | \ No newline at end of file |