@@ -530,7 +530,7 @@ |
||
530 | 530 | * |
531 | 531 | * @param int $payment_id |
532 | 532 | * |
533 | - * @return int payment_id |
|
533 | + * @return string payment_id |
|
534 | 534 | */ |
535 | 535 | function give_email_tag_payment_id( $payment_id ) { |
536 | 536 | $payment = new Give_Payment( $payment_id ); |
@@ -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 | |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * @param string $description Email tag description text |
56 | 56 | * @param callable $func Hook to run when email tag is found |
57 | 57 | */ |
58 | - public function add( $tag, $description, $func ) { |
|
59 | - if ( is_callable( $func ) ) { |
|
60 | - $this->tags[ $tag ] = array( |
|
58 | + public function add($tag, $description, $func) { |
|
59 | + if (is_callable($func)) { |
|
60 | + $this->tags[$tag] = array( |
|
61 | 61 | 'tag' => $tag, |
62 | 62 | 'description' => $description, |
63 | 63 | 'func' => $func |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param string $tag Email tag to remove hook from |
74 | 74 | */ |
75 | - public function remove( $tag ) { |
|
76 | - unset( $this->tags[ $tag ] ); |
|
75 | + public function remove($tag) { |
|
76 | + unset($this->tags[$tag]); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return bool |
87 | 87 | */ |
88 | - public function email_tag_exists( $tag ) { |
|
89 | - return array_key_exists( $tag, $this->tags ); |
|
88 | + public function email_tag_exists($tag) { |
|
89 | + return array_key_exists($tag, $this->tags); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Content with email tags filtered out. |
112 | 112 | */ |
113 | - public function do_tags( $content, $payment_id ) { |
|
113 | + public function do_tags($content, $payment_id) { |
|
114 | 114 | |
115 | 115 | // Check if there is at least one tag added. |
116 | - if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { |
|
116 | + if (empty($this->tags) || ! is_array($this->tags)) { |
|
117 | 117 | return $content; |
118 | 118 | } |
119 | 119 | |
120 | 120 | $this->payment_id = $payment_id; |
121 | 121 | |
122 | - $new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content ); |
|
122 | + $new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content); |
|
123 | 123 | |
124 | 124 | $this->payment_id = null; |
125 | 125 | |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return mixed |
137 | 137 | */ |
138 | - public function do_tag( $m ) { |
|
138 | + public function do_tag($m) { |
|
139 | 139 | |
140 | 140 | // Get tag |
141 | 141 | $tag = $m[1]; |
142 | 142 | |
143 | 143 | // Return tag if tag not set |
144 | - if ( ! $this->email_tag_exists( $tag ) ) { |
|
144 | + if ( ! $this->email_tag_exists($tag)) { |
|
145 | 145 | return $m[0]; |
146 | 146 | } |
147 | 147 | |
148 | - return call_user_func( $this->tags[ $tag ]['func'], $this->payment_id, $tag ); |
|
148 | + return call_user_func($this->tags[$tag]['func'], $this->payment_id, $tag); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | } |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | * @param string $description Description of the email tag added |
160 | 160 | * @param callable $func Hook to run when email tag is found |
161 | 161 | */ |
162 | -function give_add_email_tag( $tag, $description, $func ) { |
|
163 | - Give()->email_tags->add( $tag, $description, $func ); |
|
162 | +function give_add_email_tag($tag, $description, $func) { |
|
163 | + Give()->email_tags->add($tag, $description, $func); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @param string $tag Email tag to remove hook from |
172 | 172 | */ |
173 | -function give_remove_email_tag( $tag ) { |
|
174 | - Give()->email_tags->remove( $tag ); |
|
173 | +function give_remove_email_tag($tag) { |
|
174 | + Give()->email_tags->remove($tag); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return bool |
185 | 185 | */ |
186 | -function give_email_tag_exists( $tag ) { |
|
187 | - return Give()->email_tags->email_tag_exists( $tag ); |
|
186 | +function give_email_tag_exists($tag) { |
|
187 | + return Give()->email_tags->email_tag_exists($tag); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | $email_tags = give_get_email_tags(); |
212 | 212 | |
213 | 213 | ob_start(); |
214 | - if ( count( $email_tags ) > 0 ) : ?> |
|
214 | + if (count($email_tags) > 0) : ?> |
|
215 | 215 | <div class="give-email-tags-wrap"> |
216 | - <?php foreach ( $email_tags as $email_tag ) : ?> |
|
216 | + <?php foreach ($email_tags as $email_tag) : ?> |
|
217 | 217 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> |
218 | 218 | <code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?> |
219 | 219 | </span> |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return string Content with email tags filtered out. |
237 | 237 | */ |
238 | -function give_do_email_tags( $content, $payment_id ) { |
|
238 | +function give_do_email_tags($content, $payment_id) { |
|
239 | 239 | |
240 | 240 | // Replace all tags |
241 | - $content = Give()->email_tags->do_tags( $content, $payment_id ); |
|
241 | + $content = Give()->email_tags->do_tags($content, $payment_id); |
|
242 | 242 | |
243 | - $content = apply_filters( 'give_email_template_tags', $content, give_get_payment_meta( $payment_id ), $payment_id ); |
|
243 | + $content = apply_filters('give_email_template_tags', $content, give_get_payment_meta($payment_id), $payment_id); |
|
244 | 244 | |
245 | 245 | // Return content |
246 | 246 | return $content; |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @since 1.0 |
261 | 261 | */ |
262 | - do_action( 'give_add_email_tags' ); |
|
262 | + do_action('give_add_email_tags'); |
|
263 | 263 | } |
264 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
264 | +add_action('init', 'give_load_email_tags', - 999); |
|
265 | 265 | |
266 | 266 | |
267 | 267 | /** |
@@ -275,97 +275,97 @@ discard block |
||
275 | 275 | $email_tags = array( |
276 | 276 | array( |
277 | 277 | 'tag' => 'donation', |
278 | - 'description' => __( 'The donation form name, and the donation level (if applicable).', 'give' ), |
|
278 | + 'description' => __('The donation form name, and the donation level (if applicable).', 'give'), |
|
279 | 279 | 'function' => 'give_email_tag_donation' |
280 | 280 | ), |
281 | 281 | array( |
282 | 282 | 'tag' => 'form_title', |
283 | - 'description' => __( 'The donation form name.', 'give' ), |
|
283 | + 'description' => __('The donation form name.', 'give'), |
|
284 | 284 | 'function' => 'give_email_tag_form_title' |
285 | 285 | ), |
286 | 286 | array( |
287 | 287 | 'tag' => 'amount', |
288 | - 'description' => __( 'The total donation amount with currency sign.', 'give' ), |
|
288 | + 'description' => __('The total donation amount with currency sign.', 'give'), |
|
289 | 289 | 'function' => 'give_email_tag_amount' |
290 | 290 | ), |
291 | 291 | array( |
292 | 292 | 'tag' => 'price', |
293 | - 'description' => __( 'The total donation amount with currency sign.', 'give' ), |
|
293 | + 'description' => __('The total donation amount with currency sign.', 'give'), |
|
294 | 294 | 'function' => 'give_email_tag_price' |
295 | 295 | ), |
296 | 296 | array( |
297 | 297 | 'tag' => 'name', |
298 | - 'description' => __( 'The donor\'s first name.', 'give' ), |
|
298 | + 'description' => __('The donor\'s first name.', 'give'), |
|
299 | 299 | 'function' => 'give_email_tag_first_name' |
300 | 300 | ), |
301 | 301 | array( |
302 | 302 | 'tag' => 'fullname', |
303 | - 'description' => __( 'The donor\'s full name, first and last.', 'give' ), |
|
303 | + 'description' => __('The donor\'s full name, first and last.', 'give'), |
|
304 | 304 | 'function' => 'give_email_tag_fullname' |
305 | 305 | ), |
306 | 306 | array( |
307 | 307 | 'tag' => 'username', |
308 | - 'description' => __( 'The donor\'s user name on the site, if they registered an account.', 'give' ), |
|
308 | + 'description' => __('The donor\'s user name on the site, if they registered an account.', 'give'), |
|
309 | 309 | 'function' => 'give_email_tag_username' |
310 | 310 | ), |
311 | 311 | array( |
312 | 312 | 'tag' => 'user_email', |
313 | - 'description' => __( 'The donor\'s email address.', 'give' ), |
|
313 | + 'description' => __('The donor\'s email address.', 'give'), |
|
314 | 314 | 'function' => 'give_email_tag_user_email' |
315 | 315 | ), |
316 | 316 | array( |
317 | 317 | 'tag' => 'billing_address', |
318 | - 'description' => __( 'The donor\'s billing address.', 'give' ), |
|
318 | + 'description' => __('The donor\'s billing address.', 'give'), |
|
319 | 319 | 'function' => 'give_email_tag_billing_address' |
320 | 320 | ), |
321 | 321 | array( |
322 | 322 | 'tag' => 'date', |
323 | - 'description' => __( 'The date of the donation.', 'give' ), |
|
323 | + 'description' => __('The date of the donation.', 'give'), |
|
324 | 324 | 'function' => 'give_email_tag_date' |
325 | 325 | ), |
326 | 326 | array( |
327 | 327 | 'tag' => 'payment_id', |
328 | - 'description' => __( 'The unique ID number for this donation.', 'give' ), |
|
328 | + 'description' => __('The unique ID number for this donation.', 'give'), |
|
329 | 329 | 'function' => 'give_email_tag_payment_id' |
330 | 330 | ), |
331 | 331 | array( |
332 | 332 | 'tag' => 'receipt_id', |
333 | - 'description' => __( 'The unique ID number for this donation receipt.', 'give' ), |
|
333 | + 'description' => __('The unique ID number for this donation receipt.', 'give'), |
|
334 | 334 | 'function' => 'give_email_tag_receipt_id' |
335 | 335 | ), |
336 | 336 | array( |
337 | 337 | 'tag' => 'payment_method', |
338 | - 'description' => __( 'The method of payment used for this donation.', 'give' ), |
|
338 | + 'description' => __('The method of payment used for this donation.', 'give'), |
|
339 | 339 | 'function' => 'give_email_tag_payment_method' |
340 | 340 | ), |
341 | 341 | array( |
342 | 342 | 'tag' => 'sitename', |
343 | - 'description' => __( 'The name of your site.', 'give' ), |
|
343 | + 'description' => __('The name of your site.', 'give'), |
|
344 | 344 | 'function' => 'give_email_tag_sitename' |
345 | 345 | ), |
346 | 346 | array( |
347 | 347 | 'tag' => 'receipt_link', |
348 | - 'description' => __( 'The donation receipt direct link, to view the receipt on the website.', 'give' ), |
|
348 | + 'description' => __('The donation receipt direct link, to view the receipt on the website.', 'give'), |
|
349 | 349 | 'function' => 'give_email_tag_receipt_link' |
350 | 350 | ), |
351 | 351 | array( |
352 | 352 | 'tag' => 'receipt_link_url', |
353 | - 'description' => __( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ), |
|
353 | + 'description' => __('The donation receipt direct URL, to view the receipt on the website.', 'give'), |
|
354 | 354 | 'function' => 'give_email_tag_receipt_link_url' |
355 | 355 | ), |
356 | 356 | ); |
357 | 357 | |
358 | 358 | // Apply give_email_tags filter |
359 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
359 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
360 | 360 | |
361 | 361 | // Add email tags |
362 | - foreach ( $email_tags as $email_tag ) { |
|
363 | - give_add_email_tag( $email_tag['tag'], $email_tag['description'], $email_tag['function'] ); |
|
362 | + foreach ($email_tags as $email_tag) { |
|
363 | + give_add_email_tag($email_tag['tag'], $email_tag['description'], $email_tag['function']); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | } |
367 | 367 | |
368 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
368 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
369 | 369 | |
370 | 370 | |
371 | 371 | /** |
@@ -377,15 +377,15 @@ discard block |
||
377 | 377 | * |
378 | 378 | * @return string name |
379 | 379 | */ |
380 | -function give_email_tag_first_name( $payment_id ) { |
|
381 | - $payment = new Give_Payment( $payment_id ); |
|
380 | +function give_email_tag_first_name($payment_id) { |
|
381 | + $payment = new Give_Payment($payment_id); |
|
382 | 382 | $user_info = $payment->user_info; |
383 | 383 | |
384 | - if ( empty( $user_info ) ) { |
|
384 | + if (empty($user_info)) { |
|
385 | 385 | return ''; |
386 | 386 | } |
387 | 387 | |
388 | - $email_name = give_get_email_names( $user_info ); |
|
388 | + $email_name = give_get_email_names($user_info); |
|
389 | 389 | |
390 | 390 | return $email_name['name']; |
391 | 391 | } |
@@ -399,15 +399,15 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @return string fullname |
401 | 401 | */ |
402 | -function give_email_tag_fullname( $payment_id ) { |
|
403 | - $payment = new Give_Payment( $payment_id ); |
|
402 | +function give_email_tag_fullname($payment_id) { |
|
403 | + $payment = new Give_Payment($payment_id); |
|
404 | 404 | $user_info = $payment->user_info; |
405 | 405 | |
406 | - if ( empty( $user_info ) ) { |
|
406 | + if (empty($user_info)) { |
|
407 | 407 | return ''; |
408 | 408 | } |
409 | 409 | |
410 | - $email_name = give_get_email_names( $user_info ); |
|
410 | + $email_name = give_get_email_names($user_info); |
|
411 | 411 | |
412 | 412 | return $email_name['fullname']; |
413 | 413 | } |
@@ -421,15 +421,15 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @return string username. |
423 | 423 | */ |
424 | -function give_email_tag_username( $payment_id ) { |
|
425 | - $payment = new Give_Payment( $payment_id ); |
|
424 | +function give_email_tag_username($payment_id) { |
|
425 | + $payment = new Give_Payment($payment_id); |
|
426 | 426 | $user_info = $payment->user_info; |
427 | 427 | |
428 | - if ( empty( $user_info ) ) { |
|
428 | + if (empty($user_info)) { |
|
429 | 429 | return ''; |
430 | 430 | } |
431 | 431 | |
432 | - $email_name = give_get_email_names( $user_info ); |
|
432 | + $email_name = give_get_email_names($user_info); |
|
433 | 433 | |
434 | 434 | return $email_name['username']; |
435 | 435 | } |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | * |
444 | 444 | * @return string user_email |
445 | 445 | */ |
446 | -function give_email_tag_user_email( $payment_id ) { |
|
447 | - $payment = new Give_Payment( $payment_id ); |
|
446 | +function give_email_tag_user_email($payment_id) { |
|
447 | + $payment = new Give_Payment($payment_id); |
|
448 | 448 | |
449 | 449 | return $payment->email; |
450 | 450 | } |
@@ -458,9 +458,9 @@ discard block |
||
458 | 458 | * |
459 | 459 | * @return string billing_address |
460 | 460 | */ |
461 | -function give_email_tag_billing_address( $payment_id ) { |
|
462 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
463 | - $user_address = ! empty( $user_info['address'] ) ? $user_info['address'] : array( |
|
461 | +function give_email_tag_billing_address($payment_id) { |
|
462 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
463 | + $user_address = ! empty($user_info['address']) ? $user_info['address'] : array( |
|
464 | 464 | 'line1' => '', |
465 | 465 | 'line2' => '', |
466 | 466 | 'city' => '', |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | 'zip' => '' |
470 | 470 | ); |
471 | 471 | |
472 | - $return = $user_address['line1'] . "\n"; |
|
473 | - if ( ! empty( $user_address['line2'] ) ) { |
|
474 | - $return .= $user_address['line2'] . "\n"; |
|
472 | + $return = $user_address['line1']."\n"; |
|
473 | + if ( ! empty($user_address['line2'])) { |
|
474 | + $return .= $user_address['line2']."\n"; |
|
475 | 475 | } |
476 | - $return .= $user_address['city'] . ' ' . $user_address['zip'] . ' ' . $user_address['state'] . "\n"; |
|
476 | + $return .= $user_address['city'].' '.$user_address['zip'].' '.$user_address['state']."\n"; |
|
477 | 477 | $return .= $user_address['country']; |
478 | 478 | |
479 | 479 | return $return; |
@@ -488,10 +488,10 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @return string date |
490 | 490 | */ |
491 | -function give_email_tag_date( $payment_id ) { |
|
492 | - $payment = new Give_Payment( $payment_id ); |
|
491 | +function give_email_tag_date($payment_id) { |
|
492 | + $payment = new Give_Payment($payment_id); |
|
493 | 493 | |
494 | - return date_i18n( give_date_format(), strtotime( $payment->date ) ); |
|
494 | + return date_i18n(give_date_format(), strtotime($payment->date)); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | /** |
@@ -503,11 +503,11 @@ discard block |
||
503 | 503 | * |
504 | 504 | * @return string amount |
505 | 505 | */ |
506 | -function give_email_tag_amount( $payment_id ) { |
|
507 | - $payment = new Give_Payment( $payment_id ); |
|
508 | - $give_amount = give_currency_filter( give_format_amount( $payment->total ), $payment->currency ); |
|
506 | +function give_email_tag_amount($payment_id) { |
|
507 | + $payment = new Give_Payment($payment_id); |
|
508 | + $give_amount = give_currency_filter(give_format_amount($payment->total), $payment->currency); |
|
509 | 509 | |
510 | - return html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); |
|
510 | + return html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -519,8 +519,8 @@ discard block |
||
519 | 519 | * |
520 | 520 | * @return string price |
521 | 521 | */ |
522 | -function give_email_tag_price( $payment_id ) { |
|
523 | - return give_email_tag_amount( $payment_id ); |
|
522 | +function give_email_tag_price($payment_id) { |
|
523 | + return give_email_tag_amount($payment_id); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | /** |
@@ -532,8 +532,8 @@ discard block |
||
532 | 532 | * |
533 | 533 | * @return int payment_id |
534 | 534 | */ |
535 | -function give_email_tag_payment_id( $payment_id ) { |
|
536 | - $payment = new Give_Payment( $payment_id ); |
|
535 | +function give_email_tag_payment_id($payment_id) { |
|
536 | + $payment = new Give_Payment($payment_id); |
|
537 | 537 | |
538 | 538 | return $payment->number; |
539 | 539 | } |
@@ -547,8 +547,8 @@ discard block |
||
547 | 547 | * |
548 | 548 | * @return string receipt_id |
549 | 549 | */ |
550 | -function give_email_tag_receipt_id( $payment_id ) { |
|
551 | - $payment = new Give_Payment( $payment_id ); |
|
550 | +function give_email_tag_receipt_id($payment_id) { |
|
551 | + $payment = new Give_Payment($payment_id); |
|
552 | 552 | |
553 | 553 | return $payment->key; |
554 | 554 | } |
@@ -562,14 +562,14 @@ discard block |
||
562 | 562 | * |
563 | 563 | * @return string $form_title |
564 | 564 | */ |
565 | -function give_email_tag_donation( $payment_id ) { |
|
566 | - $payment = new Give_Payment( $payment_id ); |
|
565 | +function give_email_tag_donation($payment_id) { |
|
566 | + $payment = new Give_Payment($payment_id); |
|
567 | 567 | $payment_meta = $payment->payment_meta; |
568 | - $level_title = give_has_variable_prices( $payment->form_id ); |
|
568 | + $level_title = give_has_variable_prices($payment->form_id); |
|
569 | 569 | $separator = $level_title ? '-' : ''; |
570 | - $form_title = strip_tags( give_get_payment_form_title( $payment_meta, false, $separator ) ); |
|
570 | + $form_title = strip_tags(give_get_payment_form_title($payment_meta, false, $separator)); |
|
571 | 571 | |
572 | - return ! empty( $form_title ) ? $form_title : ''; |
|
572 | + return ! empty($form_title) ? $form_title : ''; |
|
573 | 573 | |
574 | 574 | } |
575 | 575 | |
@@ -582,11 +582,11 @@ discard block |
||
582 | 582 | * |
583 | 583 | * @return string $form_title |
584 | 584 | */ |
585 | -function give_email_tag_form_title( $payment_id ) { |
|
586 | - $payment = new Give_Payment( $payment_id ); |
|
585 | +function give_email_tag_form_title($payment_id) { |
|
586 | + $payment = new Give_Payment($payment_id); |
|
587 | 587 | $payment_meta = $payment->payment_meta; |
588 | 588 | |
589 | - return isset( $payment_meta['form_title'] ) ? strip_tags( $payment_meta['form_title'] ) : ''; |
|
589 | + return isset($payment_meta['form_title']) ? strip_tags($payment_meta['form_title']) : ''; |
|
590 | 590 | |
591 | 591 | } |
592 | 592 | |
@@ -599,10 +599,10 @@ discard block |
||
599 | 599 | * |
600 | 600 | * @return string gateway |
601 | 601 | */ |
602 | -function give_email_tag_payment_method( $payment_id ) { |
|
603 | - $payment = new Give_Payment( $payment_id ); |
|
602 | +function give_email_tag_payment_method($payment_id) { |
|
603 | + $payment = new Give_Payment($payment_id); |
|
604 | 604 | |
605 | - return give_get_gateway_checkout_label( $payment->gateway ); |
|
605 | + return give_get_gateway_checkout_label($payment->gateway); |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | /** |
@@ -614,8 +614,8 @@ discard block |
||
614 | 614 | * |
615 | 615 | * @return string sitename |
616 | 616 | */ |
617 | -function give_email_tag_sitename( $payment_id ) { |
|
618 | - return wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
617 | +function give_email_tag_sitename($payment_id) { |
|
618 | + return wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | /** |
@@ -627,19 +627,19 @@ discard block |
||
627 | 627 | * |
628 | 628 | * @return string receipt_link |
629 | 629 | */ |
630 | -function give_email_tag_receipt_link( $payment_id ) { |
|
630 | +function give_email_tag_receipt_link($payment_id) { |
|
631 | 631 | |
632 | - $receipt_url = esc_url( add_query_arg( array( |
|
633 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
632 | + $receipt_url = esc_url(add_query_arg(array( |
|
633 | + 'payment_key' => give_get_payment_key($payment_id), |
|
634 | 634 | 'give_action' => 'view_receipt' |
635 | - ), home_url() ) ); |
|
636 | - $formatted = sprintf( |
|
635 | + ), home_url())); |
|
636 | + $formatted = sprintf( |
|
637 | 637 | '<a href="%1$s">%2$s</a>', |
638 | 638 | $receipt_url, |
639 | - esc_html__( 'View it in your browser', 'give' ) |
|
639 | + esc_html__('View it in your browser', 'give') |
|
640 | 640 | ); |
641 | 641 | |
642 | - if ( give_get_option( 'email_template' ) !== 'none' ) { |
|
642 | + if (give_get_option('email_template') !== 'none') { |
|
643 | 643 | return $formatted; |
644 | 644 | } else { |
645 | 645 | return $receipt_url; |
@@ -658,12 +658,12 @@ discard block |
||
658 | 658 | * |
659 | 659 | * @return string receipt_url |
660 | 660 | */ |
661 | -function give_email_tag_receipt_link_url( $payment_id ) { |
|
661 | +function give_email_tag_receipt_link_url($payment_id) { |
|
662 | 662 | |
663 | - $receipt_url = esc_url( add_query_arg( array( |
|
664 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
663 | + $receipt_url = esc_url(add_query_arg(array( |
|
664 | + 'payment_key' => give_get_payment_key($payment_id), |
|
665 | 665 | 'give_action' => 'view_receipt' |
666 | - ), home_url() ) ); |
|
666 | + ), home_url())); |
|
667 | 667 | |
668 | 668 | return $receipt_url; |
669 | 669 |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | * Used to redirect a user back to the donation form if there are errors present. |
157 | 157 | * |
158 | - * @param array $args |
|
158 | + * @param string $args |
|
159 | 159 | * |
160 | 160 | * @access public |
161 | 161 | * @since 1.0 |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * |
438 | 438 | * @param int $form_id Give Form ID |
439 | 439 | * |
440 | - * @return int $earnings Earnings for a certain form |
|
440 | + * @return double $earnings Earnings for a certain form |
|
441 | 441 | */ |
442 | 442 | function give_get_form_earnings_stats( $form_id = 0 ) { |
443 | 443 | $give_form = new Give_Donate_Form( $form_id ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | |
24 | 24 | global $typenow; |
25 | 25 | |
26 | - if ( $typenow != 'give_forms' ) { |
|
26 | + if ($typenow != 'give_forms') { |
|
27 | 27 | return true; |
28 | 28 | } |
29 | 29 | |
30 | 30 | return false; |
31 | 31 | } |
32 | 32 | |
33 | -add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' ); |
|
33 | +add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition'); |
|
34 | 34 | |
35 | 35 | |
36 | 36 | /** |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return int|false |
42 | 42 | */ |
43 | -function get_form_id_from_args( $args ) { |
|
43 | +function get_form_id_from_args($args) { |
|
44 | 44 | |
45 | - if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) { |
|
45 | + if (isset($args['form_id']) && $args['form_id'] != 0) { |
|
46 | 46 | |
47 | - return intval( $args['form_id'] ); |
|
47 | + return intval($args['form_id']); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return false; |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return bool |
61 | 61 | */ |
62 | -function give_is_float_labels_enabled( $args ) { |
|
62 | +function give_is_float_labels_enabled($args) { |
|
63 | 63 | |
64 | 64 | $float_labels = ''; |
65 | 65 | |
66 | - if ( ! empty( $args['float_labels'] ) ) { |
|
66 | + if ( ! empty($args['float_labels'])) { |
|
67 | 67 | $float_labels = $args['float_labels']; |
68 | 68 | } |
69 | 69 | |
70 | - if ( empty( $float_labels ) ) { |
|
71 | - $float_labels = give_get_meta( $args['form_id'], '_give_form_floating_labels', true ); |
|
70 | + if (empty($float_labels)) { |
|
71 | + $float_labels = give_get_meta($args['form_id'], '_give_form_floating_labels', true); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) { |
|
75 | - $float_labels = give_get_option( 'floatlabels', 'disabled' ); |
|
74 | + if (empty($float_labels) || ('global' === $float_labels)) { |
|
75 | + $float_labels = give_get_option('floatlabels', 'disabled'); |
|
76 | 76 | } |
77 | 77 | |
78 | - return give_is_setting_enabled( $float_labels ); |
|
78 | + return give_is_setting_enabled($float_labels); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $can_checkout = true; |
93 | 93 | |
94 | - return (bool) apply_filters( 'give_can_checkout', $can_checkout ); |
|
94 | + return (bool) apply_filters('give_can_checkout', $can_checkout); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | function give_get_success_page_uri() { |
106 | 106 | $give_options = give_get_settings(); |
107 | 107 | |
108 | - $success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' ); |
|
108 | + $success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url'); |
|
109 | 109 | |
110 | - return apply_filters( 'give_get_success_page_uri', $success_page ); |
|
110 | + return apply_filters('give_get_success_page_uri', $success_page); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | */ |
120 | 120 | function give_is_success_page() { |
121 | 121 | $give_options = give_get_settings(); |
122 | - $is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false; |
|
122 | + $is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false; |
|
123 | 123 | |
124 | - return apply_filters( 'give_is_success_page', $is_success_page ); |
|
124 | + return apply_filters('give_is_success_page', $is_success_page); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | * @since 1.0 |
136 | 136 | * @return void |
137 | 137 | */ |
138 | -function give_send_to_success_page( $query_string = null ) { |
|
138 | +function give_send_to_success_page($query_string = null) { |
|
139 | 139 | |
140 | 140 | $redirect = give_get_success_page_uri(); |
141 | 141 | |
142 | - if ( $query_string ) { |
|
142 | + if ($query_string) { |
|
143 | 143 | $redirect .= $query_string; |
144 | 144 | } |
145 | 145 | |
146 | - $gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : ''; |
|
146 | + $gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : ''; |
|
147 | 147 | |
148 | - wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) ); |
|
148 | + wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string)); |
|
149 | 149 | give_die(); |
150 | 150 | } |
151 | 151 | |
@@ -161,19 +161,19 @@ discard block |
||
161 | 161 | * @since 1.0 |
162 | 162 | * @return Void |
163 | 163 | */ |
164 | -function give_send_back_to_checkout( $args = array() ) { |
|
164 | +function give_send_back_to_checkout($args = array()) { |
|
165 | 165 | |
166 | - $url = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : ''; |
|
166 | + $url = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : ''; |
|
167 | 167 | $form_id = 0; |
168 | 168 | |
169 | 169 | // Set the form_id. |
170 | - if ( isset( $_POST['give-form-id'] ) ) { |
|
171 | - $form_id = sanitize_text_field( $_POST['give-form-id'] ); |
|
170 | + if (isset($_POST['give-form-id'])) { |
|
171 | + $form_id = sanitize_text_field($_POST['give-form-id']); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | // Need a URL to continue. If none, redirect back to single form. |
175 | - if ( empty( $url ) ) { |
|
176 | - wp_safe_redirect( get_permalink( $form_id ) ); |
|
175 | + if (empty($url)) { |
|
176 | + wp_safe_redirect(get_permalink($form_id)); |
|
177 | 177 | give_die(); |
178 | 178 | } |
179 | 179 | |
@@ -182,41 +182,41 @@ discard block |
||
182 | 182 | ); |
183 | 183 | |
184 | 184 | // Set the $level_id. |
185 | - if ( isset( $_POST['give-price-id'] ) ) { |
|
186 | - $defaults['level-id'] = sanitize_text_field( $_POST['give-price-id'] ); |
|
185 | + if (isset($_POST['give-price-id'])) { |
|
186 | + $defaults['level-id'] = sanitize_text_field($_POST['give-price-id']); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | // Check for backward compatibility. |
190 | - if ( is_string( $args ) ) { |
|
191 | - $args = str_replace( '?', '', $args ); |
|
190 | + if (is_string($args)) { |
|
191 | + $args = str_replace('?', '', $args); |
|
192 | 192 | } |
193 | 193 | |
194 | - $args = wp_parse_args( $args, $defaults ); |
|
194 | + $args = wp_parse_args($args, $defaults); |
|
195 | 195 | |
196 | 196 | // Merge URL query with $args to maintain third-party URL parameters after redirect. |
197 | - $url_data = wp_parse_url( $url ); |
|
197 | + $url_data = wp_parse_url($url); |
|
198 | 198 | |
199 | 199 | // Check if an array to prevent notices before parsing. |
200 | - if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) { |
|
201 | - parse_str( $url_data['query'], $query ); |
|
200 | + if (isset($url_data['query']) && ! empty($url_data['query'])) { |
|
201 | + parse_str($url_data['query'], $query); |
|
202 | 202 | |
203 | 203 | // Precaution: don't allow any CC info. |
204 | - unset( $query['card_number'] ); |
|
205 | - unset( $query['card_cvc'] ); |
|
204 | + unset($query['card_number']); |
|
205 | + unset($query['card_cvc']); |
|
206 | 206 | |
207 | 207 | } else { |
208 | 208 | // No $url_data so pass empty array. |
209 | 209 | $query = array(); |
210 | 210 | } |
211 | 211 | |
212 | - $new_query = array_merge( $args, $query ); |
|
213 | - $new_query_string = http_build_query( $new_query ); |
|
212 | + $new_query = array_merge($args, $query); |
|
213 | + $new_query_string = http_build_query($new_query); |
|
214 | 214 | |
215 | 215 | // Assemble URL parts. |
216 | - $redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' ); |
|
216 | + $redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap'); |
|
217 | 217 | |
218 | 218 | // Redirect them. |
219 | - wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) ); |
|
219 | + wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args)); |
|
220 | 220 | give_die(); |
221 | 221 | |
222 | 222 | } |
@@ -232,16 +232,16 @@ discard block |
||
232 | 232 | * @since 1.0 |
233 | 233 | * @return string |
234 | 234 | */ |
235 | -function give_get_success_page_url( $query_string = null ) { |
|
235 | +function give_get_success_page_url($query_string = null) { |
|
236 | 236 | |
237 | - $success_page = give_get_option( 'success_page', 0 ); |
|
238 | - $success_page = get_permalink( $success_page ); |
|
237 | + $success_page = give_get_option('success_page', 0); |
|
238 | + $success_page = get_permalink($success_page); |
|
239 | 239 | |
240 | - if ( $query_string ) { |
|
240 | + if ($query_string) { |
|
241 | 241 | $success_page .= $query_string; |
242 | 242 | } |
243 | 243 | |
244 | - return apply_filters( 'give_success_page_url', $success_page ); |
|
244 | + return apply_filters('give_success_page_url', $success_page); |
|
245 | 245 | |
246 | 246 | } |
247 | 247 | |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @return mixed Full URL to the Failed Donation Page, if present, home page if it doesn't exist. |
256 | 256 | */ |
257 | -function give_get_failed_transaction_uri( $extras = false ) { |
|
257 | +function give_get_failed_transaction_uri($extras = false) { |
|
258 | 258 | $give_options = give_get_settings(); |
259 | 259 | |
260 | - $uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url(); |
|
261 | - if ( $extras ) { |
|
260 | + $uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url(); |
|
261 | + if ($extras) { |
|
262 | 262 | $uri .= $extras; |
263 | 263 | } |
264 | 264 | |
265 | - return apply_filters( 'give_get_failed_transaction_uri', $uri ); |
|
265 | + return apply_filters('give_get_failed_transaction_uri', $uri); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -273,9 +273,9 @@ discard block |
||
273 | 273 | */ |
274 | 274 | function give_is_failed_transaction_page() { |
275 | 275 | $give_options = give_get_settings(); |
276 | - $ret = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false; |
|
276 | + $ret = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false; |
|
277 | 277 | |
278 | - return apply_filters( 'give_is_failure_page', $ret ); |
|
278 | + return apply_filters('give_is_failure_page', $ret); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |
@@ -287,18 +287,18 @@ discard block |
||
287 | 287 | */ |
288 | 288 | function give_listen_for_failed_payments() { |
289 | 289 | |
290 | - $failed_page = give_get_option( 'failure_page', 0 ); |
|
290 | + $failed_page = give_get_option('failure_page', 0); |
|
291 | 291 | |
292 | - if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) { |
|
292 | + if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) { |
|
293 | 293 | |
294 | - $payment_id = absint( $_GET['payment-id'] ); |
|
295 | - give_update_payment_status( $payment_id, 'failed' ); |
|
294 | + $payment_id = absint($_GET['payment-id']); |
|
295 | + give_update_payment_status($payment_id, 'failed'); |
|
296 | 296 | |
297 | 297 | } |
298 | 298 | |
299 | 299 | } |
300 | 300 | |
301 | -add_action( 'template_redirect', 'give_listen_for_failed_payments' ); |
|
301 | +add_action('template_redirect', 'give_listen_for_failed_payments'); |
|
302 | 302 | |
303 | 303 | /** |
304 | 304 | * Retrieve the Donation History page URI |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | function give_get_history_page_uri() { |
312 | 312 | $give_options = give_get_settings(); |
313 | 313 | |
314 | - $history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' ); |
|
314 | + $history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url'); |
|
315 | 315 | |
316 | - return apply_filters( 'give_get_history_page_uri', $history_page ); |
|
316 | + return apply_filters('give_get_history_page_uri', $history_page); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | * @since 1.0 |
327 | 327 | * @return bool |
328 | 328 | */ |
329 | -function give_field_is_required( $field = '', $form_id ) { |
|
329 | +function give_field_is_required($field = '', $form_id) { |
|
330 | 330 | |
331 | - $required_fields = give_get_required_fields( $form_id ); |
|
331 | + $required_fields = give_get_required_fields($form_id); |
|
332 | 332 | |
333 | - return array_key_exists( $field, $required_fields ); |
|
333 | + return array_key_exists($field, $required_fields); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @return void |
350 | 350 | */ |
351 | -function give_record_donation_in_log( $give_form_id = 0, $payment_id, $price_id = false, $donation_date = null ) { |
|
351 | +function give_record_donation_in_log($give_form_id = 0, $payment_id, $price_id = false, $donation_date = null) { |
|
352 | 352 | global $give_logs; |
353 | 353 | |
354 | 354 | $log_data = array( |
355 | 355 | 'post_parent' => $give_form_id, |
356 | 356 | 'log_type' => 'sale', |
357 | - 'post_date' => isset( $donation_date ) ? $donation_date : null, |
|
358 | - 'post_date_gmt' => isset( $donation_date ) ? $donation_date : null, |
|
357 | + 'post_date' => isset($donation_date) ? $donation_date : null, |
|
358 | + 'post_date_gmt' => isset($donation_date) ? $donation_date : null, |
|
359 | 359 | ); |
360 | 360 | |
361 | 361 | $log_meta = array( |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | 'price_id' => (int) $price_id, |
364 | 364 | ); |
365 | 365 | |
366 | - $give_logs->insert_log( $log_data, $log_meta ); |
|
366 | + $give_logs->insert_log($log_data, $log_meta); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | * |
378 | 378 | * @return bool|int |
379 | 379 | */ |
380 | -function give_increase_donation_count( $form_id = 0, $quantity = 1 ) { |
|
380 | +function give_increase_donation_count($form_id = 0, $quantity = 1) { |
|
381 | 381 | $quantity = (int) $quantity; |
382 | - $form = new Give_Donate_Form( $form_id ); |
|
382 | + $form = new Give_Donate_Form($form_id); |
|
383 | 383 | |
384 | - return $form->increase_sales( $quantity ); |
|
384 | + return $form->increase_sales($quantity); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | /** |
@@ -394,11 +394,11 @@ discard block |
||
394 | 394 | * |
395 | 395 | * @return bool|int |
396 | 396 | */ |
397 | -function give_decrease_donation_count( $form_id = 0, $quantity = 1 ) { |
|
397 | +function give_decrease_donation_count($form_id = 0, $quantity = 1) { |
|
398 | 398 | $quantity = (int) $quantity; |
399 | - $form = new Give_Donate_Form( $form_id ); |
|
399 | + $form = new Give_Donate_Form($form_id); |
|
400 | 400 | |
401 | - return $form->decrease_sales( $quantity ); |
|
401 | + return $form->decrease_sales($quantity); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | /** |
@@ -411,10 +411,10 @@ discard block |
||
411 | 411 | * |
412 | 412 | * @return bool|int |
413 | 413 | */ |
414 | -function give_increase_earnings( $give_form_id = 0, $amount ) { |
|
415 | - $form = new Give_Donate_Form( $give_form_id ); |
|
414 | +function give_increase_earnings($give_form_id = 0, $amount) { |
|
415 | + $form = new Give_Donate_Form($give_form_id); |
|
416 | 416 | |
417 | - return $form->increase_earnings( $amount ); |
|
417 | + return $form->increase_earnings($amount); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
@@ -427,10 +427,10 @@ discard block |
||
427 | 427 | * |
428 | 428 | * @return bool|int |
429 | 429 | */ |
430 | -function give_decrease_earnings( $form_id = 0, $amount ) { |
|
431 | - $form = new Give_Donate_Form( $form_id ); |
|
430 | +function give_decrease_earnings($form_id = 0, $amount) { |
|
431 | + $form = new Give_Donate_Form($form_id); |
|
432 | 432 | |
433 | - return $form->decrease_earnings( $amount ); |
|
433 | + return $form->decrease_earnings($amount); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | * |
444 | 444 | * @return int $earnings Earnings for a certain form |
445 | 445 | */ |
446 | -function give_get_form_earnings_stats( $form_id = 0 ) { |
|
447 | - $give_form = new Give_Donate_Form( $form_id ); |
|
446 | +function give_get_form_earnings_stats($form_id = 0) { |
|
447 | + $give_form = new Give_Donate_Form($form_id); |
|
448 | 448 | |
449 | 449 | return $give_form->earnings; |
450 | 450 | } |
@@ -459,8 +459,8 @@ discard block |
||
459 | 459 | * |
460 | 460 | * @return int $sales Amount of sales for a certain form |
461 | 461 | */ |
462 | -function give_get_form_sales_stats( $give_form_id = 0 ) { |
|
463 | - $give_form = new Give_Donate_Form( $give_form_id ); |
|
462 | +function give_get_form_sales_stats($give_form_id = 0) { |
|
463 | + $give_form = new Give_Donate_Form($give_form_id); |
|
464 | 464 | |
465 | 465 | return $give_form->sales; |
466 | 466 | } |
@@ -475,16 +475,16 @@ discard block |
||
475 | 475 | * |
476 | 476 | * @return float $sales Average monthly sales |
477 | 477 | */ |
478 | -function give_get_average_monthly_form_sales( $form_id = 0 ) { |
|
479 | - $sales = give_get_form_sales_stats( $form_id ); |
|
480 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
478 | +function give_get_average_monthly_form_sales($form_id = 0) { |
|
479 | + $sales = give_get_form_sales_stats($form_id); |
|
480 | + $release_date = get_post_field('post_date', $form_id); |
|
481 | 481 | |
482 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
482 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
483 | 483 | |
484 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
484 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
485 | 485 | |
486 | - if ( $months > 0 ) { |
|
487 | - $sales = ( $sales / $months ); |
|
486 | + if ($months > 0) { |
|
487 | + $sales = ($sales / $months); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | return $sales; |
@@ -500,16 +500,16 @@ discard block |
||
500 | 500 | * |
501 | 501 | * @return float $earnings Average monthly earnings |
502 | 502 | */ |
503 | -function give_get_average_monthly_form_earnings( $form_id = 0 ) { |
|
504 | - $earnings = give_get_form_earnings_stats( $form_id ); |
|
505 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
503 | +function give_get_average_monthly_form_earnings($form_id = 0) { |
|
504 | + $earnings = give_get_form_earnings_stats($form_id); |
|
505 | + $release_date = get_post_field('post_date', $form_id); |
|
506 | 506 | |
507 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
507 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
508 | 508 | |
509 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
509 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
510 | 510 | |
511 | - if ( $months > 0 ) { |
|
512 | - $earnings = ( $earnings / $months ); |
|
511 | + if ($months > 0) { |
|
512 | + $earnings = ($earnings / $months); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | return $earnings < 0 ? 0 : $earnings; |
@@ -529,23 +529,23 @@ discard block |
||
529 | 529 | * |
530 | 530 | * @return string $price_name Name of the price option |
531 | 531 | */ |
532 | -function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) { |
|
532 | +function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) { |
|
533 | 533 | |
534 | - $prices = give_get_variable_prices( $form_id ); |
|
534 | + $prices = give_get_variable_prices($form_id); |
|
535 | 535 | $price_name = ''; |
536 | 536 | |
537 | - foreach ( $prices as $price ) { |
|
537 | + foreach ($prices as $price) { |
|
538 | 538 | |
539 | - if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) { |
|
539 | + if (intval($price['_give_id']['level_id']) == intval($price_id)) { |
|
540 | 540 | |
541 | - $price_text = isset( $price['_give_text'] ) ? $price['_give_text'] : ''; |
|
542 | - $price_fallback = give_currency_filter( give_format_amount( $price['_give_amount'] ), '', true ); |
|
543 | - $price_name = ! empty( $price_text ) ? $price_text : $price_fallback; |
|
541 | + $price_text = isset($price['_give_text']) ? $price['_give_text'] : ''; |
|
542 | + $price_fallback = give_currency_filter(give_format_amount($price['_give_amount']), '', true); |
|
543 | + $price_name = ! empty($price_text) ? $price_text : $price_fallback; |
|
544 | 544 | |
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
548 | - return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id ); |
|
548 | + return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -558,23 +558,23 @@ discard block |
||
558 | 558 | * |
559 | 559 | * @return string $range A fully formatted price range |
560 | 560 | */ |
561 | -function give_price_range( $form_id = 0 ) { |
|
562 | - $low = give_get_lowest_price_option( $form_id ); |
|
563 | - $high = give_get_highest_price_option( $form_id ); |
|
564 | - $order_type = ! empty( $_REQUEST['order'] ) ? $_REQUEST['order'] : 'asc'; |
|
561 | +function give_price_range($form_id = 0) { |
|
562 | + $low = give_get_lowest_price_option($form_id); |
|
563 | + $high = give_get_highest_price_option($form_id); |
|
564 | + $order_type = ! empty($_REQUEST['order']) ? $_REQUEST['order'] : 'asc'; |
|
565 | 565 | |
566 | 566 | $range = sprintf( |
567 | 567 | '<span class="give_price_range_%1$s">%2$s</span> |
568 | 568 | <span class="give_price_range_sep"> – </span> |
569 | 569 | <span class="give_price_range_%3$s">%4$s</span>', |
570 | 570 | 'asc' === $order_type ? 'low' : 'high', |
571 | - 'asc' === $order_type ? give_currency_filter( give_format_amount( $low ) ) : give_currency_filter( give_format_amount( $high ) ), |
|
571 | + 'asc' === $order_type ? give_currency_filter(give_format_amount($low)) : give_currency_filter(give_format_amount($high)), |
|
572 | 572 | 'asc' === $order_type ? 'high' : 'low', |
573 | - 'asc' === $order_type ? give_currency_filter( give_format_amount( $high ) ) : give_currency_filter( give_format_amount( $low ) ) |
|
573 | + 'asc' === $order_type ? give_currency_filter(give_format_amount($high)) : give_currency_filter(give_format_amount($low)) |
|
574 | 574 | |
575 | 575 | ); |
576 | 576 | |
577 | - return apply_filters( 'give_price_range', $range, $form_id, $low, $high ); |
|
577 | + return apply_filters('give_price_range', $range, $form_id, $low, $high); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | |
@@ -589,35 +589,35 @@ discard block |
||
589 | 589 | * |
590 | 590 | * @return int ID of the lowest price |
591 | 591 | */ |
592 | -function give_get_lowest_price_id( $form_id = 0 ) { |
|
592 | +function give_get_lowest_price_id($form_id = 0) { |
|
593 | 593 | |
594 | - if ( empty( $form_id ) ) { |
|
594 | + if (empty($form_id)) { |
|
595 | 595 | $form_id = get_the_ID(); |
596 | 596 | } |
597 | 597 | |
598 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
599 | - return give_get_form_price( $form_id ); |
|
598 | + if ( ! give_has_variable_prices($form_id)) { |
|
599 | + return give_get_form_price($form_id); |
|
600 | 600 | } |
601 | 601 | |
602 | - $prices = give_get_variable_prices( $form_id ); |
|
602 | + $prices = give_get_variable_prices($form_id); |
|
603 | 603 | |
604 | 604 | $min = $min_id = 0; |
605 | 605 | |
606 | - if ( ! empty( $prices ) ) { |
|
606 | + if ( ! empty($prices)) { |
|
607 | 607 | |
608 | - foreach ( $prices as $key => $price ) { |
|
608 | + foreach ($prices as $key => $price) { |
|
609 | 609 | |
610 | - if ( empty( $price['_give_amount'] ) ) { |
|
610 | + if (empty($price['_give_amount'])) { |
|
611 | 611 | continue; |
612 | 612 | } |
613 | 613 | |
614 | - if ( ! isset( $min ) ) { |
|
614 | + if ( ! isset($min)) { |
|
615 | 615 | $min = $price['_give_amount']; |
616 | 616 | } else { |
617 | - $min = min( $min, $price['_give_amount'] ); |
|
617 | + $min = min($min, $price['_give_amount']); |
|
618 | 618 | } |
619 | 619 | |
620 | - if ( $price['_give_amount'] == $min ) { |
|
620 | + if ($price['_give_amount'] == $min) { |
|
621 | 621 | $min_id = $price['_give_id']['level_id']; |
622 | 622 | } |
623 | 623 | } |
@@ -635,22 +635,22 @@ discard block |
||
635 | 635 | * |
636 | 636 | * @return float Amount of the lowest price |
637 | 637 | */ |
638 | -function give_get_lowest_price_option( $form_id = 0 ) { |
|
639 | - if ( empty( $form_id ) ) { |
|
638 | +function give_get_lowest_price_option($form_id = 0) { |
|
639 | + if (empty($form_id)) { |
|
640 | 640 | $form_id = get_the_ID(); |
641 | 641 | } |
642 | 642 | |
643 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
644 | - return give_get_form_price( $form_id ); |
|
643 | + if ( ! give_has_variable_prices($form_id)) { |
|
644 | + return give_get_form_price($form_id); |
|
645 | 645 | } |
646 | 646 | |
647 | - if ( ! ( $low = get_post_meta( $form_id, '_give_levels_minimum_amount', true ) ) ) { |
|
647 | + if ( ! ($low = get_post_meta($form_id, '_give_levels_minimum_amount', true))) { |
|
648 | 648 | // Backward compatibility. |
649 | - $prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' ); |
|
650 | - $low = ! empty( $prices ) ? min( $prices ) : 0; |
|
649 | + $prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount'); |
|
650 | + $low = ! empty($prices) ? min($prices) : 0; |
|
651 | 651 | } |
652 | 652 | |
653 | - return give_sanitize_amount( $low ); |
|
653 | + return give_sanitize_amount($low); |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | /** |
@@ -662,23 +662,23 @@ discard block |
||
662 | 662 | * |
663 | 663 | * @return float Amount of the highest price |
664 | 664 | */ |
665 | -function give_get_highest_price_option( $form_id = 0 ) { |
|
665 | +function give_get_highest_price_option($form_id = 0) { |
|
666 | 666 | |
667 | - if ( empty( $form_id ) ) { |
|
667 | + if (empty($form_id)) { |
|
668 | 668 | $form_id = get_the_ID(); |
669 | 669 | } |
670 | 670 | |
671 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
672 | - return give_get_form_price( $form_id ); |
|
671 | + if ( ! give_has_variable_prices($form_id)) { |
|
672 | + return give_get_form_price($form_id); |
|
673 | 673 | } |
674 | 674 | |
675 | - if ( ! ( $high = get_post_meta( $form_id, '_give_levels_maximum_amount', true ) ) ) { |
|
675 | + if ( ! ($high = get_post_meta($form_id, '_give_levels_maximum_amount', true))) { |
|
676 | 676 | // Backward compatibility. |
677 | - $prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' ); |
|
678 | - $high = ! empty( $prices ) ? max( $prices ) : 0; |
|
677 | + $prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount'); |
|
678 | + $high = ! empty($prices) ? max($prices) : 0; |
|
679 | 679 | } |
680 | 680 | |
681 | - return give_sanitize_amount( $high ); |
|
681 | + return give_sanitize_amount($high); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | /** |
@@ -690,15 +690,15 @@ discard block |
||
690 | 690 | * |
691 | 691 | * @return mixed string|int Price of the form |
692 | 692 | */ |
693 | -function give_get_form_price( $form_id = 0 ) { |
|
693 | +function give_get_form_price($form_id = 0) { |
|
694 | 694 | |
695 | - if ( empty( $form_id ) ) { |
|
695 | + if (empty($form_id)) { |
|
696 | 696 | return false; |
697 | 697 | } |
698 | 698 | |
699 | - $form = new Give_Donate_Form( $form_id ); |
|
699 | + $form = new Give_Donate_Form($form_id); |
|
700 | 700 | |
701 | - return $form->__get( 'price' ); |
|
701 | + return $form->__get('price'); |
|
702 | 702 | } |
703 | 703 | |
704 | 704 | /** |
@@ -710,15 +710,15 @@ discard block |
||
710 | 710 | * |
711 | 711 | * @return mixed string|int Minimum price of the form |
712 | 712 | */ |
713 | -function give_get_form_minimum_price( $form_id = 0 ) { |
|
713 | +function give_get_form_minimum_price($form_id = 0) { |
|
714 | 714 | |
715 | - if ( empty( $form_id ) ) { |
|
715 | + if (empty($form_id)) { |
|
716 | 716 | return false; |
717 | 717 | } |
718 | 718 | |
719 | - $form = new Give_Donate_Form( $form_id ); |
|
719 | + $form = new Give_Donate_Form($form_id); |
|
720 | 720 | |
721 | - return $form->__get( 'minimum_price' ); |
|
721 | + return $form->__get('minimum_price'); |
|
722 | 722 | |
723 | 723 | } |
724 | 724 | |
@@ -733,51 +733,51 @@ discard block |
||
733 | 733 | * |
734 | 734 | * @return int $formatted_price |
735 | 735 | */ |
736 | -function give_price( $form_id = 0, $echo = true, $price_id = false ) { |
|
736 | +function give_price($form_id = 0, $echo = true, $price_id = false) { |
|
737 | 737 | |
738 | - if ( empty( $form_id ) ) { |
|
738 | + if (empty($form_id)) { |
|
739 | 739 | $form_id = get_the_ID(); |
740 | 740 | } |
741 | 741 | |
742 | - if ( give_has_variable_prices( $form_id ) ) { |
|
742 | + if (give_has_variable_prices($form_id)) { |
|
743 | 743 | |
744 | - $prices = give_get_variable_prices( $form_id ); |
|
744 | + $prices = give_get_variable_prices($form_id); |
|
745 | 745 | |
746 | - if ( false !== $price_id ) { |
|
746 | + if (false !== $price_id) { |
|
747 | 747 | |
748 | 748 | // loop through multi-prices to see which is default |
749 | - foreach ( $prices as $price ) { |
|
749 | + foreach ($prices as $price) { |
|
750 | 750 | // this is the default price |
751 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
751 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
752 | 752 | $price = (float) $price['_give_amount']; |
753 | 753 | }; |
754 | 754 | } |
755 | 755 | } else { |
756 | 756 | |
757 | - $price = give_get_lowest_price_option( $form_id ); |
|
757 | + $price = give_get_lowest_price_option($form_id); |
|
758 | 758 | } |
759 | 759 | |
760 | - $price = give_sanitize_amount( $price ); |
|
760 | + $price = give_sanitize_amount($price); |
|
761 | 761 | |
762 | 762 | } else { |
763 | 763 | |
764 | - $price = give_get_form_price( $form_id ); |
|
764 | + $price = give_get_form_price($form_id); |
|
765 | 765 | |
766 | 766 | } |
767 | 767 | |
768 | - $price = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id ); |
|
769 | - $formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>'; |
|
770 | - $formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price ); |
|
768 | + $price = apply_filters('give_form_price', give_sanitize_amount($price), $form_id); |
|
769 | + $formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>'; |
|
770 | + $formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price); |
|
771 | 771 | |
772 | - if ( $echo ) { |
|
772 | + if ($echo) { |
|
773 | 773 | echo $formatted_price; |
774 | 774 | } else { |
775 | 775 | return $formatted_price; |
776 | 776 | } |
777 | 777 | } |
778 | 778 | |
779 | -add_filter( 'give_form_price', 'give_format_amount', 10 ); |
|
780 | -add_filter( 'give_form_price', 'give_currency_filter', 20 ); |
|
779 | +add_filter('give_form_price', 'give_format_amount', 10); |
|
780 | +add_filter('give_form_price', 'give_currency_filter', 20); |
|
781 | 781 | |
782 | 782 | |
783 | 783 | /** |
@@ -790,19 +790,19 @@ discard block |
||
790 | 790 | * |
791 | 791 | * @return float $amount Amount of the price option |
792 | 792 | */ |
793 | -function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) { |
|
794 | - $prices = give_get_variable_prices( $form_id ); |
|
793 | +function give_get_price_option_amount($form_id = 0, $price_id = 0) { |
|
794 | + $prices = give_get_variable_prices($form_id); |
|
795 | 795 | |
796 | 796 | $amount = 0.00; |
797 | 797 | |
798 | - foreach ( $prices as $price ) { |
|
799 | - if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) { |
|
800 | - $amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00; |
|
798 | + foreach ($prices as $price) { |
|
799 | + if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) { |
|
800 | + $amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00; |
|
801 | 801 | break; |
802 | 802 | }; |
803 | 803 | } |
804 | 804 | |
805 | - return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id ); |
|
805 | + return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id); |
|
806 | 806 | } |
807 | 807 | |
808 | 808 | /** |
@@ -814,13 +814,13 @@ discard block |
||
814 | 814 | * |
815 | 815 | * @return mixed string|int Goal of the form |
816 | 816 | */ |
817 | -function give_get_form_goal( $form_id = 0 ) { |
|
817 | +function give_get_form_goal($form_id = 0) { |
|
818 | 818 | |
819 | - if ( empty( $form_id ) ) { |
|
819 | + if (empty($form_id)) { |
|
820 | 820 | return false; |
821 | 821 | } |
822 | 822 | |
823 | - $form = new Give_Donate_Form( $form_id ); |
|
823 | + $form = new Give_Donate_Form($form_id); |
|
824 | 824 | |
825 | 825 | return $form->goal; |
826 | 826 | |
@@ -836,27 +836,27 @@ discard block |
||
836 | 836 | * |
837 | 837 | * @return string $formatted_goal |
838 | 838 | */ |
839 | -function give_goal( $form_id = 0, $echo = true ) { |
|
839 | +function give_goal($form_id = 0, $echo = true) { |
|
840 | 840 | |
841 | - if ( empty( $form_id ) ) { |
|
841 | + if (empty($form_id)) { |
|
842 | 842 | $form_id = get_the_ID(); |
843 | 843 | } |
844 | 844 | |
845 | - $goal = give_get_form_goal( $form_id ); |
|
845 | + $goal = give_get_form_goal($form_id); |
|
846 | 846 | |
847 | - $goal = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id ); |
|
848 | - $formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>'; |
|
849 | - $formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal ); |
|
847 | + $goal = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id); |
|
848 | + $formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>'; |
|
849 | + $formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal); |
|
850 | 850 | |
851 | - if ( $echo ) { |
|
851 | + if ($echo) { |
|
852 | 852 | echo $formatted_goal; |
853 | 853 | } else { |
854 | 854 | return $formatted_goal; |
855 | 855 | } |
856 | 856 | } |
857 | 857 | |
858 | -add_filter( 'give_form_goal', 'give_format_amount', 10 ); |
|
859 | -add_filter( 'give_form_goal', 'give_currency_filter', 20 ); |
|
858 | +add_filter('give_form_goal', 'give_format_amount', 10); |
|
859 | +add_filter('give_form_goal', 'give_currency_filter', 20); |
|
860 | 860 | |
861 | 861 | |
862 | 862 | /** |
@@ -868,15 +868,15 @@ discard block |
||
868 | 868 | * |
869 | 869 | * @return bool $ret Whether or not the logged_in_only setting is set |
870 | 870 | */ |
871 | -function give_logged_in_only( $form_id ) { |
|
871 | +function give_logged_in_only($form_id) { |
|
872 | 872 | // If _give_logged_in_only is set to enable then guest can donate from that specific form. |
873 | 873 | // Otherwise it is member only donation form. |
874 | - $val = give_get_meta( $form_id, '_give_logged_in_only', true ); |
|
875 | - $val = ! empty( $val ) ? $val : 'enabled'; |
|
874 | + $val = give_get_meta($form_id, '_give_logged_in_only', true); |
|
875 | + $val = ! empty($val) ? $val : 'enabled'; |
|
876 | 876 | |
877 | - $ret = ! give_is_setting_enabled( $val ); |
|
877 | + $ret = ! give_is_setting_enabled($val); |
|
878 | 878 | |
879 | - return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id ); |
|
879 | + return (bool) apply_filters('give_logged_in_only', $ret, $form_id); |
|
880 | 880 | } |
881 | 881 | |
882 | 882 | |
@@ -889,11 +889,11 @@ discard block |
||
889 | 889 | * |
890 | 890 | * @return string |
891 | 891 | */ |
892 | -function give_show_login_register_option( $form_id ) { |
|
892 | +function give_show_login_register_option($form_id) { |
|
893 | 893 | |
894 | - $show_register_form = give_get_meta( $form_id, '_give_show_register_form', true ); |
|
894 | + $show_register_form = give_get_meta($form_id, '_give_show_register_form', true); |
|
895 | 895 | |
896 | - return apply_filters( 'give_show_register_form', $show_register_form, $form_id ); |
|
896 | + return apply_filters('give_show_register_form', $show_register_form, $form_id); |
|
897 | 897 | |
898 | 898 | } |
899 | 899 | |
@@ -909,12 +909,12 @@ discard block |
||
909 | 909 | * |
910 | 910 | * @return array |
911 | 911 | */ |
912 | -function _give_get_prefill_form_field_values( $form_id ) { |
|
912 | +function _give_get_prefill_form_field_values($form_id) { |
|
913 | 913 | $logged_in_donor_info = array(); |
914 | 914 | |
915 | - if ( is_user_logged_in() ) : |
|
916 | - $donor_data = get_userdata( get_current_user_id() ); |
|
917 | - $donor_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
915 | + if (is_user_logged_in()) : |
|
916 | + $donor_data = get_userdata(get_current_user_id()); |
|
917 | + $donor_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
918 | 918 | |
919 | 919 | $logged_in_donor_info = array( |
920 | 920 | // First name. |
@@ -927,42 +927,42 @@ discard block |
||
927 | 927 | 'give_email' => $donor_data->user_email, |
928 | 928 | |
929 | 929 | // Street address 1. |
930 | - 'card_address' => ( ! empty( $donor_address['line1'] ) ? $donor_address['line1'] : '' ), |
|
930 | + 'card_address' => ( ! empty($donor_address['line1']) ? $donor_address['line1'] : ''), |
|
931 | 931 | |
932 | 932 | // Street address 2. |
933 | - 'card_address_2' => ( ! empty( $donor_address['line2'] ) ? $donor_address['line2'] : '' ), |
|
933 | + 'card_address_2' => ( ! empty($donor_address['line2']) ? $donor_address['line2'] : ''), |
|
934 | 934 | |
935 | 935 | // Country. |
936 | - 'billing_country' => ( ! empty( $donor_address['country'] ) ? $donor_address['country'] : '' ), |
|
936 | + 'billing_country' => ( ! empty($donor_address['country']) ? $donor_address['country'] : ''), |
|
937 | 937 | |
938 | 938 | // State. |
939 | - 'card_state' => ( ! empty( $donor_address['state'] ) ? $donor_address['state'] : '' ), |
|
939 | + 'card_state' => ( ! empty($donor_address['state']) ? $donor_address['state'] : ''), |
|
940 | 940 | |
941 | 941 | // City. |
942 | - 'card_city' => ( ! empty( $donor_address['city'] ) ? $donor_address['city'] : '' ), |
|
942 | + 'card_city' => ( ! empty($donor_address['city']) ? $donor_address['city'] : ''), |
|
943 | 943 | |
944 | 944 | // Zipcode |
945 | - 'card_zip' => ( ! empty( $donor_address['zip'] ) ? $donor_address['zip'] : '' ), |
|
945 | + 'card_zip' => ( ! empty($donor_address['zip']) ? $donor_address['zip'] : ''), |
|
946 | 946 | ); |
947 | 947 | endif; |
948 | 948 | |
949 | 949 | // Bailout: Auto fill form field values only form form which donor is donating. |
950 | 950 | if ( |
951 | - empty( $_GET['form-id'] ) |
|
951 | + empty($_GET['form-id']) |
|
952 | 952 | || ! $form_id |
953 | - || ( $form_id !== absint( $_GET['form-id'] ) ) |
|
953 | + || ($form_id !== absint($_GET['form-id'])) |
|
954 | 954 | ) { |
955 | 955 | return $logged_in_donor_info; |
956 | 956 | } |
957 | 957 | |
958 | 958 | // Get purchase data. |
959 | - $give_purchase_data = Give()->session->get( 'give_purchase' ); |
|
959 | + $give_purchase_data = Give()->session->get('give_purchase'); |
|
960 | 960 | |
961 | 961 | // Get donor info from form data. |
962 | - $give_donor_info_in_session = empty( $give_purchase_data['post_data'] ) |
|
962 | + $give_donor_info_in_session = empty($give_purchase_data['post_data']) |
|
963 | 963 | ? array() |
964 | 964 | : $give_purchase_data['post_data']; |
965 | 965 | |
966 | 966 | // Output. |
967 | - return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info ); |
|
967 | + return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info); |
|
968 | 968 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | * |
393 | 393 | * @param int|bool $payment_id A given payment |
394 | 394 | * |
395 | - * @return mixed void|false |
|
395 | + * @return false|null void|false |
|
396 | 396 | */ |
397 | 397 | public function __construct( $payment_id = false ) { |
398 | 398 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * |
464 | 464 | * @param string $name The attribute to get |
465 | 465 | * |
466 | - * @return boolean If the item is set or not |
|
466 | + * @return boolean|null If the item is set or not |
|
467 | 467 | */ |
468 | 468 | public function __isset( $name ) { |
469 | 469 | if ( property_exists( $this, $name ) ) { |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | * |
1303 | 1303 | * @param string $note The note to add |
1304 | 1304 | * |
1305 | - * @return void |
|
1305 | + * @return false|null |
|
1306 | 1306 | */ |
1307 | 1307 | public function add_note( $note = false ) { |
1308 | 1308 | // Bail if no note specified. |
@@ -1050,7 +1050,7 @@ |
||
1050 | 1050 | // Find a match between price_id and level_id. |
1051 | 1051 | // First verify array keys exists THEN make the match. |
1052 | 1052 | if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) ) |
1053 | - && $args['price_id'] == $price['_give_id']['level_id'] |
|
1053 | + && $args['price_id'] == $price['_give_id']['level_id'] |
|
1054 | 1054 | ) { |
1055 | 1055 | $item_price = $price['_give_amount']; |
1056 | 1056 | } |
@@ -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 | |
@@ -371,13 +371,13 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @return mixed void|false |
373 | 373 | */ |
374 | - public function __construct( $payment_id = false ) { |
|
374 | + public function __construct($payment_id = false) { |
|
375 | 375 | |
376 | - if ( empty( $payment_id ) ) { |
|
376 | + if (empty($payment_id)) { |
|
377 | 377 | return false; |
378 | 378 | } |
379 | 379 | |
380 | - $this->setup_payment( $payment_id ); |
|
380 | + $this->setup_payment($payment_id); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /** |
@@ -390,11 +390,11 @@ discard block |
||
390 | 390 | * |
391 | 391 | * @return mixed The value. |
392 | 392 | */ |
393 | - public function __get( $key ) { |
|
393 | + public function __get($key) { |
|
394 | 394 | |
395 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
395 | + if (method_exists($this, 'get_'.$key)) { |
|
396 | 396 | |
397 | - $value = call_user_func( array( $this, 'get_' . $key ) ); |
|
397 | + $value = call_user_func(array($this, 'get_'.$key)); |
|
398 | 398 | |
399 | 399 | } else { |
400 | 400 | |
@@ -416,18 +416,18 @@ discard block |
||
416 | 416 | * @param string $key The property name |
417 | 417 | * @param mixed $value The value of the property |
418 | 418 | */ |
419 | - public function __set( $key, $value ) { |
|
420 | - $ignore = array( '_ID' ); |
|
419 | + public function __set($key, $value) { |
|
420 | + $ignore = array('_ID'); |
|
421 | 421 | |
422 | - if ( $key === 'status' ) { |
|
422 | + if ($key === 'status') { |
|
423 | 423 | $this->old_status = $this->status; |
424 | 424 | } |
425 | 425 | |
426 | - if ( ! in_array( $key, $ignore ) ) { |
|
427 | - $this->pending[ $key ] = $value; |
|
426 | + if ( ! in_array($key, $ignore)) { |
|
427 | + $this->pending[$key] = $value; |
|
428 | 428 | } |
429 | 429 | |
430 | - if ( '_ID' !== $key ) { |
|
430 | + if ('_ID' !== $key) { |
|
431 | 431 | $this->$key = $value; |
432 | 432 | } |
433 | 433 | } |
@@ -442,9 +442,9 @@ discard block |
||
442 | 442 | * |
443 | 443 | * @return boolean If the item is set or not |
444 | 444 | */ |
445 | - public function __isset( $name ) { |
|
446 | - if ( property_exists( $this, $name ) ) { |
|
447 | - return false === empty( $this->$name ); |
|
445 | + public function __isset($name) { |
|
446 | + if (property_exists($this, $name)) { |
|
447 | + return false === empty($this->$name); |
|
448 | 448 | } else { |
449 | 449 | return null; |
450 | 450 | } |
@@ -460,20 +460,20 @@ discard block |
||
460 | 460 | * |
461 | 461 | * @return bool If the setup was successful or not |
462 | 462 | */ |
463 | - private function setup_payment( $payment_id ) { |
|
463 | + private function setup_payment($payment_id) { |
|
464 | 464 | $this->pending = array(); |
465 | 465 | |
466 | - if ( empty( $payment_id ) ) { |
|
466 | + if (empty($payment_id)) { |
|
467 | 467 | return false; |
468 | 468 | } |
469 | 469 | |
470 | - $payment = get_post( $payment_id ); |
|
470 | + $payment = get_post($payment_id); |
|
471 | 471 | |
472 | - if ( ! $payment || is_wp_error( $payment ) ) { |
|
472 | + if ( ! $payment || is_wp_error($payment)) { |
|
473 | 473 | return false; |
474 | 474 | } |
475 | 475 | |
476 | - if ( 'give_payment' !== $payment->post_type ) { |
|
476 | + if ('give_payment' !== $payment->post_type) { |
|
477 | 477 | return false; |
478 | 478 | } |
479 | 479 | |
@@ -487,13 +487,13 @@ discard block |
||
487 | 487 | * @param Give_Payment $this Payment object. |
488 | 488 | * @param int $payment_id The ID of the payment. |
489 | 489 | */ |
490 | - do_action( 'give_pre_setup_payment', $this, $payment_id ); |
|
490 | + do_action('give_pre_setup_payment', $this, $payment_id); |
|
491 | 491 | |
492 | 492 | // Primary Identifier. |
493 | - $this->ID = absint( $payment_id ); |
|
493 | + $this->ID = absint($payment_id); |
|
494 | 494 | |
495 | 495 | // Protected ID that can never be changed. |
496 | - $this->_ID = absint( $payment_id ); |
|
496 | + $this->_ID = absint($payment_id); |
|
497 | 497 | |
498 | 498 | // We have a payment, get the generic payment_meta item to reduce calls to it. |
499 | 499 | $this->payment_meta = $this->get_meta(); |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | $this->parent_payment = $payment->post_parent; |
509 | 509 | |
510 | 510 | $all_payment_statuses = give_get_payment_statuses(); |
511 | - $this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status ); |
|
511 | + $this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status); |
|
512 | 512 | |
513 | 513 | // Currency Based. |
514 | 514 | $this->total = $this->setup_total(); |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | * @param Give_Payment $this Payment object. |
547 | 547 | * @param int $payment_id The ID of the payment. |
548 | 548 | */ |
549 | - do_action( 'give_setup_payment', $this, $payment_id ); |
|
549 | + do_action('give_setup_payment', $this, $payment_id); |
|
550 | 550 | |
551 | 551 | return true; |
552 | 552 | } |
@@ -564,8 +564,8 @@ discard block |
||
564 | 564 | * |
565 | 565 | * @return void |
566 | 566 | */ |
567 | - public function update_payment_setup( $payment_id ) { |
|
568 | - $this->setup_payment( $payment_id ); |
|
567 | + public function update_payment_setup($payment_id) { |
|
568 | + $this->setup_payment($payment_id); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | /** |
@@ -580,24 +580,24 @@ discard block |
||
580 | 580 | |
581 | 581 | // Construct the payment title. |
582 | 582 | $payment_title = ''; |
583 | - if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) { |
|
584 | - $payment_title = $this->first_name . ' ' . $this->last_name; |
|
585 | - } elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) { |
|
583 | + if ( ! empty($this->first_name) && ! empty($this->last_name)) { |
|
584 | + $payment_title = $this->first_name.' '.$this->last_name; |
|
585 | + } elseif ( ! empty($this->first_name) && empty($this->last_name)) { |
|
586 | 586 | $payment_title = $this->first_name; |
587 | - } elseif ( ! empty( $this->email ) && is_email( $this->email ) ) { |
|
587 | + } elseif ( ! empty($this->email) && is_email($this->email)) { |
|
588 | 588 | $payment_title = $this->email; |
589 | 589 | } |
590 | 590 | |
591 | 591 | // Set Key. |
592 | - if ( empty( $this->key ) ) { |
|
592 | + if (empty($this->key)) { |
|
593 | 593 | |
594 | - $auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : ''; |
|
595 | - $this->key = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) ); // Unique key |
|
594 | + $auth_key = defined('AUTH_KEY') ? AUTH_KEY : ''; |
|
595 | + $this->key = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key |
|
596 | 596 | $this->pending['key'] = $this->key; |
597 | 597 | } |
598 | 598 | |
599 | 599 | // Set IP. |
600 | - if ( empty( $this->ip ) ) { |
|
600 | + if (empty($this->ip)) { |
|
601 | 601 | |
602 | 602 | $this->ip = give_get_ip(); |
603 | 603 | $this->pending['ip'] = $this->ip; |
@@ -623,57 +623,57 @@ discard block |
||
623 | 623 | 'status' => $this->status, |
624 | 624 | ); |
625 | 625 | |
626 | - $args = apply_filters( 'give_insert_payment_args', array( |
|
626 | + $args = apply_filters('give_insert_payment_args', array( |
|
627 | 627 | 'post_title' => $payment_title, |
628 | 628 | 'post_status' => $this->status, |
629 | 629 | 'post_type' => 'give_payment', |
630 | - 'post_date' => ! empty( $this->date ) ? $this->date : null, |
|
631 | - 'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null, |
|
630 | + 'post_date' => ! empty($this->date) ? $this->date : null, |
|
631 | + 'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null, |
|
632 | 632 | 'post_parent' => $this->parent_payment, |
633 | - ), $payment_data ); |
|
633 | + ), $payment_data); |
|
634 | 634 | |
635 | 635 | // Create a blank payment |
636 | - $payment_id = wp_insert_post( $args ); |
|
636 | + $payment_id = wp_insert_post($args); |
|
637 | 637 | |
638 | - if ( ! empty( $payment_id ) ) { |
|
638 | + if ( ! empty($payment_id)) { |
|
639 | 639 | |
640 | 640 | $this->ID = $payment_id; |
641 | 641 | $this->_ID = $payment_id; |
642 | 642 | |
643 | 643 | $donor = new stdClass; |
644 | 644 | |
645 | - if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) { |
|
646 | - $donor = new Give_Donor( get_current_user_id(), true ); |
|
645 | + if (did_action('give_pre_process_donation') && is_user_logged_in()) { |
|
646 | + $donor = new Give_Donor(get_current_user_id(), true); |
|
647 | 647 | |
648 | 648 | // Donor is logged in but used a different email to purchase with so assign to their donor record. |
649 | - if ( ! empty( $donor->id ) && $this->email != $donor->email ) { |
|
650 | - $donor->add_email( $this->email ); |
|
649 | + if ( ! empty($donor->id) && $this->email != $donor->email) { |
|
650 | + $donor->add_email($this->email); |
|
651 | 651 | } |
652 | 652 | } |
653 | 653 | |
654 | - if ( empty( $donor->id ) ) { |
|
655 | - $donor = new Give_Donor( $this->email ); |
|
654 | + if (empty($donor->id)) { |
|
655 | + $donor = new Give_Donor($this->email); |
|
656 | 656 | } |
657 | 657 | |
658 | - if ( empty( $donor->id ) ) { |
|
658 | + if (empty($donor->id)) { |
|
659 | 659 | |
660 | 660 | $donor_data = array( |
661 | - 'name' => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '', |
|
661 | + 'name' => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '', |
|
662 | 662 | 'email' => $this->email, |
663 | 663 | 'user_id' => $this->user_id, |
664 | 664 | ); |
665 | 665 | |
666 | - $donor->create( $donor_data ); |
|
666 | + $donor->create($donor_data); |
|
667 | 667 | |
668 | 668 | } |
669 | 669 | |
670 | 670 | $this->customer_id = $donor->id; |
671 | 671 | $this->pending['customer_id'] = $this->customer_id; |
672 | - $donor->attach_payment( $this->ID, false ); |
|
672 | + $donor->attach_payment($this->ID, false); |
|
673 | 673 | |
674 | - $this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data ); |
|
674 | + $this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data); |
|
675 | 675 | |
676 | - $this->update_meta( '_give_payment_meta', $this->payment_meta ); |
|
676 | + $this->update_meta('_give_payment_meta', $this->payment_meta); |
|
677 | 677 | $this->new = true; |
678 | 678 | }// End if(). |
679 | 679 | |
@@ -695,11 +695,11 @@ discard block |
||
695 | 695 | $saved = false; |
696 | 696 | |
697 | 697 | // Must have an ID. |
698 | - if ( empty( $this->ID ) ) { |
|
698 | + if (empty($this->ID)) { |
|
699 | 699 | |
700 | 700 | $payment_id = $this->insert_payment(); |
701 | 701 | |
702 | - if ( false === $payment_id ) { |
|
702 | + if (false === $payment_id) { |
|
703 | 703 | $saved = false; |
704 | 704 | } else { |
705 | 705 | $this->ID = $payment_id; |
@@ -707,48 +707,48 @@ discard block |
||
707 | 707 | } |
708 | 708 | |
709 | 709 | // Set ID if not matching. |
710 | - if ( $this->ID !== $this->_ID ) { |
|
710 | + if ($this->ID !== $this->_ID) { |
|
711 | 711 | $this->ID = $this->_ID; |
712 | 712 | } |
713 | 713 | |
714 | 714 | // If we have something pending, let's save it. |
715 | - if ( ! empty( $this->pending ) ) { |
|
715 | + if ( ! empty($this->pending)) { |
|
716 | 716 | |
717 | 717 | $total_increase = 0; |
718 | 718 | $total_decrease = 0; |
719 | 719 | |
720 | - foreach ( $this->pending as $key => $value ) { |
|
720 | + foreach ($this->pending as $key => $value) { |
|
721 | 721 | |
722 | - switch ( $key ) { |
|
722 | + switch ($key) { |
|
723 | 723 | |
724 | 724 | case 'donations': |
725 | 725 | // Update totals for pending donations. |
726 | - foreach ( $this->pending[ $key ] as $item ) { |
|
726 | + foreach ($this->pending[$key] as $item) { |
|
727 | 727 | |
728 | - $quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1; |
|
729 | - $price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0; |
|
728 | + $quantity = isset($item['quantity']) ? $item['quantity'] : 1; |
|
729 | + $price_id = isset($item['price_id']) ? $item['price_id'] : 0; |
|
730 | 730 | |
731 | - switch ( $item['action'] ) { |
|
731 | + switch ($item['action']) { |
|
732 | 732 | |
733 | 733 | case 'add': |
734 | 734 | |
735 | 735 | $price = $item['price']; |
736 | 736 | |
737 | - if ( 'publish' === $this->status || 'complete' === $this->status ) { |
|
737 | + if ('publish' === $this->status || 'complete' === $this->status) { |
|
738 | 738 | |
739 | 739 | // Add sales logs. |
740 | - $log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) ); |
|
740 | + $log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp')); |
|
741 | 741 | |
742 | 742 | $y = 0; |
743 | - while ( $y < $quantity ) { |
|
743 | + while ($y < $quantity) { |
|
744 | 744 | |
745 | - give_record_donation_in_log( $item['id'], $this->ID, $price_id, $log_date ); |
|
746 | - $y ++; |
|
745 | + give_record_donation_in_log($item['id'], $this->ID, $price_id, $log_date); |
|
746 | + $y++; |
|
747 | 747 | } |
748 | 748 | |
749 | - $form = new Give_Donate_Form( $item['id'] ); |
|
750 | - $form->increase_sales( $quantity ); |
|
751 | - $form->increase_earnings( $price ); |
|
749 | + $form = new Give_Donate_Form($item['id']); |
|
750 | + $form->increase_sales($quantity); |
|
751 | + $form->increase_earnings($price); |
|
752 | 752 | |
753 | 753 | $total_increase += $price; |
754 | 754 | } |
@@ -773,15 +773,15 @@ discard block |
||
773 | 773 | ), |
774 | 774 | ); |
775 | 775 | |
776 | - $found_logs = get_posts( $log_args ); |
|
777 | - foreach ( $found_logs as $log ) { |
|
778 | - wp_delete_post( $log->ID, true ); |
|
776 | + $found_logs = get_posts($log_args); |
|
777 | + foreach ($found_logs as $log) { |
|
778 | + wp_delete_post($log->ID, true); |
|
779 | 779 | } |
780 | 780 | |
781 | - if ( 'publish' === $this->status || 'complete' === $this->status ) { |
|
782 | - $form = new Give_Donate_Form( $item['id'] ); |
|
783 | - $form->decrease_sales( $quantity ); |
|
784 | - $form->decrease_earnings( $item['amount'] ); |
|
781 | + if ('publish' === $this->status || 'complete' === $this->status) { |
|
782 | + $form = new Give_Donate_Form($item['id']); |
|
783 | + $form->decrease_sales($quantity); |
|
784 | + $form->decrease_earnings($item['amount']); |
|
785 | 785 | |
786 | 786 | $total_decrease += $item['amount']; |
787 | 787 | } |
@@ -792,43 +792,43 @@ discard block |
||
792 | 792 | break; |
793 | 793 | |
794 | 794 | case 'status': |
795 | - $this->update_status( $this->status ); |
|
795 | + $this->update_status($this->status); |
|
796 | 796 | break; |
797 | 797 | |
798 | 798 | case 'gateway': |
799 | - $this->update_meta( '_give_payment_gateway', $this->gateway ); |
|
799 | + $this->update_meta('_give_payment_gateway', $this->gateway); |
|
800 | 800 | break; |
801 | 801 | |
802 | 802 | case 'mode': |
803 | - $this->update_meta( '_give_payment_mode', $this->mode ); |
|
803 | + $this->update_meta('_give_payment_mode', $this->mode); |
|
804 | 804 | break; |
805 | 805 | |
806 | 806 | case 'transaction_id': |
807 | - $this->update_meta( '_give_payment_transaction_id', $this->transaction_id ); |
|
807 | + $this->update_meta('_give_payment_transaction_id', $this->transaction_id); |
|
808 | 808 | break; |
809 | 809 | |
810 | 810 | case 'ip': |
811 | - $this->update_meta( '_give_payment_user_ip', $this->ip ); |
|
811 | + $this->update_meta('_give_payment_user_ip', $this->ip); |
|
812 | 812 | break; |
813 | 813 | |
814 | 814 | case 'customer_id': |
815 | - $this->update_meta( '_give_payment_customer_id', $this->customer_id ); |
|
815 | + $this->update_meta('_give_payment_customer_id', $this->customer_id); |
|
816 | 816 | break; |
817 | 817 | |
818 | 818 | case 'user_id': |
819 | - $this->update_meta( '_give_payment_user_id', $this->user_id ); |
|
819 | + $this->update_meta('_give_payment_user_id', $this->user_id); |
|
820 | 820 | break; |
821 | 821 | |
822 | 822 | case 'form_title': |
823 | - $this->update_meta( '_give_payment_form_title', $this->form_title ); |
|
823 | + $this->update_meta('_give_payment_form_title', $this->form_title); |
|
824 | 824 | break; |
825 | 825 | |
826 | 826 | case 'form_id': |
827 | - $this->update_meta( '_give_payment_form_id', $this->form_id ); |
|
827 | + $this->update_meta('_give_payment_form_id', $this->form_id); |
|
828 | 828 | break; |
829 | 829 | |
830 | 830 | case 'price_id': |
831 | - $this->update_meta( '_give_payment_price_id', $this->price_id ); |
|
831 | + $this->update_meta('_give_payment_price_id', $this->price_id); |
|
832 | 832 | break; |
833 | 833 | |
834 | 834 | case 'first_name': |
@@ -844,15 +844,15 @@ discard block |
||
844 | 844 | break; |
845 | 845 | |
846 | 846 | case 'email': |
847 | - $this->update_meta( '_give_payment_user_email', $this->email ); |
|
847 | + $this->update_meta('_give_payment_user_email', $this->email); |
|
848 | 848 | break; |
849 | 849 | |
850 | 850 | case 'key': |
851 | - $this->update_meta( '_give_payment_purchase_key', $this->key ); |
|
851 | + $this->update_meta('_give_payment_purchase_key', $this->key); |
|
852 | 852 | break; |
853 | 853 | |
854 | 854 | case 'number': |
855 | - $this->update_meta( '_give_payment_number', $this->number ); |
|
855 | + $this->update_meta('_give_payment_number', $this->number); |
|
856 | 856 | break; |
857 | 857 | |
858 | 858 | case 'date': |
@@ -862,11 +862,11 @@ discard block |
||
862 | 862 | 'edit_date' => true, |
863 | 863 | ); |
864 | 864 | |
865 | - wp_update_post( $args ); |
|
865 | + wp_update_post($args); |
|
866 | 866 | break; |
867 | 867 | |
868 | 868 | case 'completed_date': |
869 | - $this->update_meta( '_give_completed_date', $this->completed_date ); |
|
869 | + $this->update_meta('_give_completed_date', $this->completed_date); |
|
870 | 870 | break; |
871 | 871 | |
872 | 872 | case 'parent_payment': |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | 'post_parent' => $this->parent_payment, |
876 | 876 | ); |
877 | 877 | |
878 | - wp_update_post( $args ); |
|
878 | + wp_update_post($args); |
|
879 | 879 | break; |
880 | 880 | |
881 | 881 | default: |
@@ -886,33 +886,33 @@ discard block |
||
886 | 886 | * |
887 | 887 | * @param Give_Payment $this Payment object. |
888 | 888 | */ |
889 | - do_action( 'give_payment_save', $this, $key ); |
|
889 | + do_action('give_payment_save', $this, $key); |
|
890 | 890 | break; |
891 | 891 | }// End switch(). |
892 | 892 | }// End foreach(). |
893 | 893 | |
894 | - if ( 'pending' !== $this->status ) { |
|
894 | + if ('pending' !== $this->status) { |
|
895 | 895 | |
896 | - $donor = new Give_Donor( $this->customer_id ); |
|
896 | + $donor = new Give_Donor($this->customer_id); |
|
897 | 897 | |
898 | 898 | $total_change = $total_increase - $total_decrease; |
899 | - if ( $total_change < 0 ) { |
|
899 | + if ($total_change < 0) { |
|
900 | 900 | |
901 | - $total_change = - ( $total_change ); |
|
901 | + $total_change = - ($total_change); |
|
902 | 902 | // Decrease the donor's donation stats. |
903 | - $donor->decrease_value( $total_change ); |
|
904 | - give_decrease_total_earnings( $total_change ); |
|
903 | + $donor->decrease_value($total_change); |
|
904 | + give_decrease_total_earnings($total_change); |
|
905 | 905 | |
906 | - } elseif ( $total_change > 0 ) { |
|
906 | + } elseif ($total_change > 0) { |
|
907 | 907 | |
908 | 908 | // Increase the donor's donation stats. |
909 | - $donor->increase_value( $total_change ); |
|
910 | - give_increase_total_earnings( $total_change ); |
|
909 | + $donor->increase_value($total_change); |
|
910 | + give_increase_total_earnings($total_change); |
|
911 | 911 | |
912 | 912 | } |
913 | 913 | } |
914 | 914 | |
915 | - $this->update_meta( '_give_payment_total', $this->total ); |
|
915 | + $this->update_meta('_give_payment_total', $this->total); |
|
916 | 916 | |
917 | 917 | $new_meta = array( |
918 | 918 | 'form_title' => $this->form_title, |
@@ -923,12 +923,12 @@ discard block |
||
923 | 923 | ); |
924 | 924 | |
925 | 925 | $meta = $this->get_meta(); |
926 | - $merged_meta = array_merge( $meta, $new_meta ); |
|
926 | + $merged_meta = array_merge($meta, $new_meta); |
|
927 | 927 | |
928 | 928 | // Only save the payment meta if it's changed. |
929 | - if ( md5( serialize( $meta ) ) !== md5( serialize( $merged_meta ) ) ) { |
|
930 | - $updated = $this->update_meta( '_give_payment_meta', $merged_meta ); |
|
931 | - if ( false !== $updated ) { |
|
929 | + if (md5(serialize($meta)) !== md5(serialize($merged_meta))) { |
|
930 | + $updated = $this->update_meta('_give_payment_meta', $merged_meta); |
|
931 | + if (false !== $updated) { |
|
932 | 932 | $saved = true; |
933 | 933 | } |
934 | 934 | } |
@@ -937,8 +937,8 @@ discard block |
||
937 | 937 | $saved = true; |
938 | 938 | }// End if(). |
939 | 939 | |
940 | - if ( true === $saved ) { |
|
941 | - $this->setup_payment( $this->ID ); |
|
940 | + if (true === $saved) { |
|
941 | + $this->setup_payment($this->ID); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | return $saved; |
@@ -956,12 +956,12 @@ discard block |
||
956 | 956 | * |
957 | 957 | * @return bool True when successful, false otherwise |
958 | 958 | */ |
959 | - public function add_donation( $form_id = 0, $args = array(), $options = array() ) { |
|
959 | + public function add_donation($form_id = 0, $args = array(), $options = array()) { |
|
960 | 960 | |
961 | - $donation = new Give_Donate_Form( $form_id ); |
|
961 | + $donation = new Give_Donate_Form($form_id); |
|
962 | 962 | |
963 | 963 | // Bail if this post isn't a give donation form. |
964 | - if ( ! $donation || $donation->post_type !== 'give_forms' ) { |
|
964 | + if ( ! $donation || $donation->post_type !== 'give_forms') { |
|
965 | 965 | return false; |
966 | 966 | } |
967 | 967 | |
@@ -971,59 +971,59 @@ discard block |
||
971 | 971 | 'price_id' => false, |
972 | 972 | ); |
973 | 973 | |
974 | - $args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults ); |
|
974 | + $args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults); |
|
975 | 975 | |
976 | 976 | // Allow overriding the price. |
977 | - if ( false !== $args['price'] ) { |
|
977 | + if (false !== $args['price']) { |
|
978 | 978 | $item_price = $args['price']; |
979 | 979 | } else { |
980 | 980 | |
981 | 981 | // Deal with variable pricing. |
982 | - if ( give_has_variable_prices( $donation->ID ) ) { |
|
983 | - $prices = maybe_unserialize( give_get_meta( $form_id, '_give_donation_levels', true ) ); |
|
982 | + if (give_has_variable_prices($donation->ID)) { |
|
983 | + $prices = maybe_unserialize(give_get_meta($form_id, '_give_donation_levels', true)); |
|
984 | 984 | $item_price = ''; |
985 | 985 | // Loop through prices. |
986 | - foreach ( $prices as $price ) { |
|
986 | + foreach ($prices as $price) { |
|
987 | 987 | // Find a match between price_id and level_id. |
988 | 988 | // First verify array keys exists THEN make the match. |
989 | - if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) ) |
|
989 | + if ((isset($args['price_id']) && isset($price['_give_id']['level_id'])) |
|
990 | 990 | && $args['price_id'] == $price['_give_id']['level_id'] |
991 | 991 | ) { |
992 | 992 | $item_price = $price['_give_amount']; |
993 | 993 | } |
994 | 994 | } |
995 | 995 | // Fallback to the lowest price point. |
996 | - if ( $item_price == '' ) { |
|
997 | - $item_price = give_get_lowest_price_option( $donation->ID ); |
|
998 | - $args['price_id'] = give_get_lowest_price_id( $donation->ID ); |
|
996 | + if ($item_price == '') { |
|
997 | + $item_price = give_get_lowest_price_option($donation->ID); |
|
998 | + $args['price_id'] = give_get_lowest_price_id($donation->ID); |
|
999 | 999 | } |
1000 | 1000 | } else { |
1001 | 1001 | // Simple form price. |
1002 | - $item_price = give_get_form_price( $donation->ID ); |
|
1002 | + $item_price = give_get_form_price($donation->ID); |
|
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | // Sanitizing the price here so we don't have a dozen calls later. |
1007 | - $item_price = give_sanitize_amount( $item_price ); |
|
1008 | - $total = round( $item_price, give_currency_decimal_filter() ); |
|
1007 | + $item_price = give_sanitize_amount($item_price); |
|
1008 | + $total = round($item_price, give_currency_decimal_filter()); |
|
1009 | 1009 | |
1010 | 1010 | // Add Options. |
1011 | 1011 | $default_options = array(); |
1012 | - if ( false !== $args['price_id'] ) { |
|
1012 | + if (false !== $args['price_id']) { |
|
1013 | 1013 | $default_options['price_id'] = (int) $args['price_id']; |
1014 | 1014 | } |
1015 | - $options = wp_parse_args( $options, $default_options ); |
|
1015 | + $options = wp_parse_args($options, $default_options); |
|
1016 | 1016 | |
1017 | 1017 | // Do not allow totals to go negative. |
1018 | - if ( $total < 0 ) { |
|
1018 | + if ($total < 0) { |
|
1019 | 1019 | $total = 0; |
1020 | 1020 | } |
1021 | 1021 | |
1022 | 1022 | $donation = array( |
1023 | 1023 | 'name' => $donation->post_title, |
1024 | 1024 | 'id' => $donation->ID, |
1025 | - 'price' => round( $total, give_currency_decimal_filter() ), |
|
1026 | - 'subtotal' => round( $total, give_currency_decimal_filter() ), |
|
1025 | + 'price' => round($total, give_currency_decimal_filter()), |
|
1026 | + 'subtotal' => round($total, give_currency_decimal_filter()), |
|
1027 | 1027 | 'price_id' => $args['price_id'], |
1028 | 1028 | 'action' => 'add', |
1029 | 1029 | 'options' => $options, |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | |
1032 | 1032 | $this->pending['donations'][] = $donation; |
1033 | 1033 | |
1034 | - $this->increase_subtotal( $total ); |
|
1034 | + $this->increase_subtotal($total); |
|
1035 | 1035 | |
1036 | 1036 | return true; |
1037 | 1037 | |
@@ -1048,7 +1048,7 @@ discard block |
||
1048 | 1048 | * |
1049 | 1049 | * @return bool If the item was removed or not |
1050 | 1050 | */ |
1051 | - public function remove_donation( $form_id, $args = array() ) { |
|
1051 | + public function remove_donation($form_id, $args = array()) { |
|
1052 | 1052 | |
1053 | 1053 | // Set some defaults. |
1054 | 1054 | $defaults = array( |
@@ -1056,12 +1056,12 @@ discard block |
||
1056 | 1056 | 'price' => false, |
1057 | 1057 | 'price_id' => false, |
1058 | 1058 | ); |
1059 | - $args = wp_parse_args( $args, $defaults ); |
|
1059 | + $args = wp_parse_args($args, $defaults); |
|
1060 | 1060 | |
1061 | - $form = new Give_Donate_Form( $form_id ); |
|
1061 | + $form = new Give_Donate_Form($form_id); |
|
1062 | 1062 | |
1063 | 1063 | // Bail if this post isn't a valid give donation form. |
1064 | - if ( ! $form || $form->post_type !== 'give_forms' ) { |
|
1064 | + if ( ! $form || $form->post_type !== 'give_forms') { |
|
1065 | 1065 | return false; |
1066 | 1066 | } |
1067 | 1067 | |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | |
1075 | 1075 | $this->pending['donations'][] = $pending_args; |
1076 | 1076 | |
1077 | - $this->decrease_subtotal( $this->total ); |
|
1077 | + $this->decrease_subtotal($this->total); |
|
1078 | 1078 | |
1079 | 1079 | return true; |
1080 | 1080 | } |
@@ -1090,13 +1090,13 @@ discard block |
||
1090 | 1090 | * |
1091 | 1091 | * @return void |
1092 | 1092 | */ |
1093 | - public function add_note( $note = false ) { |
|
1093 | + public function add_note($note = false) { |
|
1094 | 1094 | // Bail if no note specified. |
1095 | - if ( ! $note ) { |
|
1095 | + if ( ! $note) { |
|
1096 | 1096 | return false; |
1097 | 1097 | } |
1098 | 1098 | |
1099 | - give_insert_payment_note( $this->ID, $note ); |
|
1099 | + give_insert_payment_note($this->ID, $note); |
|
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | /** |
@@ -1109,8 +1109,8 @@ discard block |
||
1109 | 1109 | * |
1110 | 1110 | * @return void |
1111 | 1111 | */ |
1112 | - private function increase_subtotal( $amount = 0.00 ) { |
|
1113 | - $amount = (float) $amount; |
|
1112 | + private function increase_subtotal($amount = 0.00) { |
|
1113 | + $amount = (float) $amount; |
|
1114 | 1114 | $this->subtotal += $amount; |
1115 | 1115 | |
1116 | 1116 | $this->recalculate_total(); |
@@ -1126,11 +1126,11 @@ discard block |
||
1126 | 1126 | * |
1127 | 1127 | * @return void |
1128 | 1128 | */ |
1129 | - private function decrease_subtotal( $amount = 0.00 ) { |
|
1130 | - $amount = (float) $amount; |
|
1129 | + private function decrease_subtotal($amount = 0.00) { |
|
1130 | + $amount = (float) $amount; |
|
1131 | 1131 | $this->subtotal -= $amount; |
1132 | 1132 | |
1133 | - if ( $this->subtotal < 0 ) { |
|
1133 | + if ($this->subtotal < 0) { |
|
1134 | 1134 | $this->subtotal = 0; |
1135 | 1135 | } |
1136 | 1136 | |
@@ -1159,24 +1159,24 @@ discard block |
||
1159 | 1159 | * |
1160 | 1160 | * @return bool $updated Returns if the status was successfully updated. |
1161 | 1161 | */ |
1162 | - public function update_status( $status = false ) { |
|
1162 | + public function update_status($status = false) { |
|
1163 | 1163 | |
1164 | 1164 | // standardize the 'complete(d)' status. |
1165 | - if ( $status == 'completed' || $status == 'complete' ) { |
|
1165 | + if ($status == 'completed' || $status == 'complete') { |
|
1166 | 1166 | $status = 'publish'; |
1167 | 1167 | } |
1168 | 1168 | |
1169 | - $old_status = ! empty( $this->old_status ) ? $this->old_status : false; |
|
1169 | + $old_status = ! empty($this->old_status) ? $this->old_status : false; |
|
1170 | 1170 | |
1171 | - if ( $old_status === $status ) { |
|
1171 | + if ($old_status === $status) { |
|
1172 | 1172 | return false; // Don't permit status changes that aren't changes. |
1173 | 1173 | } |
1174 | 1174 | |
1175 | - $do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status ); |
|
1175 | + $do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status); |
|
1176 | 1176 | |
1177 | 1177 | $updated = false; |
1178 | 1178 | |
1179 | - if ( $do_change ) { |
|
1179 | + if ($do_change) { |
|
1180 | 1180 | |
1181 | 1181 | /** |
1182 | 1182 | * Fires before changing payment status. |
@@ -1187,21 +1187,21 @@ discard block |
||
1187 | 1187 | * @param string $status The new status. |
1188 | 1188 | * @param string $old_status The old status. |
1189 | 1189 | */ |
1190 | - do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status ); |
|
1190 | + do_action('give_before_payment_status_change', $this->ID, $status, $old_status); |
|
1191 | 1191 | |
1192 | 1192 | $update_fields = array( |
1193 | 1193 | 'ID' => $this->ID, |
1194 | 1194 | 'post_status' => $status, |
1195 | - 'edit_date' => current_time( 'mysql' ), |
|
1195 | + 'edit_date' => current_time('mysql'), |
|
1196 | 1196 | ); |
1197 | 1197 | |
1198 | - $updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) ); |
|
1198 | + $updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields)); |
|
1199 | 1199 | |
1200 | 1200 | $all_payment_statuses = give_get_payment_statuses(); |
1201 | - $this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status ); |
|
1201 | + $this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status); |
|
1202 | 1202 | |
1203 | 1203 | // Process any specific status functions. |
1204 | - switch ( $status ) { |
|
1204 | + switch ($status) { |
|
1205 | 1205 | case 'refunded': |
1206 | 1206 | $this->process_refund(); |
1207 | 1207 | break; |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | * @param string $status The new status. |
1229 | 1229 | * @param string $old_status The old status. |
1230 | 1230 | */ |
1231 | - do_action( 'give_update_payment_status', $this->ID, $status, $old_status ); |
|
1231 | + do_action('give_update_payment_status', $this->ID, $status, $old_status); |
|
1232 | 1232 | |
1233 | 1233 | }// End if(). |
1234 | 1234 | |
@@ -1263,33 +1263,33 @@ discard block |
||
1263 | 1263 | * |
1264 | 1264 | * @return mixed The value from the post meta |
1265 | 1265 | */ |
1266 | - public function get_meta( $meta_key = '_give_payment_meta', $single = true ) { |
|
1266 | + public function get_meta($meta_key = '_give_payment_meta', $single = true) { |
|
1267 | 1267 | |
1268 | - $meta = give_get_meta( $this->ID, $meta_key, $single ); |
|
1268 | + $meta = give_get_meta($this->ID, $meta_key, $single); |
|
1269 | 1269 | |
1270 | - if ( $meta_key === '_give_payment_meta' ) { |
|
1270 | + if ($meta_key === '_give_payment_meta') { |
|
1271 | 1271 | $meta = (array) $meta; |
1272 | 1272 | |
1273 | - if ( empty( $meta['key'] ) ) { |
|
1273 | + if (empty($meta['key'])) { |
|
1274 | 1274 | $meta['key'] = $this->setup_payment_key(); |
1275 | 1275 | } |
1276 | 1276 | |
1277 | - if ( empty( $meta['form_title'] ) ) { |
|
1277 | + if (empty($meta['form_title'])) { |
|
1278 | 1278 | $meta['form_title'] = $this->setup_form_title(); |
1279 | 1279 | } |
1280 | 1280 | |
1281 | - if ( empty( $meta['email'] ) ) { |
|
1281 | + if (empty($meta['email'])) { |
|
1282 | 1282 | $meta['email'] = $this->setup_email(); |
1283 | 1283 | } |
1284 | 1284 | |
1285 | - if ( empty( $meta['date'] ) ) { |
|
1286 | - $meta['date'] = get_post_field( 'post_date', $this->ID ); |
|
1285 | + if (empty($meta['date'])) { |
|
1286 | + $meta['date'] = get_post_field('post_date', $this->ID); |
|
1287 | 1287 | } |
1288 | 1288 | } |
1289 | 1289 | |
1290 | - $meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID ); |
|
1290 | + $meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID); |
|
1291 | 1291 | |
1292 | - return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key ); |
|
1292 | + return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key); |
|
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | /** |
@@ -1304,23 +1304,23 @@ discard block |
||
1304 | 1304 | * |
1305 | 1305 | * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure |
1306 | 1306 | */ |
1307 | - public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) { |
|
1308 | - if ( empty( $meta_key ) ) { |
|
1307 | + public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') { |
|
1308 | + if (empty($meta_key)) { |
|
1309 | 1309 | return false; |
1310 | 1310 | } |
1311 | 1311 | |
1312 | - if ( $meta_key == 'key' || $meta_key == 'date' ) { |
|
1312 | + if ($meta_key == 'key' || $meta_key == 'date') { |
|
1313 | 1313 | |
1314 | 1314 | $current_meta = $this->get_meta(); |
1315 | - $current_meta[ $meta_key ] = $meta_value; |
|
1315 | + $current_meta[$meta_key] = $meta_value; |
|
1316 | 1316 | |
1317 | 1317 | $meta_key = '_give_payment_meta'; |
1318 | 1318 | $meta_value = $current_meta; |
1319 | 1319 | |
1320 | - } elseif ( $meta_key == 'email' || $meta_key == '_give_payment_user_email' ) { |
|
1320 | + } elseif ($meta_key == 'email' || $meta_key == '_give_payment_user_email') { |
|
1321 | 1321 | |
1322 | - $meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID ); |
|
1323 | - give_update_meta( $this->ID, '_give_payment_user_email', $meta_value ); |
|
1322 | + $meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID); |
|
1323 | + give_update_meta($this->ID, '_give_payment_user_email', $meta_value); |
|
1324 | 1324 | |
1325 | 1325 | $current_meta = $this->get_meta(); |
1326 | 1326 | $current_meta['user_info']['email'] = $meta_value; |
@@ -1330,9 +1330,9 @@ discard block |
||
1330 | 1330 | |
1331 | 1331 | } |
1332 | 1332 | |
1333 | - $meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID ); |
|
1333 | + $meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID); |
|
1334 | 1334 | |
1335 | - return give_update_meta( $this->ID, $meta_key, $meta_value, $prev_value ); |
|
1335 | + return give_update_meta($this->ID, $meta_key, $meta_value, $prev_value); |
|
1336 | 1336 | } |
1337 | 1337 | |
1338 | 1338 | /** |
@@ -1347,14 +1347,14 @@ discard block |
||
1347 | 1347 | $process_refund = true; |
1348 | 1348 | |
1349 | 1349 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
1350 | - if ( 'publish' != $this->old_status || 'refunded' != $this->status ) { |
|
1350 | + if ('publish' != $this->old_status || 'refunded' != $this->status) { |
|
1351 | 1351 | $process_refund = false; |
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1355 | - $process_refund = apply_filters( 'give_should_process_refund', $process_refund, $this ); |
|
1355 | + $process_refund = apply_filters('give_should_process_refund', $process_refund, $this); |
|
1356 | 1356 | |
1357 | - if ( false === $process_refund ) { |
|
1357 | + if (false === $process_refund) { |
|
1358 | 1358 | return; |
1359 | 1359 | } |
1360 | 1360 | |
@@ -1365,13 +1365,13 @@ discard block |
||
1365 | 1365 | * |
1366 | 1366 | * @param Give_Payment $this Payment object. |
1367 | 1367 | */ |
1368 | - do_action( 'give_pre_refund_payment', $this ); |
|
1368 | + do_action('give_pre_refund_payment', $this); |
|
1369 | 1369 | |
1370 | - $decrease_earnings = apply_filters( 'give_decrease_store_earnings_on_refund', true, $this ); |
|
1371 | - $decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_refund', true, $this ); |
|
1372 | - $decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_refund', true, $this ); |
|
1370 | + $decrease_earnings = apply_filters('give_decrease_store_earnings_on_refund', true, $this); |
|
1371 | + $decrease_customer_value = apply_filters('give_decrease_customer_value_on_refund', true, $this); |
|
1372 | + $decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_refund', true, $this); |
|
1373 | 1373 | |
1374 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_customer_value, $decrease_purchase_count ); |
|
1374 | + $this->maybe_alter_stats($decrease_earnings, $decrease_customer_value, $decrease_purchase_count); |
|
1375 | 1375 | $this->delete_sales_logs(); |
1376 | 1376 | |
1377 | 1377 | // @todo: Refresh only range related stat cache |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | * |
1385 | 1385 | * @param Give_Payment $this Payment object. |
1386 | 1386 | */ |
1387 | - do_action( 'give_post_refund_payment', $this ); |
|
1387 | + do_action('give_post_refund_payment', $this); |
|
1388 | 1388 | } |
1389 | 1389 | |
1390 | 1390 | /** |
@@ -1411,26 +1411,26 @@ discard block |
||
1411 | 1411 | $process_pending = true; |
1412 | 1412 | |
1413 | 1413 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
1414 | - if ( 'publish' != $this->old_status || 'pending' != $this->status ) { |
|
1414 | + if ('publish' != $this->old_status || 'pending' != $this->status) { |
|
1415 | 1415 | $process_pending = false; |
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1419 | - $process_pending = apply_filters( 'give_should_process_pending', $process_pending, $this ); |
|
1419 | + $process_pending = apply_filters('give_should_process_pending', $process_pending, $this); |
|
1420 | 1420 | |
1421 | - if ( false === $process_pending ) { |
|
1421 | + if (false === $process_pending) { |
|
1422 | 1422 | return; |
1423 | 1423 | } |
1424 | 1424 | |
1425 | - $decrease_earnings = apply_filters( 'give_decrease_earnings_on_pending', true, $this ); |
|
1426 | - $decrease_donor_value = apply_filters( 'give_decrease_donor_value_on_pending', true, $this ); |
|
1427 | - $decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_pending', true, $this ); |
|
1425 | + $decrease_earnings = apply_filters('give_decrease_earnings_on_pending', true, $this); |
|
1426 | + $decrease_donor_value = apply_filters('give_decrease_donor_value_on_pending', true, $this); |
|
1427 | + $decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_pending', true, $this); |
|
1428 | 1428 | |
1429 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count ); |
|
1429 | + $this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count); |
|
1430 | 1430 | $this->delete_sales_logs(); |
1431 | 1431 | |
1432 | 1432 | $this->completed_date = false; |
1433 | - $this->update_meta( '_give_completed_date', '' ); |
|
1433 | + $this->update_meta('_give_completed_date', ''); |
|
1434 | 1434 | |
1435 | 1435 | // @todo: Refresh only range related stat cache |
1436 | 1436 | give_delete_donation_stats(); |
@@ -1448,26 +1448,26 @@ discard block |
||
1448 | 1448 | $process_cancelled = true; |
1449 | 1449 | |
1450 | 1450 | // If the payment was not in publish or revoked status, don't decrement stats as they were never incremented. |
1451 | - if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) { |
|
1451 | + if ('publish' != $this->old_status || 'cancelled' != $this->status) { |
|
1452 | 1452 | $process_cancelled = false; |
1453 | 1453 | } |
1454 | 1454 | |
1455 | 1455 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1456 | - $process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this ); |
|
1456 | + $process_cancelled = apply_filters('give_should_process_cancelled', $process_cancelled, $this); |
|
1457 | 1457 | |
1458 | - if ( false === $process_cancelled ) { |
|
1458 | + if (false === $process_cancelled) { |
|
1459 | 1459 | return; |
1460 | 1460 | } |
1461 | 1461 | |
1462 | - $decrease_earnings = apply_filters( 'give_decrease_earnings_on_cancelled', true, $this ); |
|
1463 | - $decrease_donor_value = apply_filters( 'give_decrease_donor_value_on_cancelled', true, $this ); |
|
1464 | - $decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_cancelled', true, $this ); |
|
1462 | + $decrease_earnings = apply_filters('give_decrease_earnings_on_cancelled', true, $this); |
|
1463 | + $decrease_donor_value = apply_filters('give_decrease_donor_value_on_cancelled', true, $this); |
|
1464 | + $decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_cancelled', true, $this); |
|
1465 | 1465 | |
1466 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count ); |
|
1466 | + $this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count); |
|
1467 | 1467 | $this->delete_sales_logs(); |
1468 | 1468 | |
1469 | 1469 | $this->completed_date = false; |
1470 | - $this->update_meta( '_give_completed_date', '' ); |
|
1470 | + $this->update_meta('_give_completed_date', ''); |
|
1471 | 1471 | |
1472 | 1472 | // @todo: Refresh only range related stat cache |
1473 | 1473 | give_delete_donation_stats(); |
@@ -1483,26 +1483,26 @@ discard block |
||
1483 | 1483 | $process_revoked = true; |
1484 | 1484 | |
1485 | 1485 | // If the payment was not in publish, don't decrement stats as they were never incremented. |
1486 | - if ( 'publish' != $this->old_status || 'revoked' != $this->status ) { |
|
1486 | + if ('publish' != $this->old_status || 'revoked' != $this->status) { |
|
1487 | 1487 | $process_revoked = false; |
1488 | 1488 | } |
1489 | 1489 | |
1490 | 1490 | // Allow extensions to filter for their own payment types, Example: Recurring Payments. |
1491 | - $process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this ); |
|
1491 | + $process_revoked = apply_filters('give_should_process_revoked', $process_revoked, $this); |
|
1492 | 1492 | |
1493 | - if ( false === $process_revoked ) { |
|
1493 | + if (false === $process_revoked) { |
|
1494 | 1494 | return; |
1495 | 1495 | } |
1496 | 1496 | |
1497 | - $decrease_earnings = apply_filters( 'give_decrease_earnings_on_revoked', true, $this ); |
|
1498 | - $decrease_donor_value = apply_filters( 'give_decrease_donor_value_on_revoked', true, $this ); |
|
1499 | - $decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_revoked', true, $this ); |
|
1497 | + $decrease_earnings = apply_filters('give_decrease_earnings_on_revoked', true, $this); |
|
1498 | + $decrease_donor_value = apply_filters('give_decrease_donor_value_on_revoked', true, $this); |
|
1499 | + $decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_revoked', true, $this); |
|
1500 | 1500 | |
1501 | - $this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count ); |
|
1501 | + $this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count); |
|
1502 | 1502 | $this->delete_sales_logs(); |
1503 | 1503 | |
1504 | 1504 | $this->completed_date = false; |
1505 | - $this->update_meta( '_give_completed_date', '' ); |
|
1505 | + $this->update_meta('_give_completed_date', ''); |
|
1506 | 1506 | |
1507 | 1507 | // @todo: Refresh only range related stat cache |
1508 | 1508 | give_delete_donation_stats(); |
@@ -1520,25 +1520,25 @@ discard block |
||
1520 | 1520 | * |
1521 | 1521 | * @return void |
1522 | 1522 | */ |
1523 | - private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) { |
|
1523 | + private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) { |
|
1524 | 1524 | |
1525 | - give_undo_donation( $this->ID ); |
|
1525 | + give_undo_donation($this->ID); |
|
1526 | 1526 | |
1527 | 1527 | // Decrease store earnings. |
1528 | - if ( true === $alter_store_earnings ) { |
|
1529 | - give_decrease_total_earnings( $this->total ); |
|
1528 | + if (true === $alter_store_earnings) { |
|
1529 | + give_decrease_total_earnings($this->total); |
|
1530 | 1530 | } |
1531 | 1531 | |
1532 | 1532 | // Decrement the stats for the donor. |
1533 | - if ( ! empty( $this->customer_id ) ) { |
|
1533 | + if ( ! empty($this->customer_id)) { |
|
1534 | 1534 | |
1535 | - $donor = new Give_Donor( $this->customer_id ); |
|
1535 | + $donor = new Give_Donor($this->customer_id); |
|
1536 | 1536 | |
1537 | - if ( true === $alter_customer_value ) { |
|
1538 | - $donor->decrease_value( $this->total ); |
|
1537 | + if (true === $alter_customer_value) { |
|
1538 | + $donor->decrease_value($this->total); |
|
1539 | 1539 | } |
1540 | 1540 | |
1541 | - if ( true === $alter_customer_purchase_count ) { |
|
1541 | + if (true === $alter_customer_purchase_count) { |
|
1542 | 1542 | $donor->decrease_donation_count(); |
1543 | 1543 | } |
1544 | 1544 | } |
@@ -1587,13 +1587,13 @@ discard block |
||
1587 | 1587 | * @return string The date the payment was completed |
1588 | 1588 | */ |
1589 | 1589 | private function setup_completed_date() { |
1590 | - $payment = get_post( $this->ID ); |
|
1590 | + $payment = get_post($this->ID); |
|
1591 | 1591 | |
1592 | - if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) { |
|
1592 | + if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) { |
|
1593 | 1593 | return false; // This payment was never completed. |
1594 | 1594 | } |
1595 | 1595 | |
1596 | - $date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date; |
|
1596 | + $date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date; |
|
1597 | 1597 | |
1598 | 1598 | return $date; |
1599 | 1599 | } |
@@ -1607,7 +1607,7 @@ discard block |
||
1607 | 1607 | * @return string The payment mode |
1608 | 1608 | */ |
1609 | 1609 | private function setup_mode() { |
1610 | - return $this->get_meta( '_give_payment_mode' ); |
|
1610 | + return $this->get_meta('_give_payment_mode'); |
|
1611 | 1611 | } |
1612 | 1612 | |
1613 | 1613 | /** |
@@ -1619,18 +1619,18 @@ discard block |
||
1619 | 1619 | * @return float The payment total |
1620 | 1620 | */ |
1621 | 1621 | private function setup_total() { |
1622 | - $amount = $this->get_meta( '_give_payment_total', true ); |
|
1622 | + $amount = $this->get_meta('_give_payment_total', true); |
|
1623 | 1623 | |
1624 | - if ( empty( $amount ) && '0.00' != $amount ) { |
|
1625 | - $meta = $this->get_meta( '_give_payment_meta', true ); |
|
1626 | - $meta = maybe_unserialize( $meta ); |
|
1624 | + if (empty($amount) && '0.00' != $amount) { |
|
1625 | + $meta = $this->get_meta('_give_payment_meta', true); |
|
1626 | + $meta = maybe_unserialize($meta); |
|
1627 | 1627 | |
1628 | - if ( isset( $meta['amount'] ) ) { |
|
1628 | + if (isset($meta['amount'])) { |
|
1629 | 1629 | $amount = $meta['amount']; |
1630 | 1630 | } |
1631 | 1631 | } |
1632 | 1632 | |
1633 | - return round( floatval( $amount ), give_currency_decimal_filter() ); |
|
1633 | + return round(floatval($amount), give_currency_decimal_filter()); |
|
1634 | 1634 | } |
1635 | 1635 | |
1636 | 1636 | /** |
@@ -1656,7 +1656,7 @@ discard block |
||
1656 | 1656 | * @return string The currency for the payment |
1657 | 1657 | */ |
1658 | 1658 | private function setup_currency() { |
1659 | - $currency = isset( $this->payment_meta['currency'] ) ? $this->payment_meta['currency'] : apply_filters( 'give_payment_currency_default', give_get_currency(), $this ); |
|
1659 | + $currency = isset($this->payment_meta['currency']) ? $this->payment_meta['currency'] : apply_filters('give_payment_currency_default', give_get_currency(), $this); |
|
1660 | 1660 | |
1661 | 1661 | return $currency; |
1662 | 1662 | } |
@@ -1670,7 +1670,7 @@ discard block |
||
1670 | 1670 | * @return string The gateway |
1671 | 1671 | */ |
1672 | 1672 | private function setup_gateway() { |
1673 | - $gateway = $this->get_meta( '_give_payment_gateway', true ); |
|
1673 | + $gateway = $this->get_meta('_give_payment_gateway', true); |
|
1674 | 1674 | |
1675 | 1675 | return $gateway; |
1676 | 1676 | } |
@@ -1684,11 +1684,11 @@ discard block |
||
1684 | 1684 | * @return string The donation ID |
1685 | 1685 | */ |
1686 | 1686 | private function setup_transaction_id() { |
1687 | - $transaction_id = $this->get_meta( '_give_payment_transaction_id', true ); |
|
1687 | + $transaction_id = $this->get_meta('_give_payment_transaction_id', true); |
|
1688 | 1688 | |
1689 | - if ( empty( $transaction_id ) ) { |
|
1689 | + if (empty($transaction_id)) { |
|
1690 | 1690 | $gateway = $this->gateway; |
1691 | - $transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID ); |
|
1691 | + $transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID); |
|
1692 | 1692 | } |
1693 | 1693 | |
1694 | 1694 | return $transaction_id; |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | * @return string The IP address for the payment |
1704 | 1704 | */ |
1705 | 1705 | private function setup_ip() { |
1706 | - $ip = $this->get_meta( '_give_payment_user_ip', true ); |
|
1706 | + $ip = $this->get_meta('_give_payment_user_ip', true); |
|
1707 | 1707 | |
1708 | 1708 | return $ip; |
1709 | 1709 | } |
@@ -1717,7 +1717,7 @@ discard block |
||
1717 | 1717 | * @return int The Donor ID. |
1718 | 1718 | */ |
1719 | 1719 | private function setup_donor_id() { |
1720 | - $customer_id = $this->get_meta( '_give_payment_customer_id', true ); |
|
1720 | + $customer_id = $this->get_meta('_give_payment_customer_id', true); |
|
1721 | 1721 | |
1722 | 1722 | return $customer_id; |
1723 | 1723 | } |
@@ -1731,7 +1731,7 @@ discard block |
||
1731 | 1731 | * @return int The User ID |
1732 | 1732 | */ |
1733 | 1733 | private function setup_user_id() { |
1734 | - $user_id = $this->get_meta( '_give_payment_user_id', true ); |
|
1734 | + $user_id = $this->get_meta('_give_payment_user_id', true); |
|
1735 | 1735 | |
1736 | 1736 | return $user_id; |
1737 | 1737 | } |
@@ -1745,10 +1745,10 @@ discard block |
||
1745 | 1745 | * @return string The email address for the payment. |
1746 | 1746 | */ |
1747 | 1747 | private function setup_email() { |
1748 | - $email = $this->get_meta( '_give_payment_user_email', true ); |
|
1748 | + $email = $this->get_meta('_give_payment_user_email', true); |
|
1749 | 1749 | |
1750 | - if ( empty( $email ) ) { |
|
1751 | - $email = Give()->donors->get_column( 'email', $this->customer_id ); |
|
1750 | + if (empty($email)) { |
|
1751 | + $email = Give()->donors->get_column('email', $this->customer_id); |
|
1752 | 1752 | } |
1753 | 1753 | |
1754 | 1754 | return $email; |
@@ -1768,15 +1768,15 @@ discard block |
||
1768 | 1768 | 'last_name' => $this->last_name, |
1769 | 1769 | ); |
1770 | 1770 | |
1771 | - $user_info = isset( $this->payment_meta['user_info'] ) ? maybe_unserialize( $this->payment_meta['user_info'] ) : array(); |
|
1772 | - $user_info = wp_parse_args( $user_info, $defaults ); |
|
1771 | + $user_info = isset($this->payment_meta['user_info']) ? maybe_unserialize($this->payment_meta['user_info']) : array(); |
|
1772 | + $user_info = wp_parse_args($user_info, $defaults); |
|
1773 | 1773 | |
1774 | - if ( empty( $user_info ) ) { |
|
1774 | + if (empty($user_info)) { |
|
1775 | 1775 | // Get the donor, but only if it's been created. |
1776 | - $donor = new Give_Donor( $this->customer_id ); |
|
1776 | + $donor = new Give_Donor($this->customer_id); |
|
1777 | 1777 | |
1778 | - if ( $donor->id > 0 ) { |
|
1779 | - $name = explode( ' ', $donor->name, 2 ); |
|
1778 | + if ($donor->id > 0) { |
|
1779 | + $name = explode(' ', $donor->name, 2); |
|
1780 | 1780 | $user_info = array( |
1781 | 1781 | 'first_name' => $name[0], |
1782 | 1782 | 'last_name' => $name[1], |
@@ -1786,29 +1786,29 @@ discard block |
||
1786 | 1786 | } |
1787 | 1787 | } else { |
1788 | 1788 | // Get the donor, but only if it's been created. |
1789 | - $donor = new Give_Donor( $this->customer_id ); |
|
1790 | - if ( $donor->id > 0 ) { |
|
1791 | - foreach ( $user_info as $key => $value ) { |
|
1792 | - if ( ! empty( $value ) ) { |
|
1789 | + $donor = new Give_Donor($this->customer_id); |
|
1790 | + if ($donor->id > 0) { |
|
1791 | + foreach ($user_info as $key => $value) { |
|
1792 | + if ( ! empty($value)) { |
|
1793 | 1793 | continue; |
1794 | 1794 | } |
1795 | 1795 | |
1796 | - switch ( $key ) { |
|
1796 | + switch ($key) { |
|
1797 | 1797 | case 'first_name': |
1798 | - $name = explode( ' ', $donor->name, 2 ); |
|
1798 | + $name = explode(' ', $donor->name, 2); |
|
1799 | 1799 | |
1800 | - $user_info[ $key ] = $name[0]; |
|
1800 | + $user_info[$key] = $name[0]; |
|
1801 | 1801 | break; |
1802 | 1802 | |
1803 | 1803 | case 'last_name': |
1804 | - $name = explode( ' ', $donor->name, 2 ); |
|
1805 | - $last_name = ! empty( $name[1] ) ? $name[1] : ''; |
|
1804 | + $name = explode(' ', $donor->name, 2); |
|
1805 | + $last_name = ! empty($name[1]) ? $name[1] : ''; |
|
1806 | 1806 | |
1807 | - $user_info[ $key ] = $last_name; |
|
1807 | + $user_info[$key] = $last_name; |
|
1808 | 1808 | break; |
1809 | 1809 | |
1810 | 1810 | case 'email': |
1811 | - $user_info[ $key ] = $donor->email; |
|
1811 | + $user_info[$key] = $donor->email; |
|
1812 | 1812 | break; |
1813 | 1813 | } |
1814 | 1814 | } |
@@ -1829,7 +1829,7 @@ discard block |
||
1829 | 1829 | */ |
1830 | 1830 | private function setup_address() { |
1831 | 1831 | |
1832 | - $address = ! empty( $this->payment_meta['user_info']['address'] ) ? $this->payment_meta['user_info']['address'] : array( |
|
1832 | + $address = ! empty($this->payment_meta['user_info']['address']) ? $this->payment_meta['user_info']['address'] : array( |
|
1833 | 1833 | 'line1' => '', |
1834 | 1834 | 'line2' => '', |
1835 | 1835 | 'city' => '', |
@@ -1851,7 +1851,7 @@ discard block |
||
1851 | 1851 | */ |
1852 | 1852 | private function setup_form_title() { |
1853 | 1853 | |
1854 | - $form_id = $this->get_meta( '_give_payment_form_title', true ); |
|
1854 | + $form_id = $this->get_meta('_give_payment_form_title', true); |
|
1855 | 1855 | |
1856 | 1856 | return $form_id; |
1857 | 1857 | } |
@@ -1866,7 +1866,7 @@ discard block |
||
1866 | 1866 | */ |
1867 | 1867 | private function setup_form_id() { |
1868 | 1868 | |
1869 | - $form_id = $this->get_meta( '_give_payment_form_id', true ); |
|
1869 | + $form_id = $this->get_meta('_give_payment_form_id', true); |
|
1870 | 1870 | |
1871 | 1871 | return $form_id; |
1872 | 1872 | } |
@@ -1880,7 +1880,7 @@ discard block |
||
1880 | 1880 | * @return int The Form Price ID. |
1881 | 1881 | */ |
1882 | 1882 | private function setup_price_id() { |
1883 | - $price_id = $this->get_meta( '_give_payment_price_id', true ); |
|
1883 | + $price_id = $this->get_meta('_give_payment_price_id', true); |
|
1884 | 1884 | |
1885 | 1885 | return $price_id; |
1886 | 1886 | } |
@@ -1894,7 +1894,7 @@ discard block |
||
1894 | 1894 | * @return string The Payment Key. |
1895 | 1895 | */ |
1896 | 1896 | private function setup_payment_key() { |
1897 | - $key = $this->get_meta( '_give_payment_purchase_key', true ); |
|
1897 | + $key = $this->get_meta('_give_payment_purchase_key', true); |
|
1898 | 1898 | |
1899 | 1899 | return $key; |
1900 | 1900 | } |
@@ -1910,11 +1910,11 @@ discard block |
||
1910 | 1910 | private function setup_payment_number() { |
1911 | 1911 | $number = $this->ID; |
1912 | 1912 | |
1913 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
1913 | + if (give_get_option('enable_sequential')) { |
|
1914 | 1914 | |
1915 | - $number = $this->get_meta( '_give_payment_number', true ); |
|
1915 | + $number = $this->get_meta('_give_payment_number', true); |
|
1916 | 1916 | |
1917 | - if ( ! $number ) { |
|
1917 | + if ( ! $number) { |
|
1918 | 1918 | |
1919 | 1919 | $number = $this->ID; |
1920 | 1920 | |
@@ -1932,7 +1932,7 @@ discard block |
||
1932 | 1932 | * @return array The payment object as an array. |
1933 | 1933 | */ |
1934 | 1934 | public function array_convert() { |
1935 | - return get_object_vars( $this ); |
|
1935 | + return get_object_vars($this); |
|
1936 | 1936 | } |
1937 | 1937 | |
1938 | 1938 | |
@@ -1945,7 +1945,7 @@ discard block |
||
1945 | 1945 | * @return bool |
1946 | 1946 | */ |
1947 | 1947 | public function is_completed() { |
1948 | - return ( 'publish' === $this->status && $this->completed_date ); |
|
1948 | + return ('publish' === $this->status && $this->completed_date); |
|
1949 | 1949 | } |
1950 | 1950 | |
1951 | 1951 | /** |
@@ -1957,7 +1957,7 @@ discard block |
||
1957 | 1957 | * @return string Date payment was completed. |
1958 | 1958 | */ |
1959 | 1959 | private function get_completed_date() { |
1960 | - return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this ); |
|
1960 | + return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this); |
|
1961 | 1961 | } |
1962 | 1962 | |
1963 | 1963 | /** |
@@ -1969,7 +1969,7 @@ discard block |
||
1969 | 1969 | * @return float Payment subtotal. |
1970 | 1970 | */ |
1971 | 1971 | private function get_subtotal() { |
1972 | - return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this ); |
|
1972 | + return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this); |
|
1973 | 1973 | } |
1974 | 1974 | |
1975 | 1975 | /** |
@@ -1981,7 +1981,7 @@ discard block |
||
1981 | 1981 | * @return string Payment currency code. |
1982 | 1982 | */ |
1983 | 1983 | private function get_currency() { |
1984 | - return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this ); |
|
1984 | + return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this); |
|
1985 | 1985 | } |
1986 | 1986 | |
1987 | 1987 | /** |
@@ -1993,7 +1993,7 @@ discard block |
||
1993 | 1993 | * @return string Gateway used. |
1994 | 1994 | */ |
1995 | 1995 | private function get_gateway() { |
1996 | - return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this ); |
|
1996 | + return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this); |
|
1997 | 1997 | } |
1998 | 1998 | |
1999 | 1999 | /** |
@@ -2005,7 +2005,7 @@ discard block |
||
2005 | 2005 | * @return string Donation ID from merchant processor. |
2006 | 2006 | */ |
2007 | 2007 | private function get_transaction_id() { |
2008 | - return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this ); |
|
2008 | + return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this); |
|
2009 | 2009 | } |
2010 | 2010 | |
2011 | 2011 | /** |
@@ -2017,7 +2017,7 @@ discard block |
||
2017 | 2017 | * @return string Payment IP address |
2018 | 2018 | */ |
2019 | 2019 | private function get_ip() { |
2020 | - return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this ); |
|
2020 | + return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this); |
|
2021 | 2021 | } |
2022 | 2022 | |
2023 | 2023 | /** |
@@ -2029,7 +2029,7 @@ discard block |
||
2029 | 2029 | * @return int Payment donor ID. |
2030 | 2030 | */ |
2031 | 2031 | private function get_donor_id() { |
2032 | - return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this ); |
|
2032 | + return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this); |
|
2033 | 2033 | } |
2034 | 2034 | |
2035 | 2035 | /** |
@@ -2041,7 +2041,7 @@ discard block |
||
2041 | 2041 | * @return int Payment user ID. |
2042 | 2042 | */ |
2043 | 2043 | private function get_user_id() { |
2044 | - return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this ); |
|
2044 | + return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this); |
|
2045 | 2045 | } |
2046 | 2046 | |
2047 | 2047 | /** |
@@ -2053,7 +2053,7 @@ discard block |
||
2053 | 2053 | * @return string Payment donor email. |
2054 | 2054 | */ |
2055 | 2055 | private function get_email() { |
2056 | - return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this ); |
|
2056 | + return apply_filters('give_payment_user_email', $this->email, $this->ID, $this); |
|
2057 | 2057 | } |
2058 | 2058 | |
2059 | 2059 | /** |
@@ -2065,7 +2065,7 @@ discard block |
||
2065 | 2065 | * @return array Payment user info. |
2066 | 2066 | */ |
2067 | 2067 | private function get_user_info() { |
2068 | - return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this ); |
|
2068 | + return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this); |
|
2069 | 2069 | } |
2070 | 2070 | |
2071 | 2071 | /** |
@@ -2077,7 +2077,7 @@ discard block |
||
2077 | 2077 | * @return array Payment billing address. |
2078 | 2078 | */ |
2079 | 2079 | private function get_address() { |
2080 | - return apply_filters( 'give_payment_address', $this->address, $this->ID, $this ); |
|
2080 | + return apply_filters('give_payment_address', $this->address, $this->ID, $this); |
|
2081 | 2081 | } |
2082 | 2082 | |
2083 | 2083 | /** |
@@ -2089,7 +2089,7 @@ discard block |
||
2089 | 2089 | * @return string Payment key. |
2090 | 2090 | */ |
2091 | 2091 | private function get_key() { |
2092 | - return apply_filters( 'give_payment_key', $this->key, $this->ID, $this ); |
|
2092 | + return apply_filters('give_payment_key', $this->key, $this->ID, $this); |
|
2093 | 2093 | } |
2094 | 2094 | |
2095 | 2095 | /** |
@@ -2101,7 +2101,7 @@ discard block |
||
2101 | 2101 | * @return string Payment form id |
2102 | 2102 | */ |
2103 | 2103 | private function get_form_id() { |
2104 | - return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this ); |
|
2104 | + return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this); |
|
2105 | 2105 | } |
2106 | 2106 | |
2107 | 2107 | /** |
@@ -2113,7 +2113,7 @@ discard block |
||
2113 | 2113 | * @return int|string Payment number |
2114 | 2114 | */ |
2115 | 2115 | private function get_number() { |
2116 | - return apply_filters( 'give_payment_number', $this->number, $this->ID, $this ); |
|
2116 | + return apply_filters('give_payment_number', $this->number, $this->ID, $this); |
|
2117 | 2117 | } |
2118 | 2118 | |
2119 | 2119 | } |
@@ -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 | |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @see Give_Cron::weekly_events() |
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | - add_filter( 'cron_schedules', array( $this, 'add_schedules' ) ); |
|
38 | - add_action( 'wp', array( $this, 'schedule_Events' ) ); |
|
37 | + add_filter('cron_schedules', array($this, 'add_schedules')); |
|
38 | + add_action('wp', array($this, 'schedule_Events')); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return array An array of non-default cron schedules. |
50 | 50 | */ |
51 | - public function add_schedules( $schedules = array() ) { |
|
51 | + public function add_schedules($schedules = array()) { |
|
52 | 52 | // Adds once weekly to the existing schedules. |
53 | 53 | $schedules['weekly'] = array( |
54 | 54 | 'interval' => 604800, |
55 | - 'display' => esc_html__( 'Once Weekly', 'give' ) |
|
55 | + 'display' => esc_html__('Once Weekly', 'give') |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | return $schedules; |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | private function weekly_events() { |
83 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
84 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
83 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
84 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @return void |
95 | 95 | */ |
96 | 96 | private function daily_events() { |
97 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
98 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
97 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
98 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | 'default' => get_bloginfo( 'admin_email' ), |
80 | 80 | 'type' => 'text' |
81 | 81 | ), |
82 | - array( |
|
83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
84 | - 'id' => 'email_settings_docs_link', |
|
85 | - 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | - 'title' => __( 'Email Settings', 'give' ), |
|
87 | - 'type' => 'give_docs_link', |
|
88 | - ), |
|
82 | + array( |
|
83 | + 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
84 | + 'id' => 'email_settings_docs_link', |
|
85 | + 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | + 'title' => __( 'Email Settings', 'give' ), |
|
87 | + 'type' => 'give_docs_link', |
|
88 | + ), |
|
89 | 89 | array( |
90 | 90 | 'id' => 'give_title_email_settings_1', |
91 | 91 | 'type' => 'sectionend' |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | 'type' => 'wysiwyg', |
119 | 119 | 'default' => give_get_default_donation_receipt_email() |
120 | 120 | ), |
121 | - array( |
|
122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
123 | - 'id' => 'donation_receipt_settings_docs_link', |
|
124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
126 | - 'type' => 'give_docs_link', |
|
127 | - ), |
|
121 | + array( |
|
122 | + 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
123 | + 'id' => 'donation_receipt_settings_docs_link', |
|
124 | + 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | + 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
126 | + 'type' => 'give_docs_link', |
|
127 | + ), |
|
128 | 128 | array( |
129 | 129 | 'id' => 'give_title_email_settings_2', |
130 | 130 | 'type' => 'sectionend' |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | 'type' => 'textarea', |
176 | 176 | 'default' => get_bloginfo( 'admin_email' ) |
177 | 177 | ), |
178 | - array( |
|
179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
180 | - 'id' => 'donation_notification_settings_docs_link', |
|
181 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
183 | - 'type' => 'give_docs_link', |
|
184 | - ), |
|
178 | + array( |
|
179 | + 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
180 | + 'id' => 'donation_notification_settings_docs_link', |
|
181 | + 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | + 'title' => __( 'Donation Notification Settings', 'give' ), |
|
183 | + 'type' => 'give_docs_link', |
|
184 | + ), |
|
185 | 185 | array( |
186 | 186 | 'id' => 'give_title_email_settings_3', |
187 | 187 | 'type' => 'sectionend' |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Email' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Email')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Email. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'emails'; |
30 | - $this->label = esc_html__( 'Emails', 'give' ); |
|
30 | + $this->label = esc_html__('Emails', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'email-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'email-settings' : |
49 | 49 | $settings = array( |
50 | 50 | // Section 1: Email |
@@ -54,36 +54,36 @@ discard block |
||
54 | 54 | ), |
55 | 55 | array( |
56 | 56 | 'id' => 'email_template', |
57 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
58 | - 'desc' => esc_html__( 'Choose your template from the available registered template types.', 'give' ), |
|
57 | + 'name' => esc_html__('Email Template', 'give'), |
|
58 | + 'desc' => esc_html__('Choose your template from the available registered template types.', 'give'), |
|
59 | 59 | 'type' => 'select', |
60 | 60 | 'options' => give_get_email_templates() |
61 | 61 | ), |
62 | 62 | array( |
63 | 63 | 'id' => 'email_logo', |
64 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
65 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
64 | + 'name' => esc_html__('Logo', 'give'), |
|
65 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
66 | 66 | 'type' => 'file' |
67 | 67 | ), |
68 | 68 | array( |
69 | 69 | 'id' => 'from_name', |
70 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
71 | - 'desc' => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ), |
|
72 | - 'default' => get_bloginfo( 'name' ), |
|
70 | + 'name' => esc_html__('From Name', 'give'), |
|
71 | + 'desc' => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'), |
|
72 | + 'default' => get_bloginfo('name'), |
|
73 | 73 | 'type' => 'text' |
74 | 74 | ), |
75 | 75 | array( |
76 | 76 | 'id' => 'from_email', |
77 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
78 | - 'desc' => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ), |
|
79 | - 'default' => get_bloginfo( 'admin_email' ), |
|
77 | + 'name' => esc_html__('From Email', 'give'), |
|
78 | + 'desc' => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'), |
|
79 | + 'default' => get_bloginfo('admin_email'), |
|
80 | 80 | 'type' => 'text' |
81 | 81 | ), |
82 | 82 | array( |
83 | - 'name' => esc_html__( 'Email Settings Docs Link', 'give' ), |
|
83 | + 'name' => esc_html__('Email Settings Docs Link', 'give'), |
|
84 | 84 | 'id' => 'email_settings_docs_link', |
85 | - 'url' => esc_url( 'http://docs.givewp.com/settings-emails' ), |
|
86 | - 'title' => __( 'Email Settings', 'give' ), |
|
85 | + 'url' => esc_url('http://docs.givewp.com/settings-emails'), |
|
86 | + 'title' => __('Email Settings', 'give'), |
|
87 | 87 | 'type' => 'give_docs_link', |
88 | 88 | ), |
89 | 89 | array( |
@@ -102,27 +102,27 @@ discard block |
||
102 | 102 | ), |
103 | 103 | array( |
104 | 104 | 'id' => 'donation_subject', |
105 | - 'name' => esc_html__( 'Donation Email Subject', 'give' ), |
|
106 | - 'desc' => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
107 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
105 | + 'name' => esc_html__('Donation Email Subject', 'give'), |
|
106 | + 'desc' => esc_html__('Enter the subject line for the donation receipt email.', 'give'), |
|
107 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
108 | 108 | 'type' => 'text' |
109 | 109 | ), |
110 | 110 | array( |
111 | 111 | 'id' => 'donation_receipt', |
112 | - 'name' => esc_html__( 'Donation Receipt', 'give' ), |
|
112 | + 'name' => esc_html__('Donation Receipt', 'give'), |
|
113 | 113 | 'desc' => sprintf( |
114 | 114 | /* translators: %s: emails tags list */ |
115 | - __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted.<br /><strong>Available template tags:</strong> %s', 'give' ), |
|
115 | + __('Enter the email that is sent to users after completing a successful donation. HTML is accepted.<br /><strong>Available template tags:</strong> %s', 'give'), |
|
116 | 116 | '<br/>'.give_get_emails_tags_list() |
117 | 117 | ), |
118 | 118 | 'type' => 'wysiwyg', |
119 | 119 | 'default' => give_get_default_donation_receipt_email() |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => esc_html__( 'Donation Receipt Settings Docs Link', 'give' ), |
|
122 | + 'name' => esc_html__('Donation Receipt Settings Docs Link', 'give'), |
|
123 | 123 | 'id' => 'donation_receipt_settings_docs_link', |
124 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-receipt' ), |
|
125 | - 'title' => __( 'Donation Receipt Settings', 'give' ), |
|
124 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-receipt'), |
|
125 | + 'title' => __('Donation Receipt Settings', 'give'), |
|
126 | 126 | 'type' => 'give_docs_link', |
127 | 127 | ), |
128 | 128 | array( |
@@ -141,28 +141,28 @@ discard block |
||
141 | 141 | ), |
142 | 142 | array( |
143 | 143 | 'id' => 'admin_notices', |
144 | - 'name' => esc_html__( 'Admin Notifications', 'give' ), |
|
145 | - 'desc' => esc_html__( 'Enable/Disable all admin notifications from Give completely.', 'give' ), |
|
144 | + 'name' => esc_html__('Admin Notifications', 'give'), |
|
145 | + 'desc' => esc_html__('Enable/Disable all admin notifications from Give completely.', 'give'), |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'enabled', |
148 | 148 | 'options' => array( |
149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
149 | + 'enabled' => __('Enabled', 'give'), |
|
150 | + 'disabled' => __('Disabled', 'give'), |
|
151 | 151 | ) |
152 | 152 | ), |
153 | 153 | array( |
154 | 154 | 'id' => 'donation_notification_subject', |
155 | - 'name' => esc_html__( 'Donation Notification Subject', 'give' ), |
|
156 | - 'desc' => esc_html__( 'Enter the subject line for the admin donation notification email.', 'give' ), |
|
155 | + 'name' => esc_html__('Donation Notification Subject', 'give'), |
|
156 | + 'desc' => esc_html__('Enter the subject line for the admin donation notification email.', 'give'), |
|
157 | 157 | 'type' => 'text', |
158 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ) |
|
158 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give') |
|
159 | 159 | ), |
160 | 160 | array( |
161 | 161 | 'id' => 'donation_notification', |
162 | - 'name' => esc_html__( 'Donation Notification', 'give' ), |
|
162 | + 'name' => esc_html__('Donation Notification', 'give'), |
|
163 | 163 | 'desc' => sprintf( |
164 | 164 | /* translators: %s: emails tags list */ |
165 | - __( 'Enter the content of the email that is sent to notify an admin of a new donation. HTML is accepted. <br /><strong>Available template tags:</strong> %s', 'give' ), |
|
165 | + __('Enter the content of the email that is sent to notify an admin of a new donation. HTML is accepted. <br /><strong>Available template tags:</strong> %s', 'give'), |
|
166 | 166 | '<br/>'.give_get_emails_tags_list() |
167 | 167 | ), |
168 | 168 | 'type' => 'wysiwyg', |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | ), |
171 | 171 | array( |
172 | 172 | 'id' => 'admin_notice_emails', |
173 | - 'name' => esc_html__( 'Donation Notification Emails', 'give' ), |
|
174 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
173 | + 'name' => esc_html__('Donation Notification Emails', 'give'), |
|
174 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
175 | 175 | 'type' => 'textarea', |
176 | - 'default' => get_bloginfo( 'admin_email' ) |
|
176 | + 'default' => get_bloginfo('admin_email') |
|
177 | 177 | ), |
178 | 178 | array( |
179 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
179 | + 'name' => esc_html__('Donation Notification Settings Docs Link', 'give'), |
|
180 | 180 | 'id' => 'donation_notification_settings_docs_link', |
181 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
182 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
181 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-notification'), |
|
182 | + 'title' => __('Donation Notification Settings', 'give'), |
|
183 | 183 | 'type' => 'give_docs_link', |
184 | 184 | ), |
185 | 185 | array( |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * Filter the emails settings. |
195 | 195 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
196 | 196 | */ |
197 | - $settings = apply_filters( 'give_settings_emails', $settings ); |
|
197 | + $settings = apply_filters('give_settings_emails', $settings); |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Filter the settings. |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @since 1.8 |
203 | 203 | * @param array $settings |
204 | 204 | */ |
205 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
205 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
206 | 206 | |
207 | 207 | // Output. |
208 | 208 | return $settings; |
@@ -216,12 +216,12 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function get_sections() { |
218 | 218 | $sections = array( |
219 | - 'email-settings' => esc_html__( 'Email Settings', 'give' ), |
|
220 | - 'donation-receipt' => esc_html__( 'Donation Receipt', 'give' ), |
|
221 | - 'new-donation-notification' => esc_html__( 'New Donation Notification', 'give' ) |
|
219 | + 'email-settings' => esc_html__('Email Settings', 'give'), |
|
220 | + 'donation-receipt' => esc_html__('Donation Receipt', 'give'), |
|
221 | + 'new-donation-notification' => esc_html__('New Donation Notification', 'give') |
|
222 | 222 | ); |
223 | 223 | |
224 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
224 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 |
@@ -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 | |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' ); |
|
24 | + $this->shortcode['label'] = esc_html__('Profile Editor', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'give_profile_editor' ); |
|
26 | + parent::__construct('give_profile_editor'); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | |
27 | - $this->shortcode['title'] = esc_html__( 'Donation Receipt', 'give' ); |
|
28 | - $this->shortcode['label'] = esc_html__( 'Donation Receipt', 'give' ); |
|
27 | + $this->shortcode['title'] = esc_html__('Donation Receipt', 'give'); |
|
28 | + $this->shortcode['label'] = esc_html__('Donation Receipt', 'give'); |
|
29 | 29 | |
30 | - parent::__construct( 'give_receipt' ); |
|
30 | + parent::__construct('give_receipt'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -40,60 +40,60 @@ discard block |
||
40 | 40 | return array( |
41 | 41 | array( |
42 | 42 | 'type' => 'container', |
43 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
43 | + 'html' => sprintf('<p class="strong">%s</p>', esc_html__('Optional settings', 'give')), |
|
44 | 44 | ), |
45 | 45 | array( |
46 | 46 | 'type' => 'listbox', |
47 | 47 | 'name' => 'price', |
48 | - 'label' => esc_html__( 'Show Donation Amount:', 'give' ), |
|
48 | + 'label' => esc_html__('Show Donation Amount:', 'give'), |
|
49 | 49 | 'options' => array( |
50 | - 'true' => esc_html__( 'Show', 'give' ), |
|
51 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
50 | + 'true' => esc_html__('Show', 'give'), |
|
51 | + 'false' => esc_html__('Hide', 'give'), |
|
52 | 52 | ), |
53 | 53 | ), |
54 | 54 | array( |
55 | 55 | 'type' => 'listbox', |
56 | 56 | 'name' => 'donor', |
57 | - 'label' => esc_html__( 'Show Donor Name:', 'give' ), |
|
57 | + 'label' => esc_html__('Show Donor Name:', 'give'), |
|
58 | 58 | 'options' => array( |
59 | - 'true' => esc_html__( 'Show', 'give' ), |
|
60 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
59 | + 'true' => esc_html__('Show', 'give'), |
|
60 | + 'false' => esc_html__('Hide', 'give'), |
|
61 | 61 | ), |
62 | 62 | ), |
63 | 63 | array( |
64 | 64 | 'type' => 'listbox', |
65 | 65 | 'name' => 'date', |
66 | - 'label' => esc_html__( 'Show Date:', 'give' ), |
|
66 | + 'label' => esc_html__('Show Date:', 'give'), |
|
67 | 67 | 'options' => array( |
68 | - 'true' => esc_html__( 'Show', 'give' ), |
|
69 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
68 | + 'true' => esc_html__('Show', 'give'), |
|
69 | + 'false' => esc_html__('Hide', 'give'), |
|
70 | 70 | ), |
71 | 71 | ), |
72 | 72 | array( |
73 | 73 | 'type' => 'listbox', |
74 | 74 | 'name' => 'payment_key', |
75 | - 'label' => esc_html__( 'Show Payment Key:', 'give' ), |
|
75 | + 'label' => esc_html__('Show Payment Key:', 'give'), |
|
76 | 76 | 'options' => array( |
77 | - 'true' => esc_html__( 'Show', 'give' ), |
|
78 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
77 | + 'true' => esc_html__('Show', 'give'), |
|
78 | + 'false' => esc_html__('Hide', 'give'), |
|
79 | 79 | ), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'type' => 'listbox', |
83 | 83 | 'name' => 'payment_method', |
84 | - 'label' => esc_html__( 'Show Payment Method:', 'give' ), |
|
84 | + 'label' => esc_html__('Show Payment Method:', 'give'), |
|
85 | 85 | 'options' => array( |
86 | - 'true' => esc_html__( 'Show', 'give' ), |
|
87 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
86 | + 'true' => esc_html__('Show', 'give'), |
|
87 | + 'false' => esc_html__('Hide', 'give'), |
|
88 | 88 | ), |
89 | 89 | ), |
90 | 90 | array( |
91 | 91 | 'type' => 'listbox', |
92 | 92 | 'name' => 'payment_id', |
93 | - 'label' => esc_html__( 'Show Payment ID:', 'give' ), |
|
93 | + 'label' => esc_html__('Show Payment ID:', 'give'), |
|
94 | 94 | 'options' => array( |
95 | - 'true' => esc_html__( 'Show', 'give' ), |
|
96 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
95 | + 'true' => esc_html__('Show', 'give'), |
|
96 | + 'false' => esc_html__('Hide', 'give'), |
|
97 | 97 | ), |
98 | 98 | ), |
99 | 99 | ); |
@@ -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 | |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = esc_html__( 'Register', 'give' ); |
|
25 | - $this->shortcode['label'] = esc_html__( 'Register', 'give' ); |
|
24 | + $this->shortcode['title'] = esc_html__('Register', 'give'); |
|
25 | + $this->shortcode['label'] = esc_html__('Register', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_register' ); |
|
27 | + parent::__construct('give_register'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | return array( |
38 | 38 | array( |
39 | 39 | 'type' => 'container', |
40 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
|
40 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')), |
|
41 | 41 | ), |
42 | 42 | array( |
43 | 43 | 'type' => 'textbox', |
44 | 44 | 'name' => 'redirect', |
45 | 45 | 'minWidth' => 320, |
46 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
46 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after registering.', 'give'), |
|
47 | 47 | ), |
48 | 48 | ); |
49 | 49 | } |
@@ -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 | |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['label'] = esc_html__( 'Donation History', 'give' ); |
|
24 | + $this->shortcode['label'] = esc_html__('Donation History', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'donation_history' ); |
|
26 | + parent::__construct('donation_history'); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |