@@ -19,16 +19,16 @@ discard block |
||
19 | 19 | |
20 | 20 | // Define constants. |
21 | 21 | if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) { |
22 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
22 | + define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | if ( ! defined( 'WPINV_VERSION' ) ) { |
26 | - define( 'WPINV_VERSION', '2.6.5' ); |
|
26 | + define( 'WPINV_VERSION', '2.6.5' ); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // Include the main Invoicing class. |
30 | 30 | if ( ! class_exists( 'WPInv_Plugin', false ) ) { |
31 | - require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
31 | + require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $GLOBALS['invoicing'] = new WPInv_Plugin(); |
44 | 44 | } |
45 | 45 | |
46 | - return $GLOBALS['invoicing']; |
|
46 | + return $GLOBALS['invoicing']; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -37,29 +37,29 @@ discard block |
||
37 | 37 | 'advanced' => false, |
38 | 38 | ), |
39 | 39 | 'items' => array( |
40 | - 'title' => __( 'Items to buy', 'invoicing' ), |
|
41 | - 'desc' => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2 ', 'invoicing' ), |
|
42 | - 'type' => 'text', |
|
43 | - 'desc_tip' => true, |
|
44 | - 'default' => '', |
|
45 | - 'placeholder' => __( 'Items to buy', 'invoicing' ), |
|
46 | - 'advanced' => false, |
|
40 | + 'title' => __( 'Items to buy', 'invoicing' ), |
|
41 | + 'desc' => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2 ', 'invoicing' ), |
|
42 | + 'type' => 'text', |
|
43 | + 'desc_tip' => true, |
|
44 | + 'default' => '', |
|
45 | + 'placeholder' => __( 'Items to buy', 'invoicing' ), |
|
46 | + 'advanced' => false, |
|
47 | 47 | ), |
48 | 48 | 'label' => array( |
49 | - 'title' => __( 'Button Label', 'invoicing' ), |
|
50 | - 'desc' => __( 'Enter button label. Default "Buy Now".', 'invoicing' ), |
|
51 | - 'type' => 'text', |
|
52 | - 'desc_tip' => true, |
|
53 | - 'default' => __( 'Buy Now', 'invoicing' ), |
|
54 | - 'advanced' => false, |
|
49 | + 'title' => __( 'Button Label', 'invoicing' ), |
|
50 | + 'desc' => __( 'Enter button label. Default "Buy Now".', 'invoicing' ), |
|
51 | + 'type' => 'text', |
|
52 | + 'desc_tip' => true, |
|
53 | + 'default' => __( 'Buy Now', 'invoicing' ), |
|
54 | + 'advanced' => false, |
|
55 | 55 | ), |
56 | 56 | 'post_id' => array( |
57 | - 'title' => __( 'Post ID', 'invoicing' ), |
|
58 | - 'desc' => __( 'Enter related post ID. This is for 3rd party add ons and not mandatory field.', 'invoicing' ), |
|
59 | - 'type' => 'number', |
|
60 | - 'desc_tip' => true, |
|
61 | - 'default' => '', |
|
62 | - 'advanced' => true, |
|
57 | + 'title' => __( 'Post ID', 'invoicing' ), |
|
58 | + 'desc' => __( 'Enter related post ID. This is for 3rd party add ons and not mandatory field.', 'invoicing' ), |
|
59 | + 'type' => 'number', |
|
60 | + 'desc_tip' => true, |
|
61 | + 'default' => '', |
|
62 | + 'advanced' => true, |
|
63 | 63 | ), |
64 | 64 | ), |
65 | 65 | |
@@ -68,43 +68,43 @@ discard block |
||
68 | 68 | parent::__construct( $options ); |
69 | 69 | } |
70 | 70 | |
71 | - /** |
|
72 | - * The Super block output function. |
|
73 | - * |
|
74 | - * @param array $args |
|
75 | - * @param array $widget_args |
|
76 | - * @param string $content |
|
77 | - * |
|
78 | - * @return string |
|
79 | - */ |
|
71 | + /** |
|
72 | + * The Super block output function. |
|
73 | + * |
|
74 | + * @param array $args |
|
75 | + * @param array $widget_args |
|
76 | + * @param string $content |
|
77 | + * |
|
78 | + * @return string |
|
79 | + */ |
|
80 | 80 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
81 | 81 | |
82 | - $defaults = array( |
|
83 | - 'items' => '', // should be used like: item_id|quantity,item_id|quantity,item_id|quantity |
|
84 | - 'label' => __( 'Buy Now', 'invoicing' ), // the button title |
|
85 | - 'post_id' => '', // any related post_id |
|
86 | - ); |
|
82 | + $defaults = array( |
|
83 | + 'items' => '', // should be used like: item_id|quantity,item_id|quantity,item_id|quantity |
|
84 | + 'label' => __( 'Buy Now', 'invoicing' ), // the button title |
|
85 | + 'post_id' => '', // any related post_id |
|
86 | + ); |
|
87 | 87 | |
88 | - /** |
|
89 | - * Parse incoming $args into an array and merge it with $defaults |
|
90 | - */ |
|
91 | - $args = wp_parse_args( $args, $defaults ); |
|
88 | + /** |
|
89 | + * Parse incoming $args into an array and merge it with $defaults |
|
90 | + */ |
|
91 | + $args = wp_parse_args( $args, $defaults ); |
|
92 | 92 | |
93 | - $html = '<div class="wpi-buy-button-wrapper wpi-g">'; |
|
93 | + $html = '<div class="wpi-buy-button-wrapper wpi-g">'; |
|
94 | 94 | |
95 | - if ( empty( $args['items'] ) ) { |
|
96 | - $html .= __( 'No items selected', 'invoicing' ); |
|
97 | - } else { |
|
98 | - $post_id = isset( $args['post_id'] ) && is_numeric( $args['post_id'] ) ? sanitize_text_field( $args['post_id'] ) : 0; |
|
99 | - $label = isset( $args['label'] ) ? sanitize_text_field( $args['label'] ) : __( 'Buy Now', 'invoicing' ); |
|
100 | - $items = esc_attr( $args['items'] ); |
|
101 | - $html .= "<button class='button button-primary wpi-buy-button' type='button' onclick=\"wpi_buy(this, '$items','$post_id');\">$label</button>"; |
|
102 | - } |
|
95 | + if ( empty( $args['items'] ) ) { |
|
96 | + $html .= __( 'No items selected', 'invoicing' ); |
|
97 | + } else { |
|
98 | + $post_id = isset( $args['post_id'] ) && is_numeric( $args['post_id'] ) ? sanitize_text_field( $args['post_id'] ) : 0; |
|
99 | + $label = isset( $args['label'] ) ? sanitize_text_field( $args['label'] ) : __( 'Buy Now', 'invoicing' ); |
|
100 | + $items = esc_attr( $args['items'] ); |
|
101 | + $html .= "<button class='button button-primary wpi-buy-button' type='button' onclick=\"wpi_buy(this, '$items','$post_id');\">$label</button>"; |
|
102 | + } |
|
103 | 103 | |
104 | - $html .= wp_nonce_field( 'wpinv_buy_items', 'wpinv_buy_nonce', true, false ); |
|
105 | - $html .= '</div>'; |
|
104 | + $html .= wp_nonce_field( 'wpinv_buy_items', 'wpinv_buy_nonce', true, false ); |
|
105 | + $html .= '</div>'; |
|
106 | 106 | |
107 | - return $html; |
|
107 | + return $html; |
|
108 | 108 | |
109 | 109 | } |
110 | 110 |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | 'advanced' => false, |
37 | 37 | ), |
38 | 38 | 'id' => array( |
39 | - 'title' => __( 'Invoice', 'invoicing' ), |
|
40 | - 'desc' => __( 'Enter the invoice ID', 'invoicing' ), |
|
41 | - 'type' => 'text', |
|
42 | - 'desc_tip' => true, |
|
43 | - 'default' => '', |
|
44 | - 'placeholder' => __( '1', 'invoicing' ), |
|
45 | - 'advanced' => false, |
|
46 | - ), |
|
39 | + 'title' => __( 'Invoice', 'invoicing' ), |
|
40 | + 'desc' => __( 'Enter the invoice ID', 'invoicing' ), |
|
41 | + 'type' => 'text', |
|
42 | + 'desc_tip' => true, |
|
43 | + 'default' => '', |
|
44 | + 'placeholder' => __( '1', 'invoicing' ), |
|
45 | + 'advanced' => false, |
|
46 | + ), |
|
47 | 47 | ), |
48 | 48 | |
49 | 49 | ); |
@@ -51,26 +51,26 @@ discard block |
||
51 | 51 | parent::__construct( $options ); |
52 | 52 | } |
53 | 53 | |
54 | - /** |
|
55 | - * The Super block output function. |
|
56 | - * |
|
57 | - * @param array $args |
|
58 | - * @param array $widget_args |
|
59 | - * @param string $content |
|
60 | - * |
|
61 | - * @return mixed|string|bool |
|
62 | - */ |
|
54 | + /** |
|
55 | + * The Super block output function. |
|
56 | + * |
|
57 | + * @param array $args |
|
58 | + * @param array $widget_args |
|
59 | + * @param string $content |
|
60 | + * |
|
61 | + * @return mixed|string|bool |
|
62 | + */ |
|
63 | 63 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
64 | 64 | |
65 | 65 | // Is the shortcode set up correctly? |
66 | - if ( empty( $args['id'] ) ) { |
|
67 | - return aui()->alert( |
|
68 | - array( |
|
69 | - 'type' => 'warning', |
|
70 | - 'content' => __( 'Missing invoice ID', 'invoicing' ), |
|
71 | - ) |
|
72 | - ); |
|
73 | - } |
|
66 | + if ( empty( $args['id'] ) ) { |
|
67 | + return aui()->alert( |
|
68 | + array( |
|
69 | + 'type' => 'warning', |
|
70 | + 'content' => __( 'Missing invoice ID', 'invoicing' ), |
|
71 | + ) |
|
72 | + ); |
|
73 | + } |
|
74 | 74 | |
75 | 75 | $invoice = wpinv_get_invoice( (int) $args['id'] ); |
76 | 76 |
@@ -36,36 +36,36 @@ discard block |
||
36 | 36 | 'desc_tip' => true, |
37 | 37 | 'default' => '', |
38 | 38 | 'advanced' => false, |
39 | - ), |
|
39 | + ), |
|
40 | 40 | |
41 | 41 | 'form' => array( |
42 | - 'title' => __( 'Form', 'invoicing' ), |
|
43 | - 'desc' => __( 'Enter a form id in case you want to display a specific payment form', 'invoicing' ), |
|
44 | - 'type' => 'text', |
|
45 | - 'desc_tip' => true, |
|
46 | - 'default' => '', |
|
47 | - 'placeholder' => __( '1', 'invoicing' ), |
|
48 | - 'advanced' => false, |
|
49 | - ), |
|
50 | - |
|
51 | - 'item' => array( |
|
52 | - 'title' => __( 'Items', 'invoicing' ), |
|
53 | - 'desc' => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2. This will be ignored in case you specify a form above. Enter 0 as the quantity to let users select their own quantities', 'invoicing' ), |
|
54 | - 'type' => 'text', |
|
55 | - 'desc_tip' => true, |
|
56 | - 'default' => '', |
|
57 | - 'placeholder' => __( '1', 'invoicing' ), |
|
58 | - 'advanced' => false, |
|
59 | - ), |
|
42 | + 'title' => __( 'Form', 'invoicing' ), |
|
43 | + 'desc' => __( 'Enter a form id in case you want to display a specific payment form', 'invoicing' ), |
|
44 | + 'type' => 'text', |
|
45 | + 'desc_tip' => true, |
|
46 | + 'default' => '', |
|
47 | + 'placeholder' => __( '1', 'invoicing' ), |
|
48 | + 'advanced' => false, |
|
49 | + ), |
|
50 | + |
|
51 | + 'item' => array( |
|
52 | + 'title' => __( 'Items', 'invoicing' ), |
|
53 | + 'desc' => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2. This will be ignored in case you specify a form above. Enter 0 as the quantity to let users select their own quantities', 'invoicing' ), |
|
54 | + 'type' => 'text', |
|
55 | + 'desc_tip' => true, |
|
56 | + 'default' => '', |
|
57 | + 'placeholder' => __( '1', 'invoicing' ), |
|
58 | + 'advanced' => false, |
|
59 | + ), |
|
60 | 60 | |
61 | 61 | 'button' => array( |
62 | - 'title' => __( 'Button', 'invoicing' ), |
|
63 | - 'desc' => __( 'Enter button label in case you would like to display the forms in a popup.', 'invoicing' ), |
|
64 | - 'type' => 'text', |
|
65 | - 'desc_tip' => true, |
|
66 | - 'default' => '', |
|
67 | - 'advanced' => false, |
|
68 | - ), |
|
62 | + 'title' => __( 'Button', 'invoicing' ), |
|
63 | + 'desc' => __( 'Enter button label in case you would like to display the forms in a popup.', 'invoicing' ), |
|
64 | + 'type' => 'text', |
|
65 | + 'desc_tip' => true, |
|
66 | + 'default' => '', |
|
67 | + 'advanced' => false, |
|
68 | + ), |
|
69 | 69 | |
70 | 70 | ), |
71 | 71 | |
@@ -74,96 +74,96 @@ discard block |
||
74 | 74 | parent::__construct( $options ); |
75 | 75 | } |
76 | 76 | |
77 | - /** |
|
78 | - * The Super block output function. |
|
79 | - * |
|
80 | - * @param array $args |
|
81 | - * @param array $widget_args |
|
82 | - * @param string $content |
|
83 | - * |
|
84 | - * @return string |
|
85 | - */ |
|
77 | + /** |
|
78 | + * The Super block output function. |
|
79 | + * |
|
80 | + * @param array $args |
|
81 | + * @param array $widget_args |
|
82 | + * @param string $content |
|
83 | + * |
|
84 | + * @return string |
|
85 | + */ |
|
86 | 86 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
87 | 87 | |
88 | - // Is the shortcode set up correctly? |
|
89 | - if ( empty( $args['form'] ) && empty( $args['item'] ) ) { |
|
90 | - return aui()->alert( |
|
91 | - array( |
|
92 | - 'type' => 'warning', |
|
93 | - 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
94 | - ) |
|
95 | - ); |
|
96 | - } |
|
97 | - |
|
98 | - // Payment form or button? |
|
99 | - if ( ! empty( $args['form'] ) ) { |
|
100 | - return $this->handle_payment_form( $args ); |
|
101 | - } else { |
|
102 | - return $this->handle_buy_item( $args ); |
|
103 | - } |
|
104 | - |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * Displaying a payment form |
|
109 | - * |
|
110 | - * @return string |
|
111 | - */ |
|
88 | + // Is the shortcode set up correctly? |
|
89 | + if ( empty( $args['form'] ) && empty( $args['item'] ) ) { |
|
90 | + return aui()->alert( |
|
91 | + array( |
|
92 | + 'type' => 'warning', |
|
93 | + 'content' => __( 'No payment form or item selected', 'invoicing' ), |
|
94 | + ) |
|
95 | + ); |
|
96 | + } |
|
97 | + |
|
98 | + // Payment form or button? |
|
99 | + if ( ! empty( $args['form'] ) ) { |
|
100 | + return $this->handle_payment_form( $args ); |
|
101 | + } else { |
|
102 | + return $this->handle_buy_item( $args ); |
|
103 | + } |
|
104 | + |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * Displaying a payment form |
|
109 | + * |
|
110 | + * @return string |
|
111 | + */ |
|
112 | 112 | protected function handle_payment_form( $args = array() ) { |
113 | 113 | |
114 | - if ( empty( $args['button'] ) ) { |
|
115 | - ob_start(); |
|
116 | - getpaid_display_payment_form( $args['form'] ); |
|
117 | - return ob_get_clean(); |
|
118 | - } |
|
114 | + if ( empty( $args['button'] ) ) { |
|
115 | + ob_start(); |
|
116 | + getpaid_display_payment_form( $args['form'] ); |
|
117 | + return ob_get_clean(); |
|
118 | + } |
|
119 | 119 | |
120 | - return $this->payment_form_button( $args['form'], $args['button'] ); |
|
121 | - } |
|
120 | + return $this->payment_form_button( $args['form'], $args['button'] ); |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
124 | - * Displays a payment form button. |
|
125 | - * |
|
126 | - * @return string |
|
127 | - */ |
|
123 | + /** |
|
124 | + * Displays a payment form button. |
|
125 | + * |
|
126 | + * @return string |
|
127 | + */ |
|
128 | 128 | protected function payment_form_button( $form, $button ) { |
129 | - return getpaid_get_payment_button( $button, $form ); |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * Selling an item |
|
134 | - * |
|
135 | - * @return string |
|
136 | - */ |
|
129 | + return getpaid_get_payment_button( $button, $form ); |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * Selling an item |
|
134 | + * |
|
135 | + * @return string |
|
136 | + */ |
|
137 | 137 | protected function handle_buy_item( $args = array() ) { |
138 | 138 | |
139 | - if ( empty( $args['button'] ) ) { |
|
140 | - return $this->buy_item_form( $args['item'] ); |
|
141 | - } |
|
139 | + if ( empty( $args['button'] ) ) { |
|
140 | + return $this->buy_item_form( $args['item'] ); |
|
141 | + } |
|
142 | 142 | |
143 | - return $this->buy_item_button( $args['item'], $args['button'] ); |
|
143 | + return $this->buy_item_button( $args['item'], $args['button'] ); |
|
144 | 144 | |
145 | - } |
|
145 | + } |
|
146 | 146 | |
147 | - /** |
|
148 | - * Displays a buy item form. |
|
149 | - * |
|
150 | - * @return string |
|
151 | - */ |
|
147 | + /** |
|
148 | + * Displays a buy item form. |
|
149 | + * |
|
150 | + * @return string |
|
151 | + */ |
|
152 | 152 | protected function buy_item_form( $item ) { |
153 | - $items = getpaid_convert_items_to_array( $item ); |
|
154 | - ob_start(); |
|
155 | - getpaid_display_item_payment_form( $items ); |
|
156 | - return ob_get_clean(); |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * Displays a buy item button. |
|
161 | - * |
|
162 | - * @return string |
|
163 | - */ |
|
153 | + $items = getpaid_convert_items_to_array( $item ); |
|
154 | + ob_start(); |
|
155 | + getpaid_display_item_payment_form( $items ); |
|
156 | + return ob_get_clean(); |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * Displays a buy item button. |
|
161 | + * |
|
162 | + * @return string |
|
163 | + */ |
|
164 | 164 | protected function buy_item_button( $item, $button ) { |
165 | - $button = getpaid_get_payment_button( $button, null, $item ); |
|
166 | - return apply_filters( 'getpaid_buy_item_button_widget', $button, $item ); |
|
165 | + $button = getpaid_get_payment_button( $button, null, $item ); |
|
166 | + return apply_filters( 'getpaid_buy_item_button_widget', $button, $item ); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | } |
@@ -32,34 +32,34 @@ discard block |
||
32 | 32 | // Item name. |
33 | 33 | if ( 'name' == $column ) { |
34 | 34 | |
35 | - // Display the name. |
|
36 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
35 | + // Display the name. |
|
36 | + echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
37 | 37 | |
38 | - // And an optional description. |
|
39 | - $description = $item->get_description(); |
|
38 | + // And an optional description. |
|
39 | + $description = $item->get_description(); |
|
40 | 40 | |
41 | - if ( ! empty( $description ) ) { |
|
42 | - $description = wp_kses_post( $description ); |
|
43 | - echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
|
41 | + if ( ! empty( $description ) ) { |
|
42 | + $description = wp_kses_post( $description ); |
|
43 | + echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
|
44 | 44 | } |
45 | 45 | |
46 | - // Fires before printing the line item actions. |
|
47 | - do_action( 'getpaid_before_invoice_line_item_actions', $item, $invoice ); |
|
46 | + // Fires before printing the line item actions. |
|
47 | + do_action( 'getpaid_before_invoice_line_item_actions', $item, $invoice ); |
|
48 | 48 | |
49 | - $actions = apply_filters( 'getpaid-invoice-page-line-item-actions', array(), $item, $invoice ); |
|
49 | + $actions = apply_filters( 'getpaid-invoice-page-line-item-actions', array(), $item, $invoice ); |
|
50 | 50 | |
51 | - if ( ! empty( $actions ) ) { |
|
51 | + if ( ! empty( $actions ) ) { |
|
52 | 52 | |
53 | - $sanitized = array(); |
|
54 | - foreach ( $actions as $key => $action ) { |
|
55 | - $key = sanitize_html_class( $key ); |
|
56 | - $action = wp_kses_post( $action ); |
|
57 | - $sanitized[] = "<span class='$key'>$action</span>"; |
|
53 | + $sanitized = array(); |
|
54 | + foreach ( $actions as $key => $action ) { |
|
55 | + $key = sanitize_html_class( $key ); |
|
56 | + $action = wp_kses_post( $action ); |
|
57 | + $sanitized[] = "<span class='$key'>$action</span>"; |
|
58 | 58 | } |
59 | 59 | |
60 | - echo "<small class='form-text getpaid-line-item-actions'>"; |
|
61 | - echo implode( ' | ', $sanitized ); |
|
62 | - echo '</small>'; |
|
60 | + echo "<small class='form-text getpaid-line-item-actions'>"; |
|
61 | + echo implode( ' | ', $sanitized ); |
|
62 | + echo '</small>'; |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | } |
@@ -67,26 +67,26 @@ discard block |
||
67 | 67 | // Item price. |
68 | 68 | if ( 'price' == $column ) { |
69 | 69 | |
70 | - // Display the item price (or recurring price if this is a renewal invoice) |
|
71 | - $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price(); |
|
72 | - echo wpinv_price( $price, $invoice->get_currency() ); |
|
70 | + // Display the item price (or recurring price if this is a renewal invoice) |
|
71 | + $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price(); |
|
72 | + echo wpinv_price( $price, $invoice->get_currency() ); |
|
73 | 73 | |
74 | 74 | } |
75 | 75 | |
76 | 76 | // Tax rate. |
77 | 77 | if ( 'tax_rate' == $column ) { |
78 | - echo round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) . '%'; |
|
78 | + echo round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) . '%'; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | // Item quantity. |
82 | 82 | if ( 'quantity' == $column ) { |
83 | - echo (float) $item->get_quantity(); |
|
83 | + echo (float) $item->get_quantity(); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // Item sub total. |
87 | 87 | if ( 'subtotal' == $column ) { |
88 | - $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total(); |
|
89 | - echo wpinv_price( $subtotal, $invoice->get_currency() ); |
|
88 | + $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total(); |
|
89 | + echo wpinv_price( $subtotal, $invoice->get_currency() ); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | // Fires when printing a line item column. |
@@ -37,42 +37,42 @@ |
||
37 | 37 | |
38 | 38 | // Total tax. |
39 | 39 | if ( 'tax' == $key ) { |
40 | - echo wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ); |
|
40 | + echo wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ); |
|
41 | 41 | |
42 | - if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) { |
|
42 | + if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) { |
|
43 | 43 | |
44 | - $taxes = $invoice->get_total_tax(); |
|
45 | - if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) { |
|
46 | - echo ' <em class="text-muted small">'; |
|
47 | - _x( '(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing' ); |
|
48 | - echo '</em>'; |
|
44 | + $taxes = $invoice->get_total_tax(); |
|
45 | + if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) { |
|
46 | + echo ' <em class="text-muted small">'; |
|
47 | + _x( '(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing' ); |
|
48 | + echo '</em>'; |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | 53 | // Total Fee. |
54 | 54 | if ( 'fee' == $key ) { |
55 | - echo wpinv_price( $invoice->get_total_fees(), $invoice->get_currency() ); |
|
55 | + echo wpinv_price( $invoice->get_total_fees(), $invoice->get_currency() ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | // Total discount. |
59 | 59 | if ( 'discount' == $key ) { |
60 | - echo wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ); |
|
60 | + echo wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // Shipping. |
64 | 64 | if ( 'shipping' == $key ) { |
65 | - echo wpinv_price( $invoice->get_shipping(), $invoice->get_currency() ); |
|
65 | + echo wpinv_price( $invoice->get_shipping(), $invoice->get_currency() ); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // Sub total. |
69 | 69 | if ( 'subtotal' == $key ) { |
70 | - echo wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ); |
|
70 | + echo wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Total. |
74 | 74 | if ( 'total' == $key ) { |
75 | - echo wpinv_price( $invoice->get_total(), $invoice->get_currency() ); |
|
75 | + echo wpinv_price( $invoice->get_total(), $invoice->get_currency() ); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | // Fires when printing a cart total. |
@@ -31,44 +31,44 @@ |
||
31 | 31 | // Item name. |
32 | 32 | if ( 'name' == $column ) { |
33 | 33 | |
34 | - // Display the name. |
|
35 | - echo '<div class="mb-1">' . esc_html( $fee['name'] ) . '</div>'; |
|
34 | + // Display the name. |
|
35 | + echo '<div class="mb-1">' . esc_html( $fee['name'] ) . '</div>'; |
|
36 | 36 | |
37 | - // And an optional description. |
|
38 | - $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] ); |
|
39 | - echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
|
37 | + // And an optional description. |
|
38 | + $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] ); |
|
39 | + echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
|
40 | 40 | |
41 | 41 | } |
42 | 42 | |
43 | 43 | // Item price. |
44 | 44 | if ( 'price' == $column ) { |
45 | 45 | |
46 | - // Display the item price (or recurring price if this is a renewal invoice) |
|
47 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
48 | - echo wpinv_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
46 | + // Display the item price (or recurring price if this is a renewal invoice) |
|
47 | + if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
48 | + echo wpinv_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
49 | 49 | } else { |
50 | - echo wpinv_price( $fee['initial_fee'], $invoice->get_currency() ); |
|
50 | + echo wpinv_price( $fee['initial_fee'], $invoice->get_currency() ); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | 54 | // Item quantity. |
55 | 55 | if ( 'quantity' == $column ) { |
56 | - echo '—'; |
|
56 | + echo '—'; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Item tax. |
60 | 60 | if ( 'tax_rate' == $column ) { |
61 | - echo '—'; |
|
61 | + echo '—'; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | // Item sub total. |
65 | 65 | if ( 'subtotal' == $column ) { |
66 | 66 | |
67 | - // Display the item price (or recurring price if this is a renewal invoice) |
|
68 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
69 | - echo wpinv_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
67 | + // Display the item price (or recurring price if this is a renewal invoice) |
|
68 | + if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
69 | + echo wpinv_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
70 | 70 | } else { |
71 | - echo wpinv_price( $fee['initial_fee'], $invoice->get_currency() ); |
|
71 | + echo wpinv_price( $fee['initial_fee'], $invoice->get_currency() ); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 |
@@ -33,12 +33,12 @@ |
||
33 | 33 | |
34 | 34 | // Display the item totals. |
35 | 35 | foreach ( $invoice->get_items() as $item ) { |
36 | - wpinv_get_template( 'invoice/line-item.php', compact( 'invoice', 'item', 'columns' ) ); |
|
36 | + wpinv_get_template( 'invoice/line-item.php', compact( 'invoice', 'item', 'columns' ) ); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Display the fee totals. |
40 | 40 | foreach ( $invoice->get_fees() as $fee ) { |
41 | - wpinv_get_template( 'invoice/fee-item.php', compact( 'invoice', 'fee', 'columns' ) ); |
|
41 | + wpinv_get_template( 'invoice/fee-item.php', compact( 'invoice', 'fee', 'columns' ) ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // Display the cart totals. |
@@ -40,19 +40,19 @@ |
||
40 | 40 | <?php |
41 | 41 | |
42 | 42 | if ( ! $invoice->exists() || $invoice->is_draft() ) { |
43 | - $error = __( 'This invoice was deleted or is not visible.', 'invoicing' ); |
|
43 | + $error = __( 'This invoice was deleted or is not visible.', 'invoicing' ); |
|
44 | 44 | } else { |
45 | 45 | |
46 | - $user_id = get_current_user_id(); |
|
47 | - if ( wpinv_require_login_to_checkout() && empty( $user_id ) ) { |
|
48 | - $error = __( 'You must be logged in to view this invoice.', 'invoicing' ); |
|
49 | - $error .= sprintf( |
|
50 | - ' <a href="%s">%s</a>', |
|
51 | - wp_login_url( $invoice->get_view_url() ), |
|
52 | - __( 'Login.', 'invoicing' ) |
|
53 | - ); |
|
54 | - } else { |
|
55 | - $error = __( 'This invoice is only viewable by clicking on the invoice link that was sent to you via email.', 'invoicing' ); |
|
46 | + $user_id = get_current_user_id(); |
|
47 | + if ( wpinv_require_login_to_checkout() && empty( $user_id ) ) { |
|
48 | + $error = __( 'You must be logged in to view this invoice.', 'invoicing' ); |
|
49 | + $error .= sprintf( |
|
50 | + ' <a href="%s">%s</a>', |
|
51 | + wp_login_url( $invoice->get_view_url() ), |
|
52 | + __( 'Login.', 'invoicing' ) |
|
53 | + ); |
|
54 | + } else { |
|
55 | + $error = __( 'This invoice is only viewable by clicking on the invoice link that was sent to you via email.', 'invoicing' ); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 |