@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -16,82 +16,82 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class GetPaid_Meta_Box_Invoice_Items { |
18 | 18 | |
19 | - public static function get_columns( $invoice ) { |
|
19 | + public static function get_columns($invoice) { |
|
20 | 20 | $use_taxes = $invoice->is_taxable() && wpinv_use_taxes(); |
21 | 21 | $columns = array( |
22 | - 'id' => __( 'ID', 'invoicing' ), |
|
23 | - 'title' => __( 'Item', 'invoicing' ), |
|
22 | + 'id' => __('ID', 'invoicing'), |
|
23 | + 'title' => __('Item', 'invoicing'), |
|
24 | 24 | 'price' => sprintf( |
25 | 25 | '<span class="getpaid-hide-if-hours getpaid-hide-if-quantity">%s</span> |
26 | 26 | <span class="getpaid-hide-if-hours hide-if-amount">%s</span> |
27 | 27 | <span class="getpaid-hide-if-quantity hide-if-amount">%s</span>', |
28 | - __( 'Amount', 'invoicing' ), |
|
29 | - __( 'Price', 'invoicing' ), |
|
30 | - __( 'Rate', 'invoicing' ) |
|
28 | + __('Amount', 'invoicing'), |
|
29 | + __('Price', 'invoicing'), |
|
30 | + __('Rate', 'invoicing') |
|
31 | 31 | ), |
32 | 32 | 'qty' => sprintf( |
33 | 33 | '<span class="getpaid-hide-if-hours">%s</span><span class="getpaid-hide-if-quantity">%s</span>', |
34 | - __( 'Quantity', 'invoicing' ), |
|
35 | - __( 'Hours', 'invoicing' ) |
|
34 | + __('Quantity', 'invoicing'), |
|
35 | + __('Hours', 'invoicing') |
|
36 | 36 | ), |
37 | - 'total' => __( 'Total', 'invoicing' ), |
|
38 | - 'tax' => __( 'Tax (%)', 'invoicing' ), |
|
37 | + 'total' => __('Total', 'invoicing'), |
|
38 | + 'tax' => __('Tax (%)', 'invoicing'), |
|
39 | 39 | 'action' => '', |
40 | 40 | ); |
41 | 41 | |
42 | - if ( ! $use_taxes ) { |
|
43 | - unset( $columns['tax'] ); |
|
42 | + if (!$use_taxes) { |
|
43 | + unset($columns['tax']); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | return $columns; |
47 | 47 | } |
48 | 48 | |
49 | - public static function output( $post, $invoice = false ) { |
|
49 | + public static function output($post, $invoice = false) { |
|
50 | 50 | |
51 | - if ( apply_filters( 'getpaid_use_new_invoice_items_metabox', false ) ) { |
|
52 | - return self::output2( $post ); |
|
51 | + if (apply_filters('getpaid_use_new_invoice_items_metabox', false)) { |
|
52 | + return self::output2($post); |
|
53 | 53 | } |
54 | 54 | |
55 | - $post_id = !empty( $post->ID ) ? $post->ID : 0; |
|
56 | - $invoice = $invoice instanceof WPInv_Invoice ? $invoice : new WPInv_Invoice( $post_id ); |
|
55 | + $post_id = !empty($post->ID) ? $post->ID : 0; |
|
56 | + $invoice = $invoice instanceof WPInv_Invoice ? $invoice : new WPInv_Invoice($post_id); |
|
57 | 57 | $use_taxes = $invoice->is_taxable() && wpinv_use_taxes(); |
58 | - $item_types = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post ); |
|
59 | - $columns = self::get_columns( $invoice ); |
|
60 | - $cols = count( $columns ); |
|
58 | + $item_types = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post); |
|
59 | + $columns = self::get_columns($invoice); |
|
60 | + $cols = count($columns); |
|
61 | 61 | $class = ''; |
62 | 62 | |
63 | - unset( $item_types['adv'] ); |
|
64 | - unset( $item_types['package'] ); |
|
63 | + unset($item_types['adv']); |
|
64 | + unset($item_types['package']); |
|
65 | 65 | |
66 | - if ( $invoice->is_paid() ) { |
|
66 | + if ($invoice->is_paid()) { |
|
67 | 67 | $class .= ' wpinv-paid'; |
68 | 68 | } |
69 | 69 | |
70 | - if ( $invoice->is_refunded() ) { |
|
70 | + if ($invoice->is_refunded()) { |
|
71 | 71 | $class .= ' wpinv-refunded'; |
72 | 72 | } |
73 | 73 | |
74 | - if ( $invoice->is_recurring() ) { |
|
74 | + if ($invoice->is_recurring()) { |
|
75 | 75 | $class .= ' wpi-recurring'; |
76 | 76 | } |
77 | 77 | |
78 | 78 | ?> |
79 | 79 | |
80 | - <div class="wpinv-items-wrap<?php echo $class; ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr( $invoice->get_status() ); ?>"> |
|
80 | + <div class="wpinv-items-wrap<?php echo $class; ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr($invoice->get_status()); ?>"> |
|
81 | 81 | <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0"> |
82 | 82 | |
83 | 83 | <thead> |
84 | 84 | <tr> |
85 | - <?php foreach ( $columns as $key => $label ) : ?> |
|
86 | - <th class="<?php echo esc_attr( $key ); echo 'total' == $key || 'qty' == $key ? ' hide-if-amount' : '' ?>"><?php echo wp_kses_post( $label ); ?></th> |
|
85 | + <?php foreach ($columns as $key => $label) : ?> |
|
86 | + <th class="<?php echo esc_attr($key); echo 'total' == $key || 'qty' == $key ? ' hide-if-amount' : '' ?>"><?php echo wp_kses_post($label); ?></th> |
|
87 | 87 | <?php endforeach; ?> |
88 | 88 | </tr> |
89 | 89 | </thead> |
90 | 90 | |
91 | 91 | <tbody class="wpinv-line-items"> |
92 | 92 | <?php |
93 | - foreach ( $invoice->get_items() as $int => $item ) { |
|
94 | - self::output_row( $columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd' ); |
|
93 | + foreach ($invoice->get_items() as $int => $item) { |
|
94 | + self::output_row($columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd'); |
|
95 | 95 | } |
96 | 96 | ?> |
97 | 97 | </tbody> |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | <div class="wp-clearfix"> |
109 | 109 | <label class="wpi-item-name"> |
110 | 110 | <span class="input-text-wrap"> |
111 | - <input type="text" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' );?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]"> |
|
111 | + <input type="text" style="width: 100%" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]"> |
|
112 | 112 | </span> |
113 | 113 | </label> |
114 | 114 | </div> |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | <div class="wp-clearfix"> |
117 | 117 | <label class="wpi-item-price"> |
118 | 118 | <span class="input-text-wrap"> |
119 | - <input type="text" style="width: 200px" placeholder="<?php esc_attr_e( 'Item Price', 'invoicing' );?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]"> |
|
120 | - × <input type="text" style="width: 140px" placeholder="<?php esc_attr_e( 'Item Quantity', 'invoicing' );?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]"> |
|
119 | + <input type="text" style="width: 200px" placeholder="<?php esc_attr_e('Item Price', 'invoicing'); ?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]"> |
|
120 | + × <input type="text" style="width: 140px" placeholder="<?php esc_attr_e('Item Quantity', 'invoicing'); ?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]"> |
|
121 | 121 | </span> |
122 | 122 | </label> |
123 | 123 | </div> |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | <div class="wp-clearfix"> |
126 | 126 | <label class="wpi-item-name"> |
127 | 127 | <span class="input-text-wrap"> |
128 | - <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Description', 'invoicing' );?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea> |
|
128 | + <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e('Item Description', 'invoicing'); ?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea> |
|
129 | 129 | </span> |
130 | 130 | </label> |
131 | 131 | </div> |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | <div class="wp-clearfix"> |
134 | 134 | <label class="wpi-item-type"> |
135 | 135 | <span class="input-text-wrap"> |
136 | - <?php echo wpinv_html_select( array( |
|
136 | + <?php echo wpinv_html_select(array( |
|
137 | 137 | 'options' => $item_types, |
138 | 138 | 'name' => '_wpinv_quick[type]', |
139 | 139 | 'id' => '_wpinv_quick_type', |
@@ -141,19 +141,19 @@ discard block |
||
141 | 141 | 'show_option_all' => false, |
142 | 142 | 'show_option_none' => false, |
143 | 143 | 'class' => 'gdmbx2-text-medium wpinv-quick-type', |
144 | - ) ); ?> |
|
144 | + )); ?> |
|
145 | 145 | </span> |
146 | 146 | </label> |
147 | 147 | </div> |
148 | 148 | |
149 | - <?php if ( $use_taxes ) : ?> |
|
149 | + <?php if ($use_taxes) : ?> |
|
150 | 150 | <div class="wp-clearfix"> |
151 | 151 | <label class="wpi-vat-rule"> |
152 | 152 | <span class="input-text-wrap"> |
153 | 153 | <?php |
154 | - echo wpinv_html_select( array( |
|
154 | + echo wpinv_html_select(array( |
|
155 | 155 | 'options' => array_merge( |
156 | - array( '' => __( 'Select VAT Rule', 'invoicing' ) ), |
|
156 | + array('' => __('Select VAT Rule', 'invoicing')), |
|
157 | 157 | getpaid_get_tax_rules() |
158 | 158 | ), |
159 | 159 | 'name' => '_wpinv_quick[vat_rule]', |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | 'show_option_all' => false, |
162 | 162 | 'show_option_none' => false, |
163 | 163 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-rule', |
164 | - ) ); |
|
164 | + )); |
|
165 | 165 | ?> |
166 | 166 | </span> |
167 | 167 | </label> |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | <label class="wpi-vat-class"> |
171 | 171 | <span class="input-text-wrap"> |
172 | 172 | <?php |
173 | - echo wpinv_html_select( array( |
|
173 | + echo wpinv_html_select(array( |
|
174 | 174 | 'options' => array_merge( |
175 | - array( '' => __( 'Select VAT Class', 'invoicing' ) ), |
|
175 | + array('' => __('Select VAT Class', 'invoicing')), |
|
176 | 176 | getpaid_get_tax_classes() |
177 | 177 | ), |
178 | 178 | 'name' => '_wpinv_quick[vat_class]', |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | 'show_option_all' => false, |
181 | 181 | 'show_option_none' => false, |
182 | 182 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-class', |
183 | - ) ); |
|
183 | + )); |
|
184 | 184 | ?> |
185 | 185 | </span> |
186 | 186 | </label> |
@@ -201,29 +201,29 @@ discard block |
||
201 | 201 | </td> |
202 | 202 | </tr> |
203 | 203 | <tr class="totals"> |
204 | - <td colspan="<?php echo ( $cols - 4 ); ?>"></td> |
|
204 | + <td colspan="<?php echo ($cols - 4); ?>"></td> |
|
205 | 205 | <td colspan="4"> |
206 | 206 | <table cellspacing="0" cellpadding="0"> |
207 | 207 | <tr class="subtotal"> |
208 | - <td class="name"><?php _e( 'Sub Total:', 'invoicing' );?></td> |
|
209 | - <td class="total"><?php echo wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() );?></td> |
|
208 | + <td class="name"><?php _e('Sub Total:', 'invoicing'); ?></td> |
|
209 | + <td class="total"><?php echo wpinv_price($invoice->get_subtotal(), $invoice->get_currency()); ?></td> |
|
210 | 210 | <td class="action"></td> |
211 | 211 | </tr> |
212 | 212 | <tr class="discount"> |
213 | - <td class="name"><?php _e( 'Discount:', 'invoicing' ) ; ?></td> |
|
214 | - <td class="total"><?php echo wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() );?></td> |
|
213 | + <td class="name"><?php _e('Discount:', 'invoicing'); ?></td> |
|
214 | + <td class="total"><?php echo wpinv_price($invoice->get_total_discount(), $invoice->get_currency()); ?></td> |
|
215 | 215 | <td class="action"></td> |
216 | 216 | </tr> |
217 | - <?php if ( $use_taxes ) : ?> |
|
217 | + <?php if ($use_taxes) : ?> |
|
218 | 218 | <tr class="tax"> |
219 | - <td class="name"><?php _e( 'Tax:', 'invoicing' );?></td> |
|
220 | - <td class="total"><?php echo wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() );?></td> |
|
219 | + <td class="name"><?php _e('Tax:', 'invoicing'); ?></td> |
|
220 | + <td class="total"><?php echo wpinv_price($invoice->get_total_tax(), $invoice->get_currency()); ?></td> |
|
221 | 221 | <td class="action"></td> |
222 | 222 | </tr> |
223 | 223 | <?php endif; ?> |
224 | 224 | <tr class="total"> |
225 | - <td class="name"><?php _e( 'Total:', 'invoicing' );?></td> |
|
226 | - <td class="total"><?php echo wpinv_price( $invoice->get_total(), $invoice->get_currency() );?></td> |
|
225 | + <td class="name"><?php _e('Total:', 'invoicing'); ?></td> |
|
226 | + <td class="total"><?php echo wpinv_price($invoice->get_total(), $invoice->get_currency()); ?></td> |
|
227 | 227 | <td class="action"></td> |
228 | 228 | </tr> |
229 | 229 | </table> |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | </table> |
235 | 235 | <div class="wpinv-actions"> |
236 | 236 | <?php |
237 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
237 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
238 | 238 | echo wpinv_item_dropdown( |
239 | 239 | array( |
240 | 240 | 'name' => 'wpinv_invoice_item', |
@@ -244,61 +244,61 @@ discard block |
||
244 | 244 | ) |
245 | 245 | ); |
246 | 246 | |
247 | - echo " " . '<button class="button button-primary" id="wpinv-add-item">' . sprintf( esc_html__( 'Add item to %s', 'invoicing' ), $invoice->get_label() ) . '</button>'; |
|
248 | - echo " " . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__( 'Create new item', 'invoicing' ) . '</button>'; |
|
249 | - echo " " . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__( 'Recalculate Totals', 'invoicing' ) . '</button>'; |
|
247 | + echo " " . '<button class="button button-primary" id="wpinv-add-item">' . sprintf(esc_html__('Add item to %s', 'invoicing'), $invoice->get_label()) . '</button>'; |
|
248 | + echo " " . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__('Create new item', 'invoicing') . '</button>'; |
|
249 | + echo " " . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__('Recalculate Totals', 'invoicing') . '</button>'; |
|
250 | 250 | |
251 | 251 | } |
252 | 252 | ?> |
253 | - <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?> |
|
253 | + <?php do_action('wpinv_invoice_items_actions', $invoice); ?> |
|
254 | 254 | </div> |
255 | 255 | </div> |
256 | 256 | <?php |
257 | 257 | } |
258 | 258 | |
259 | - public static function output_row( $columns, $item, $invoice, $class='even' ) { |
|
259 | + public static function output_row($columns, $item, $invoice, $class = 'even') { |
|
260 | 260 | |
261 | 261 | ?> |
262 | - <tr class="item item-<?php echo esc_attr( $class ); ?>" data-item-id="<?php echo esc_attr( $item->get_id() ); ?>"> |
|
263 | - <?php foreach ( array_keys( $columns ) as $column ) : ?> |
|
264 | - <td class="<?php echo esc_attr( $column ); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>"> |
|
262 | + <tr class="item item-<?php echo esc_attr($class); ?>" data-item-id="<?php echo esc_attr($item->get_id()); ?>"> |
|
263 | + <?php foreach (array_keys($columns) as $column) : ?> |
|
264 | + <td class="<?php echo esc_attr($column); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>"> |
|
265 | 265 | <?php |
266 | - switch ( $column ) { |
|
266 | + switch ($column) { |
|
267 | 267 | case 'id': |
268 | 268 | echo (int) $item->get_id(); |
269 | 269 | break; |
270 | 270 | case 'title': |
271 | 271 | printf( |
272 | 272 | '<a href="%s" target="_blank">%s</a>', |
273 | - get_edit_post_link( $item->get_id() ), |
|
274 | - esc_html( $item->get_raw_name() ) |
|
273 | + get_edit_post_link($item->get_id()), |
|
274 | + esc_html($item->get_raw_name()) |
|
275 | 275 | ); |
276 | 276 | |
277 | - $summary = apply_filters( 'getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice ); |
|
278 | - if ( $summary !== '' ) { |
|
277 | + $summary = apply_filters('getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice); |
|
278 | + if ($summary !== '') { |
|
279 | 279 | printf( |
280 | 280 | '<span class="meta">%s</span>', |
281 | - wpautop( wp_kses_post( $summary ) ) |
|
281 | + wpautop(wp_kses_post($summary)) |
|
282 | 282 | ); |
283 | 283 | } |
284 | 284 | |
285 | 285 | printf( |
286 | 286 | '<input type="hidden" value="%s" name="getpaid_items[%s][name]" class="getpaid-recalculate-prices-on-change" />', |
287 | - esc_attr( $item->get_raw_name() ), |
|
287 | + esc_attr($item->get_raw_name()), |
|
288 | 288 | (int) $item->get_id() |
289 | 289 | ); |
290 | 290 | |
291 | 291 | printf( |
292 | 292 | '<textarea style="display: none;" name="getpaid_items[%s][description]" class="getpaid-recalculate-prices-on-change">%s</textarea>', |
293 | 293 | (int) $item->get_id(), |
294 | - esc_attr( $item->get_description() ) |
|
294 | + esc_attr($item->get_description()) |
|
295 | 295 | ); |
296 | 296 | |
297 | 297 | break; |
298 | 298 | case 'price': |
299 | 299 | printf( |
300 | 300 | '<input type="text" value="%s" name="getpaid_items[%s][price]" style="width: 100px;" class="getpaid-admin-invoice-item-price getpaid-recalculate-prices-on-change" />', |
301 | - esc_attr( getpaid_unstandardize_amount( $item->get_price() ) ), |
|
301 | + esc_attr(getpaid_unstandardize_amount($item->get_price())), |
|
302 | 302 | (int) $item->get_id() |
303 | 303 | ); |
304 | 304 | |
@@ -306,26 +306,26 @@ discard block |
||
306 | 306 | case 'qty': |
307 | 307 | printf( |
308 | 308 | '<input type="text" style="width: 100px;" value="%s" name="getpaid_items[%s][quantity]" class="getpaid-admin-invoice-item-quantity getpaid-recalculate-prices-on-change" />', |
309 | - floatval( $item->get_quantity() ), |
|
309 | + floatval($item->get_quantity()), |
|
310 | 310 | (int) $item->get_id() |
311 | 311 | ); |
312 | 312 | |
313 | 313 | break; |
314 | 314 | case 'total': |
315 | - echo wpinv_price( $item->get_sub_total(), $invoice->get_currency() ); |
|
315 | + echo wpinv_price($item->get_sub_total(), $invoice->get_currency()); |
|
316 | 316 | |
317 | 317 | break; |
318 | 318 | case 'tax': |
319 | - echo wpinv_round_amount( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) . '%'; |
|
319 | + echo wpinv_round_amount(getpaid_get_invoice_tax_rate($invoice, $item), 2) . '%'; |
|
320 | 320 | |
321 | 321 | break; |
322 | 322 | case 'action': |
323 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
323 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
324 | 324 | echo '<i class="fa fa-trash wpinv-item-remove"></i>'; |
325 | 325 | } |
326 | 326 | break; |
327 | 327 | } |
328 | - do_action( 'getpaid_admin_edit_invoice_item_' . $column, $item, $invoice ); |
|
328 | + do_action('getpaid_admin_edit_invoice_item_' . $column, $item, $invoice); |
|
329 | 329 | ?> |
330 | 330 | </td> |
331 | 331 | <?php endforeach; ?> |
@@ -338,10 +338,10 @@ discard block |
||
338 | 338 | * |
339 | 339 | * @param WP_Post $post |
340 | 340 | */ |
341 | - public static function output2( $post ) { |
|
341 | + public static function output2($post) { |
|
342 | 342 | |
343 | 343 | // Prepare the invoice. |
344 | - $invoice = new WPInv_Invoice( $post ); |
|
344 | + $invoice = new WPInv_Invoice($post); |
|
345 | 345 | |
346 | 346 | // Invoice items. |
347 | 347 | $items = $invoice->get_items(); |
@@ -349,28 +349,28 @@ discard block |
||
349 | 349 | $totals = array( |
350 | 350 | |
351 | 351 | 'subtotal' => array( |
352 | - 'label' => __( 'Items Subtotal', 'invoicing' ), |
|
353 | - 'value' => wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ), |
|
352 | + 'label' => __('Items Subtotal', 'invoicing'), |
|
353 | + 'value' => wpinv_price($invoice->get_subtotal(), $invoice->get_currency()), |
|
354 | 354 | ), |
355 | 355 | |
356 | 356 | 'discount' => array( |
357 | - 'label' => __( 'Total Discount', 'invoicing' ), |
|
358 | - 'value' => wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ), |
|
357 | + 'label' => __('Total Discount', 'invoicing'), |
|
358 | + 'value' => wpinv_price($invoice->get_total_discount(), $invoice->get_currency()), |
|
359 | 359 | ), |
360 | 360 | |
361 | 361 | 'tax' => array( |
362 | - 'label' => __( 'Total Tax', 'invoicing' ), |
|
363 | - 'value' => wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ), |
|
362 | + 'label' => __('Total Tax', 'invoicing'), |
|
363 | + 'value' => wpinv_price($invoice->get_total_tax(), $invoice->get_currency()), |
|
364 | 364 | ), |
365 | 365 | |
366 | 366 | 'total' => array( |
367 | - 'label' => __( 'Invoice Total', 'invoicing' ), |
|
368 | - 'value' => wpinv_price( $invoice->get_total(), $invoice->get_currency() ), |
|
367 | + 'label' => __('Invoice Total', 'invoicing'), |
|
368 | + 'value' => wpinv_price($invoice->get_total(), $invoice->get_currency()), |
|
369 | 369 | ) |
370 | 370 | ); |
371 | 371 | |
372 | - if ( ! wpinv_use_taxes() ) { |
|
373 | - unset( $totals['tax'] ); |
|
372 | + if (!wpinv_use_taxes()) { |
|
373 | + unset($totals['tax']); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | $item_args = array( |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | 'orderby' => 'title', |
379 | 379 | 'order' => 'ASC', |
380 | 380 | 'posts_per_page' => -1, |
381 | - 'post_status' => array( 'publish' ), |
|
381 | + 'post_status' => array('publish'), |
|
382 | 382 | 'meta_query' => array( |
383 | 383 | array( |
384 | 384 | 'key' => '_wpinv_type', |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | } |
403 | 403 | </style> |
404 | 404 | |
405 | - <div class="bsui getpaid-invoice-items-inner <?php echo empty( $items ) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem; padding: 0 12px 12px;"> |
|
405 | + <div class="bsui getpaid-invoice-items-inner <?php echo empty($items) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem; padding: 0 12px 12px;"> |
|
406 | 406 | |
407 | - <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?> |
|
408 | - <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?> |
|
407 | + <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?> |
|
408 | + <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?> |
|
409 | 409 | |
410 | 410 | <div class="row"> |
411 | 411 | <div class="col-12 col-sm-6"> |
@@ -414,15 +414,15 @@ discard block |
||
414 | 414 | array( |
415 | 415 | 'id' => 'wpinv_template', |
416 | 416 | 'name' => 'wpinv_template', |
417 | - 'label' => __( 'Template', 'invoicing' ), |
|
417 | + 'label' => __('Template', 'invoicing'), |
|
418 | 418 | 'label_type' => 'vertical', |
419 | - 'placeholder' => __( 'Choose a template', 'invoicing' ), |
|
419 | + 'placeholder' => __('Choose a template', 'invoicing'), |
|
420 | 420 | 'class' => 'form-control-sm', |
421 | - 'value' => $invoice->get_template( 'edit' ), |
|
421 | + 'value' => $invoice->get_template('edit'), |
|
422 | 422 | 'options' => array( |
423 | - 'quantity' => __( 'Quantity', 'invoicing' ), |
|
424 | - 'hours' => __( 'Hours', 'invoicing' ), |
|
425 | - 'amount' => __( 'Amount Only', 'invoicing' ), |
|
423 | + 'quantity' => __('Quantity', 'invoicing'), |
|
424 | + 'hours' => __('Hours', 'invoicing'), |
|
425 | + 'amount' => __('Amount Only', 'invoicing'), |
|
426 | 426 | ), |
427 | 427 | 'data-allow-clear' => 'false', |
428 | 428 | 'select2' => true, |
@@ -438,11 +438,11 @@ discard block |
||
438 | 438 | array( |
439 | 439 | 'id' => 'wpinv_currency', |
440 | 440 | 'name' => 'wpinv_currency', |
441 | - 'label' => __( 'Currency', 'invoicing' ), |
|
441 | + 'label' => __('Currency', 'invoicing'), |
|
442 | 442 | 'label_type' => 'vertical', |
443 | - 'placeholder' => __( 'Select Invoice Currency', 'invoicing' ), |
|
443 | + 'placeholder' => __('Select Invoice Currency', 'invoicing'), |
|
444 | 444 | 'class' => 'form-control-sm', |
445 | - 'value' => $invoice->get_currency( 'edit' ), |
|
445 | + 'value' => $invoice->get_currency('edit'), |
|
446 | 446 | 'required' => false, |
447 | 447 | 'data-allow-clear' => 'false', |
448 | 448 | 'select2' => true, |
@@ -454,24 +454,24 @@ discard block |
||
454 | 454 | </div> |
455 | 455 | </div> |
456 | 456 | |
457 | - <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?> |
|
457 | + <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?> |
|
458 | 458 | <?php endif; ?> |
459 | 459 | |
460 | 460 | <table cellpadding="0" cellspacing="0" class="getpaid_invoice_items"> |
461 | 461 | <thead> |
462 | 462 | <tr> |
463 | - <th class="getpaid-item" colspan="2"><?php _e( 'Item', 'invoicing' ) ?></th> |
|
463 | + <th class="getpaid-item" colspan="2"><?php _e('Item', 'invoicing') ?></th> |
|
464 | 464 | <th class="getpaid-quantity hide-if-amount text-right"> |
465 | - <span class="getpaid-hide-if-hours"><?php _e( 'Quantity', 'invoicing' ) ?></span> |
|
466 | - <span class="getpaid-hide-if-quantity"><?php _e( 'Hours', 'invoicing' ) ?></span> |
|
465 | + <span class="getpaid-hide-if-hours"><?php _e('Quantity', 'invoicing') ?></span> |
|
466 | + <span class="getpaid-hide-if-quantity"><?php _e('Hours', 'invoicing') ?></span> |
|
467 | 467 | </th> |
468 | 468 | <th class="getpaid-price hide-if-amount text-right"> |
469 | - <span class="getpaid-hide-if-hours"><?php _e( 'Price', 'invoicing' ) ?></span> |
|
470 | - <span class="getpaid-hide-if-quantity"><?php _e( 'Rate', 'invoicing' ) ?></span> |
|
469 | + <span class="getpaid-hide-if-hours"><?php _e('Price', 'invoicing') ?></span> |
|
470 | + <span class="getpaid-hide-if-quantity"><?php _e('Rate', 'invoicing') ?></span> |
|
471 | 471 | </th> |
472 | 472 | <th class="getpaid-item-subtotal text-right"> |
473 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php _e( 'Amount', 'invoicing' ) ?></span> |
|
474 | - <span class="hide-if-amount"><?php _e( 'Total', 'invoicing' ) ?></span> |
|
473 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php _e('Amount', 'invoicing') ?></span> |
|
474 | + <span class="hide-if-amount"><?php _e('Total', 'invoicing') ?></span> |
|
475 | 475 | </th> |
476 | 476 | <th class="getpaid-item-actions hide-if-not-editable" width="70px"> </th> |
477 | 477 | </tr> |
@@ -479,8 +479,8 @@ discard block |
||
479 | 479 | <tbody class="getpaid_invoice_line_items"> |
480 | 480 | <tr class="hide-if-has-items hide-if-not-editable"> |
481 | 481 | <td colspan="2" class="pt-4 pb-4"> |
482 | - <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e( 'Add Existing Items', 'invoicing' ) ?></button> |
|
483 | - <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e( 'Create New Item', 'invoicing' ) ?></button> |
|
482 | + <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e('Add Existing Items', 'invoicing') ?></button> |
|
483 | + <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e('Create New Item', 'invoicing') ?></button> |
|
484 | 484 | </td> |
485 | 485 | <td class="hide-if-amount"> </th> |
486 | 486 | <td class="hide-if-amount"> </th> |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | <div class="col-12 col-sm-6 offset-sm-6"> |
513 | 513 | <table class="getpaid-invoice-totals text-right w-100"> |
514 | 514 | <tbody> |
515 | - <?php foreach ( apply_filters( 'getpaid_invoice_subtotal_rows', $totals, $invoice ) as $key => $data ) : ?> |
|
516 | - <tr class="getpaid-totals-<?php echo sanitize_html_class( $key ); ?>"> |
|
517 | - <td class="label"><?php echo esc_html( $data['label'] ) ?>:</td> |
|
515 | + <?php foreach (apply_filters('getpaid_invoice_subtotal_rows', $totals, $invoice) as $key => $data) : ?> |
|
516 | + <tr class="getpaid-totals-<?php echo sanitize_html_class($key); ?>"> |
|
517 | + <td class="label"><?php echo esc_html($data['label']) ?>:</td> |
|
518 | 518 | <td width="1%"></td> |
519 | - <td class="value"><?php echo wp_kses_post( $data['value'] ) ?></td> |
|
519 | + <td class="value"><?php echo wp_kses_post($data['value']) ?></td> |
|
520 | 520 | </tr> |
521 | 521 | <?php endforeach; ?> |
522 | 522 | </tbody> |
@@ -529,18 +529,18 @@ discard block |
||
529 | 529 | <div class="getpaid-invoice-item-actions hide-if-no-items hide-if-not-editable"> |
530 | 530 | <div class="row"> |
531 | 531 | <div class="text-left col-12 col-sm-8"> |
532 | - <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e( 'Add Existing Item', 'invoicing' ) ?></button> |
|
533 | - <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e( 'Create New Item', 'invoicing' ) ?></button> |
|
534 | - <?php do_action( 'getpaid-invoice-items-actions', $invoice ); ?> |
|
532 | + <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e('Add Existing Item', 'invoicing') ?></button> |
|
533 | + <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e('Create New Item', 'invoicing') ?></button> |
|
534 | + <?php do_action('getpaid-invoice-items-actions', $invoice); ?> |
|
535 | 535 | </div> |
536 | 536 | <div class="text-right col-12 col-sm-4"> |
537 | - <button type="button" class="button button-primary recalculate-totals-button"><?php _e( 'Recalculate Totals', 'invoicing' ) ?></button> |
|
537 | + <button type="button" class="button button-primary recalculate-totals-button"><?php _e('Recalculate Totals', 'invoicing') ?></button> |
|
538 | 538 | </div> |
539 | 539 | </div> |
540 | 540 | </div> |
541 | 541 | |
542 | 542 | <div class="getpaid-invoice-item-actions hide-if-editable"> |
543 | - <p class="description m-2 text-right text-muted"><?php _e( 'This invoice is no longer editable', 'invoicing' ); ?></p> |
|
543 | + <p class="description m-2 text-right text-muted"><?php _e('This invoice is no longer editable', 'invoicing'); ?></p> |
|
544 | 544 | </div> |
545 | 545 | |
546 | 546 | <!-- Add items to an invoice --> |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | <div class="modal-dialog modal-dialog-centered" role="document"> |
549 | 549 | <div class="modal-content"> |
550 | 550 | <div class="modal-header"> |
551 | - <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php _e( "Add Item(s)", 'invoicing' ); ?></h5> |
|
552 | - <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>"> |
|
551 | + <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php _e("Add Item(s)", 'invoicing'); ?></h5> |
|
552 | + <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>"> |
|
553 | 553 | <span aria-hidden="true">×</span> |
554 | 554 | </button> |
555 | 555 | </div> |
@@ -557,10 +557,10 @@ discard block |
||
557 | 557 | <table class="widefat"> |
558 | 558 | <thead> |
559 | 559 | <tr> |
560 | - <th class="pl-0 text-left"><?php _e( 'Item', 'invoicing' ) ?></th> |
|
560 | + <th class="pl-0 text-left"><?php _e('Item', 'invoicing') ?></th> |
|
561 | 561 | <th class="pr-0 text-right hide-if-amount"> |
562 | - <span class="getpaid-hide-if-hours"><?php _e( 'Quantity', 'invoicing' ) ?></span> |
|
563 | - <span class="getpaid-hide-if-quantity"><?php _e( 'Hours', 'invoicing' ) ?></span> |
|
562 | + <span class="getpaid-hide-if-hours"><?php _e('Quantity', 'invoicing') ?></span> |
|
563 | + <span class="getpaid-hide-if-quantity"><?php _e('Hours', 'invoicing') ?></span> |
|
564 | 564 | </th> |
565 | 565 | </tr> |
566 | 566 | </thead> |
@@ -568,9 +568,9 @@ discard block |
||
568 | 568 | <tr> |
569 | 569 | <td class="pl-0 text-left"> |
570 | 570 | <select class="regular-text getpaid-add-invoice-item-select"> |
571 | - <option value="" selected="selected" disabled><?php esc_html_e( 'Select an item…', 'invoicing' ); ?></option> |
|
572 | - <?php foreach ( get_posts( $item_args ) as $item ) : ?> |
|
573 | - <option value="<?php echo (int) $item->ID; ?>"><?php echo strip_tags( $item->post_title ); ?></option> |
|
571 | + <option value="" selected="selected" disabled><?php esc_html_e('Select an item…', 'invoicing'); ?></option> |
|
572 | + <?php foreach (get_posts($item_args) as $item) : ?> |
|
573 | + <option value="<?php echo (int) $item->ID; ?>"><?php echo strip_tags($item->post_title); ?></option> |
|
574 | 574 | <?php endforeach; ?> |
575 | 575 | </select> |
576 | 576 | </td> |
@@ -582,8 +582,8 @@ discard block |
||
582 | 582 | </table> |
583 | 583 | </div> |
584 | 584 | <div class="modal-footer"> |
585 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button> |
|
586 | - <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php _e( 'Add', 'invoicing' ); ?></button> |
|
585 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button> |
|
586 | + <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php _e('Add', 'invoicing'); ?></button> |
|
587 | 587 | </div> |
588 | 588 | </div> |
589 | 589 | </div> |
@@ -594,8 +594,8 @@ discard block |
||
594 | 594 | <div class="modal-dialog modal-dialog-centered" role="document"> |
595 | 595 | <div class="modal-content"> |
596 | 596 | <div class="modal-header"> |
597 | - <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php _e( "Create Item", 'invoicing' ); ?></h5> |
|
598 | - <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>"> |
|
597 | + <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php _e("Create Item", 'invoicing'); ?></h5> |
|
598 | + <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>"> |
|
599 | 599 | <span aria-hidden="true">×</span> |
600 | 600 | </button> |
601 | 601 | </div> |
@@ -603,27 +603,27 @@ discard block |
||
603 | 603 | <div class="getpaid-create-item-div"> |
604 | 604 | <input type="hidden" name="id" value="new" class="form-control form-control-sm item-id"> |
605 | 605 | <label class="form-group w-100"> |
606 | - <span><?php _e( 'Name', 'invoicing' ); ?></span> |
|
607 | - <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name"> |
|
606 | + <span><?php _e('Name', 'invoicing'); ?></span> |
|
607 | + <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name"> |
|
608 | 608 | </label> |
609 | 609 | <label class="form-group w-100"> |
610 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e( 'Amount', 'invoicing' ); ?></span> |
|
611 | - <span class="hide-if-amount"><?php _e( 'Price', 'invoicing' ); ?></span> |
|
612 | - <input type="text" name="price" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price"> |
|
610 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e('Amount', 'invoicing'); ?></span> |
|
611 | + <span class="hide-if-amount"><?php _e('Price', 'invoicing'); ?></span> |
|
612 | + <input type="text" name="price" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price"> |
|
613 | 613 | </label> |
614 | 614 | <label class="form-group w-100 hide-if-amount"> |
615 | - <span><?php _e( 'Quantity', 'invoicing' ); ?></span> |
|
615 | + <span><?php _e('Quantity', 'invoicing'); ?></span> |
|
616 | 616 | <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity"> |
617 | 617 | </label> |
618 | 618 | <label class="form-group w-100"> |
619 | - <span><?php _e( 'Item Description', 'invoicing' ); ?></span> |
|
620 | - <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea> |
|
619 | + <span><?php _e('Item Description', 'invoicing'); ?></span> |
|
620 | + <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea> |
|
621 | 621 | </label> |
622 | 622 | </div> |
623 | 623 | </div> |
624 | 624 | <div class="modal-footer"> |
625 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button> |
|
626 | - <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e( 'Create', 'invoicing' ); ?></button> |
|
625 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button> |
|
626 | + <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e('Create', 'invoicing'); ?></button> |
|
627 | 627 | </div> |
628 | 628 | </div> |
629 | 629 | </div> |
@@ -634,8 +634,8 @@ discard block |
||
634 | 634 | <div class="modal-dialog modal-dialog-centered" role="document"> |
635 | 635 | <div class="modal-content"> |
636 | 636 | <div class="modal-header"> |
637 | - <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php _e( "Edit Item", 'invoicing' ); ?></h5> |
|
638 | - <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>"> |
|
637 | + <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php _e("Edit Item", 'invoicing'); ?></h5> |
|
638 | + <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>"> |
|
639 | 639 | <span aria-hidden="true">×</span> |
640 | 640 | </button> |
641 | 641 | </div> |
@@ -643,27 +643,27 @@ discard block |
||
643 | 643 | <div class="getpaid-edit-item-div"> |
644 | 644 | <input type="hidden" name="id" class="form-control form-control-sm item-id"> |
645 | 645 | <label class="form-group w-100"> |
646 | - <span><?php _e( 'Name', 'invoicing' ); ?></span> |
|
647 | - <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name"> |
|
646 | + <span><?php _e('Name', 'invoicing'); ?></span> |
|
647 | + <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name"> |
|
648 | 648 | </label> |
649 | 649 | <label class="form-group w-100"> |
650 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e( 'Amount', 'invoicing' ); ?></span> |
|
651 | - <span class="hide-if-amount"><?php _e( 'Price', 'invoicing' ); ?></span> |
|
652 | - <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price"> |
|
650 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e('Amount', 'invoicing'); ?></span> |
|
651 | + <span class="hide-if-amount"><?php _e('Price', 'invoicing'); ?></span> |
|
652 | + <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price"> |
|
653 | 653 | </label> |
654 | 654 | <label class="form-group w-100 hide-if-amount"> |
655 | - <span><?php _e( 'Quantity', 'invoicing' ); ?></span> |
|
655 | + <span><?php _e('Quantity', 'invoicing'); ?></span> |
|
656 | 656 | <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity"> |
657 | 657 | </label> |
658 | 658 | <label class="form-group w-100"> |
659 | - <span><?php _e( 'Item Description', 'invoicing' ); ?></span> |
|
660 | - <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea> |
|
659 | + <span><?php _e('Item Description', 'invoicing'); ?></span> |
|
660 | + <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea> |
|
661 | 661 | </label> |
662 | 662 | </div> |
663 | 663 | </div> |
664 | 664 | <div class="modal-footer"> |
665 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button> |
|
666 | - <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e( 'Save', 'invoicing' ); ?></button> |
|
665 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button> |
|
666 | + <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e('Save', 'invoicing'); ?></button> |
|
667 | 667 | </div> |
668 | 668 | </div> |
669 | 669 | </div> |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
8 | +if (!defined('ABSPATH')) { |
|
9 | 9 | exit; // Exit if accessed directly |
10 | 10 | } |
11 | 11 | |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @param WP_Post $post |
21 | 21 | */ |
22 | - public static function output( $post ) { |
|
22 | + public static function output($post) { |
|
23 | 23 | |
24 | 24 | // Fetch the invoice. |
25 | - $invoice = new WPInv_Invoice( $post ); |
|
25 | + $invoice = new WPInv_Invoice($post); |
|
26 | 26 | |
27 | - do_action( 'wpinv_metabox_resend_invoice_before', $invoice ); |
|
27 | + do_action('wpinv_metabox_resend_invoice_before', $invoice); |
|
28 | 28 | |
29 | 29 | $invoice_actions = array( |
30 | 30 | 'resend-email' => array( |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | 'getpaid-nonce', |
39 | 39 | 'getpaid-nonce' |
40 | 40 | ), |
41 | - 'label' => __( 'Resend Invoice', 'invoicing' ), |
|
41 | + 'label' => __('Resend Invoice', 'invoicing'), |
|
42 | 42 | ) |
43 | 43 | ); |
44 | 44 | |
45 | - if ( $invoice->needs_payment() ) { |
|
45 | + if ($invoice->needs_payment()) { |
|
46 | 46 | |
47 | 47 | $invoice_actions['send-reminder'] = array( |
48 | 48 | 'url' => wp_nonce_url( |
@@ -55,29 +55,29 @@ discard block |
||
55 | 55 | 'getpaid-nonce', |
56 | 56 | 'getpaid-nonce' |
57 | 57 | ), |
58 | - 'label' => __( 'Send Reminder', 'invoicing' ), |
|
58 | + 'label' => __('Send Reminder', 'invoicing'), |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | - $invoice_actions = apply_filters( 'getpaid_edit_invoice_actions', $invoice_actions, $invoice ); |
|
63 | + $invoice_actions = apply_filters('getpaid_edit_invoice_actions', $invoice_actions, $invoice); |
|
64 | 64 | |
65 | - foreach ( $invoice_actions as $key => $action ) { |
|
65 | + foreach ($invoice_actions as $key => $action) { |
|
66 | 66 | |
67 | - if ( 'resend-email' === $key ) { |
|
68 | - echo wpautop( __( "This will send a copy of the invoice to the customer's email address.", 'invoicing' ) ); |
|
67 | + if ('resend-email' === $key) { |
|
68 | + echo wpautop(__("This will send a copy of the invoice to the customer's email address.", 'invoicing')); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | printf( |
72 | 72 | '<p class="wpi-meta-row wpi-%s"><a href="%s" class="button button-secondary">%s</a>', |
73 | - esc_attr( $key ), |
|
74 | - esc_url( $action['url'] ), |
|
75 | - esc_html( $action['label'] ) |
|
73 | + esc_attr($key), |
|
74 | + esc_url($action['url']), |
|
75 | + esc_html($action['label']) |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | - do_action( 'wpinv_metabox_resend_invoice_after', $invoice ); |
|
80 | + do_action('wpinv_metabox_resend_invoice_after', $invoice); |
|
81 | 81 | |
82 | 82 | } |
83 | 83 |
@@ -5,10 +5,10 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | // Exit if accessed directly |
8 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
8 | +if (!defined('ABSPATH')) exit; |
|
9 | 9 | |
10 | 10 | // Load WP_List_Table if not loaded |
11 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
11 | +if (!class_exists('WP_List_Table')) { |
|
12 | 12 | require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
13 | 13 | } |
14 | 14 | |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | public function __construct() { |
43 | 43 | |
44 | 44 | // Set parent defaults |
45 | - parent::__construct( array( |
|
45 | + parent::__construct(array( |
|
46 | 46 | 'singular' => 'id', |
47 | 47 | 'plural' => 'ids', |
48 | 48 | 'ajax' => false, |
49 | - ) ); |
|
49 | + )); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return string Column Name |
74 | 74 | */ |
75 | - public function column_default( $item, $column_name ) { |
|
76 | - $value = esc_html( get_user_meta( $item->ID, '_wpinv_' . $column_name, true ) ); |
|
77 | - return apply_filters( 'wpinv_customers_table_column' . $column_name, $value, $item ); |
|
75 | + public function column_default($item, $column_name) { |
|
76 | + $value = esc_html(get_user_meta($item->ID, '_wpinv_' . $column_name, true)); |
|
77 | + return apply_filters('wpinv_customers_table_column' . $column_name, $value, $item); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return string Column Name |
88 | 88 | */ |
89 | - public function column_country( $user ) { |
|
90 | - $country = wpinv_sanitize_country( $user->_wpinv_country ); |
|
91 | - if ( $country ) { |
|
92 | - $country = wpinv_country_name( $country ); |
|
89 | + public function column_country($user) { |
|
90 | + $country = wpinv_sanitize_country($user->_wpinv_country); |
|
91 | + if ($country) { |
|
92 | + $country = wpinv_country_name($country); |
|
93 | 93 | } |
94 | - return esc_html( $country ); |
|
94 | + return esc_html($country); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return string Column Name |
105 | 105 | */ |
106 | - public function column_state( $user ) { |
|
107 | - $country = wpinv_sanitize_country( $user->_wpinv_country ); |
|
106 | + public function column_state($user) { |
|
107 | + $country = wpinv_sanitize_country($user->_wpinv_country); |
|
108 | 108 | $state = $user->_wpinv_state; |
109 | - if ( $state ) { |
|
110 | - $state = wpinv_state_name( $state, $country ); |
|
109 | + if ($state) { |
|
110 | + $state = wpinv_state_name($state, $country); |
|
111 | 111 | } |
112 | 112 | |
113 | - return esc_html( $state ); |
|
113 | + return esc_html($state); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return string Column Name |
124 | 124 | */ |
125 | - public function column_signup( $user ) { |
|
126 | - return getpaid_format_date_value( $user->user_registered ); |
|
125 | + public function column_signup($user) { |
|
126 | + return getpaid_format_date_value($user->user_registered); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return string Column Name |
137 | 137 | */ |
138 | - public function column_total( $user ) { |
|
139 | - return wpinv_price( $this->column_total_raw( $user ) ); |
|
138 | + public function column_total($user) { |
|
139 | + return wpinv_price($this->column_total_raw($user)); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return float |
150 | 150 | */ |
151 | - public function column_total_raw( $user ) { |
|
151 | + public function column_total_raw($user) { |
|
152 | 152 | |
153 | 153 | $args = array( |
154 | 154 | 'data' => array( |
@@ -164,17 +164,17 @@ discard block |
||
164 | 164 | |
165 | 165 | 'author' => array( |
166 | 166 | 'type' => 'post_data', |
167 | - 'value' => absint( $user->ID ), |
|
167 | + 'value' => absint($user->ID), |
|
168 | 168 | 'key' => 'posts.post_author', |
169 | 169 | 'operator' => '=', |
170 | 170 | ), |
171 | 171 | |
172 | 172 | ), |
173 | 173 | 'query_type' => 'get_var', |
174 | - 'invoice_status' => array( 'wpi-renewal', 'wpi-processing', 'publish' ), |
|
174 | + 'invoice_status' => array('wpi-renewal', 'wpi-processing', 'publish'), |
|
175 | 175 | ); |
176 | 176 | |
177 | - return wpinv_round_amount( GetPaid_Reports_Helper::get_invoice_report_data( $args ) ); |
|
177 | + return wpinv_round_amount(GetPaid_Reports_Helper::get_invoice_report_data($args)); |
|
178 | 178 | |
179 | 179 | } |
180 | 180 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @return string Column Name |
189 | 189 | */ |
190 | - public function column_invoices( $user ) { |
|
190 | + public function column_invoices($user) { |
|
191 | 191 | |
192 | 192 | $args = array( |
193 | 193 | 'data' => array( |
@@ -204,17 +204,17 @@ discard block |
||
204 | 204 | |
205 | 205 | 'author' => array( |
206 | 206 | 'type' => 'post_data', |
207 | - 'value' => absint( $user->ID ), |
|
207 | + 'value' => absint($user->ID), |
|
208 | 208 | 'key' => 'posts.post_author', |
209 | 209 | 'operator' => '=', |
210 | 210 | ), |
211 | 211 | |
212 | 212 | ), |
213 | 213 | 'query_type' => 'get_var', |
214 | - 'invoice_status' => array_keys( wpinv_get_invoice_statuses() ), |
|
214 | + 'invoice_status' => array_keys(wpinv_get_invoice_statuses()), |
|
215 | 215 | ); |
216 | 216 | |
217 | - return absint( GetPaid_Reports_Helper::get_invoice_report_data( $args ) ); |
|
217 | + return absint(GetPaid_Reports_Helper::get_invoice_report_data($args)); |
|
218 | 218 | |
219 | 219 | } |
220 | 220 | |
@@ -224,15 +224,15 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @param int $item The user id. |
226 | 226 | */ |
227 | - public function single_row( $item ) { |
|
228 | - $item = get_user_by( 'id', $item ); |
|
227 | + public function single_row($item) { |
|
228 | + $item = get_user_by('id', $item); |
|
229 | 229 | |
230 | - if ( empty( $item ) ) { |
|
230 | + if (empty($item)) { |
|
231 | 231 | return; |
232 | 232 | } |
233 | 233 | |
234 | 234 | echo '<tr>'; |
235 | - $this->single_row_columns( $item ); |
|
235 | + $this->single_row_columns($item); |
|
236 | 236 | echo '</tr>'; |
237 | 237 | } |
238 | 238 | |
@@ -242,30 +242,30 @@ discard block |
||
242 | 242 | * @param WP_User $customer customer. |
243 | 243 | * @return string |
244 | 244 | */ |
245 | - public function column_name( $customer ) { |
|
245 | + public function column_name($customer) { |
|
246 | 246 | |
247 | 247 | // Customer view URL. |
248 | - $view_url = esc_url( add_query_arg( 'user_id', $customer->ID, admin_url( 'user-edit.php' ) ) ); |
|
248 | + $view_url = esc_url(add_query_arg('user_id', $customer->ID, admin_url('user-edit.php'))); |
|
249 | 249 | $row_actions = $this->row_actions( |
250 | 250 | array( |
251 | - 'view' => '<a href="' . $view_url . '#getpaid-fieldset-billing">' . __( 'Edit Details', 'invoicing' ) . '</a>', |
|
251 | + 'view' => '<a href="' . $view_url . '#getpaid-fieldset-billing">' . __('Edit Details', 'invoicing') . '</a>', |
|
252 | 252 | ) |
253 | 253 | ); |
254 | 254 | |
255 | 255 | // Get user's address. |
256 | - $address = wpinv_get_user_address( $customer->ID ); |
|
256 | + $address = wpinv_get_user_address($customer->ID); |
|
257 | 257 | |
258 | 258 | // Customer email address. |
259 | - $email = sanitize_email( $customer->user_email ); |
|
259 | + $email = sanitize_email($customer->user_email); |
|
260 | 260 | |
261 | 261 | // Customer's avatar. |
262 | - $avatar = esc_url( get_avatar_url( $email ) ); |
|
262 | + $avatar = esc_url(get_avatar_url($email)); |
|
263 | 263 | $avatar = "<img src='$avatar' height='32' width='32'/>"; |
264 | 264 | |
265 | 265 | // Customer's name. |
266 | - $name = esc_html( "{$address['first_name']} {$address['last_name']}" ); |
|
266 | + $name = esc_html("{$address['first_name']} {$address['last_name']}"); |
|
267 | 267 | |
268 | - if ( ! empty( $name ) ) { |
|
268 | + if (!empty($name)) { |
|
269 | 269 | $name = "<div style='overflow: hidden;height: 18px;'>$name</div>"; |
270 | 270 | } |
271 | 271 | |
@@ -284,19 +284,19 @@ discard block |
||
284 | 284 | public function get_columns() { |
285 | 285 | |
286 | 286 | $columns = array( |
287 | - 'name' => __( 'Name', 'invoicing' ), |
|
288 | - 'country' => __( 'Country', 'invoicing' ), |
|
289 | - 'state' => __( 'State', 'invoicing' ), |
|
290 | - 'city' => __( 'City', 'invoicing' ), |
|
291 | - 'zip' => __( 'ZIP', 'invoicing' ), |
|
292 | - 'address' => __( 'Address', 'invoicing' ), |
|
293 | - 'phone' => __( 'Phone', 'invoicing' ), |
|
294 | - 'company' => __( 'Company', 'invoicing' ), |
|
295 | - 'invoices' => __( 'Invoices', 'invoicing' ), |
|
296 | - 'total' => __( 'Total Spend', 'invoicing' ), |
|
297 | - 'signup' => __( 'Date created', 'invoicing' ), |
|
287 | + 'name' => __('Name', 'invoicing'), |
|
288 | + 'country' => __('Country', 'invoicing'), |
|
289 | + 'state' => __('State', 'invoicing'), |
|
290 | + 'city' => __('City', 'invoicing'), |
|
291 | + 'zip' => __('ZIP', 'invoicing'), |
|
292 | + 'address' => __('Address', 'invoicing'), |
|
293 | + 'phone' => __('Phone', 'invoicing'), |
|
294 | + 'company' => __('Company', 'invoicing'), |
|
295 | + 'invoices' => __('Invoices', 'invoicing'), |
|
296 | + 'total' => __('Total Spend', 'invoicing'), |
|
297 | + 'signup' => __('Date created', 'invoicing'), |
|
298 | 298 | ); |
299 | - return apply_filters( 'wpinv_customers_table_columns', $columns ); |
|
299 | + return apply_filters('wpinv_customers_table_columns', $columns); |
|
300 | 300 | |
301 | 301 | } |
302 | 302 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * @return int Current page number |
308 | 308 | */ |
309 | 309 | public function get_paged() { |
310 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
310 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @since 1.0.19 |
317 | 317 | * @return void |
318 | 318 | */ |
319 | - public function bulk_actions( $which = '' ) { |
|
319 | + public function bulk_actions($which = '') { |
|
320 | 320 | return array(); |
321 | 321 | } |
322 | 322 | |
@@ -328,23 +328,23 @@ discard block |
||
328 | 328 | |
329 | 329 | $post_types = ''; |
330 | 330 | |
331 | - foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) { |
|
332 | - $post_types .= $wpdb->prepare( "post_type=%s OR ", $post_type ); |
|
331 | + foreach (array_keys(getpaid_get_invoice_post_types()) as $post_type) { |
|
332 | + $post_types .= $wpdb->prepare("post_type=%s OR ", $post_type); |
|
333 | 333 | } |
334 | 334 | |
335 | - $post_types = rtrim( $post_types, ' OR' ); |
|
335 | + $post_types = rtrim($post_types, ' OR'); |
|
336 | 336 | |
337 | 337 | // Maybe search. |
338 | - if ( ! empty( $_POST['s'] ) ) { |
|
338 | + if (!empty($_POST['s'])) { |
|
339 | 339 | $users = get_users( |
340 | 340 | array( |
341 | - 'search' => '*' . sanitize_text_field( urldecode( $_POST['s'] ) ) . '*', |
|
342 | - 'search_columns' => array( 'user_login', 'user_email', 'display_name' ), |
|
341 | + 'search' => '*' . sanitize_text_field(urldecode($_POST['s'])) . '*', |
|
342 | + 'search_columns' => array('user_login', 'user_email', 'display_name'), |
|
343 | 343 | 'fields' => 'ID', |
344 | 344 | ) |
345 | 345 | ); |
346 | 346 | |
347 | - $users = implode( ', ', $users ); |
|
347 | + $users = implode(', ', $users); |
|
348 | 348 | $post_types = "($post_types) AND ( post_author IN ( $users ) )"; |
349 | 349 | } |
350 | 350 | |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | ); |
359 | 359 | |
360 | 360 | $this->items = $customers; |
361 | - $this->total = (int) $wpdb->get_var( "SELECT COUNT( DISTINCT( post_author ) ) FROM $wpdb->posts WHERE $post_types" ); |
|
361 | + $this->total = (int) $wpdb->get_var("SELECT COUNT( DISTINCT( post_author ) ) FROM $wpdb->posts WHERE $post_types"); |
|
362 | 362 | |
363 | 363 | } |
364 | 364 | |
@@ -372,14 +372,14 @@ discard block |
||
372 | 372 | $columns = $this->get_columns(); |
373 | 373 | $hidden = array(); // No hidden columns |
374 | 374 | $sortable = $this->get_sortable_columns(); |
375 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
375 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
376 | 376 | $this->prepare_query(); |
377 | 377 | |
378 | 378 | $this->set_pagination_args( |
379 | 379 | array( |
380 | 380 | 'total_items' => $this->total, |
381 | 381 | 'per_page' => $this->per_page, |
382 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
382 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
383 | 383 | ) |
384 | 384 | ); |
385 | 385 |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | -add_action( 'manage_wpi_discount_posts_custom_column', 'wpinv_discount_custom_column' ); |
|
8 | -function wpinv_discount_custom_column( $column ) { |
|
7 | +add_action('manage_wpi_discount_posts_custom_column', 'wpinv_discount_custom_column'); |
|
8 | +function wpinv_discount_custom_column($column) { |
|
9 | 9 | global $post; |
10 | 10 | |
11 | - $discount = new WPInv_Discount( $post ); |
|
11 | + $discount = new WPInv_Discount($post); |
|
12 | 12 | |
13 | - switch ( $column ) { |
|
13 | + switch ($column) { |
|
14 | 14 | case 'code' : |
15 | 15 | echo $discount->get_code(); |
16 | 16 | break; |
@@ -21,31 +21,31 @@ discard block |
||
21 | 21 | echo $discount->get_usage(); |
22 | 22 | break; |
23 | 23 | case 'start_date' : |
24 | - echo getpaid_format_date_value( $discount->get_start_date() ); |
|
24 | + echo getpaid_format_date_value($discount->get_start_date()); |
|
25 | 25 | break; |
26 | 26 | case 'expiry_date' : |
27 | - echo getpaid_format_date_value( $discount->get_expiration_date(), __( 'Never', 'invoicing' ) ); |
|
27 | + echo getpaid_format_date_value($discount->get_expiration_date(), __('Never', 'invoicing')); |
|
28 | 28 | break; |
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | -add_filter( 'post_row_actions', 'wpinv_post_row_actions', 90, 2 ); |
|
33 | -function wpinv_post_row_actions( $actions, $post ) { |
|
34 | - $post_type = !empty( $post->post_type ) ? $post->post_type : ''; |
|
32 | +add_filter('post_row_actions', 'wpinv_post_row_actions', 90, 2); |
|
33 | +function wpinv_post_row_actions($actions, $post) { |
|
34 | + $post_type = !empty($post->post_type) ? $post->post_type : ''; |
|
35 | 35 | |
36 | - if ( $post_type == 'wpi_discount' ) { |
|
37 | - $actions = wpinv_discount_row_actions( $post, $actions ); |
|
36 | + if ($post_type == 'wpi_discount') { |
|
37 | + $actions = wpinv_discount_row_actions($post, $actions); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return $actions; |
41 | 41 | } |
42 | 42 | |
43 | -function wpinv_discount_row_actions( $discount, $row_actions ) { |
|
44 | - $row_actions = array(); |
|
45 | - $edit_link = get_edit_post_link( $discount->ID ); |
|
46 | - $row_actions['edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit', 'invoicing' ) . '</a>'; |
|
43 | +function wpinv_discount_row_actions($discount, $row_actions) { |
|
44 | + $row_actions = array(); |
|
45 | + $edit_link = get_edit_post_link($discount->ID); |
|
46 | + $row_actions['edit'] = '<a href="' . esc_url($edit_link) . '">' . __('Edit', 'invoicing') . '</a>'; |
|
47 | 47 | |
48 | - if ( in_array( strtolower( $discount->post_status ), array( 'publish' ) ) ) { |
|
48 | + if (in_array(strtolower($discount->post_status), array('publish'))) { |
|
49 | 49 | |
50 | 50 | $url = wp_nonce_url( |
51 | 51 | add_query_arg( |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | 'getpaid-nonce', |
58 | 58 | 'getpaid-nonce' |
59 | 59 | ); |
60 | - $anchor = __( 'Deactivate', 'invoicing' ); |
|
61 | - $title = esc_attr__( 'Are you sure you want to deactivate this discount?', 'invoicing' ); |
|
60 | + $anchor = __('Deactivate', 'invoicing'); |
|
61 | + $title = esc_attr__('Are you sure you want to deactivate this discount?', 'invoicing'); |
|
62 | 62 | $row_actions['deactivate'] = "<a href='$url' onclick='return confirm(\"$title\")'>$anchor</a>"; |
63 | 63 | |
64 | - } else if( in_array( strtolower( $discount->post_status ), array( 'pending', 'draft' ) ) ) { |
|
64 | + } else if (in_array(strtolower($discount->post_status), array('pending', 'draft'))) { |
|
65 | 65 | |
66 | - $url = wp_nonce_url( |
|
66 | + $url = wp_nonce_url( |
|
67 | 67 | add_query_arg( |
68 | 68 | array( |
69 | 69 | 'getpaid-admin-action' => 'activate_discount', |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | 'getpaid-nonce', |
74 | 74 | 'getpaid-nonce' |
75 | 75 | ); |
76 | - $anchor = __( 'Activate', 'invoicing' ); |
|
77 | - $title = esc_attr__( 'Are you sure you want to activate this discount?', 'invoicing' ); |
|
76 | + $anchor = __('Activate', 'invoicing'); |
|
77 | + $title = esc_attr__('Are you sure you want to activate this discount?', 'invoicing'); |
|
78 | 78 | $row_actions['activate'] = "<a href='$url' onclick='return confirm(\"$title\")'>$anchor</a>"; |
79 | 79 | |
80 | 80 | } |
81 | 81 | |
82 | - $url = esc_url( |
|
82 | + $url = esc_url( |
|
83 | 83 | wp_nonce_url( |
84 | 84 | add_query_arg( |
85 | 85 | array( |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | 'getpaid-nonce' |
92 | 92 | ) |
93 | 93 | ); |
94 | - $anchor = __( 'Delete', 'invoicing' ); |
|
95 | - $title = esc_attr__( 'Are you sure you want to delete this discount?', 'invoicing' ); |
|
94 | + $anchor = __('Delete', 'invoicing'); |
|
95 | + $title = esc_attr__('Are you sure you want to delete this discount?', 'invoicing'); |
|
96 | 96 | $row_actions['delete'] = "<a href='$url' onclick='return confirm(\"$title\")'>$anchor</a>"; |
97 | 97 | |
98 | - $row_actions = apply_filters( 'wpinv_discount_row_actions', $row_actions, $discount ); |
|
98 | + $row_actions = apply_filters('wpinv_discount_row_actions', $row_actions, $discount); |
|
99 | 99 | |
100 | 100 | return $row_actions; |
101 | 101 | } |
@@ -103,68 +103,68 @@ discard block |
||
103 | 103 | function wpinv_restrict_manage_posts() { |
104 | 104 | global $typenow; |
105 | 105 | |
106 | - if( 'wpi_discount' == $typenow ) { |
|
106 | + if ('wpi_discount' == $typenow) { |
|
107 | 107 | wpinv_discount_filters(); |
108 | 108 | } |
109 | 109 | } |
110 | -add_action( 'restrict_manage_posts', 'wpinv_restrict_manage_posts', 10 ); |
|
110 | +add_action('restrict_manage_posts', 'wpinv_restrict_manage_posts', 10); |
|
111 | 111 | |
112 | 112 | function wpinv_discount_filters() { |
113 | 113 | |
114 | 114 | ?> |
115 | 115 | <select name="discount_type" id="dropdown_wpinv_discount_type"> |
116 | - <option value=""><?php _e( 'Show all types', 'invoicing' ); ?></option> |
|
116 | + <option value=""><?php _e('Show all types', 'invoicing'); ?></option> |
|
117 | 117 | <?php |
118 | 118 | $types = wpinv_get_discount_types(); |
119 | 119 | |
120 | - foreach ( $types as $name => $type ) { |
|
121 | - echo '<option value="' . esc_attr( $name ) . '"'; |
|
120 | + foreach ($types as $name => $type) { |
|
121 | + echo '<option value="' . esc_attr($name) . '"'; |
|
122 | 122 | |
123 | - if ( isset( $_GET['discount_type'] ) ) |
|
124 | - selected( $name, $_GET['discount_type'] ); |
|
123 | + if (isset($_GET['discount_type'])) |
|
124 | + selected($name, $_GET['discount_type']); |
|
125 | 125 | |
126 | - echo '>' . esc_html__( $type, 'invoicing' ) . '</option>'; |
|
126 | + echo '>' . esc_html__($type, 'invoicing') . '</option>'; |
|
127 | 127 | } |
128 | 128 | ?> |
129 | 129 | </select> |
130 | 130 | <?php |
131 | 131 | } |
132 | 132 | |
133 | -function wpinv_request( $vars ) { |
|
133 | +function wpinv_request($vars) { |
|
134 | 134 | global $typenow, $wp_post_statuses; |
135 | 135 | |
136 | - if ( getpaid_is_invoice_post_type( $typenow ) ) { |
|
137 | - if ( ! isset( $vars['post_status'] ) ) { |
|
138 | - $post_statuses = wpinv_get_invoice_statuses( false, false, $typenow ); |
|
136 | + if (getpaid_is_invoice_post_type($typenow)) { |
|
137 | + if (!isset($vars['post_status'])) { |
|
138 | + $post_statuses = wpinv_get_invoice_statuses(false, false, $typenow); |
|
139 | 139 | |
140 | - foreach ( $post_statuses as $status => $value ) { |
|
141 | - if ( isset( $wp_post_statuses[ $status ] ) && false === $wp_post_statuses[ $status ]->show_in_admin_all_list ) { |
|
142 | - unset( $post_statuses[ $status ] ); |
|
140 | + foreach ($post_statuses as $status => $value) { |
|
141 | + if (isset($wp_post_statuses[$status]) && false === $wp_post_statuses[$status]->show_in_admin_all_list) { |
|
142 | + unset($post_statuses[$status]); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | - $vars['post_status'] = array_keys( $post_statuses ); |
|
146 | + $vars['post_status'] = array_keys($post_statuses); |
|
147 | 147 | } |
148 | 148 | |
149 | - } else if ( 'wpi_discount' == $typenow ) { |
|
150 | - $meta_query = !empty( $vars['meta_query'] ) ? $vars['meta_query'] : array(); |
|
149 | + } else if ('wpi_discount' == $typenow) { |
|
150 | + $meta_query = !empty($vars['meta_query']) ? $vars['meta_query'] : array(); |
|
151 | 151 | // Filter vat rule type |
152 | - if ( isset( $_GET['discount_type'] ) && $_GET['discount_type'] !== '' ) { |
|
152 | + if (isset($_GET['discount_type']) && $_GET['discount_type'] !== '') { |
|
153 | 153 | $meta_query[] = array( |
154 | 154 | 'key' => '_wpi_discount_type', |
155 | - 'value' => sanitize_key( urldecode( $_GET['discount_type'] ) ), |
|
155 | + 'value' => sanitize_key(urldecode($_GET['discount_type'])), |
|
156 | 156 | 'compare' => '=' |
157 | 157 | ); |
158 | 158 | } |
159 | 159 | |
160 | - if ( !empty( $meta_query ) ) { |
|
160 | + if (!empty($meta_query)) { |
|
161 | 161 | $vars['meta_query'] = $meta_query; |
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | 165 | return $vars; |
166 | 166 | } |
167 | -add_filter( 'request', 'wpinv_request' ); |
|
167 | +add_filter('request', 'wpinv_request'); |
|
168 | 168 | |
169 | 169 | /** |
170 | 170 | * Create a page and store the ID in an option. |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | * @param int $post_parent (default: 0) Parent for the new page |
177 | 177 | * @return int page ID |
178 | 178 | */ |
179 | -function wpinv_create_page( $slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0 ) { |
|
179 | +function wpinv_create_page($slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0) { |
|
180 | 180 | global $wpdb; |
181 | 181 | |
182 | - $option_value = wpinv_get_option( $option ); |
|
182 | + $option_value = wpinv_get_option($option); |
|
183 | 183 | |
184 | - if ( ! empty( $option_value ) && ( $page_object = get_post( $option_value ) ) ) { |
|
185 | - if ( 'page' === $page_object->post_type && ! in_array( $page_object->post_status, array( 'pending', 'trash', 'future', 'auto-draft' ) ) ) { |
|
184 | + if (!empty($option_value) && ($page_object = get_post($option_value))) { |
|
185 | + if ('page' === $page_object->post_type && !in_array($page_object->post_status, array('pending', 'trash', 'future', 'auto-draft'))) { |
|
186 | 186 | // Valid page is already in place |
187 | 187 | return $page_object->ID; |
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | - if(!empty($post_parent)){ |
|
191 | + if (!empty($post_parent)) { |
|
192 | 192 | $page = get_page_by_path($post_parent); |
193 | 193 | if ($page) { |
194 | 194 | $post_parent = $page->ID; |
@@ -197,40 +197,40 @@ discard block |
||
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - if ( strlen( $page_content ) > 0 ) { |
|
200 | + if (strlen($page_content) > 0) { |
|
201 | 201 | // Search for an existing page with the specified page content (typically a shortcode) |
202 | - $valid_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) ); |
|
202 | + $valid_page_found = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_content LIKE %s LIMIT 1;", "%{$page_content}%")); |
|
203 | 203 | } else { |
204 | 204 | // Search for an existing page with the specified page slug |
205 | - $valid_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_name = %s LIMIT 1;", $slug ) ); |
|
205 | + $valid_page_found = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_name = %s LIMIT 1;", $slug)); |
|
206 | 206 | } |
207 | 207 | |
208 | - $valid_page_found = apply_filters( 'wpinv_create_page_id', $valid_page_found, $slug, $page_content ); |
|
208 | + $valid_page_found = apply_filters('wpinv_create_page_id', $valid_page_found, $slug, $page_content); |
|
209 | 209 | |
210 | - if ( $valid_page_found ) { |
|
211 | - if ( $option ) { |
|
212 | - wpinv_update_option( $option, $valid_page_found ); |
|
210 | + if ($valid_page_found) { |
|
211 | + if ($option) { |
|
212 | + wpinv_update_option($option, $valid_page_found); |
|
213 | 213 | } |
214 | 214 | return $valid_page_found; |
215 | 215 | } |
216 | 216 | |
217 | 217 | // Search for a matching valid trashed page |
218 | - if ( strlen( $page_content ) > 0 ) { |
|
218 | + if (strlen($page_content) > 0) { |
|
219 | 219 | // Search for an existing page with the specified page content (typically a shortcode) |
220 | - $trashed_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) ); |
|
220 | + $trashed_page_found = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_content LIKE %s LIMIT 1;", "%{$page_content}%")); |
|
221 | 221 | } else { |
222 | 222 | // Search for an existing page with the specified page slug |
223 | - $trashed_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_name = %s LIMIT 1;", $slug ) ); |
|
223 | + $trashed_page_found = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_name = %s LIMIT 1;", $slug)); |
|
224 | 224 | } |
225 | 225 | |
226 | - if ( $trashed_page_found ) { |
|
226 | + if ($trashed_page_found) { |
|
227 | 227 | $page_id = $trashed_page_found; |
228 | 228 | $page_data = array( |
229 | 229 | 'ID' => $page_id, |
230 | 230 | 'post_status' => 'publish', |
231 | 231 | 'post_parent' => $post_parent, |
232 | 232 | ); |
233 | - wp_update_post( $page_data ); |
|
233 | + wp_update_post($page_data); |
|
234 | 234 | } else { |
235 | 235 | $page_data = array( |
236 | 236 | 'post_status' => 'publish', |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | 'post_parent' => $post_parent, |
243 | 243 | 'comment_status' => 'closed', |
244 | 244 | ); |
245 | - $page_id = wp_insert_post( $page_data ); |
|
245 | + $page_id = wp_insert_post($page_data); |
|
246 | 246 | } |
247 | 247 | |
248 | - if ( $option ) { |
|
249 | - wpinv_update_option( $option, (int) $page_id ); |
|
248 | + if ($option) { |
|
249 | + wpinv_update_option($option, (int) $page_id); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | return $page_id; |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @return array |
261 | 261 | */ |
262 | -function wpinv_add_aui_screens($screen_ids){ |
|
262 | +function wpinv_add_aui_screens($screen_ids) { |
|
263 | 263 | |
264 | 264 | // load on these pages if set |
265 | - $screen_ids = array_merge( $screen_ids, wpinv_get_screen_ids() ); |
|
265 | + $screen_ids = array_merge($screen_ids, wpinv_get_screen_ids()); |
|
266 | 266 | |
267 | 267 | return $screen_ids; |
268 | 268 | } |
269 | -add_filter('aui_screen_ids','wpinv_add_aui_screens'); |
|
270 | 269 | \ No newline at end of file |
270 | +add_filter('aui_screen_ids', 'wpinv_add_aui_screens'); |
|
271 | 271 | \ No newline at end of file |
@@ -4,29 +4,29 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | $gateways = wpinv_get_payment_gateways(); |
10 | -ksort( $gateways ); |
|
10 | +ksort($gateways); |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | <div class="table-responsive"> |
14 | 14 | <table id="wpinv_gateways_select" class="table border bg-white form-table"> |
15 | - <caption><?php echo esc_html_e( 'This table displays installed payment methods.', 'invoicing' ); ?></caption> |
|
15 | + <caption><?php echo esc_html_e('This table displays installed payment methods.', 'invoicing'); ?></caption> |
|
16 | 16 | |
17 | 17 | <thead> |
18 | 18 | <tr class="table-light"> |
19 | 19 | |
20 | 20 | <th scope="col" class="border-bottom border-top text-left"> |
21 | - <?php _e( 'Payment Method', 'invoicing' ); ?> |
|
21 | + <?php _e('Payment Method', 'invoicing'); ?> |
|
22 | 22 | </th> |
23 | 23 | |
24 | 24 | <th scope="col" class="border-bottom border-top text-center"> |
25 | - <?php _e( 'Enabled', 'invoicing' ); ?> |
|
25 | + <?php _e('Enabled', 'invoicing'); ?> |
|
26 | 26 | </th> |
27 | 27 | |
28 | 28 | <th scope="col" class="border-bottom border-top text-center"> |
29 | - <?php _e( 'Supports Subscriptions', 'invoicing' ); ?> |
|
29 | + <?php _e('Supports Subscriptions', 'invoicing'); ?> |
|
30 | 30 | </th> |
31 | 31 | |
32 | 32 | <th scope="col" class="border-bottom border-top text-right" style="width:32px"> </th> |
@@ -35,15 +35,15 @@ discard block |
||
35 | 35 | </thead> |
36 | 36 | |
37 | 37 | <tbody> |
38 | - <?php foreach ( $gateways as $id => $gateway ) : ?> |
|
38 | + <?php foreach ($gateways as $id => $gateway) : ?> |
|
39 | 39 | <tr> |
40 | 40 | <td class="getpaid-payment-method text-left"> |
41 | - <a style="color: #0073aa;" href="<?php echo esc_url( add_query_arg( 'section', $id ) ); ?>" class="font-weight-bold"><?php echo esc_html( $gateway['admin_label'] ); ?></a> |
|
41 | + <a style="color: #0073aa;" href="<?php echo esc_url(add_query_arg('section', $id)); ?>" class="font-weight-bold"><?php echo esc_html($gateway['admin_label']); ?></a> |
|
42 | 42 | </td> |
43 | 43 | <td class="getpaid-payment-method-enabled text-center"> |
44 | 44 | <?php |
45 | 45 | |
46 | - if ( wpinv_is_gateway_active( $id ) ) { |
|
46 | + if (wpinv_is_gateway_active($id)) { |
|
47 | 47 | echo "<i class='text-success fa fa-check'></i>"; |
48 | 48 | } else { |
49 | 49 | echo "<i class='text-dark fa fa-times'></i>"; |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | <td class="getpaid-payment-method-subscription text-center"> |
55 | 55 | <?php |
56 | 56 | |
57 | - $supports = apply_filters( "wpinv_{$id}_support_subscription", false ); |
|
58 | - $supports = apply_filters( 'getapid_gateway_supports_subscription', $supports, $id ); |
|
57 | + $supports = apply_filters("wpinv_{$id}_support_subscription", false); |
|
58 | + $supports = apply_filters('getapid_gateway_supports_subscription', $supports, $id); |
|
59 | 59 | |
60 | - if ( $supports ) { |
|
60 | + if ($supports) { |
|
61 | 61 | echo "<i class='text-success fa fa-check'></i>"; |
62 | 62 | } else { |
63 | 63 | echo "<i class='text-dark fa fa-times'></i>"; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | </td> |
68 | 68 | |
69 | 69 | <td class="getpaid-payment-method-action text-right"> |
70 | - <a class="button button-secondary" href="<?php echo esc_url( add_query_arg( 'section', $id ) ); ?>"><?php _e( 'Manage', 'invoicing' ); ?></a> |
|
70 | + <a class="button button-secondary" href="<?php echo esc_url(add_query_arg('section', $id)); ?>"><?php _e('Manage', 'invoicing'); ?></a> |
|
71 | 71 | </td> |
72 | 72 | |
73 | 73 | </tr> |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | <tfoot> |
78 | 78 | <tr class="table-light"> |
79 | 79 | <td colspan="4" class="border-top"> |
80 | - <a class="button button-secondary getpaid-install-gateways" href="<?php echo esc_url( admin_url( 'admin.php?page=wpi-addons&tab=gateways' ) ); ?>"> |
|
81 | - <span><?php _e( 'Add Payment Methods', 'invoicing' ); ?></span> |
|
80 | + <a class="button button-secondary getpaid-install-gateways" href="<?php echo esc_url(admin_url('admin.php?page=wpi-addons&tab=gateways')); ?>"> |
|
81 | + <span><?php _e('Add Payment Methods', 'invoicing'); ?></span> |
|
82 | 82 | </a> |
83 | 83 | </td> |
84 | 84 | </tr> |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @var array $tax_rate |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | ?> |
12 | 12 | |
@@ -18,54 +18,54 @@ discard block |
||
18 | 18 | $country = aui()->select( |
19 | 19 | array( |
20 | 20 | 'options' => array_merge( |
21 | - array( '' => __( 'All Countries', 'invoicing' ) ), |
|
21 | + array('' => __('All Countries', 'invoicing')), |
|
22 | 22 | wpinv_get_country_list() |
23 | 23 | ), |
24 | 24 | 'name' => "tax_rates[$key][country]", |
25 | - 'id' => uniqid( 'tax_rate_country' ), |
|
26 | - 'value' => esc_html( $tax_rate['country'] ), |
|
27 | - 'label' => __( 'Country', 'invoicing' ), |
|
25 | + 'id' => uniqid('tax_rate_country'), |
|
26 | + 'value' => esc_html($tax_rate['country']), |
|
27 | + 'label' => __('Country', 'invoicing'), |
|
28 | 28 | 'class' => 'wpinv_country', |
29 | 29 | 'no_wrap' => true, |
30 | 30 | ) |
31 | 31 | ); |
32 | 32 | |
33 | - echo str_replace( 'custom-select', '', $country ); |
|
33 | + echo str_replace('custom-select', '', $country); |
|
34 | 34 | ?> |
35 | 35 | </td> |
36 | 36 | |
37 | 37 | <td class="wpinv_tax_state"> |
38 | 38 | |
39 | 39 | <label class="w-100"> |
40 | - <span class="screen-reader-text"><?php _e( 'States', 'invoicing' ); ?></span> |
|
41 | - <input type="text" placeholder="<?php esc_attr_e( 'Apply to whole country', 'invoicing' ); ?>" name="tax_rates[<?php echo esc_attr( $key ) ?>][state]" value="<?php echo empty( $tax_rate['global'] ) ? esc_attr( $tax_rate['state'] ) : ''; ?>"/> |
|
40 | + <span class="screen-reader-text"><?php _e('States', 'invoicing'); ?></span> |
|
41 | + <input type="text" placeholder="<?php esc_attr_e('Apply to whole country', 'invoicing'); ?>" name="tax_rates[<?php echo esc_attr($key) ?>][state]" value="<?php echo empty($tax_rate['global']) ? esc_attr($tax_rate['state']) : ''; ?>"/> |
|
42 | 42 | </label> |
43 | 43 | |
44 | 44 | </td> |
45 | 45 | |
46 | 46 | <td class="wpinv_standard_rate"> |
47 | 47 | <label class="w-100"> |
48 | - <span class="screen-reader-text"><?php _e( 'Standard Rate', 'invoicing' ); ?></span> |
|
49 | - <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr( $key ) ?>][rate]" value="<?php echo wpinv_sanitize_amount( $tax_rate['rate'] ); ?>"/> |
|
48 | + <span class="screen-reader-text"><?php _e('Standard Rate', 'invoicing'); ?></span> |
|
49 | + <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr($key) ?>][rate]" value="<?php echo wpinv_sanitize_amount($tax_rate['rate']); ?>"/> |
|
50 | 50 | </label> |
51 | 51 | </td> |
52 | 52 | |
53 | 53 | <td class="wpinv_reduced_rate"> |
54 | 54 | <label class="w-100"> |
55 | - <span class="screen-reader-text"><?php _e( 'Reduced Rate', 'invoicing' ); ?></span> |
|
56 | - <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr( $key ) ?>][reduced_rate]" value="<?php echo wpinv_sanitize_amount( $tax_rate['reduced_rate'] ); ?>"/> |
|
55 | + <span class="screen-reader-text"><?php _e('Reduced Rate', 'invoicing'); ?></span> |
|
56 | + <input type="number" step="any" min="0" max="99" name="tax_rates[<?php echo esc_attr($key) ?>][reduced_rate]" value="<?php echo wpinv_sanitize_amount($tax_rate['reduced_rate']); ?>"/> |
|
57 | 57 | </label> |
58 | 58 | </td> |
59 | 59 | |
60 | 60 | <td class="wpinv_tax_name"> |
61 | 61 | <label class="w-100"> |
62 | - <span class="screen-reader-text"><?php _e( 'Tax Name', 'invoicing' ); ?></span> |
|
63 | - <input type="text" name="tax_rates[<?php echo esc_attr( $key ) ?>][name]" value="<?php echo esc_attr( $tax_rate['name'] ); ?>"/> |
|
62 | + <span class="screen-reader-text"><?php _e('Tax Name', 'invoicing'); ?></span> |
|
63 | + <input type="text" name="tax_rates[<?php echo esc_attr($key) ?>][name]" value="<?php echo esc_attr($tax_rate['name']); ?>"/> |
|
64 | 64 | </label> |
65 | 65 | </td> |
66 | 66 | |
67 | 67 | <td class="wpinv_tax_remove"> |
68 | - <button type="button" class="close wpinv_remove_tax_rate" aria-label="<?php esc_attr_e( 'Delete', 'invoicing' ); ?>" title="<?php esc_attr_e( 'Delete', 'invoicing' ); ?>"> |
|
68 | + <button type="button" class="close wpinv_remove_tax_rate" aria-label="<?php esc_attr_e('Delete', 'invoicing'); ?>" title="<?php esc_attr_e('Delete', 'invoicing'); ?>"> |
|
69 | 69 | <span aria-hidden="true">×</span> |
70 | 70 | </button> |
71 | 71 | </td> |
@@ -7,35 +7,35 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Ensure that we have options. |
13 | -if ( empty( $options ) ) { |
|
13 | +if (empty($options)) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Prepare price options. |
18 | -$options = getpaid_convert_price_string_to_options( $options ); |
|
19 | -$keys = array_keys( $options ); |
|
20 | -$value = empty( $options ) ? '' : $keys[0]; |
|
18 | +$options = getpaid_convert_price_string_to_options($options); |
|
19 | +$keys = array_keys($options); |
|
20 | +$value = empty($options) ? '' : $keys[0]; |
|
21 | 21 | |
22 | 22 | // Prepare id. |
23 | -$id = esc_attr( $id ); |
|
23 | +$id = esc_attr($id); |
|
24 | 24 | |
25 | -$select_type = empty( $select_type ) ? 'select' : $select_type; |
|
25 | +$select_type = empty($select_type) ? 'select' : $select_type; |
|
26 | 26 | |
27 | 27 | // Item select; |
28 | -if ( $select_type == 'select' ) { |
|
28 | +if ($select_type == 'select') { |
|
29 | 29 | echo aui()->select( |
30 | 30 | array( |
31 | 31 | 'name' => $id, |
32 | - 'id' => $id . uniqid( '_' ), |
|
33 | - 'placeholder'=> empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
32 | + 'id' => $id . uniqid('_'), |
|
33 | + 'placeholder'=> empty($placeholder) ? '' : esc_attr($placeholder), |
|
34 | 34 | 'value' => $value, |
35 | - 'label' => empty( $label ) ? '' : esc_html( $label ), |
|
35 | + 'label' => empty($label) ? '' : esc_html($label), |
|
36 | 36 | 'label_type' => 'vertical', |
37 | 37 | 'class' => 'getpaid-price-select-dropdown getpaid-refresh-on-change', |
38 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
38 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
39 | 39 | 'options' => $options, |
40 | 40 | ) |
41 | 41 | ); |
@@ -43,18 +43,18 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | // Item radios; |
46 | -if ( $select_type == 'radios' ) { |
|
46 | +if ($select_type == 'radios') { |
|
47 | 47 | echo aui()->radio( |
48 | 48 | array( |
49 | - 'name' => esc_attr( $id ), |
|
50 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
51 | - 'label' => empty( $label ) ? '' : esc_html( $label ), |
|
49 | + 'name' => esc_attr($id), |
|
50 | + 'id' => esc_attr($id) . uniqid('_'), |
|
51 | + 'label' => empty($label) ? '' : esc_html($label), |
|
52 | 52 | 'label_type' => 'vertical', |
53 | 53 | 'class' => 'getpaid-price-select-radio getpaid-refresh-on-change w-100', |
54 | 54 | 'value' => $value, |
55 | 55 | 'inline' => false, |
56 | 56 | 'options' => $options, |
57 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
57 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
58 | 58 | ) |
59 | 59 | ); |
60 | 60 | return; |
@@ -62,30 +62,30 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | // Display the label. |
65 | -if ( ! empty( $label ) ) { |
|
66 | - $label = esc_html( $label ); |
|
65 | +if (!empty($label)) { |
|
66 | + $label = esc_html($label); |
|
67 | 67 | echo "<label>$label</label>"; |
68 | 68 | } |
69 | 69 | |
70 | 70 | // Item buttons; |
71 | -if ( $select_type == 'buttons' || $select_type == 'circles' ) { |
|
71 | +if ($select_type == 'buttons' || $select_type == 'circles') { |
|
72 | 72 | |
73 | 73 | $class = 'getpaid-price-buttons'; |
74 | 74 | |
75 | - if ( $select_type == 'circles' ) { |
|
75 | + if ($select_type == 'circles') { |
|
76 | 76 | $class .= ' getpaid-price-circles'; |
77 | 77 | } |
78 | 78 | echo "<div class='$class'>"; |
79 | 79 | |
80 | - foreach ( $options as $price => $label ) { |
|
81 | - $label = esc_html( $label ); |
|
82 | - $price = esc_attr( $price ); |
|
83 | - $_id = $id . uniqid( '_' ); |
|
84 | - $checked = checked( $price, $value, false ); |
|
80 | + foreach ($options as $price => $label) { |
|
81 | + $label = esc_html($label); |
|
82 | + $price = esc_attr($price); |
|
83 | + $_id = $id . uniqid('_'); |
|
84 | + $checked = checked($price, $value, false); |
|
85 | 85 | |
86 | 86 | $class = 'rounded'; |
87 | 87 | |
88 | - if ( $select_type == 'circles' ) { |
|
88 | + if ($select_type == 'circles') { |
|
89 | 89 | $class = ''; |
90 | 90 | } |
91 | 91 | echo " |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | // Item checkboxes; |
104 | -if ( $select_type == 'checkboxes' ) { |
|
104 | +if ($select_type == 'checkboxes') { |
|
105 | 105 | echo '<div class="form-group">'; |
106 | 106 | |
107 | - foreach ( $options as $price => $label ) { |
|
108 | - $label = esc_html( $label ); |
|
109 | - $price = esc_attr( $price ); |
|
110 | - $checked = checked( $price, $value, false ); |
|
107 | + foreach ($options as $price => $label) { |
|
108 | + $label = esc_html($label); |
|
109 | + $price = esc_attr($price); |
|
110 | + $checked = checked($price, $value, false); |
|
111 | 111 | echo " |
112 | 112 | <label class='d-block'> |
113 | 113 | <input type='checkbox' class='getpaid-price-select-checkbox getpaid-refresh-on-change w-auto' name='{$id}[]' value='$price' $checked /> |
@@ -120,6 +120,6 @@ discard block |
||
120 | 120 | |
121 | 121 | } |
122 | 122 | |
123 | -if ( ! empty( $description ) ) { |
|
123 | +if (!empty($description)) { |
|
124 | 124 | echo "<small class='form-text text-muted'>$description</small>"; |
125 | 125 | } |
@@ -7,16 +7,16 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -if ( empty( $text ) ) { |
|
13 | - $text = __( 'Your IP address is:', 'invoicing' ); |
|
12 | +if (empty($text)) { |
|
13 | + $text = __('Your IP address is:', 'invoicing'); |
|
14 | 14 | } |
15 | 15 | |
16 | -$ip_address = esc_html( wpinv_get_ip() ); |
|
16 | +$ip_address = esc_html(wpinv_get_ip()); |
|
17 | 17 | |
18 | 18 | ?> |
19 | 19 | <div class="form-group getpaid-ip-info"> |
20 | - <span><?php echo wp_kses_post( $text ); ?></span> |
|
20 | + <span><?php echo wp_kses_post($text); ?></span> |
|
21 | 21 | <strong><?php echo $ip_address; ?></strong> |
22 | 22 | </div> |
@@ -7,32 +7,32 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Set the currency position. |
13 | 13 | $position = wpinv_currency_position(); |
14 | 14 | |
15 | -if ( $position == 'left_space' ) { |
|
15 | +if ($position == 'left_space') { |
|
16 | 16 | $position = 'left'; |
17 | 17 | } |
18 | 18 | |
19 | -if ( $position == 'right_space' ) { |
|
19 | +if ($position == 'right_space') { |
|
20 | 20 | $position = 'right'; |
21 | 21 | } |
22 | -$label = empty( $label ) ? '' : esc_html( $label ); |
|
23 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
22 | +$label = empty($label) ? '' : esc_html($label); |
|
23 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
24 | 24 | |
25 | 25 | echo aui()->input( |
26 | 26 | array( |
27 | - 'name' => esc_attr( $id ), |
|
28 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
29 | - 'placeholder' => empty( $placeholder ) ? wpinv_format_amount(0) : wpinv_format_amount( $placeholder ), |
|
30 | - 'value' => empty( $value ) ? wpinv_format_amount(0) : wpinv_format_amount( $value ), |
|
31 | - 'label' => empty( $label ) ? '' : wp_kses_post( $label ), |
|
27 | + 'name' => esc_attr($id), |
|
28 | + 'id' => esc_attr($id) . uniqid('_'), |
|
29 | + 'placeholder' => empty($placeholder) ? wpinv_format_amount(0) : wpinv_format_amount($placeholder), |
|
30 | + 'value' => empty($value) ? wpinv_format_amount(0) : wpinv_format_amount($value), |
|
31 | + 'label' => empty($label) ? '' : wp_kses_post($label), |
|
32 | 32 | 'label_type' => 'vertical', |
33 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
34 | - 'input_group_right' => $position == 'right' ? wpinv_currency_symbol( $form->get_currency() ) : '', |
|
35 | - 'input_group_left' => $position == 'left' ? wpinv_currency_symbol( $form->get_currency() ) : '', |
|
33 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
34 | + 'input_group_right' => $position == 'right' ? wpinv_currency_symbol($form->get_currency()) : '', |
|
35 | + 'input_group_left' => $position == 'left' ? wpinv_currency_symbol($form->get_currency()) : '', |
|
36 | 36 | 'class' => 'getpaid-refresh-on-change ' . $label_class, |
37 | 37 | ) |
38 | 38 | ); |