@@ -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,62 +16,62 @@ 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 | |
@@ -87,26 +87,26 @@ discard block  | 
                                                    ||
| 87 | 87 | );  | 
                                                        
| 88 | 88 | ?>  | 
                                                        
| 89 | 89 | |
| 90 | - <div class="wpinv-items-wrap<?php echo esc_attr( $class ); ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr( $invoice->get_status() ); ?>">  | 
                                                        |
| 90 | + <div class="wpinv-items-wrap<?php echo esc_attr($class); ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr($invoice->get_status()); ?>">  | 
                                                        |
| 91 | 91 | <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0">  | 
                                                        
| 92 | 92 | |
| 93 | 93 | <thead>  | 
                                                        
| 94 | 94 | <tr>  | 
                                                        
| 95 | - <?php foreach ( $columns as $key => $label ) : ?>  | 
                                                        |
| 95 | + <?php foreach ($columns as $key => $label) : ?>  | 
                                                        |
| 96 | 96 | <th class="  | 
                                                        
| 97 | 97 | <?php  | 
                                                        
| 98 | - echo esc_attr( $key );  | 
                                                        |
| 98 | + echo esc_attr($key);  | 
                                                        |
| 99 | 99 | echo 'total' == $key || 'qty' == $key ? ' hide-if-amount' : '';  | 
                                                        
| 100 | 100 | ?>  | 
                                                        
| 101 | - "><?php echo wp_kses_post( $label ); ?></th>  | 
                                                        |
| 101 | + "><?php echo wp_kses_post($label); ?></th>  | 
                                                        |
| 102 | 102 | <?php endforeach; ?>  | 
                                                        
| 103 | 103 | </tr>  | 
                                                        
| 104 | 104 | </thead>  | 
                                                        
| 105 | 105 | |
| 106 | 106 | <tbody class="wpinv-line-items">  | 
                                                        
| 107 | 107 | <?php  | 
                                                        
