@@ -48,7 +48,6 @@ |
||
| 48 | 48 | /** |
| 49 | 49 | * Retrieve the current session instance. |
| 50 | 50 | * |
| 51 | - * @param bool $session_id Session ID from which to populate data. |
|
| 52 | 51 | * |
| 53 | 52 | * @return bool|WP_Session |
| 54 | 53 | */ |
@@ -407,6 +407,10 @@ discard block |
||
| 407 | 407 | exit; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | + /** |
|
| 411 | + * @param string $source_url |
|
| 412 | + * @param string $destination_file |
|
| 413 | + */ |
|
| 410 | 414 | public static function geoip2_download_file( $source_url, $destination_file ) { |
| 411 | 415 | $success = false; |
| 412 | 416 | $message = ''; |
@@ -1192,6 +1196,9 @@ discard block |
||
| 1192 | 1196 | return apply_filters( 'wpinv_response_euvatrates', $response, $group ); |
| 1193 | 1197 | } |
| 1194 | 1198 | |
| 1199 | + /** |
|
| 1200 | + * @param boolean $is_digital |
|
| 1201 | + */ |
|
| 1195 | 1202 | public static function requires_vat( $requires_vat = false, $user_id = 0, $is_digital = null ) { |
| 1196 | 1203 | global $wpi_item_id, $wpi_country; |
| 1197 | 1204 | |
@@ -1412,6 +1419,9 @@ discard block |
||
| 1412 | 1419 | return apply_filters( 'wpinv_item_is_taxable', $is_taxable, $item_id, $country , $state ); |
| 1413 | 1420 | } |
| 1414 | 1421 | |
| 1422 | + /** |
|
| 1423 | + * @param string|null $state |
|
| 1424 | + */ |
|
| 1415 | 1425 | public static function find_rate( $country, $state, $rate, $class ) { |
| 1416 | 1426 | global $wpi_zero_tax; |
| 1417 | 1427 | |
@@ -324,12 +324,18 @@ discard block |
||
| 324 | 324 | return apply_filters( 'wpinv_get_discount_code', $code, $code_id ); |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | +/** |
|
| 328 | + * @return string |
|
| 329 | + */ |
|
| 327 | 330 | function wpinv_get_discount_start_date( $code_id = null ) { |
| 328 | 331 | $start_date = get_post_meta( $code_id, '_wpi_discount_start', true ); |
| 329 | 332 | |
| 330 | 333 | return apply_filters( 'wpinv_get_discount_start_date', $start_date, $code_id ); |
| 331 | 334 | } |
| 332 | 335 | |
| 336 | +/** |
|
| 337 | + * @return string |
|
| 338 | + */ |
|
| 333 | 339 | function wpinv_get_discount_expiration( $code_id = null ) { |
| 334 | 340 | $expiration = get_post_meta( $code_id, '_wpi_discount_expiration', true ); |
| 335 | 341 | |
@@ -652,6 +658,9 @@ discard block |
||
| 652 | 658 | return (bool) apply_filters( 'wpinv_is_discount_item_req_met', $ret, $code_id, $condition ); |
| 653 | 659 | } |
| 654 | 660 | |
| 661 | +/** |
|
| 662 | + * @param string $code |
|
| 663 | + */ |
|
| 655 | 664 | function wpinv_is_discount_used( $code = null, $user = '', $code_id = 0 ) { |
| 656 | 665 | global $wpi_checkout_id; |
| 657 | 666 | |
@@ -817,6 +826,9 @@ discard block |
||
| 817 | 826 | |
| 818 | 827 | } |
| 819 | 828 | |
| 829 | +/** |
|
| 830 | + * @param double $amount |
|
| 831 | + */ |
|
| 820 | 832 | function wpinv_format_discount_rate( $type, $amount ) { |
| 821 | 833 | if ( $type == 'flat' ) { |
| 822 | 834 | return wpinv_price( wpinv_format_amount( $amount ) ); |
@@ -861,6 +873,9 @@ discard block |
||
| 861 | 873 | return $discounts; |
| 862 | 874 | } |
| 863 | 875 | |
| 876 | +/** |
|
| 877 | + * @return boolean |
|
| 878 | + */ |
|
| 864 | 879 | function wpinv_unset_cart_discount( $code = '' ) { |
| 865 | 880 | $discounts = wpinv_get_cart_discounts(); |
| 866 | 881 | |
@@ -1175,6 +1190,9 @@ discard block |
||
| 1175 | 1190 | } |
| 1176 | 1191 | //add_action( 'init', 'wpinv_apply_preset_discount', 999 ); |
| 1177 | 1192 | |
| 1193 | +/** |
|
| 1194 | + * @param integer $code |
|
| 1195 | + */ |
|
| 1178 | 1196 | function wpinv_get_discount_label( $code, $echo = true ) { |
| 1179 | 1197 | $label = wp_sprintf( __( 'Discount%1$s', 'invoicing' ), ( $code != '' && $code != 'none' ? ' (<code>' . $code . '</code>)': '' ) ); |
| 1180 | 1198 | $label = apply_filters( 'wpinv_get_discount_label', $label, $code ); |
@@ -47,6 +47,9 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | + /** |
|
| 51 | + * @param integer $code |
|
| 52 | + */ |
|
| 50 | 53 | public function send_status( $code ) { |
| 51 | 54 | status_header( $code ); |
| 52 | 55 | } |
@@ -195,6 +198,11 @@ discard block |
||
| 195 | 198 | class WPInv_API_Exception extends Exception { |
| 196 | 199 | protected $error_code; |
| 197 | 200 | |
| 201 | + /** |
|
| 202 | + * @param string $error_code |
|
| 203 | + * @param string $error_message |
|
| 204 | + * @param integer $http_status_code |
|
| 205 | + */ |
|
| 198 | 206 | public function __construct( $error_code, $error_message, $http_status_code ) { |
| 199 | 207 | $this->error_code = $error_code; |
| 200 | 208 | parent::__construct( $error_message, $http_status_code ); |
@@ -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 ); |