@@ -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 ); |
@@ -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 | |
@@ -916,6 +919,9 @@ discard block |
||
| 916 | 919 | return $removed; |
| 917 | 920 | } |
| 918 | 921 | |
| 922 | + /** |
|
| 923 | + * @param string $key |
|
| 924 | + */ |
|
| 919 | 925 | public function remove_fee_by( $key, $value, $global = false ) { |
| 920 | 926 | $allowed_fee_keys = apply_filters( 'wpinv_fee_keys', array( |
| 921 | 927 | 'index', 'label', 'amount', 'type', |
@@ -1375,6 +1381,9 @@ discard block |
||
| 1375 | 1381 | return apply_filters( 'wpinv_get_invoice_final_total', $final_total, $this, $currency ); |
| 1376 | 1382 | } |
| 1377 | 1383 | |
| 1384 | + /** |
|
| 1385 | + * @return boolean |
|
| 1386 | + */ |
|
| 1378 | 1387 | public function get_discounts( $array = false ) { |
| 1379 | 1388 | $discounts = $this->discounts; |
| 1380 | 1389 | if ( $array && $discounts ) { |
@@ -1383,6 +1392,9 @@ discard block |
||
| 1383 | 1392 | return apply_filters( 'wpinv_payment_discounts', $discounts, $this->ID, $this, $array ); |
| 1384 | 1393 | } |
| 1385 | 1394 | |
| 1395 | + /** |
|
| 1396 | + * @return string |
|
| 1397 | + */ |
|
| 1386 | 1398 | public function get_discount( $currency = false, $dash = false ) { |
| 1387 | 1399 | if ( !empty( $this->discounts ) ) { |
| 1388 | 1400 | global $ajax_cart_details; |
@@ -1479,10 +1491,16 @@ discard block |
||
| 1479 | 1491 | return apply_filters( 'wpinv_user_full_name', $this->full_name, $this->ID, $this ); |
| 1480 | 1492 | } |
| 1481 | 1493 | |
| 1494 | + /** |
|
| 1495 | + * @return string |
|
| 1496 | + */ |
|
| 1482 | 1497 | public function get_user_info() { |
| 1483 | 1498 | return apply_filters( 'wpinv_user_info', $this->user_info, $this->ID, $this ); |
| 1484 | 1499 | } |
| 1485 | 1500 | |
| 1501 | + /** |
|
| 1502 | + * @return string |
|
| 1503 | + */ |
|
| 1486 | 1504 | public function get_email() { |
| 1487 | 1505 | return apply_filters( 'wpinv_user_email', $this->email, $this->ID, $this ); |
| 1488 | 1506 | } |
@@ -1525,10 +1543,16 @@ discard block |
||
| 1525 | 1543 | return apply_filters( 'wpinv_currency_code', $this->currency, $this->ID, $this ); |
| 1526 | 1544 | } |
| 1527 | 1545 | |
| 1546 | + /** |
|
| 1547 | + * @return string |
|
| 1548 | + */ |
|
| 1528 | 1549 | public function get_created_date() { |
| 1529 | 1550 | return apply_filters( 'wpinv_created_date', $this->date, $this->ID, $this ); |
| 1530 | 1551 | } |
| 1531 | 1552 | |
| 1553 | + /** |
|
| 1554 | + * @return string |
|
| 1555 | + */ |
|
| 1532 | 1556 | public function get_due_date( $display = false ) { |
| 1533 | 1557 | $due_date = apply_filters( 'wpinv_due_date', $this->due_date, $this->ID, $this ); |
| 1534 | 1558 | |
@@ -2081,6 +2105,9 @@ discard block |
||
| 2081 | 2105 | return apply_filters( 'wpinv_invoice_get_subscription_name', $name, $this ); |
| 2082 | 2106 | } |
| 2083 | 2107 | |
| 2108 | + /** |
|
| 2109 | + * @return string |
|
| 2110 | + */ |
|
| 2084 | 2111 | public function get_expiration() { |
| 2085 | 2112 | $expiration = $this->get_meta( '_wpinv_subscr_expiration', true ); |
| 2086 | 2113 | return $expiration; |
@@ -2096,6 +2123,9 @@ discard block |
||
| 2096 | 2123 | return $cancelled_date; |
| 2097 | 2124 | } |
| 2098 | 2125 | |
| 2126 | + /** |
|
| 2127 | + * @return string |
|
| 2128 | + */ |
|
| 2099 | 2129 | public function get_trial_end_date( $formatted = true ) { |
| 2100 | 2130 | if ( !$this->is_free_trial() || !$this->is_paid() ) { |
| 2101 | 2131 | return NULL; |
@@ -2117,6 +2147,9 @@ discard block |
||
| 2117 | 2147 | return $trial_end_date; |
| 2118 | 2148 | } |
| 2119 | 2149 | |
| 2150 | + /** |
|
| 2151 | + * @return string |
|
| 2152 | + */ |
|
| 2120 | 2153 | public function get_subscription_created( $default = true ) { |
| 2121 | 2154 | $created = $this->get_meta( '_wpinv_subscr_created', true ); |
| 2122 | 2155 | |
@@ -2126,6 +2159,9 @@ discard block |
||
| 2126 | 2159 | return $created; |
| 2127 | 2160 | } |
| 2128 | 2161 | |
| 2162 | + /** |
|
| 2163 | + * @return string |
|
| 2164 | + */ |
|
| 2129 | 2165 | public function get_subscription_start( $formatted = true ) { |
| 2130 | 2166 | if ( !$this->is_paid() ) { |
| 2131 | 2167 | return '-'; |