| 108 | -                        foreach ( $invoice->get_items() as $int => $item ) { | 
                                                        |
| 109 | - self::output_row( $columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd' );  | 
                                                        |
| 108 | +                        foreach ($invoice->get_items() as $int => $item) { | 
                                                        |
| 109 | + self::output_row($columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd');  | 
                                                        |
| 110 | 110 | }  | 
                                                        
| 111 | 111 | ?>  | 
                                                        
| 112 | 112 | </tbody>  | 
                                                        
@@ -123,7 +123,7 @@ discard block  | 
                                                    ||
| 123 | 123 | <div class="wp-clearfix">  | 
                                                        
| 124 | 124 | <label class="wpi-item-name">  | 
                                                        
| 125 | 125 | <span class="input-text-wrap">  | 
                                                        
| 126 | - <input type="text" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]">  | 
                                                        |
| 126 | +                                                        <input type="text" style="width: 100%" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]"> | 
                                                        |
| 127 | 127 | </span>  | 
                                                        
| 128 | 128 | </label>  | 
                                                        
| 129 | 129 | </div>  | 
                                                        
@@ -131,8 +131,8 @@ discard block  | 
                                                    ||
| 131 | 131 | <div class="wp-clearfix">  | 
                                                        
| 132 | 132 | <label class="wpi-item-price">  | 
                                                        
| 133 | 133 | <span class="input-text-wrap">  | 
                                                        
| 134 | - <input type="text" style="width: 200px" placeholder="<?php esc_attr_e( 'Item Price', 'invoicing' ); ?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]">  | 
                                                        |
| 135 | - × <input type="text" style="width: 140px" placeholder="<?php esc_attr_e( 'Item Quantity', 'invoicing' ); ?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]">  | 
                                                        |
| 134 | +                                                    <input type="text" style="width: 200px" placeholder="<?php esc_attr_e('Item Price', 'invoicing'); ?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]"> | 
                                                        |
| 135 | +                                                        × <input type="text" style="width: 140px" placeholder="<?php esc_attr_e('Item Quantity', 'invoicing'); ?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]"> | 
                                                        |
| 136 | 136 | </span>  | 
                                                        
| 137 | 137 | </label>  | 
                                                        
| 138 | 138 | </div>  | 
                                                        
@@ -140,7 +140,7 @@ discard block  | 
                                                    ||
| 140 | 140 | <div class="wp-clearfix">  | 
                                                        
| 141 | 141 | <label class="wpi-item-name">  | 
                                                        
| 142 | 142 | <span class="input-text-wrap">  | 
                                                        
| 143 | - <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Description', 'invoicing' ); ?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea>  | 
                                                        |
| 143 | +                                                        <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e('Item Description', 'invoicing'); ?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea> | 
                                                        |
| 144 | 144 | </span>  | 
                                                        
| 145 | 145 | </label>  | 
                                                        
| 146 | 146 | </div>  | 
                                                        
@@ -165,7 +165,7 @@ discard block  | 
                                                    ||
| 165 | 165 | </label>  | 
                                                        
| 166 | 166 | </div>  | 
                                                        
| 167 | 167 | |
| 168 | - <?php if ( $use_taxes ) : ?>  | 
                                                        |
| 168 | + <?php if ($use_taxes) : ?>  | 
                                                        |
| 169 | 169 | <div class="wp-clearfix">  | 
                                                        
| 170 | 170 | <label class="wpi-vat-rule">  | 
                                                        
| 171 | 171 | <span class="input-text-wrap">  | 
                                                        
@@ -173,7 +173,7 @@ discard block  | 
                                                    ||
| 173 | 173 | wpinv_html_select(  | 
                                                        
| 174 | 174 | array(  | 
                                                        
| 175 | 175 | 'options' => array_merge(  | 
                                                        
| 176 | - array( '' => __( 'Select VAT Rule', 'invoicing' ) ),  | 
                                                        |
| 176 | +																			array('' => __('Select VAT Rule', 'invoicing')), | 
                                                        |
| 177 | 177 | getpaid_get_tax_rules()  | 
                                                        
| 178 | 178 | ),  | 
                                                        
| 179 | 179 | 'name' => '_wpinv_quick[vat_rule]',  | 
                                                        
@@ -195,7 +195,7 @@ discard block  | 
                                                    ||
| 195 | 195 | wpinv_html_select(  | 
                                                        
| 196 | 196 | array(  | 
                                                        
| 197 | 197 | 'options' => array_merge(  | 
                                                        
| 198 | - array( '' => __( 'Select VAT Class', 'invoicing' ) ),  | 
                                                        |
| 198 | +																			array('' => __('Select VAT Class', 'invoicing')), | 
                                                        |
| 199 | 199 | getpaid_get_tax_classes()  | 
                                                        
| 200 | 200 | ),  | 
                                                        
| 201 | 201 | 'name' => '_wpinv_quick[vat_class]',  | 
                                                        
@@ -219,7 +219,7 @@ discard block  | 
                                                    ||
| 219 | 219 | 'type' => 'checkbox',  | 
                                                        
| 220 | 220 | 'name' => '_wpinv_quick[one-time]',  | 
                                                        
| 221 | 221 | 'id' => '_wpinv_quick-one-time',  | 
                                                        
| 222 | - 'label' => __( "One time item (won't be saved to regular items list)", 'invoicing' ),  | 
                                                        |
| 222 | +                                                            'label'   => __("One time item (won't be saved to regular items list)", 'invoicing'), | 
                                                        |
| 223 | 223 | 'value' => 1,  | 
                                                        
| 224 | 224 | 'no_wrap' => true,  | 
                                                        
| 225 | 225 | 'checked' => false,  | 
                                                        
@@ -243,29 +243,29 @@ discard block  | 
                                                    ||
| 243 | 243 | </td>  | 
                                                        
| 244 | 244 | </tr>  | 
                                                        
| 245 | 245 | <tr class="totals">  | 
                                                        
| 246 | - <td colspan="<?php echo ( (int) $cols - 4 ); ?>"></td>  | 
                                                        |
| 246 | + <td colspan="<?php echo ((int) $cols - 4); ?>"></td>  | 
                                                        |
| 247 | 247 | <td colspan="4">  | 
                                                        
| 248 | 248 | <table cellspacing="0" cellpadding="0">  | 
                                                        
| 249 | 249 | <tr class="subtotal">  | 
                                                        
| 250 | - <td class="name"><?php esc_html_e( 'Sub Total:', 'invoicing' ); ?></td>  | 
                                                        |
| 251 | - <td class="total"><?php wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() ); ?></td>  | 
                                                        |
| 250 | +                                    <td class="name"><?php esc_html_e('Sub Total:', 'invoicing'); ?></td> | 
                                                        |
| 251 | + <td class="total"><?php wpinv_the_price($invoice->get_subtotal(), $invoice->get_currency()); ?></td>  | 
                                                        |
| 252 | 252 | <td class="action"></td>  | 
                                                        
| 253 | 253 | </tr>  | 
                                                        
| 254 | 254 | <tr class="discount">  | 
                                                        
| 255 | - <td class="name"><?php esc_html_e( 'Discount:', 'invoicing' ); ?></td>  | 
                                                        |
| 256 | - <td class="total"><?php wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() ); ?></td>  | 
                                                        |
| 255 | +                                    <td class="name"><?php esc_html_e('Discount:', 'invoicing'); ?></td> | 
                                                        |
| 256 | + <td class="total"><?php wpinv_the_price($invoice->get_total_discount(), $invoice->get_currency()); ?></td>  | 
                                                        |
| 257 | 257 | <td class="action"></td>  | 
                                                        
| 258 | 258 | </tr>  | 
                                                        
| 259 | - <?php if ( $use_taxes ) : ?>  | 
                                                        |
| 259 | + <?php if ($use_taxes) : ?>  | 
                                                        |
| 260 | 260 | <tr class="tax">  | 
                                                        
| 261 | - <td class="name"><?php esc_html_e( 'Tax:', 'invoicing' ); ?></td>  | 
                                                        |
| 262 | - <td class="total"><?php wpinv_the_price( $invoice->get_total_tax(), $invoice->get_currency() ); ?></td>  | 
                                                        |
| 261 | +                                    <td class="name"><?php esc_html_e('Tax:', 'invoicing'); ?></td> | 
                                                        |
| 262 | + <td class="total"><?php wpinv_the_price($invoice->get_total_tax(), $invoice->get_currency()); ?></td>  | 
                                                        |
| 263 | 263 | <td class="action"></td>  | 
                                                        
| 264 | 264 | </tr>  | 
                                                        
| 265 | 265 | <?php endif; ?>  | 
                                                        
| 266 | 266 | <tr class="total">  | 
                                                        
| 267 | - <td class="name"><?php esc_html_e( 'Total:', 'invoicing' ); ?></td>  | 
                                                        |
| 268 | - <td class="total"><?php wpinv_the_price( $invoice->get_total(), $invoice->get_currency() ); ?></td>  | 
                                                        |
| 267 | +                                    <td class="name"><?php esc_html_e('Total:', 'invoicing'); ?></td> | 
                                                        |
| 268 | + <td class="total"><?php wpinv_the_price($invoice->get_total(), $invoice->get_currency()); ?></td>  | 
                                                        |
| 269 | 269 | <td class="action"></td>  | 
                                                        
| 270 | 270 | </tr>  | 
                                                        
| 271 | 271 | </table>  | 
                                                        
@@ -281,18 +281,18 @@ discard block  | 
                                                    ||
| 281 | 281 | <div class="modal-dialog modal-dialog-centered" role="document">  | 
                                                        
| 282 | 282 | <div class="modal-content">  | 
                                                        
| 283 | 283 | <div class="modal-header">  | 
                                                        
| 284 | - <h5 class="modal-title" id="getpaid-refund-invoice-modal-label"><?php esc_html_e( 'Refund Payment', 'invoicing' ); ?></h5>  | 
                                                        |
| 285 | - <button type="button" class="close btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="<?php esc_html_e( 'Close', 'invoicing' ); ?>">  | 
                                                        |
| 286 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>  | 
                                                        |
| 284 | +                                <h5 class="modal-title" id="getpaid-refund-invoice-modal-label"><?php esc_html_e('Refund Payment', 'invoicing'); ?></h5> | 
                                                        |
| 285 | +                                <button type="button" class="close btn-close" data-bs-dismiss="modal" data-dismiss="modal" aria-label="<?php esc_html_e('Close', 'invoicing'); ?>"> | 
                                                        |
| 286 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?>  | 
                                                        |
| 287 | 287 | <span aria-hidden="true">×</span>  | 
                                                        
| 288 | 288 | <?php endif; ?>  | 
                                                        
| 289 | 289 | </button>  | 
                                                        
| 290 | 290 | </div>  | 
                                                        
| 291 | 291 | <div class="modal-body">  | 
                                                        
| 292 | 292 | <p>  | 
                                                        
| 293 | - <?php esc_html_e( 'Are you sure you want to refund this payment?', 'invoicing' ); ?>  | 
                                                        |
| 293 | +									<?php esc_html_e('Are you sure you want to refund this payment?', 'invoicing'); ?> | 
                                                        |
| 294 | 294 | </p>  | 
                                                        
| 295 | - <?php if ( getpaid_payment_gateway_supports( $invoice->get_gateway(), 'refunds' ) ) : ?>  | 
                                                        |
| 295 | + <?php if (getpaid_payment_gateway_supports($invoice->get_gateway(), 'refunds')) : ?>  | 
                                                        |
| 296 | 296 | <?php  | 
                                                        
| 297 | 297 | aui()->input(  | 
                                                        
| 298 | 298 | array(  | 
                                                        
@@ -301,7 +301,7 @@ discard block  | 
                                                    ||
| 301 | 301 | 'id' => 'getpaid_refund_remote',  | 
                                                        
| 302 | 302 | 'label' => sprintf(  | 
                                                        
| 303 | 303 | 'Refund payment in %s',  | 
                                                        
| 304 | - wpinv_get_gateway_admin_label( $invoice->get_gateway() )  | 
                                                        |
| 304 | + wpinv_get_gateway_admin_label($invoice->get_gateway())  | 
                                                        |
| 305 | 305 | ),  | 
                                                        
| 306 | 306 | 'value' => 1,  | 
                                                        
| 307 | 307 | 'class' => 'getpaid-refund-field',  | 
                                                        
@@ -311,14 +311,14 @@ discard block  | 
                                                    ||
| 311 | 311 | ?>  | 
                                                        
| 312 | 312 | <?php endif; ?>  | 
                                                        
| 313 | 313 | |
| 314 | - <?php if ( getpaid_get_invoice_subscriptions( $invoice ) ) : ?>  | 
                                                        |
| 314 | + <?php if (getpaid_get_invoice_subscriptions($invoice)) : ?>  | 
                                                        |
| 315 | 315 | <?php  | 
                                                        
| 316 | 316 | aui()->input(  | 
                                                        
| 317 | 317 | array(  | 
                                                        
| 318 | 318 | 'type' => 'checkbox',  | 
                                                        
| 319 | 319 | 'name' => 'getpaid_cancel_subscription',  | 
                                                        
| 320 | 320 | 'id' => 'getpaid_cancel_subscription',  | 
                                                        
| 321 | - 'label' => __( 'Cancel subscription', 'invoicing' ),  | 
                                                        |
| 321 | +												'label' => __('Cancel subscription', 'invoicing'), | 
                                                        |
| 322 | 322 | 'value' => 1,  | 
                                                        
| 323 | 323 | 'class' => 'getpaid-refund-field',  | 
                                                        
| 324 | 324 | ),  | 
                                                        
@@ -328,12 +328,12 @@ discard block  | 
                                                    ||
| 328 | 328 | <?php endif; ?>  | 
                                                        
| 329 | 329 | </div>  | 
                                                        
| 330 | 330 | <div class="modal-footer">  | 
                                                        
| 331 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-bs-dismiss="modal" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button>  | 
                                                        |
| 331 | +                                <button type="button" class="btn btn-secondary getpaid-cancel" data-bs-dismiss="modal" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button> | 
                                                        |
| 332 | 332 | <a  | 
                                                        
| 333 | - href="<?php echo esc_url_raw( $refund_url ); ?>"  | 
                                                        |
| 334 | - data-href="<?php echo esc_url_raw( $refund_url ); ?>"  | 
                                                        |
| 333 | + href="<?php echo esc_url_raw($refund_url); ?>"  | 
                                                        |
| 334 | + data-href="<?php echo esc_url_raw($refund_url); ?>"  | 
                                                        |
| 335 | 335 | class="btn btn-primary getpaid-refund-payment-button"  | 
                                                        
| 336 | - ><?php esc_html_e( 'Refund', 'invoicing' ); ?></a>  | 
                                                        |
| 336 | +								><?php esc_html_e('Refund', 'invoicing'); ?></a> | 
                                                        |
| 337 | 337 | <script>  | 
                                                        
| 338 | 338 | // Update the refund URL when the user changes the refund options.  | 
                                                        
| 339 | 339 |  									jQuery( function( $ ) { | 
                                                        
@@ -359,13 +359,13 @@ discard block  | 
                                                    ||
| 359 | 359 | |
| 360 | 360 | <div class="wpinv-actions">  | 
                                                        
| 361 | 361 | <?php  | 
                                                        
| 362 | -                    if ( $invoice->is_paid() ) { | 
                                                        |
| 362 | +                    if ($invoice->is_paid()) { | 
                                                        |
| 363 | 363 | |
| 364 | 364 | printf(  | 
                                                        
| 365 | 365 | '<span class="bsui"><button type="button" class="button button-primary" data-toggle="modal" data-bs-toggle="modal" data-bs-target="#getpaid-refund-invoice-modal" data-target="#getpaid-refund-invoice-modal">%s</button></span>',  | 
                                                        
| 366 | - esc_html__( 'Refund', 'invoicing' )  | 
                                                        |
| 366 | +							esc_html__('Refund', 'invoicing') | 
                                                        |
| 367 | 367 | );  | 
                                                        
| 368 | -                    } elseif ( ! $invoice->is_refunded() ) { | 
                                                        |
| 368 | +                    } elseif (!$invoice->is_refunded()) { | 
                                                        |
| 369 | 369 | wpinv_item_dropdown(  | 
                                                        
| 370 | 370 | array(  | 
                                                        
| 371 | 371 | 'name' => 'wpinv_invoice_item',  | 
                                                        
@@ -375,66 +375,66 @@ discard block  | 
                                                    ||
| 375 | 375 | )  | 
                                                        
| 376 | 376 | );  | 
                                                        
| 377 | 377 | |
| 378 | - echo ' ' . '<button type="button" class="button button-primary" id="wpinv-add-item">' . sprintf( esc_html__( 'Add item to %s', 'invoicing' ), esc_html( $invoice->get_label() ) ) . '</button>';  | 
                                                        |
| 379 | - echo ' ' . '<button type="button" class="button button-primary" id="wpinv-new-item">' . esc_html__( 'Create new item', 'invoicing' ) . '</button>';  | 
                                                        |
| 380 | - echo ' ' . '<button type="button" class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__( 'Recalculate Totals', 'invoicing' ) . '</button>';  | 
                                                        |
| 378 | +						echo ' ' . '<button type="button" class="button button-primary" id="wpinv-add-item">' . sprintf(esc_html__('Add item to %s', 'invoicing'), esc_html($invoice->get_label())) . '</button>'; | 
                                                        |
| 379 | +						echo ' ' . '<button type="button" class="button button-primary" id="wpinv-new-item">' . esc_html__('Create new item', 'invoicing') . '</button>'; | 
                                                        |
| 380 | +						echo ' ' . '<button type="button" class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__('Recalculate Totals', 'invoicing') . '</button>'; | 
                                                        |
| 381 | 381 | |
| 382 | 382 | }  | 
                                                        
| 383 | 383 | ?>  | 
                                                        
| 384 | - <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?>  | 
                                                        |
| 384 | +                <?php do_action('wpinv_invoice_items_actions', $invoice); ?> | 
                                                        |
| 385 | 385 | </div>  | 
                                                        
| 386 | 386 | </div>  | 
                                                        
| 387 | 387 | <?php  | 
                                                        
| 388 | 388 | }  | 
                                                        
| 389 | 389 | |
| 390 | -    public static function output_row( $columns, $item, $invoice, $class = 'even' ) { | 
                                                        |
| 390 | +    public static function output_row($columns, $item, $invoice, $class = 'even') { | 
                                                        |
| 391 | 391 | |
| 392 | 392 | ?>  | 
                                                        
| 393 | - <tr class="item item-<?php echo esc_attr( $class ); ?>" data-item-id="<?php echo esc_attr( $item->get_id() ); ?>">  | 
                                                        |
| 394 | - <?php foreach ( array_keys( $columns ) as $column ) : ?>  | 
                                                        |
| 393 | + <tr class="item item-<?php echo esc_attr($class); ?>" data-item-id="<?php echo esc_attr($item->get_id()); ?>">  | 
                                                        |
| 394 | + <?php foreach (array_keys($columns) as $column) : ?>  | 
                                                        |
| 395 | 395 | <td class="  | 
                                                        
| 396 | 396 | <?php  | 
                                                        
| 397 | - echo esc_attr( $column );  | 
                                                        |
| 397 | + echo esc_attr($column);  | 
                                                        |
| 398 | 398 | echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '';  | 
                                                        
| 399 | 399 | ?>  | 
                                                        
| 400 | 400 | ">  | 
                                                        
| 401 | 401 | <?php  | 
                                                        
| 402 | -                        switch ( $column ) { | 
                                                        |
| 402 | +                        switch ($column) { | 
                                                        |
| 403 | 403 | case 'id':  | 
                                                        
| 404 | 404 | echo (int) $item->get_id();  | 
                                                        
| 405 | 405 | break;  | 
                                                        
| 406 | 406 | case 'title':  | 
                                                        
| 407 | 407 | printf(  | 
                                                        
| 408 | 408 | '<a href="%s" target="_blank">%s</a>',  | 
                                                        
| 409 | - esc_url( get_edit_post_link( $item->get_id() ) ),  | 
                                                        |
| 410 | - esc_html( $item->get_raw_name() )  | 
                                                        |
| 409 | + esc_url(get_edit_post_link($item->get_id())),  | 
                                                        |
| 410 | + esc_html($item->get_raw_name())  | 
                                                        |
| 411 | 411 | );  | 
                                                        
| 412 | 412 | |
| 413 | - $summary = apply_filters( 'getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice );  | 
                                                        |
| 414 | -							if ( $summary !== '' ) { | 
                                                        |
| 413 | +							$summary = apply_filters('getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice); | 
                                                        |
| 414 | +							if ($summary !== '') { | 
                                                        |
| 415 | 415 | printf(  | 
                                                        
| 416 | 416 | '<span class="meta">%s</span>',  | 
                                                        
| 417 | - wp_kses_post( wpautop( $summary ) )  | 
                                                        |
| 417 | + wp_kses_post(wpautop($summary))  | 
                                                        |
| 418 | 418 | );  | 
                                                        
| 419 | 419 | }  | 
                                                        
| 420 | 420 | |
| 421 | 421 | printf(  | 
                                                        
| 422 | 422 | '<input type="hidden" value="%s" name="getpaid_items[%s][name]" class="getpaid-recalculate-prices-on-change" />',  | 
                                                        
| 423 | - esc_attr( $item->get_raw_name() ),  | 
                                                        |
| 423 | + esc_attr($item->get_raw_name()),  | 
                                                        |
| 424 | 424 | (int) $item->get_id()  | 
                                                        
| 425 | 425 | );  | 
                                                        
| 426 | 426 | |
| 427 | 427 | printf(  | 
                                                        
| 428 | 428 | '<textarea style="display: none;" name="getpaid_items[%s][description]" class="getpaid-recalculate-prices-on-change">%s</textarea>',  | 
                                                        
| 429 | 429 | (int) $item->get_id(),  | 
                                                        
| 430 | - esc_attr( $item->get_description() )  | 
                                                        |
| 430 | + esc_attr($item->get_description())  | 
                                                        |
| 431 | 431 | );  | 
                                                        
| 432 | 432 | |
| 433 | 433 | break;  | 
                                                        
| 434 | 434 | case 'price':  | 
                                                        
| 435 | 435 | printf(  | 
                                                        
| 436 | 436 | '<input type="text" value="%s" name="getpaid_items[%s][price]" style="width: 100px;" class="getpaid-admin-invoice-item-price getpaid-recalculate-prices-on-change" />',  | 
                                                        
| 437 | - esc_attr( getpaid_unstandardize_amount( $item->get_price() ) ),  | 
                                                        |
| 437 | + esc_attr(getpaid_unstandardize_amount($item->get_price())),  | 
                                                        |
| 438 | 438 | (int) $item->get_id()  | 
                                                        
| 439 | 439 | );  | 
                                                        
| 440 | 440 | |
@@ -442,26 +442,26 @@ discard block  | 
                                                    ||
| 442 | 442 | case 'qty':  | 
                                                        
| 443 | 443 | printf(  | 
                                                        
| 444 | 444 | '<input type="text" style="width: 100px;" value="%s" name="getpaid_items[%s][quantity]" class="getpaid-admin-invoice-item-quantity getpaid-recalculate-prices-on-change" />',  | 
                                                        
| 445 | - floatval( $item->get_quantity() ),  | 
                                                        |
| 445 | + floatval($item->get_quantity()),  | 
                                                        |
| 446 | 446 | (int) $item->get_id()  | 
                                                        
| 447 | 447 | );  | 
                                                        
| 448 | 448 | |
| 449 | 449 | break;  | 
                                                        
| 450 | 450 | case 'total':  | 
                                                        
| 451 | - wpinv_the_price( $item->get_sub_total(), $invoice->get_currency() );  | 
                                                        |
| 451 | + wpinv_the_price($item->get_sub_total(), $invoice->get_currency());  | 
                                                        |
| 452 | 452 | |
| 453 | 453 | break;  | 
                                                        
| 454 | 454 | case 'tax':  | 
                                                        
| 455 | - echo floatval( wpinv_round_amount( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';  | 
                                                        |
| 455 | + echo floatval(wpinv_round_amount(getpaid_get_invoice_tax_rate($invoice, $item), 2)) . '%';  | 
                                                        |
| 456 | 456 | |
| 457 | 457 | break;  | 
                                                        
| 458 | 458 | case 'action':  | 
                                                        
| 459 | -							if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { | 
                                                        |
| 459 | +							if (!$invoice->is_paid() && !$invoice->is_refunded()) { | 
                                                        |
| 460 | 460 | echo '<i class="fa fa-trash wpinv-item-remove"></i>';  | 
                                                        
| 461 | 461 | }  | 
                                                        
| 462 | 462 | break;  | 
                                                        
| 463 | 463 | }  | 
                                                        
| 464 | - do_action( 'getpaid_admin_edit_invoice_item_' . $column, $item, $invoice );  | 
                                                        |
| 464 | +                        do_action('getpaid_admin_edit_invoice_item_' . $column, $item, $invoice); | 
                                                        |
| 465 | 465 | ?>  | 
                                                        
| 466 | 466 | </td>  | 
                                                        
| 467 | 467 | <?php endforeach; ?>  | 
                                                        
@@ -474,10 +474,10 @@ discard block  | 
                                                    ||
| 474 | 474 | *  | 
                                                        
| 475 | 475 | * @param WP_Post $post  | 
                                                        
| 476 | 476 | */  | 
                                                        
| 477 | -    public static function output2( $post ) { | 
                                                        |
| 477 | +    public static function output2($post) { | 
                                                        |
| 478 | 478 | |
| 479 | 479 | // Prepare the invoice.  | 
                                                        
| 480 | - $invoice = new WPInv_Invoice( $post );  | 
                                                        |
| 480 | + $invoice = new WPInv_Invoice($post);  | 
                                                        |
| 481 | 481 | |
| 482 | 482 | // Invoice items.  | 
                                                        
| 483 | 483 | $items = $invoice->get_items();  | 
                                                        
@@ -485,28 +485,28 @@ discard block  | 
                                                    ||
| 485 | 485 | $totals = array(  | 
                                                        
| 486 | 486 | |
| 487 | 487 | 'subtotal' => array(  | 
                                                        
| 488 | - 'label' => __( 'Items Subtotal', 'invoicing' ),  | 
                                                        |
| 489 | - 'value' => wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ),  | 
                                                        |
| 488 | +                'label' => __('Items Subtotal', 'invoicing'), | 
                                                        |
| 489 | + 'value' => wpinv_price($invoice->get_subtotal(), $invoice->get_currency()),  | 
                                                        |
| 490 | 490 | ),  | 
                                                        
| 491 | 491 | |
| 492 | 492 | 'discount' => array(  | 
                                                        
| 493 | - 'label' => __( 'Total Discount', 'invoicing' ),  | 
                                                        |
| 494 | - 'value' => wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ),  | 
                                                        |
| 493 | +                'label' => __('Total Discount', 'invoicing'), | 
                                                        |
| 494 | + 'value' => wpinv_price($invoice->get_total_discount(), $invoice->get_currency()),  | 
                                                        |
| 495 | 495 | ),  | 
                                                        
| 496 | 496 | |
| 497 | 497 | 'tax' => array(  | 
                                                        
| 498 | - 'label' => __( 'Total Tax', 'invoicing' ),  | 
                                                        |
| 499 | - 'value' => wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ),  | 
                                                        |
| 498 | +                'label' => __('Total Tax', 'invoicing'), | 
                                                        |
| 499 | + 'value' => wpinv_price($invoice->get_total_tax(), $invoice->get_currency()),  | 
                                                        |
| 500 | 500 | ),  | 
                                                        
| 501 | 501 | |
| 502 | 502 | 'total' => array(  | 
                                                        
| 503 | - 'label' => __( 'Invoice Total', 'invoicing' ),  | 
                                                        |
| 504 | - 'value' => wpinv_price( $invoice->get_total(), $invoice->get_currency() ),  | 
                                                        |
| 503 | +                'label' => __('Invoice Total', 'invoicing'), | 
                                                        |
| 504 | + 'value' => wpinv_price($invoice->get_total(), $invoice->get_currency()),  | 
                                                        |
| 505 | 505 | ),  | 
                                                        
| 506 | 506 | );  | 
                                                        
| 507 | 507 | |
| 508 | -        if ( ! wpinv_use_taxes() ) { | 
                                                        |
| 509 | - unset( $totals['tax'] );  | 
                                                        |
| 508 | +        if (!wpinv_use_taxes()) { | 
                                                        |
| 509 | + unset($totals['tax']);  | 
                                                        |
| 510 | 510 | }  | 
                                                        
| 511 | 511 | |
| 512 | 512 | $item_args = array(  | 
                                                        
@@ -514,7 +514,7 @@ discard block  | 
                                                    ||
| 514 | 514 | 'orderby' => 'title',  | 
                                                        
| 515 | 515 | 'order' => 'ASC',  | 
                                                        
| 516 | 516 | 'posts_per_page' => -1,  | 
                                                        
| 517 | - 'post_status' => array( 'publish' ),  | 
                                                        |
| 517 | +            'post_status'    => array('publish'), | 
                                                        |
| 518 | 518 | 'meta_query' => array(  | 
                                                        
| 519 | 519 | array(  | 
                                                        
| 520 | 520 | 'key' => '_wpinv_type',  | 
                                                        
@@ -542,10 +542,10 @@ discard block  | 
                                                    ||
| 542 | 542 | }  | 
                                                        
| 543 | 543 | </style>  | 
                                                        
| 544 | 544 | |
| 545 | - <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;">  | 
                                                        |
| 545 | + <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;">  | 
                                                        |
| 546 | 546 | |
| 547 | - <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?>  | 
                                                        |
| 548 | - <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?>  | 
                                                        |
| 547 | + <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?>  | 
                                                        |
| 548 | +                        <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?> | 
                                                        |
| 549 | 549 | |
| 550 | 550 | <div class="row">  | 
                                                        
| 551 | 551 | <div class="col-12 col-sm-6">  | 
                                                        
@@ -554,15 +554,15 @@ discard block  | 
                                                    ||
| 554 | 554 | array(  | 
                                                        
| 555 | 555 | 'id' => 'wpinv_template',  | 
                                                        
| 556 | 556 | 'name' => 'wpinv_template',  | 
                                                        
| 557 | - 'label' => __( 'Template', 'invoicing' ),  | 
                                                        |
| 557 | +                                            'label'       => __('Template', 'invoicing'), | 
                                                        |
| 558 | 558 | 'label_type' => 'vertical',  | 
                                                        
| 559 | - 'placeholder' => __( 'Choose a template', 'invoicing' ),  | 
                                                        |
| 559 | +                                            'placeholder' => __('Choose a template', 'invoicing'), | 
                                                        |
| 560 | 560 | 'class' => 'form-control-sm',  | 
                                                        
| 561 | - 'value' => $invoice->get_template( 'edit' ),  | 
                                                        |
| 561 | +                                            'value'       => $invoice->get_template('edit'), | 
                                                        |
| 562 | 562 | 'options' => array(  | 
                                                        
| 563 | - 'quantity' => __( 'Quantity', 'invoicing' ),  | 
                                                        |
| 564 | - 'hours' => __( 'Hours', 'invoicing' ),  | 
                                                        |
| 565 | - 'amount' => __( 'Amount Only', 'invoicing' ),  | 
                                                        |
| 563 | +                                                'quantity' => __('Quantity', 'invoicing'), | 
                                                        |
| 564 | +                                                'hours'    => __('Hours', 'invoicing'), | 
                                                        |
| 565 | +                                                'amount'   => __('Amount Only', 'invoicing'), | 
                                                        |
| 566 | 566 | ),  | 
                                                        
| 567 | 567 | 'data-allow-clear' => 'false',  | 
                                                        
| 568 | 568 | 'select2' => true,  | 
                                                        
@@ -579,11 +579,11 @@ discard block  | 
                                                    ||
| 579 | 579 | array(  | 
                                                        
| 580 | 580 | 'id' => 'wpinv_currency',  | 
                                                        
| 581 | 581 | 'name' => 'wpinv_currency',  | 
                                                        
| 582 | - 'label' => __( 'Currency', 'invoicing' ),  | 
                                                        |
| 582 | +                                            'label'       => __('Currency', 'invoicing'), | 
                                                        |
| 583 | 583 | 'label_type' => 'vertical',  | 
                                                        
| 584 | - 'placeholder' => __( 'Select Invoice Currency', 'invoicing' ),  | 
                                                        |
| 584 | +                                            'placeholder' => __('Select Invoice Currency', 'invoicing'), | 
                                                        |
| 585 | 585 | 'class' => 'form-control-sm',  | 
                                                        
| 586 | - 'value' => $invoice->get_currency( 'edit' ),  | 
                                                        |
| 586 | +                                            'value'       => $invoice->get_currency('edit'), | 
                                                        |
| 587 | 587 | 'required' => false,  | 
                                                        
| 588 | 588 | 'data-allow-clear' => 'false',  | 
                                                        
| 589 | 589 | 'select2' => true,  | 
                                                        
@@ -596,24 +596,24 @@ discard block  | 
                                                    ||
| 596 | 596 | </div>  | 
                                                        
| 597 | 597 | </div>  | 
                                                        
| 598 | 598 | |
| 599 | - <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?>  | 
                                                        |
| 599 | +                        <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?> | 
                                                        |
| 600 | 600 | <?php endif; ?>  | 
                                                        
| 601 | 601 | |
| 602 | 602 | <table cellpadding="0" cellspacing="0" class="getpaid_invoice_items">  | 
                                                        
| 603 | 603 | <thead>  | 
                                                        
| 604 | 604 | <tr>  | 
                                                        
| 605 | - <th class="getpaid-item" colspan="2"><?php esc_html_e( 'Item', 'invoicing' ); ?></th>  | 
                                                        |
| 605 | +                                <th class="getpaid-item" colspan="2"><?php esc_html_e('Item', 'invoicing'); ?></th> | 
                                                        |
| 606 | 606 | <th class="getpaid-quantity hide-if-amount text-right">  | 
                                                        
| 607 | - <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Quantity', 'invoicing' ); ?></span>  | 
                                                        |
| 608 | - <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Hours', 'invoicing' ); ?></span>  | 
                                                        |
| 607 | +                                    <span class="getpaid-hide-if-hours"><?php esc_html_e('Quantity', 'invoicing'); ?></span> | 
                                                        |
| 608 | +                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e('Hours', 'invoicing'); ?></span> | 
                                                        |
| 609 | 609 | </th>  | 
                                                        
| 610 | 610 | <th class="getpaid-price hide-if-amount text-right">  | 
                                                        
| 611 | - <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Price', 'invoicing' ); ?></span>  | 
                                                        |
| 612 | - <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Rate', 'invoicing' ); ?></span>  | 
                                                        |
| 611 | +                                    <span class="getpaid-hide-if-hours"><?php esc_html_e('Price', 'invoicing'); ?></span> | 
                                                        |
| 612 | +                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e('Rate', 'invoicing'); ?></span> | 
                                                        |
| 613 | 613 | </th>  | 
                                                        
| 614 | 614 | <th class="getpaid-item-subtotal text-right">  | 
                                                        
| 615 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php esc_html_e( 'Amount', 'invoicing' ); ?></span>  | 
                                                        |
| 616 | - <span class="hide-if-amount"><?php esc_html_e( 'Total', 'invoicing' ); ?></span>  | 
                                                        |
| 615 | +                                    <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php esc_html_e('Amount', 'invoicing'); ?></span> | 
                                                        |
| 616 | +                                    <span class="hide-if-amount"><?php esc_html_e('Total', 'invoicing'); ?></span> | 
                                                        |
| 617 | 617 | </th>  | 
                                                        
| 618 | 618 | <th class="getpaid-item-actions hide-if-not-editable" width="70px"> </th>  | 
                                                        
| 619 | 619 | </tr>  | 
                                                        
@@ -621,8 +621,8 @@ discard block  | 
                                                    ||
| 621 | 621 | <tbody class="getpaid_invoice_line_items">  | 
                                                        
| 622 | 622 | <tr class="hide-if-has-items hide-if-not-editable">  | 
                                                        
| 623 | 623 | <td colspan="2" class="pt-4 pb-4">  | 
                                                        
| 624 | - <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php esc_html_e( 'Add Existing Items', 'invoicing' ); ?></button>  | 
                                                        |
| 625 | - <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php esc_html_e( 'Create New Item', 'invoicing' ); ?></button>  | 
                                                        |
| 624 | +                                    <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php esc_html_e('Add Existing Items', 'invoicing'); ?></button> | 
                                                        |
| 625 | +                                    <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php esc_html_e('Create New Item', 'invoicing'); ?></button> | 
                                                        |
| 626 | 626 | </td>  | 
                                                        
| 627 | 627 | <td class="hide-if-amount"> </th>  | 
                                                        
| 628 | 628 | <td class="hide-if-amount"> </th>  | 
                                                        
@@ -654,11 +654,11 @@ discard block  | 
                                                    ||
| 654 | 654 | <div class="col-12 col-sm-6 offset-sm-6">  | 
                                                        
| 655 | 655 | <table class="getpaid-invoice-totals text-right w-100">  | 
                                                        
| 656 | 656 | <tbody>  | 
                                                        
| 657 | - <?php foreach ( apply_filters( 'getpaid_invoice_subtotal_rows', $totals, $invoice ) as $key => $data ) : ?>  | 
                                                        |
| 658 | - <tr class="getpaid-totals-<?php echo esc_attr( $key ); ?>">  | 
                                                        |
| 659 | - <td class="label"><?php echo esc_html( $data['label'] ); ?>:</td>  | 
                                                        |
| 657 | +                                        <?php foreach (apply_filters('getpaid_invoice_subtotal_rows', $totals, $invoice) as $key => $data) : ?> | 
                                                        |
| 658 | + <tr class="getpaid-totals-<?php echo esc_attr($key); ?>">  | 
                                                        |
| 659 | + <td class="label"><?php echo esc_html($data['label']); ?>:</td>  | 
                                                        |
| 660 | 660 | <td width="1%"></td>  | 
                                                        
| 661 | - <td class="value"><?php echo wp_kses_post( $data['value'] ); ?></td>  | 
                                                        |
| 661 | + <td class="value"><?php echo wp_kses_post($data['value']); ?></td>  | 
                                                        |
| 662 | 662 | </tr>  | 
                                                        
| 663 | 663 | <?php endforeach; ?>  | 
                                                        
| 664 | 664 | </tbody>  | 
                                                        
@@ -671,18 +671,18 @@ discard block  | 
                                                    ||
| 671 | 671 | <div class="getpaid-invoice-item-actions hide-if-no-items hide-if-not-editable">  | 
                                                        
| 672 | 672 | <div class="row">  | 
                                                        
| 673 | 673 | <div class="text-left col-12 col-sm-8">  | 
                                                        
| 674 | - <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php esc_html_e( 'Add Existing Item', 'invoicing' ); ?></button>  | 
                                                        |
| 675 | - <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php esc_html_e( 'Create New Item', 'invoicing' ); ?></button>  | 
                                                        |
| 676 | - <?php do_action( 'getpaid-invoice-items-actions', $invoice ); ?>  | 
                                                        |
| 674 | +                                <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php esc_html_e('Add Existing Item', 'invoicing'); ?></button> | 
                                                        |
| 675 | +                                <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php esc_html_e('Create New Item', 'invoicing'); ?></button> | 
                                                        |
| 676 | +                                <?php do_action('getpaid-invoice-items-actions', $invoice); ?> | 
                                                        |
| 677 | 677 | </div>  | 
                                                        
| 678 | 678 | <div class="text-right col-12 col-sm-4">  | 
                                                        
| 679 | - <button type="button" class="button button-primary recalculate-totals-button"><?php esc_html_e( 'Recalculate Totals', 'invoicing' ); ?></button>  | 
                                                        |
| 679 | +                                <button type="button" class="button button-primary recalculate-totals-button"><?php esc_html_e('Recalculate Totals', 'invoicing'); ?></button> | 
                                                        |
| 680 | 680 | </div>  | 
                                                        
| 681 | 681 | </div>  | 
                                                        
| 682 | 682 | </div>  | 
                                                        
| 683 | 683 | |
| 684 | 684 | <div class="getpaid-invoice-item-actions hide-if-editable">  | 
                                                        
| 685 | - <p class="description m-2 text-right text-muted"><?php esc_html_e( 'This invoice is no longer editable', 'invoicing' ); ?></p>  | 
                                                        |
| 685 | +                        <p class="description m-2 text-right text-muted"><?php esc_html_e('This invoice is no longer editable', 'invoicing'); ?></p> | 
                                                        |
| 686 | 686 | </div>  | 
                                                        
| 687 | 687 | |
| 688 | 688 | <!-- Add items to an invoice -->  | 
                                                        
@@ -690,9 +690,9 @@ discard block  | 
                                                    ||
| 690 | 690 | <div class="modal-dialog modal-dialog-centered" role="document">  | 
                                                        
| 691 | 691 | <div class="modal-content">  | 
                                                        
| 692 | 692 | <div class="modal-header">  | 
                                                        
| 693 | - <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php esc_html_e( 'Add Item(s)', 'invoicing' ); ?></h5>  | 
                                                        |
| 694 | - <button type="button" class="close btn-close" data-dismiss="modal" aria-label="<?php esc_html_e( 'Close', 'invoicing' ); ?>">  | 
                                                        |
| 695 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>  | 
                                                        |
| 693 | +                                    <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php esc_html_e('Add Item(s)', 'invoicing'); ?></h5> | 
                                                        |
| 694 | +                                    <button type="button" class="close btn-close" data-dismiss="modal" aria-label="<?php esc_html_e('Close', 'invoicing'); ?>"> | 
                                                        |
| 695 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?>  | 
                                                        |
| 696 | 696 | <span aria-hidden="true">×</span>  | 
                                                        
| 697 | 697 | <?php endif; ?>  | 
                                                        
| 698 | 698 | </button>  | 
                                                        
@@ -701,10 +701,10 @@ discard block  | 
                                                    ||
| 701 | 701 | <table class="widefat">  | 
                                                        
| 702 | 702 | <thead>  | 
                                                        
| 703 | 703 | <tr>  | 
                                                        
| 704 | - <th class="pl-0 text-left"><?php esc_html_e( 'Item', 'invoicing' ); ?></th>  | 
                                                        |
| 704 | +                                                <th class="pl-0 text-left"><?php esc_html_e('Item', 'invoicing'); ?></th> | 
                                                        |
| 705 | 705 | <th class="pr-0 text-right hide-if-amount">  | 
                                                        
| 706 | - <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Quantity', 'invoicing' ); ?></span>  | 
                                                        |
| 707 | - <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Hours', 'invoicing' ); ?></span>  | 
                                                        |
| 706 | +                                                    <span class="getpaid-hide-if-hours"><?php esc_html_e('Quantity', 'invoicing'); ?></span> | 
                                                        |
| 707 | +                                                    <span class="getpaid-hide-if-quantity"><?php esc_html_e('Hours', 'invoicing'); ?></span> | 
                                                        |
| 708 | 708 | </th>  | 
                                                        
| 709 | 709 | </tr>  | 
                                                        
| 710 | 710 | </thead>  | 
                                                        
@@ -712,9 +712,9 @@ discard block  | 
                                                    ||
| 712 | 712 | <tr>  | 
                                                        
| 713 | 713 | <td class="pl-0 text-left">  | 
                                                        
| 714 | 714 | <select class="regular-text getpaid-add-invoice-item-select">  | 
                                                        
| 715 | - <option value="" selected="selected" disabled><?php esc_html_e( 'Select an item…', 'invoicing' ); ?></option>  | 
                                                        |
| 716 | - <?php foreach ( get_posts( $item_args ) as $item ) : ?>  | 
                                                        |
| 717 | - <option value="<?php echo (int) $item->ID; ?>"><?php echo esc_html( $item->post_title ); ?></option>  | 
                                                        |
| 715 | +                                                        <option value="" selected="selected" disabled><?php esc_html_e('Select an item…', 'invoicing'); ?></option> | 
                                                        |
| 716 | + <?php foreach (get_posts($item_args) as $item) : ?>  | 
                                                        |
| 717 | + <option value="<?php echo (int) $item->ID; ?>"><?php echo esc_html($item->post_title); ?></option>  | 
                                                        |
| 718 | 718 | <?php endforeach; ?>  | 
                                                        
| 719 | 719 | </select>  | 
                                                        
| 720 | 720 | </td>  | 
                                                        
@@ -726,8 +726,8 @@ discard block  | 
                                                    ||
| 726 | 726 | </table>  | 
                                                        
| 727 | 727 | </div>  | 
                                                        
| 728 | 728 | <div class="modal-footer">  | 
                                                        
| 729 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button>  | 
                                                        |
| 730 | - <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php esc_html_e( 'Add', 'invoicing' ); ?></button>  | 
                                                        |
| 729 | +                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button> | 
                                                        |
| 730 | +                                    <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php esc_html_e('Add', 'invoicing'); ?></button> | 
                                                        |
| 731 | 731 | </div>  | 
                                                        
| 732 | 732 | </div>  | 
                                                        
| 733 | 733 | </div>  | 
                                                        
@@ -738,9 +738,9 @@ discard block  | 
                                                    ||
| 738 | 738 | <div class="modal-dialog modal-dialog-centered" role="document">  | 
                                                        
| 739 | 739 | <div class="modal-content">  | 
                                                        
| 740 | 740 | <div class="modal-header">  | 
                                                        
| 741 | - <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php esc_html_e( 'Create Item', 'invoicing' ); ?></h5>  | 
                                                        |
| 742 | - <button type="button" class="close btn-close" data-dismiss="modal" aria-label="<?php esc_html_e( 'Close', 'invoicing' ); ?>">  | 
                                                        |
| 743 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>  | 
                                                        |
| 741 | +                                    <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php esc_html_e('Create Item', 'invoicing'); ?></h5> | 
                                                        |
| 742 | +                                    <button type="button" class="close btn-close" data-dismiss="modal" aria-label="<?php esc_html_e('Close', 'invoicing'); ?>"> | 
                                                        |
| 743 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?>  | 
                                                        |
| 744 | 744 | <span aria-hidden="true">×</span>  | 
                                                        
| 745 | 745 | <?php endif; ?>  | 
                                                        
| 746 | 746 | </button>  | 
                                                        
@@ -749,27 +749,27 @@ discard block  | 
                                                    ||
| 749 | 749 | <div class="getpaid-create-item-div">  | 
                                                        
| 750 | 750 | <input type="hidden" name="id" value="new" class="form-control form-control-sm item-id">  | 
                                                        
| 751 | 751 | <label class="form-group mb-3 w-100">  | 
                                                        
| 752 | - <span><?php esc_html_e( 'Name', 'invoicing' ); ?></span>  | 
                                                        |
| 753 | - <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name">  | 
                                                        |
| 752 | +                                            <span><?php esc_html_e('Name', 'invoicing'); ?></span> | 
                                                        |
| 753 | +                                            <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name"> | 
                                                        |
| 754 | 754 | </label>  | 
                                                        
| 755 | 755 | <label class="form-group mb-3 w-100">  | 
                                                        
| 756 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e( 'Amount', 'invoicing' ); ?></span>  | 
                                                        |
| 757 | - <span class="hide-if-amount"><?php esc_html_e( 'Price', 'invoicing' ); ?></span>  | 
                                                        |
| 758 | - <input type="text" name="price" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control form-control-sm item-price">  | 
                                                        |
| 756 | +                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e('Amount', 'invoicing'); ?></span> | 
                                                        |
| 757 | +                                            <span class="hide-if-amount"><?php esc_html_e('Price', 'invoicing'); ?></span> | 
                                                        |
| 758 | + <input type="text" name="price" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control form-control-sm item-price">  | 
                                                        |
| 759 | 759 | </label>  | 
                                                        
| 760 | 760 | <label class="form-group mb-3 w-100 hide-if-amount">  | 
                                                        
| 761 | - <span><?php esc_html_e( 'Quantity', 'invoicing' ); ?></span>  | 
                                                        |
| 761 | +                                            <span><?php esc_html_e('Quantity', 'invoicing'); ?></span> | 
                                                        |
| 762 | 762 | <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity">  | 
                                                        
| 763 | 763 | </label>  | 
                                                        
| 764 | 764 | <label class="form-group mb-3 w-100">  | 
                                                        
| 765 | - <span><?php esc_html_e( 'Item Description', 'invoicing' ); ?></span>  | 
                                                        |
| 766 | - <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea>  | 
                                                        |
| 765 | +                                            <span><?php esc_html_e('Item Description', 'invoicing'); ?></span> | 
                                                        |
| 766 | +                                            <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea> | 
                                                        |
| 767 | 767 | </label>  | 
                                                        
| 768 | 768 | </div>  | 
                                                        
| 769 | 769 | </div>  | 
                                                        
| 770 | 770 | <div class="modal-footer">  | 
                                                        
| 771 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button>  | 
                                                        |
| 772 | - <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e( 'Create', 'invoicing' ); ?></button>  | 
                                                        |
| 771 | +                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button> | 
                                                        |
| 772 | +                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e('Create', 'invoicing'); ?></button> | 
                                                        |
| 773 | 773 | </div>  | 
                                                        
| 774 | 774 | </div>  | 
                                                        
| 775 | 775 | </div>  | 
                                                        
@@ -780,9 +780,9 @@ discard block  | 
                                                    ||
| 780 | 780 | <div class="modal-dialog modal-dialog-centered" role="document">  | 
                                                        
| 781 | 781 | <div class="modal-content">  | 
                                                        
| 782 | 782 | <div class="modal-header">  | 
                                                        
| 783 | - <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php esc_html_e( 'Edit Item', 'invoicing' ); ?></h5>  | 
                                                        |
| 784 | - <button type="button" class="close close" data-dismiss="modal" aria-label="<?php esc_html_e( 'Close', 'invoicing' ); ?>">  | 
                                                        |
| 785 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?>  | 
                                                        |
| 783 | +                                    <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php esc_html_e('Edit Item', 'invoicing'); ?></h5> | 
                                                        |
| 784 | +                                    <button type="button" class="close close" data-dismiss="modal" aria-label="<?php esc_html_e('Close', 'invoicing'); ?>"> | 
                                                        |
| 785 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?>  | 
                                                        |
| 786 | 786 | <span aria-hidden="true">×</span>  | 
                                                        
| 787 | 787 | <?php endif; ?>  | 
                                                        
| 788 | 788 | </button>  | 
                                                        
@@ -791,27 +791,27 @@ discard block  | 
                                                    ||
| 791 | 791 | <div class="getpaid-edit-item-div">  | 
                                                        
| 792 | 792 | <input type="hidden" name="id" class="form-control form-control-sm item-id">  | 
                                                        
| 793 | 793 | <label class="form-group mb-3 w-100">  | 
                                                        
| 794 | - <span><?php esc_html_e( 'Name', 'invoicing' ); ?></span>  | 
                                                        |
| 795 | - <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name">  | 
                                                        |
| 794 | +                                            <span><?php esc_html_e('Name', 'invoicing'); ?></span> | 
                                                        |
| 795 | +                                            <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name"> | 
                                                        |
| 796 | 796 | </label>  | 
                                                        
| 797 | 797 | <label class="form-group mb-3 w-100">  | 
                                                        
| 798 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e( 'Amount', 'invoicing' ); ?></span>  | 
                                                        |
| 799 | - <span class="hide-if-amount"><?php esc_html_e( 'Price', 'invoicing' ); ?></span>  | 
                                                        |
| 800 | - <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price">  | 
                                                        |
| 798 | +                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e('Amount', 'invoicing'); ?></span> | 
                                                        |
| 799 | +                                            <span class="hide-if-amount"><?php esc_html_e('Price', 'invoicing'); ?></span> | 
                                                        |
| 800 | + <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price">  | 
                                                        |
| 801 | 801 | </label>  | 
                                                        
| 802 | 802 | <label class="form-group mb-3 w-100 hide-if-amount">  | 
                                                        
| 803 | - <span><?php esc_html_e( 'Quantity', 'invoicing' ); ?></span>  | 
                                                        |
| 803 | +                                            <span><?php esc_html_e('Quantity', 'invoicing'); ?></span> | 
                                                        |
| 804 | 804 | <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity">  | 
                                                        
| 805 | 805 | </label>  | 
                                                        
| 806 | 806 | <label class="form-group mb-3 w-100">  | 
                                                        
| 807 | - <span><?php esc_html_e( 'Item Description', 'invoicing' ); ?></span>  | 
                                                        |
| 808 | - <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea>  | 
                                                        |
| 807 | +                                            <span><?php esc_html_e('Item Description', 'invoicing'); ?></span> | 
                                                        |
| 808 | +                                            <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea> | 
                                                        |
| 809 | 809 | </label>  | 
                                                        
| 810 | 810 | </div>  | 
                                                        
| 811 | 811 | </div>  | 
                                                        
| 812 | 812 | <div class="modal-footer">  | 
                                                        
| 813 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button>  | 
                                                        |
| 814 | - <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e( 'Save', 'invoicing' ); ?></button>  | 
                                                        |
| 813 | +                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button> | 
                                                        |
| 814 | +                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e('Save', 'invoicing'); ?></button> | 
                                                        |
| 815 | 815 | </div>  | 
                                                        
| 816 | 816 | </div>  | 
                                                        
| 817 | 817 | </div>  |