@@ -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 ); |
@@ -176,6 +176,9 @@ discard block |
||
176 | 176 | return $date_created; |
177 | 177 | } |
178 | 178 | |
179 | +/** |
|
180 | + * @return string |
|
181 | + */ |
|
179 | 182 | function wpinv_get_invoice_date( $invoice_id = 0, $format = '' ) { |
180 | 183 | $invoice = new WPInv_Invoice( $invoice_id ); |
181 | 184 | |
@@ -1375,6 +1378,9 @@ discard block |
||
1375 | 1378 | return $display; |
1376 | 1379 | } |
1377 | 1380 | |
1381 | +/** |
|
1382 | + * @return integer |
|
1383 | + */ |
|
1378 | 1384 | function wpinv_get_invoice_id_by_key( $key ) { |
1379 | 1385 | global $wpdb; |
1380 | 1386 |
@@ -529,6 +529,9 @@ |
||
529 | 529 | return apply_filters( 'wpinv_get_cart_item_price_name', $name, $item['id'], $price_id, $item ); |
530 | 530 | } |
531 | 531 | |
532 | +/** |
|
533 | + * @return string |
|
534 | + */ |
|
532 | 535 | function wpinv_get_cart_item_name( $item = array() ) { |
533 | 536 | $item_title = !empty( $item['name'] ) ? $item['name'] : get_the_title( $item['id'] ); |
534 | 537 |
@@ -194,6 +194,9 @@ |
||
194 | 194 | return apply_filters( 'wpinv_is_tax_exclusive', $ret, $item_id ); |
195 | 195 | } |
196 | 196 | |
197 | +/** |
|
198 | + * @return integer |
|
199 | + */ |
|
197 | 200 | function wpinv_currency_decimal_filter( $decimals = 2 ) { |
198 | 201 | $currency = wpinv_get_currency(); |
199 | 202 |
@@ -161,6 +161,9 @@ |
||
161 | 161 | wp_redirect( $redirect_to ); |
162 | 162 | } |
163 | 163 | |
164 | +/** |
|
165 | + * @param integer $user_id |
|
166 | + */ |
|
164 | 167 | function wpinv_login_user( $user_id ) { |
165 | 168 | if ( is_user_logged_in() ) { |
166 | 169 | return true; |
@@ -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 ); |
@@ -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(); |
@@ -117,6 +126,9 @@ discard block |
||
117 | 126 | return $status; |
118 | 127 | } |
119 | 128 | |
129 | +/** |
|
130 | + * @return string |
|
131 | + */ |
|
120 | 132 | function wpinv_get_currency() { |
121 | 133 | $currency = wpinv_get_option( 'currency', 'USD' ); |
122 | 134 | |
@@ -187,6 +199,9 @@ discard block |
||
187 | 199 | return apply_filters( 'wpinv_currency_symbol', $currency_symbol, $currency ); |
188 | 200 | } |
189 | 201 | |
202 | +/** |
|
203 | + * @return string |
|
204 | + */ |
|
190 | 205 | function wpinv_currency_position() { |
191 | 206 | $position = wpinv_get_option( 'currency_position', 'left' ); |
192 | 207 | |
@@ -315,6 +330,9 @@ discard block |
||
315 | 330 | return $price; |
316 | 331 | } |
317 | 332 | |
333 | +/** |
|
334 | + * @return string |
|
335 | + */ |
|
318 | 336 | function wpinv_format_amount( $amount, $decimals = NULL, $calculate = false ) { |
319 | 337 | $thousands_sep = wpinv_thousands_separator(); |
320 | 338 | $decimal_sep = wpinv_decimal_separator(); |
@@ -365,6 +383,9 @@ discard block |
||
365 | 383 | return apply_filters( 'wpinv_sanitize_key', $key, $raw_key ); |
366 | 384 | } |
367 | 385 | |
386 | +/** |
|
387 | + * @return string |
|
388 | + */ |
|
368 | 389 | function wpinv_get_file_extension( $str ) { |
369 | 390 | $parts = explode( '.', $str ); |
370 | 391 | return end( $parts ); |
@@ -569,6 +590,9 @@ discard block |
||
569 | 590 | return strlen( $str ); |
570 | 591 | } |
571 | 592 | |
593 | +/** |
|
594 | + * @param string $str |
|
595 | + */ |
|
572 | 596 | function wpinv_utf8_strtolower( $str, $encoding = 'UTF-8' ) { |
573 | 597 | if ( function_exists( 'mb_strtolower' ) ) { |
574 | 598 | return mb_strtolower( $str, $encoding ); |
@@ -577,6 +601,9 @@ discard block |
||
577 | 601 | return strtolower( $str ); |
578 | 602 | } |
579 | 603 | |
604 | +/** |
|
605 | + * @param string $str |
|
606 | + */ |
|
580 | 607 | function wpinv_utf8_strtoupper( $str, $encoding = 'UTF-8' ) { |
581 | 608 | if ( function_exists( 'mb_strtoupper' ) ) { |
582 | 609 | return mb_strtoupper( $str, $encoding ); |
@@ -654,7 +681,7 @@ discard block |
||
654 | 681 | * |
655 | 682 | * @param string $str The string being decoded. |
656 | 683 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
657 | - * @return string The width of string. |
|
684 | + * @return integer The width of string. |
|
658 | 685 | */ |
659 | 686 | function wpinv_utf8_strwidth( $str, $encoding = 'UTF-8' ) { |
660 | 687 | if ( function_exists( 'mb_strwidth' ) ) { |