@@ -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 '-'; |
@@ -740,6 +740,9 @@ |
||
740 | 740 | add_action( 'geodir_dashboard_links', 'wpinv_gdp_dashboard_invoice_history_link' ); |
741 | 741 | remove_action( 'geodir_dashboard_links', 'geodir_payment_invoices_list_page_link' ); |
742 | 742 | |
743 | +/** |
|
744 | + * @param string $new_status |
|
745 | + */ |
|
743 | 746 | function wpinv_wpi_to_gdp_update_status( $invoice_id, $new_status, $old_status ) { |
744 | 747 | if (!defined('GEODIRPAYMENT_VERSION')) { |
745 | 748 | 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'] ); |
@@ -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' ) ) { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
3 | - exit; |
|
3 | + exit; |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | if ( !( $user_id = get_current_user_id() ) ) { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | <tbody> |
32 | 32 | <?php foreach ( $user_invoices->invoices as $invoice ) { |
33 | - ?> |
|
33 | + ?> |
|
34 | 34 | <tr class="wpinv-item wpinv-item-<?php echo $invoice_status = $invoice->get_status(); ?>"> |
35 | 35 | <?php foreach ( wpinv_get_user_invoices_columns() as $column_id => $column_name ) : ?> |
36 | 36 | <td class="<?php echo esc_attr( $column_id ); ?> <?php echo (!empty($column_name['class']) ? $column_name['class'] : '');?>" data-title="<?php echo esc_attr( $column_name['title'] ); ?>"> |
@@ -53,31 +53,31 @@ discard block |
||
53 | 53 | |
54 | 54 | <?php elseif ( 'invoice-actions' === $column_id ) : ?> |
55 | 55 | <?php |
56 | - $actions = array( |
|
57 | - 'pay' => array( |
|
58 | - 'url' => $invoice->get_checkout_payment_url(), |
|
59 | - 'name' => __( 'Pay Now', 'invoicing' ), |
|
56 | + $actions = array( |
|
57 | + 'pay' => array( |
|
58 | + 'url' => $invoice->get_checkout_payment_url(), |
|
59 | + 'name' => __( 'Pay Now', 'invoicing' ), |
|
60 | 60 | 'class' => 'btn-success' |
61 | - ), |
|
61 | + ), |
|
62 | 62 | 'print' => array( |
63 | - 'url' => $invoice->get_view_url(), |
|
64 | - 'name' => __( 'Print', 'invoicing' ), |
|
63 | + 'url' => $invoice->get_view_url(), |
|
64 | + 'name' => __( 'Print', 'invoicing' ), |
|
65 | 65 | 'class' => 'btn-primary', |
66 | 66 | 'attrs' => 'target="_blank"' |
67 | - ) |
|
68 | - ); |
|
67 | + ) |
|
68 | + ); |
|
69 | 69 | |
70 | - if ( ! $invoice->needs_payment() ) { |
|
71 | - unset( $actions['pay'] ); |
|
72 | - } |
|
70 | + if ( ! $invoice->needs_payment() ) { |
|
71 | + unset( $actions['pay'] ); |
|
72 | + } |
|
73 | 73 | |
74 | - if ( $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice ) ) { |
|
75 | - foreach ( $actions as $key => $action ) { |
|
76 | - $class = !empty($action['class']) ? sanitize_html_class($action['class']) : ''; |
|
74 | + if ( $actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice ) ) { |
|
75 | + foreach ( $actions as $key => $action ) { |
|
76 | + $class = !empty($action['class']) ? sanitize_html_class($action['class']) : ''; |
|
77 | 77 | echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm ' . $class . ' ' . sanitize_html_class( $key ) . '" ' . ( !empty($action['attrs']) ? $action['attrs'] : '' ) . '>' . $action['name'] . '</a>'; |
78 | - } |
|
79 | - } |
|
80 | - ?> |
|
78 | + } |
|
79 | + } |
|
80 | + ?> |
|
81 | 81 | <?php endif; ?> |
82 | 82 | </td> |
83 | 83 | <?php endforeach; ?> |
@@ -91,26 +91,26 @@ discard block |
||
91 | 91 | <?php if ( 1 < $user_invoices->max_num_pages ) : ?> |
92 | 92 | <div class="invoicing-Pagination"> |
93 | 93 | <?php |
94 | - $big = 999999; |
|
95 | - $wpinv_cpt = isset($_REQUEST['wpinv-cpt']) ? $_REQUEST['wpinv-cpt'] : ''; |
|
96 | - |
|
97 | - if (get_query_var('paged') && 'wpi_invoice' == $wpinv_cpt) |
|
98 | - $current_page = get_query_var('paged'); |
|
99 | - elseif (get_query_var('page') && 'wpi_invoice' == $wpinv_cpt) |
|
100 | - $current_page = get_query_var('page'); |
|
101 | - else |
|
102 | - $current_page = 1; |
|
103 | - |
|
104 | - echo paginate_links( array( |
|
105 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
106 | - 'format' => '?paged=%#%', |
|
107 | - 'current' => max( 1, $current_page ), |
|
108 | - 'total' => $user_invoices->max_num_pages, |
|
109 | - 'add_args' => array( |
|
110 | - 'wpinv-cpt' => 'wpi_invoice', |
|
111 | - ) |
|
112 | - ) ); |
|
113 | - ?> |
|
94 | + $big = 999999; |
|
95 | + $wpinv_cpt = isset($_REQUEST['wpinv-cpt']) ? $_REQUEST['wpinv-cpt'] : ''; |
|
96 | + |
|
97 | + if (get_query_var('paged') && 'wpi_invoice' == $wpinv_cpt) |
|
98 | + $current_page = get_query_var('paged'); |
|
99 | + elseif (get_query_var('page') && 'wpi_invoice' == $wpinv_cpt) |
|
100 | + $current_page = get_query_var('page'); |
|
101 | + else |
|
102 | + $current_page = 1; |
|
103 | + |
|
104 | + echo paginate_links( array( |
|
105 | + 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
106 | + 'format' => '?paged=%#%', |
|
107 | + 'current' => max( 1, $current_page ), |
|
108 | + 'total' => $user_invoices->max_num_pages, |
|
109 | + 'add_args' => array( |
|
110 | + 'wpinv-cpt' => 'wpi_invoice', |
|
111 | + ) |
|
112 | + ) ); |
|
113 | + ?> |
|
114 | 114 | </div> |
115 | 115 | <?php endif; ?> |
116 | 116 |