@@ -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' ) ) { |
@@ -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; |
@@ -21,6 +21,9 @@ |
||
| 21 | 21 | add_shortcode( 'wpinv_messages', __CLASS__ . '::messages' ); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | + /** |
|
| 25 | + * @param string[] $function |
|
| 26 | + */ |
|
| 24 | 27 | public static function shortcode_wrapper( |
| 25 | 28 | $function, |
| 26 | 29 | $atts = array(), |
@@ -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; |