@@ -664,6 +664,9 @@ discard block |
||
| 664 | 664 | return $sent; |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | +/** |
|
| 668 | + * @return string |
|
| 669 | + */ |
|
| 667 | 670 | function wpinv_mail_get_from_address() { |
| 668 | 671 | $from_address = apply_filters( 'wpinv_mail_from_address', wpinv_get_option( 'email_from' ) ); |
| 669 | 672 | return sanitize_email( $from_address ); |
@@ -1123,6 +1126,9 @@ discard block |
||
| 1123 | 1126 | } |
| 1124 | 1127 | add_filter( 'wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1 ); |
| 1125 | 1128 | |
| 1129 | +/** |
|
| 1130 | + * @param string $email_type |
|
| 1131 | + */ |
|
| 1126 | 1132 | function wpinv_email_is_enabled( $email_type ) { |
| 1127 | 1133 | $emails = wpinv_get_emails(); |
| 1128 | 1134 | $enabled = isset( $emails[$email_type] ) && wpinv_get_option( 'email_'. $email_type . '_active', 0 ) ? true : false; |
@@ -140,6 +140,9 @@ discard block |
||
| 140 | 140 | do_action( 'wpinv_after_template_part', $template_name, $template_path, $located, $args ); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | +/** |
|
| 144 | + * @param string $template_name |
|
| 145 | + */ |
|
| 143 | 146 | function wpinv_get_template_html( $template_name, $args = array(), $template_path = '', $default_path = '' ) { |
| 144 | 147 | ob_start(); |
| 145 | 148 | wpinv_get_template( $template_name, $args, $template_path, $default_path ); |
@@ -172,6 +175,9 @@ discard block |
||
| 172 | 175 | return apply_filters( 'wpinv_locate_template', $template, $template_name, $template_path ); |
| 173 | 176 | } |
| 174 | 177 | |
| 178 | +/** |
|
| 179 | + * @param string $slug |
|
| 180 | + */ |
|
| 175 | 181 | function wpinv_get_template_part( $slug, $name = null, $load = true ) { |
| 176 | 182 | do_action( 'get_template_part_' . $slug, $slug, $name ); |
| 177 | 183 | |
@@ -871,6 +877,9 @@ discard block |
||
| 871 | 877 | return apply_filters( 'wpinv_get_watermark', $output, $id ); |
| 872 | 878 | } |
| 873 | 879 | |
| 880 | +/** |
|
| 881 | + * @param integer $id |
|
| 882 | + */ |
|
| 874 | 883 | function wpinv_get_watermark( $id ) { |
| 875 | 884 | if ( !$id > 0 ) { |
| 876 | 885 | return NULL; |
@@ -22,6 +22,9 @@ |
||
| 22 | 22 | add_shortcode( 'wpinv_messages', __CLASS__ . '::messages' ); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string[] $function |
|
| 27 | + */ |
|
| 25 | 28 | public static function shortcode_wrapper( $function, $atts = array(), $content = null, $wrapper = array( 'class' => 'wpi-g', 'before' => null, 'after' => null ) ) { |
| 26 | 29 | ob_start(); |
| 27 | 30 | |
@@ -83,6 +83,9 @@ discard block |
||
| 83 | 83 | return $value; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | + /** |
|
| 87 | + * @param string $key |
|
| 88 | + */ |
|
| 86 | 89 | public function set( $key, $value ) { |
| 87 | 90 | $ignore = array( 'items', 'cart_details', 'fees', '_ID' ); |
| 88 | 91 | |
@@ -921,6 +924,9 @@ discard block |
||
| 921 | 924 | return $removed; |
| 922 | 925 | } |
| 923 | 926 | |
| 927 | + /** |
|
| 928 | + * @param string $key |
|
| 929 | + */ |
|
| 924 | 930 | public function remove_fee_by( $key, $value, $global = false ) { |
| 925 | 931 | $allowed_fee_keys = apply_filters( 'wpinv_fee_keys', array( |
| 926 | 932 | 'index', 'label', 'amount', 'type', |
@@ -1381,6 +1387,9 @@ discard block |
||
| 1381 | 1387 | return apply_filters( 'wpinv_get_invoice_final_total', $final_total, $this, $currency ); |
| 1382 | 1388 | } |
| 1383 | 1389 | |
| 1390 | + /** |
|
| 1391 | + * @return boolean |
|
| 1392 | + */ |
|
| 1384 | 1393 | public function get_discounts( $array = false ) { |
| 1385 | 1394 | $discounts = $this->discounts; |
| 1386 | 1395 | if ( $array && $discounts ) { |
@@ -1389,6 +1398,9 @@ discard block |
||
| 1389 | 1398 | return apply_filters( 'wpinv_payment_discounts', $discounts, $this->ID, $this, $array ); |
| 1390 | 1399 | } |
| 1391 | 1400 | |
| 1401 | + /** |
|
| 1402 | + * @return string |
|
| 1403 | + */ |
|
| 1392 | 1404 | public function get_discount( $currency = false, $dash = false ) { |
| 1393 | 1405 | if ( !empty( $this->discounts ) ) { |
| 1394 | 1406 | global $ajax_cart_details; |
@@ -1491,10 +1503,16 @@ discard block |
||
| 1491 | 1503 | return apply_filters( 'wpinv_user_full_name', $this->full_name, $this->ID, $this ); |
| 1492 | 1504 | } |
| 1493 | 1505 | |
| 1506 | + /** |
|
| 1507 | + * @return string |
|
| 1508 | + */ |
|
| 1494 | 1509 | public function get_user_info() { |
| 1495 | 1510 | return apply_filters( 'wpinv_user_info', $this->user_info, $this->ID, $this ); |
| 1496 | 1511 | } |
| 1497 | 1512 | |
| 1513 | + /** |
|
| 1514 | + * @return string |
|
| 1515 | + */ |
|
| 1498 | 1516 | public function get_email() { |
| 1499 | 1517 | return apply_filters( 'wpinv_user_email', $this->email, $this->ID, $this ); |
| 1500 | 1518 | } |
@@ -1537,6 +1555,9 @@ discard block |
||
| 1537 | 1555 | return apply_filters( 'wpinv_currency_code', $this->currency, $this->ID, $this ); |
| 1538 | 1556 | } |
| 1539 | 1557 | |
| 1558 | + /** |
|
| 1559 | + * @return string |
|
| 1560 | + */ |
|
| 1540 | 1561 | public function get_created_date() { |
| 1541 | 1562 | return apply_filters( 'wpinv_created_date', $this->date, $this->ID, $this ); |
| 1542 | 1563 | } |
@@ -1555,6 +1576,9 @@ discard block |
||
| 1555 | 1576 | return apply_filters( 'wpinv_completed_date', $this->completed_date, $this->ID, $this ); |
| 1556 | 1577 | } |
| 1557 | 1578 | |
| 1579 | + /** |
|
| 1580 | + * @return string |
|
| 1581 | + */ |
|
| 1558 | 1582 | public function get_invoice_date( $formatted = true ) { |
| 1559 | 1583 | $date_completed = $this->completed_date; |
| 1560 | 1584 | $invoice_date = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? $date_completed : ''; |
@@ -31,6 +31,9 @@ discard block |
||
| 31 | 31 | return apply_filters( 'wpinv_get_ip', $ip ); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | +/** |
|
| 35 | + * @return string |
|
| 36 | + */ |
|
| 34 | 37 | function wpinv_get_user_agent() { |
| 35 | 38 | if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
| 36 | 39 | $user_agent = sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ); |
@@ -41,6 +44,9 @@ discard block |
||
| 41 | 44 | return apply_filters( 'wpinv_get_user_agent', $user_agent ); |
| 42 | 45 | } |
| 43 | 46 | |
| 47 | +/** |
|
| 48 | + * @param integer $decimals |
|
| 49 | + */ |
|
| 44 | 50 | function wpinv_sanitize_amount( $amount, $decimals = NULL ) { |
| 45 | 51 | $is_negative = false; |
| 46 | 52 | $thousands_sep = wpinv_thousands_separator(); |
@@ -79,6 +85,9 @@ discard block |
||
| 79 | 85 | } |
| 80 | 86 | add_filter( 'wpinv_sanitize_amount_decimals', 'wpinv_currency_decimal_filter', 10, 1 ); |
| 81 | 87 | |
| 88 | +/** |
|
| 89 | + * @param integer $decimals |
|
| 90 | + */ |
|
| 82 | 91 | function wpinv_round_amount( $amount, $decimals = NULL ) { |
| 83 | 92 | if ( $decimals === NULL ) { |
| 84 | 93 | $decimals = wpinv_decimals(); |
@@ -298,6 +307,9 @@ discard block |
||
| 298 | 307 | return apply_filters( 'wpinv_currency_symbol', $currency_symbol, $currency ); |
| 299 | 308 | } |
| 300 | 309 | |
| 310 | +/** |
|
| 311 | + * @return string |
|
| 312 | + */ |
|
| 301 | 313 | function wpinv_currency_position() { |
| 302 | 314 | $position = wpinv_get_option( 'currency_position', 'left' ); |
| 303 | 315 | |
@@ -556,6 +568,9 @@ discard block |
||
| 556 | 568 | return $price; |
| 557 | 569 | } |
| 558 | 570 | |
| 571 | +/** |
|
| 572 | + * @return string |
|
| 573 | + */ |
|
| 559 | 574 | function wpinv_format_amount( $amount, $decimals = NULL, $calculate = false ) { |
| 560 | 575 | $thousands_sep = wpinv_thousands_separator(); |
| 561 | 576 | $decimal_sep = wpinv_decimal_separator(); |
@@ -606,6 +621,9 @@ discard block |
||
| 606 | 621 | return apply_filters( 'wpinv_sanitize_key', $key, $raw_key ); |
| 607 | 622 | } |
| 608 | 623 | |
| 624 | +/** |
|
| 625 | + * @return string |
|
| 626 | + */ |
|
| 609 | 627 | function wpinv_get_file_extension( $str ) { |
| 610 | 628 | $parts = explode( '.', $str ); |
| 611 | 629 | return end( $parts ); |
@@ -810,6 +828,9 @@ discard block |
||
| 810 | 828 | return strlen( $str ); |
| 811 | 829 | } |
| 812 | 830 | |
| 831 | +/** |
|
| 832 | + * @param string $str |
|
| 833 | + */ |
|
| 813 | 834 | function wpinv_utf8_strtolower( $str, $encoding = 'UTF-8' ) { |
| 814 | 835 | if ( function_exists( 'mb_strtolower' ) ) { |
| 815 | 836 | return mb_strtolower( $str, $encoding ); |
@@ -818,6 +839,9 @@ discard block |
||
| 818 | 839 | return strtolower( $str ); |
| 819 | 840 | } |
| 820 | 841 | |
| 842 | +/** |
|
| 843 | + * @param string $str |
|
| 844 | + */ |
|
| 821 | 845 | function wpinv_utf8_strtoupper( $str, $encoding = 'UTF-8' ) { |
| 822 | 846 | if ( function_exists( 'mb_strtoupper' ) ) { |
| 823 | 847 | return mb_strtoupper( $str, $encoding ); |
@@ -895,7 +919,7 @@ discard block |
||
| 895 | 919 | * |
| 896 | 920 | * @param string $str The string being decoded. |
| 897 | 921 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
| 898 | - * @return string The width of string. |
|
| 922 | + * @return integer The width of string. |
|
| 899 | 923 | */ |
| 900 | 924 | function wpinv_utf8_strwidth( $str, $encoding = 'UTF-8' ) { |
| 901 | 925 | if ( function_exists( 'mb_strwidth' ) ) { |
@@ -946,6 +970,11 @@ discard block |
||
| 946 | 970 | return $period; |
| 947 | 971 | } |
| 948 | 972 | |
| 973 | +/** |
|
| 974 | + * @param integer $calendar |
|
| 975 | + * @param string $month |
|
| 976 | + * @param string $year |
|
| 977 | + */ |
|
| 949 | 978 | function wpinv_cal_days_in_month( $calendar, $month, $year ) { |
| 950 | 979 | if ( function_exists( 'cal_days_in_month' ) ) { |
| 951 | 980 | return cal_days_in_month( $calendar, $month, $year ); |
@@ -488,6 +488,9 @@ discard block |
||
| 488 | 488 | return $invoice->get_description(); |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | +/** |
|
| 492 | + * @return string |
|
| 493 | + */ |
|
| 491 | 494 | function wpinv_get_invoice_currency_code( $invoice_id = 0 ) { |
| 492 | 495 | $invoice = new WPInv_Invoice( $invoice_id ); |
| 493 | 496 | return $invoice->get_currency(); |
@@ -521,6 +524,9 @@ discard block |
||
| 521 | 524 | return $invoice->get_gateway_title(); |
| 522 | 525 | } |
| 523 | 526 | |
| 527 | +/** |
|
| 528 | + * @return string |
|
| 529 | + */ |
|
| 524 | 530 | function wpinv_get_payment_transaction_id( $invoice_id ) { |
| 525 | 531 | $invoice = new WPInv_Invoice( $invoice_id ); |
| 526 | 532 | |
@@ -616,6 +622,9 @@ discard block |
||
| 616 | 622 | return $invoice->get_total( $currency ); |
| 617 | 623 | } |
| 618 | 624 | |
| 625 | +/** |
|
| 626 | + * @return string |
|
| 627 | + */ |
|
| 619 | 628 | function wpinv_get_date_created( $invoice_id = 0, $format = '' ) { |
| 620 | 629 | $invoice = new WPInv_Invoice( $invoice_id ); |
| 621 | 630 | |
@@ -626,6 +635,9 @@ discard block |
||
| 626 | 635 | return $date_created; |
| 627 | 636 | } |
| 628 | 637 | |
| 638 | +/** |
|
| 639 | + * @return string |
|
| 640 | + */ |
|
| 629 | 641 | function wpinv_get_invoice_date( $invoice_id = 0, $format = '', $default = true ) { |
| 630 | 642 | $invoice = new WPInv_Invoice( $invoice_id ); |
| 631 | 643 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | * Retrieves the transaction ID from the subscription |
| 371 | 371 | * |
| 372 | 372 | * @since 1.0.0 |
| 373 | - * @return bool |
|
| 373 | + * @return string |
|
| 374 | 374 | */ |
| 375 | 375 | public function get_transaction_id() { |
| 376 | 376 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | * Stores the transaction ID for the subscription purchase |
| 393 | 393 | * |
| 394 | 394 | * @since 1.0.0.4 |
| 395 | - * @return bool |
|
| 395 | + * @return boolean|null |
|
| 396 | 396 | */ |
| 397 | 397 | public function set_transaction_id( $txn_id = '' ) { |
| 398 | 398 | $this->update( array( 'transaction_id' => $txn_id ) ); |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | * Renews a subscription |
| 404 | 404 | * |
| 405 | 405 | * @since 1.0.0 |
| 406 | - * @return bool |
|
| 406 | + * @return boolean|null |
|
| 407 | 407 | */ |
| 408 | 408 | public function renew() { |
| 409 | 409 | |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | * |
| 493 | 493 | * @since 1.0.0 |
| 494 | 494 | * @param $check_expiration bool True if expiration date should be checked with merchant processor before expiring |
| 495 | - * @return void |
|
| 495 | + * @return false|null |
|
| 496 | 496 | */ |
| 497 | 497 | public function expire( $check_expiration = false ) { |
| 498 | 498 | |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | * Retrieves the subscription status |
| 745 | 745 | * |
| 746 | 746 | * @since 1.0.0 |
| 747 | - * @return int |
|
| 747 | + * @return string |
|
| 748 | 748 | */ |
| 749 | 749 | public function get_status() { |
| 750 | 750 | |
@@ -648,6 +648,9 @@ |
||
| 648 | 648 | } |
| 649 | 649 | add_filter( 'wpinv_enabled_payment_gateways', 'wpinv_check_authorizenet_currency_support', 10, 1 ); |
| 650 | 650 | |
| 651 | +/** |
|
| 652 | + * @param WPInv_Invoice $invoice |
|
| 653 | + */ |
|
| 651 | 654 | function wpinv_authorizenet_link_transaction_id( $transaction_id, $invoice_id, $invoice ) { |
| 652 | 655 | if ( $transaction_id == $invoice_id ) { |
| 653 | 656 | $link = $transaction_id; |
@@ -757,6 +757,9 @@ |
||
| 757 | 757 | } |
| 758 | 758 | add_filter( 'wpinv_payment_get_transaction_id-paypal', 'wpinv_paypal_get_transaction_id', 10, 1 ); |
| 759 | 759 | |
| 760 | +/** |
|
| 761 | + * @param WPInv_Invoice $invoice |
|
| 762 | + */ |
|
| 760 | 763 | function wpinv_paypal_link_transaction_id( $transaction_id, $invoice_id, $invoice ) { |
| 761 | 764 | if ( $transaction_id == $invoice_id ) { |
| 762 | 765 | $transaction_link = $transaction_id; |