@@ -115,6 +115,9 @@ discard block |
||
| 115 | 115 | return $this->resolveDataPointer($pointer); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | + /** |
|
| 119 | + * @param string $ipAddress |
|
| 120 | + */ |
|
| 118 | 121 | private function findAddressInTree($ipAddress) |
| 119 | 122 | { |
| 120 | 123 | // XXX - could simplify. Done as a byte array to ease porting |
@@ -146,6 +149,9 @@ discard block |
||
| 146 | 149 | } |
| 147 | 150 | |
| 148 | 151 | |
| 152 | + /** |
|
| 153 | + * @param integer $length |
|
| 154 | + */ |
|
| 149 | 155 | private function startNode($length) |
| 150 | 156 | { |
| 151 | 157 | // Check if we are looking up an IPv4 address in an IPv6 tree. If this |
@@ -178,6 +184,9 @@ discard block |
||
| 178 | 184 | return $node; |
| 179 | 185 | } |
| 180 | 186 | |
| 187 | + /** |
|
| 188 | + * @param integer $index |
|
| 189 | + */ |
|
| 181 | 190 | private function readNode($nodeNumber, $index) |
| 182 | 191 | { |
| 183 | 192 | $baseOffset = $nodeNumber * $this->metadata->nodeByteSize; |
@@ -230,6 +239,10 @@ discard block |
||
| 230 | 239 | * are much faster algorithms (e.g., Boyer-Moore) for this if speed is ever |
| 231 | 240 | * an issue, but I suspect it won't be. |
| 232 | 241 | */ |
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * @param string $filename |
|
| 245 | + */ |
|
| 233 | 246 | private function findMetadataStart($filename) |
| 234 | 247 | { |
| 235 | 248 | $handle = $this->fileHandle; |
@@ -104,7 +104,6 @@ |
||
| 104 | 104 | * @link http://php.net/manual/en/arrayaccess.offsetset.php |
| 105 | 105 | * |
| 106 | 106 | * @param mixed $offset The offset to assign the value to. |
| 107 | - * @param mixed $value The value to set. |
|
| 108 | 107 | * |
| 109 | 108 | * @return void |
| 110 | 109 | */ |
@@ -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 ); |
@@ -624,6 +624,9 @@ discard block |
||
| 624 | 624 | return $sent; |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | +/** |
|
| 628 | + * @return string |
|
| 629 | + */ |
|
| 627 | 630 | function wpinv_mail_get_from_address() { |
| 628 | 631 | $from_address = apply_filters( 'wpinv_mail_from_address', wpinv_get_option( 'email_from' ) ); |
| 629 | 632 | return sanitize_email( $from_address ); |
@@ -1083,6 +1086,9 @@ discard block |
||
| 1083 | 1086 | } |
| 1084 | 1087 | add_filter( 'wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1 ); |
| 1085 | 1088 | |
| 1089 | +/** |
|
| 1090 | + * @param string $email_type |
|
| 1091 | + */ |
|
| 1086 | 1092 | function wpinv_email_is_enabled( $email_type ) { |
| 1087 | 1093 | $emails = wpinv_get_emails(); |
| 1088 | 1094 | $enabled = isset( $emails[$email_type] ) && wpinv_get_option( $email_type . '_active', 1 ) ? true : false; |
@@ -183,6 +183,9 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | add_action( 'geodir_checkout_page_content', 'wpinv_print_checkout_errors', -10 ); |
| 185 | 185 | |
| 186 | +/** |
|
| 187 | + * @return integer |
|
| 188 | + */ |
|
| 186 | 189 | function wpinv_cpt_save( $invoice_id, $update = false, $pre_status = NULL ) { |
| 187 | 190 | global $wpi_nosave, $wpi_zero_tax, $wpi_gdp_inv_merge; |
| 188 | 191 | |
@@ -899,6 +902,9 @@ discard block |
||
| 899 | 902 | add_action( 'geodir_dashboard_links', 'wpinv_gdp_dashboard_invoice_history_link' ); |
| 900 | 903 | remove_action( 'geodir_dashboard_links', 'geodir_payment_invoices_list_page_link' ); |
| 901 | 904 | |
| 905 | +/** |
|
| 906 | + * @param string $new_status |
|
| 907 | + */ |
|
| 902 | 908 | function wpinv_wpi_to_gdp_update_status( $invoice_id, $new_status, $old_status ) { |
| 903 | 909 | if (!defined('GEODIRPAYMENT_VERSION')) { |
| 904 | 910 | return false; |
@@ -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'] ); |
@@ -101,6 +104,9 @@ discard block |
||
| 101 | 104 | return $status; |
| 102 | 105 | } |
| 103 | 106 | |
| 107 | +/** |
|
| 108 | + * @return string |
|
| 109 | + */ |
|
| 104 | 110 | function wpinv_get_currency() { |
| 105 | 111 | $currency = wpinv_get_option( 'currency', 'USD' ); |
| 106 | 112 | |
@@ -171,6 +177,9 @@ discard block |
||
| 171 | 177 | return apply_filters( 'wpinv_currency_symbol', $currency_symbol, $currency ); |
| 172 | 178 | } |
| 173 | 179 | |
| 180 | +/** |
|
| 181 | + * @return string |
|
| 182 | + */ |
|
| 174 | 183 | function wpinv_currency_position() { |
| 175 | 184 | $position = wpinv_get_option( 'currency_position', 'left' ); |
| 176 | 185 | |
@@ -299,6 +308,9 @@ discard block |
||
| 299 | 308 | return $price; |
| 300 | 309 | } |
| 301 | 310 | |
| 311 | +/** |
|
| 312 | + * @param integer $decimals |
|
| 313 | + */ |
|
| 302 | 314 | function wpinv_format_amount( $amount, $decimals = NULL, $calculate = false ) { |
| 303 | 315 | $thousands_sep = wpinv_thousands_seperator(); |
| 304 | 316 | $decimal_sep = wpinv_decimal_seperator(); |
@@ -348,6 +360,9 @@ discard block |
||
| 348 | 360 | return apply_filters( 'wpinv_sanitize_key', $key, $raw_key ); |
| 349 | 361 | } |
| 350 | 362 | |
| 363 | +/** |
|
| 364 | + * @return string |
|
| 365 | + */ |
|
| 351 | 366 | function wpinv_get_file_extension( $str ) { |
| 352 | 367 | $parts = explode( '.', $str ); |
| 353 | 368 | return end( $parts ); |
@@ -552,6 +567,9 @@ discard block |
||
| 552 | 567 | return strlen( $str ); |
| 553 | 568 | } |
| 554 | 569 | |
| 570 | +/** |
|
| 571 | + * @param string $str |
|
| 572 | + */ |
|
| 555 | 573 | function wpinv_utf8_strtolower( $str, $encoding = 'UTF-8' ) { |
| 556 | 574 | if ( function_exists( 'mb_strtolower' ) ) { |
| 557 | 575 | return mb_strtolower( $str, $encoding ); |
@@ -560,6 +578,9 @@ discard block |
||
| 560 | 578 | return strtolower( $str ); |
| 561 | 579 | } |
| 562 | 580 | |
| 581 | +/** |
|
| 582 | + * @param string $str |
|
| 583 | + */ |
|
| 563 | 584 | function wpinv_utf8_strtoupper( $str, $encoding = 'UTF-8' ) { |
| 564 | 585 | if ( function_exists( 'mb_strtoupper' ) ) { |
| 565 | 586 | return mb_strtoupper( $str, $encoding ); |
@@ -637,7 +658,7 @@ discard block |
||
| 637 | 658 | * |
| 638 | 659 | * @param string $str The string being decoded. |
| 639 | 660 | * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8". |
| 640 | - * @return string The width of string. |
|
| 661 | + * @return integer The width of string. |
|
| 641 | 662 | */ |
| 642 | 663 | function wpinv_utf8_strwidth( $str, $encoding = 'UTF-8' ) { |
| 643 | 664 | if ( function_exists( 'mb_strwidth' ) ) { |
@@ -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 | |