@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if (!defined('ABSPATH')) { |
|
| 11 | 11 | exit; // Exit if accessed directly |
| 12 | 12 | } |
| 13 | 13 | |
@@ -16,82 +16,82 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class GetPaid_Meta_Box_Invoice_Items { |
| 18 | 18 | |
| 19 | - public static function get_columns( $invoice ) { |
|
| 19 | + public static function get_columns($invoice) { |
|
| 20 | 20 | $use_taxes = $invoice->is_taxable() && wpinv_use_taxes(); |
| 21 | 21 | $columns = array( |
| 22 | - 'id' => __( 'ID', 'invoicing' ), |
|
| 23 | - 'title' => __( 'Item', 'invoicing' ), |
|
| 22 | + 'id' => __('ID', 'invoicing'), |
|
| 23 | + 'title' => __('Item', 'invoicing'), |
|
| 24 | 24 | 'price' => sprintf( |
| 25 | 25 | '<span class="getpaid-hide-if-hours getpaid-hide-if-quantity">%s</span> |
| 26 | 26 | <span class="getpaid-hide-if-hours hide-if-amount">%s</span> |
| 27 | 27 | <span class="getpaid-hide-if-quantity hide-if-amount">%s</span>', |
| 28 | - __( 'Amount', 'invoicing' ), |
|
| 29 | - __( 'Price', 'invoicing' ), |
|
| 30 | - __( 'Rate', 'invoicing' ) |
|
| 28 | + __('Amount', 'invoicing'), |
|
| 29 | + __('Price', 'invoicing'), |
|
| 30 | + __('Rate', 'invoicing') |
|
| 31 | 31 | ), |
| 32 | 32 | 'qty' => sprintf( |
| 33 | 33 | '<span class="getpaid-hide-if-hours">%s</span><span class="getpaid-hide-if-quantity">%s</span>', |
| 34 | - __( 'Quantity', 'invoicing' ), |
|
| 35 | - __( 'Hours', 'invoicing' ) |
|
| 34 | + __('Quantity', 'invoicing'), |
|
| 35 | + __('Hours', 'invoicing') |
|
| 36 | 36 | ), |
| 37 | - 'total' => __( 'Total', 'invoicing' ), |
|
| 38 | - 'tax' => __( 'Tax (%)', 'invoicing' ), |
|
| 37 | + 'total' => __('Total', 'invoicing'), |
|
| 38 | + 'tax' => __('Tax (%)', 'invoicing'), |
|
| 39 | 39 | 'action' => '', |
| 40 | 40 | ); |
| 41 | 41 | |
| 42 | - if ( ! $use_taxes ) { |
|
| 43 | - unset( $columns['tax'] ); |
|
| 42 | + if (!$use_taxes) { |
|
| 43 | + unset($columns['tax']); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | return $columns; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public static function output( $post, $invoice = false ) { |
|
| 49 | + public static function output($post, $invoice = false) { |
|
| 50 | 50 | |
| 51 | - if ( apply_filters( 'getpaid_use_new_invoice_items_metabox', false ) ) { |
|
| 52 | - return self::output2( $post ); |
|
| 51 | + if (apply_filters('getpaid_use_new_invoice_items_metabox', false)) { |
|
| 52 | + return self::output2($post); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $post_id = !empty( $post->ID ) ? $post->ID : 0; |
|
| 56 | - $invoice = $invoice instanceof WPInv_Invoice ? $invoice : new WPInv_Invoice( $post_id ); |
|
| 55 | + $post_id = !empty($post->ID) ? $post->ID : 0; |
|
| 56 | + $invoice = $invoice instanceof WPInv_Invoice ? $invoice : new WPInv_Invoice($post_id); |
|
| 57 | 57 | $use_taxes = $invoice->is_taxable() && wpinv_use_taxes(); |
| 58 | - $item_types = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post ); |
|
| 59 | - $columns = self::get_columns( $invoice ); |
|
| 60 | - $cols = count( $columns ); |
|
| 58 | + $item_types = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post); |
|
| 59 | + $columns = self::get_columns($invoice); |
|
| 60 | + $cols = count($columns); |
|
| 61 | 61 | $class = ''; |
| 62 | 62 | |
| 63 | - unset( $item_types['adv'] ); |
|
| 64 | - unset( $item_types['package'] ); |
|
| 63 | + unset($item_types['adv']); |
|
| 64 | + unset($item_types['package']); |
|
| 65 | 65 | |
| 66 | - if ( $invoice->is_paid() ) { |
|
| 66 | + if ($invoice->is_paid()) { |
|
| 67 | 67 | $class .= ' wpinv-paid'; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if ( $invoice->is_refunded() ) { |
|
| 70 | + if ($invoice->is_refunded()) { |
|
| 71 | 71 | $class .= ' wpinv-refunded'; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if ( $invoice->is_recurring() ) { |
|
| 74 | + if ($invoice->is_recurring()) { |
|
| 75 | 75 | $class .= ' wpi-recurring'; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | ?> |
| 79 | 79 | |
| 80 | - <div class="wpinv-items-wrap<?php echo esc_attr( $class ); ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr( $invoice->get_status() ); ?>"> |
|
| 80 | + <div class="wpinv-items-wrap<?php echo esc_attr($class); ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr($invoice->get_status()); ?>"> |
|
| 81 | 81 | <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0"> |
| 82 | 82 | |
| 83 | 83 | <thead> |
| 84 | 84 | <tr> |
| 85 | - <?php foreach ( $columns as $key => $label ) : ?> |
|
| 86 | - <th class="<?php echo esc_attr( $key ); echo 'total' == $key || 'qty' == $key ? ' hide-if-amount' : '' ?>"><?php echo wp_kses_post( $label ); ?></th> |
|
| 85 | + <?php foreach ($columns as $key => $label) : ?> |
|
| 86 | + <th class="<?php echo esc_attr($key); echo 'total' == $key || 'qty' == $key ? ' hide-if-amount' : '' ?>"><?php echo wp_kses_post($label); ?></th> |
|
| 87 | 87 | <?php endforeach; ?> |
| 88 | 88 | </tr> |
| 89 | 89 | </thead> |
| 90 | 90 | |
| 91 | 91 | <tbody class="wpinv-line-items"> |
| 92 | 92 | <?php |
| 93 | - foreach ( $invoice->get_items() as $int => $item ) { |
|
| 94 | - self::output_row( $columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd' ); |
|
| 93 | + foreach ($invoice->get_items() as $int => $item) { |
|
| 94 | + self::output_row($columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd'); |
|
| 95 | 95 | } |
| 96 | 96 | ?> |
| 97 | 97 | </tbody> |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | <div class="wp-clearfix"> |
| 109 | 109 | <label class="wpi-item-name"> |
| 110 | 110 | <span class="input-text-wrap"> |
| 111 | - <input type="text" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' );?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]"> |
|
| 111 | + <input type="text" style="width: 100%" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]"> |
|
| 112 | 112 | </span> |
| 113 | 113 | </label> |
| 114 | 114 | </div> |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | <div class="wp-clearfix"> |
| 117 | 117 | <label class="wpi-item-price"> |
| 118 | 118 | <span class="input-text-wrap"> |
| 119 | - <input type="text" style="width: 200px" placeholder="<?php esc_attr_e( 'Item Price', 'invoicing' );?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]"> |
|
| 120 | - × <input type="text" style="width: 140px" placeholder="<?php esc_attr_e( 'Item Quantity', 'invoicing' );?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]"> |
|
| 119 | + <input type="text" style="width: 200px" placeholder="<?php esc_attr_e('Item Price', 'invoicing'); ?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]"> |
|
| 120 | + × <input type="text" style="width: 140px" placeholder="<?php esc_attr_e('Item Quantity', 'invoicing'); ?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]"> |
|
| 121 | 121 | </span> |
| 122 | 122 | </label> |
| 123 | 123 | </div> |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | <div class="wp-clearfix"> |
| 126 | 126 | <label class="wpi-item-name"> |
| 127 | 127 | <span class="input-text-wrap"> |
| 128 | - <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Description', 'invoicing' );?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea> |
|
| 128 | + <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e('Item Description', 'invoicing'); ?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea> |
|
| 129 | 129 | </span> |
| 130 | 130 | </label> |
| 131 | 131 | </div> |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | <div class="wp-clearfix"> |
| 134 | 134 | <label class="wpi-item-type"> |
| 135 | 135 | <span class="input-text-wrap"> |
| 136 | - <?php wpinv_html_select( array( |
|
| 136 | + <?php wpinv_html_select(array( |
|
| 137 | 137 | 'options' => $item_types, |
| 138 | 138 | 'name' => '_wpinv_quick[type]', |
| 139 | 139 | 'id' => '_wpinv_quick_type', |
@@ -141,19 +141,19 @@ discard block |
||
| 141 | 141 | 'show_option_all' => false, |
| 142 | 142 | 'show_option_none' => false, |
| 143 | 143 | 'class' => 'gdmbx2-text-medium wpinv-quick-type', |
| 144 | - ) ); ?> |
|
| 144 | + )); ?> |
|
| 145 | 145 | </span> |
| 146 | 146 | </label> |
| 147 | 147 | </div> |
| 148 | 148 | |
| 149 | - <?php if ( $use_taxes ) : ?> |
|
| 149 | + <?php if ($use_taxes) : ?> |
|
| 150 | 150 | <div class="wp-clearfix"> |
| 151 | 151 | <label class="wpi-vat-rule"> |
| 152 | 152 | <span class="input-text-wrap"> |
| 153 | 153 | <?php |
| 154 | - wpinv_html_select( array( |
|
| 154 | + wpinv_html_select(array( |
|
| 155 | 155 | 'options' => array_merge( |
| 156 | - array( '' => __( 'Select VAT Rule', 'invoicing' ) ), |
|
| 156 | + array('' => __('Select VAT Rule', 'invoicing')), |
|
| 157 | 157 | getpaid_get_tax_rules() |
| 158 | 158 | ), |
| 159 | 159 | 'name' => '_wpinv_quick[vat_rule]', |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | 'show_option_none' => false, |
| 163 | 163 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-rule', |
| 164 | 164 | 'selected' => 'digital', |
| 165 | - ) ); |
|
| 165 | + )); |
|
| 166 | 166 | ?> |
| 167 | 167 | </span> |
| 168 | 168 | </label> |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | <label class="wpi-vat-class"> |
| 172 | 172 | <span class="input-text-wrap"> |
| 173 | 173 | <?php |
| 174 | - wpinv_html_select( array( |
|
| 174 | + wpinv_html_select(array( |
|
| 175 | 175 | 'options' => array_merge( |
| 176 | - array( '' => __( 'Select VAT Class', 'invoicing' ) ), |
|
| 176 | + array('' => __('Select VAT Class', 'invoicing')), |
|
| 177 | 177 | getpaid_get_tax_classes() |
| 178 | 178 | ), |
| 179 | 179 | 'name' => '_wpinv_quick[vat_class]', |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | 'show_option_none' => false, |
| 183 | 183 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-class', |
| 184 | 184 | 'selected' => '_standard', |
| 185 | - ) ); |
|
| 185 | + )); |
|
| 186 | 186 | ?> |
| 187 | 187 | </span> |
| 188 | 188 | </label> |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | 'type' => 'checkbox', |
| 197 | 197 | 'name' => '_wpinv_quick[one-time]', |
| 198 | 198 | 'id' => '_wpinv_quick-one-time', |
| 199 | - 'label' => __( "One time item (won't be saved to regular items list)", 'invoicing' ), |
|
| 199 | + 'label' => __("One time item (won't be saved to regular items list)", 'invoicing'), |
|
| 200 | 200 | 'value' => 1, |
| 201 | 201 | 'no_wrap' => true, |
| 202 | 202 | 'checked' => false, |
@@ -220,29 +220,29 @@ discard block |
||
| 220 | 220 | </td> |
| 221 | 221 | </tr> |
| 222 | 222 | <tr class="totals"> |
| 223 | - <td colspan="<?php echo ( (int) $cols - 4 ); ?>"></td> |
|
| 223 | + <td colspan="<?php echo ((int) $cols - 4); ?>"></td> |
|
| 224 | 224 | <td colspan="4"> |
| 225 | 225 | <table cellspacing="0" cellpadding="0"> |
| 226 | 226 | <tr class="subtotal"> |
| 227 | - <td class="name"><?php esc_html_e( 'Sub Total:', 'invoicing' );?></td> |
|
| 228 | - <td class="total"><?php wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() );?></td> |
|
| 227 | + <td class="name"><?php esc_html_e('Sub Total:', 'invoicing'); ?></td> |
|
| 228 | + <td class="total"><?php wpinv_the_price($invoice->get_subtotal(), $invoice->get_currency()); ?></td> |
|
| 229 | 229 | <td class="action"></td> |
| 230 | 230 | </tr> |
| 231 | 231 | <tr class="discount"> |
| 232 | - <td class="name"><?php esc_html_e( 'Discount:', 'invoicing' ) ; ?></td> |
|
| 233 | - <td class="total"><?php wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() );?></td> |
|
| 232 | + <td class="name"><?php esc_html_e('Discount:', 'invoicing'); ?></td> |
|
| 233 | + <td class="total"><?php wpinv_the_price($invoice->get_total_discount(), $invoice->get_currency()); ?></td> |
|
| 234 | 234 | <td class="action"></td> |
| 235 | 235 | </tr> |
| 236 | - <?php if ( $use_taxes ) : ?> |
|
| 236 | + <?php if ($use_taxes) : ?> |
|
| 237 | 237 | <tr class="tax"> |
| 238 | - <td class="name"><?php esc_html_e( 'Tax:', 'invoicing' );?></td> |
|
| 239 | - <td class="total"><?php wpinv_the_price( $invoice->get_total_tax(), $invoice->get_currency() );?></td> |
|
| 238 | + <td class="name"><?php esc_html_e('Tax:', 'invoicing'); ?></td> |
|
| 239 | + <td class="total"><?php wpinv_the_price($invoice->get_total_tax(), $invoice->get_currency()); ?></td> |
|
| 240 | 240 | <td class="action"></td> |
| 241 | 241 | </tr> |
| 242 | 242 | <?php endif; ?> |
| 243 | 243 | <tr class="total"> |
| 244 | - <td class="name"><?php esc_html_e( 'Total:', 'invoicing' );?></td> |
|
| 245 | - <td class="total"><?php wpinv_the_price( $invoice->get_total(), $invoice->get_currency() );?></td> |
|
| 244 | + <td class="name"><?php esc_html_e('Total:', 'invoicing'); ?></td> |
|
| 245 | + <td class="total"><?php wpinv_the_price($invoice->get_total(), $invoice->get_currency()); ?></td> |
|
| 246 | 246 | <td class="action"></td> |
| 247 | 247 | </tr> |
| 248 | 248 | </table> |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | </table> |
| 254 | 254 | <div class="wpinv-actions"> |
| 255 | 255 | <?php |
| 256 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
| 256 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
| 257 | 257 | wpinv_item_dropdown( |
| 258 | 258 | array( |
| 259 | 259 | 'name' => 'wpinv_invoice_item', |
@@ -263,61 +263,61 @@ discard block |
||
| 263 | 263 | ) |
| 264 | 264 | ); |
| 265 | 265 | |
| 266 | - echo " " . '<button class="button button-primary" id="wpinv-add-item">' . sprintf( esc_html__( 'Add item to %s', 'invoicing' ), esc_html( $invoice->get_label() ) ) . '</button>'; |
|
| 267 | - echo " " . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__( 'Create new item', 'invoicing' ) . '</button>'; |
|
| 268 | - echo " " . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__( 'Recalculate Totals', 'invoicing' ) . '</button>'; |
|
| 266 | + echo " " . '<button class="button button-primary" id="wpinv-add-item">' . sprintf(esc_html__('Add item to %s', 'invoicing'), esc_html($invoice->get_label())) . '</button>'; |
|
| 267 | + echo " " . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__('Create new item', 'invoicing') . '</button>'; |
|
| 268 | + echo " " . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__('Recalculate Totals', 'invoicing') . '</button>'; |
|
| 269 | 269 | |
| 270 | 270 | } |
| 271 | 271 | ?> |
| 272 | - <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?> |
|
| 272 | + <?php do_action('wpinv_invoice_items_actions', $invoice); ?> |
|
| 273 | 273 | </div> |
| 274 | 274 | </div> |
| 275 | 275 | <?php |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - public static function output_row( $columns, $item, $invoice, $class='even' ) { |
|
| 278 | + public static function output_row($columns, $item, $invoice, $class = 'even') { |
|
| 279 | 279 | |
| 280 | 280 | ?> |
| 281 | - <tr class="item item-<?php echo esc_attr( $class ); ?>" data-item-id="<?php echo esc_attr( $item->get_id() ); ?>"> |
|
| 282 | - <?php foreach ( array_keys( $columns ) as $column ) : ?> |
|
| 283 | - <td class="<?php echo esc_attr( $column ); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>"> |
|
| 281 | + <tr class="item item-<?php echo esc_attr($class); ?>" data-item-id="<?php echo esc_attr($item->get_id()); ?>"> |
|
| 282 | + <?php foreach (array_keys($columns) as $column) : ?> |
|
| 283 | + <td class="<?php echo esc_attr($column); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>"> |
|
| 284 | 284 | <?php |
| 285 | - switch ( $column ) { |
|
| 285 | + switch ($column) { |
|
| 286 | 286 | case 'id': |
| 287 | 287 | echo (int) $item->get_id(); |
| 288 | 288 | break; |
| 289 | 289 | case 'title': |
| 290 | 290 | printf( |
| 291 | 291 | '<a href="%s" target="_blank">%s</a>', |
| 292 | - esc_url( get_edit_post_link( $item->get_id() ) ), |
|
| 293 | - esc_html( $item->get_raw_name() ) |
|
| 292 | + esc_url(get_edit_post_link($item->get_id())), |
|
| 293 | + esc_html($item->get_raw_name()) |
|
| 294 | 294 | ); |
| 295 | 295 | |
| 296 | - $summary = apply_filters( 'getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice ); |
|
| 297 | - if ( $summary !== '' ) { |
|
| 296 | + $summary = apply_filters('getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice); |
|
| 297 | + if ($summary !== '') { |
|
| 298 | 298 | printf( |
| 299 | 299 | '<span class="meta">%s</span>', |
| 300 | - wp_kses_post( wpautop( $summary ) ) |
|
| 300 | + wp_kses_post(wpautop($summary)) |
|
| 301 | 301 | ); |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | printf( |
| 305 | 305 | '<input type="hidden" value="%s" name="getpaid_items[%s][name]" class="getpaid-recalculate-prices-on-change" />', |
| 306 | - esc_attr( $item->get_raw_name() ), |
|
| 306 | + esc_attr($item->get_raw_name()), |
|
| 307 | 307 | (int) $item->get_id() |
| 308 | 308 | ); |
| 309 | 309 | |
| 310 | 310 | printf( |
| 311 | 311 | '<textarea style="display: none;" name="getpaid_items[%s][description]" class="getpaid-recalculate-prices-on-change">%s</textarea>', |
| 312 | 312 | (int) $item->get_id(), |
| 313 | - esc_attr( $item->get_description() ) |
|
| 313 | + esc_attr($item->get_description()) |
|
| 314 | 314 | ); |
| 315 | 315 | |
| 316 | 316 | break; |
| 317 | 317 | case 'price': |
| 318 | 318 | printf( |
| 319 | 319 | '<input type="text" value="%s" name="getpaid_items[%s][price]" style="width: 100px;" class="getpaid-admin-invoice-item-price getpaid-recalculate-prices-on-change" />', |
| 320 | - esc_attr( getpaid_unstandardize_amount( $item->get_price() ) ), |
|
| 320 | + esc_attr(getpaid_unstandardize_amount($item->get_price())), |
|
| 321 | 321 | (int) $item->get_id() |
| 322 | 322 | ); |
| 323 | 323 | |
@@ -325,26 +325,26 @@ discard block |
||
| 325 | 325 | case 'qty': |
| 326 | 326 | printf( |
| 327 | 327 | '<input type="text" style="width: 100px;" value="%s" name="getpaid_items[%s][quantity]" class="getpaid-admin-invoice-item-quantity getpaid-recalculate-prices-on-change" />', |
| 328 | - floatval( $item->get_quantity() ), |
|
| 328 | + floatval($item->get_quantity()), |
|
| 329 | 329 | (int) $item->get_id() |
| 330 | 330 | ); |
| 331 | 331 | |
| 332 | 332 | break; |
| 333 | 333 | case 'total': |
| 334 | - wpinv_the_price( $item->get_sub_total(), $invoice->get_currency() ); |
|
| 334 | + wpinv_the_price($item->get_sub_total(), $invoice->get_currency()); |
|
| 335 | 335 | |
| 336 | 336 | break; |
| 337 | 337 | case 'tax': |
| 338 | - echo floatval( wpinv_round_amount( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%'; |
|
| 338 | + echo floatval(wpinv_round_amount(getpaid_get_invoice_tax_rate($invoice, $item), 2)) . '%'; |
|
| 339 | 339 | |
| 340 | 340 | break; |
| 341 | 341 | case 'action': |
| 342 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
| 342 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
| 343 | 343 | echo '<i class="fa fa-trash wpinv-item-remove"></i>'; |
| 344 | 344 | } |
| 345 | 345 | break; |
| 346 | 346 | } |
| 347 | - do_action( 'getpaid_admin_edit_invoice_item_' . $column, $item, $invoice ); |
|
| 347 | + do_action('getpaid_admin_edit_invoice_item_' . $column, $item, $invoice); |
|
| 348 | 348 | ?> |
| 349 | 349 | </td> |
| 350 | 350 | <?php endforeach; ?> |
@@ -357,10 +357,10 @@ discard block |
||
| 357 | 357 | * |
| 358 | 358 | * @param WP_Post $post |
| 359 | 359 | */ |
| 360 | - public static function output2( $post ) { |
|
| 360 | + public static function output2($post) { |
|
| 361 | 361 | |
| 362 | 362 | // Prepare the invoice. |
| 363 | - $invoice = new WPInv_Invoice( $post ); |
|
| 363 | + $invoice = new WPInv_Invoice($post); |
|
| 364 | 364 | |
| 365 | 365 | // Invoice items. |
| 366 | 366 | $items = $invoice->get_items(); |
@@ -368,28 +368,28 @@ discard block |
||
| 368 | 368 | $totals = array( |
| 369 | 369 | |
| 370 | 370 | 'subtotal' => array( |
| 371 | - 'label' => __( 'Items Subtotal', 'invoicing' ), |
|
| 372 | - 'value' => wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ), |
|
| 371 | + 'label' => __('Items Subtotal', 'invoicing'), |
|
| 372 | + 'value' => wpinv_price($invoice->get_subtotal(), $invoice->get_currency()), |
|
| 373 | 373 | ), |
| 374 | 374 | |
| 375 | 375 | 'discount' => array( |
| 376 | - 'label' => __( 'Total Discount', 'invoicing' ), |
|
| 377 | - 'value' => wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ), |
|
| 376 | + 'label' => __('Total Discount', 'invoicing'), |
|
| 377 | + 'value' => wpinv_price($invoice->get_total_discount(), $invoice->get_currency()), |
|
| 378 | 378 | ), |
| 379 | 379 | |
| 380 | 380 | 'tax' => array( |
| 381 | - 'label' => __( 'Total Tax', 'invoicing' ), |
|
| 382 | - 'value' => wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ), |
|
| 381 | + 'label' => __('Total Tax', 'invoicing'), |
|
| 382 | + 'value' => wpinv_price($invoice->get_total_tax(), $invoice->get_currency()), |
|
| 383 | 383 | ), |
| 384 | 384 | |
| 385 | 385 | 'total' => array( |
| 386 | - 'label' => __( 'Invoice Total', 'invoicing' ), |
|
| 387 | - 'value' => wpinv_price( $invoice->get_total(), $invoice->get_currency() ), |
|
| 386 | + 'label' => __('Invoice Total', 'invoicing'), |
|
| 387 | + 'value' => wpinv_price($invoice->get_total(), $invoice->get_currency()), |
|
| 388 | 388 | ) |
| 389 | 389 | ); |
| 390 | 390 | |
| 391 | - if ( ! wpinv_use_taxes() ) { |
|
| 392 | - unset( $totals['tax'] ); |
|
| 391 | + if (!wpinv_use_taxes()) { |
|
| 392 | + unset($totals['tax']); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | $item_args = array( |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | 'orderby' => 'title', |
| 398 | 398 | 'order' => 'ASC', |
| 399 | 399 | 'posts_per_page' => -1, |
| 400 | - 'post_status' => array( 'publish' ), |
|
| 400 | + 'post_status' => array('publish'), |
|
| 401 | 401 | 'meta_query' => array( |
| 402 | 402 | array( |
| 403 | 403 | 'key' => '_wpinv_type', |
@@ -425,10 +425,10 @@ discard block |
||
| 425 | 425 | } |
| 426 | 426 | </style> |
| 427 | 427 | |
| 428 | - <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;"> |
|
| 428 | + <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;"> |
|
| 429 | 429 | |
| 430 | - <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?> |
|
| 431 | - <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?> |
|
| 430 | + <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?> |
|
| 431 | + <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?> |
|
| 432 | 432 | |
| 433 | 433 | <div class="row"> |
| 434 | 434 | <div class="col-12 col-sm-6"> |
@@ -437,15 +437,15 @@ discard block |
||
| 437 | 437 | array( |
| 438 | 438 | 'id' => 'wpinv_template', |
| 439 | 439 | 'name' => 'wpinv_template', |
| 440 | - 'label' => __( 'Template', 'invoicing' ), |
|
| 440 | + 'label' => __('Template', 'invoicing'), |
|
| 441 | 441 | 'label_type' => 'vertical', |
| 442 | - 'placeholder' => __( 'Choose a template', 'invoicing' ), |
|
| 442 | + 'placeholder' => __('Choose a template', 'invoicing'), |
|
| 443 | 443 | 'class' => 'form-control-sm', |
| 444 | - 'value' => $invoice->get_template( 'edit' ), |
|
| 444 | + 'value' => $invoice->get_template('edit'), |
|
| 445 | 445 | 'options' => array( |
| 446 | - 'quantity' => __( 'Quantity', 'invoicing' ), |
|
| 447 | - 'hours' => __( 'Hours', 'invoicing' ), |
|
| 448 | - 'amount' => __( 'Amount Only', 'invoicing' ), |
|
| 446 | + 'quantity' => __('Quantity', 'invoicing'), |
|
| 447 | + 'hours' => __('Hours', 'invoicing'), |
|
| 448 | + 'amount' => __('Amount Only', 'invoicing'), |
|
| 449 | 449 | ), |
| 450 | 450 | 'data-allow-clear' => 'false', |
| 451 | 451 | 'select2' => true, |
@@ -462,11 +462,11 @@ discard block |
||
| 462 | 462 | array( |
| 463 | 463 | 'id' => 'wpinv_currency', |
| 464 | 464 | 'name' => 'wpinv_currency', |
| 465 | - 'label' => __( 'Currency', 'invoicing' ), |
|
| 465 | + 'label' => __('Currency', 'invoicing'), |
|
| 466 | 466 | 'label_type' => 'vertical', |
| 467 | - 'placeholder' => __( 'Select Invoice Currency', 'invoicing' ), |
|
| 467 | + 'placeholder' => __('Select Invoice Currency', 'invoicing'), |
|
| 468 | 468 | 'class' => 'form-control-sm', |
| 469 | - 'value' => $invoice->get_currency( 'edit' ), |
|
| 469 | + 'value' => $invoice->get_currency('edit'), |
|
| 470 | 470 | 'required' => false, |
| 471 | 471 | 'data-allow-clear' => 'false', |
| 472 | 472 | 'select2' => true, |
@@ -479,24 +479,24 @@ discard block |
||
| 479 | 479 | </div> |
| 480 | 480 | </div> |
| 481 | 481 | |
| 482 | - <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?> |
|
| 482 | + <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?> |
|
| 483 | 483 | <?php endif; ?> |
| 484 | 484 | |
| 485 | 485 | <table cellpadding="0" cellspacing="0" class="getpaid_invoice_items"> |
| 486 | 486 | <thead> |
| 487 | 487 | <tr> |
| 488 | - <th class="getpaid-item" colspan="2"><?php esc_html_e( 'Item', 'invoicing' ) ?></th> |
|
| 488 | + <th class="getpaid-item" colspan="2"><?php esc_html_e('Item', 'invoicing') ?></th> |
|
| 489 | 489 | <th class="getpaid-quantity hide-if-amount text-right"> |
| 490 | - <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Quantity', 'invoicing' ) ?></span> |
|
| 491 | - <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Hours', 'invoicing' ) ?></span> |
|
| 490 | + <span class="getpaid-hide-if-hours"><?php esc_html_e('Quantity', 'invoicing') ?></span> |
|
| 491 | + <span class="getpaid-hide-if-quantity"><?php esc_html_e('Hours', 'invoicing') ?></span> |
|
| 492 | 492 | </th> |
| 493 | 493 | <th class="getpaid-price hide-if-amount text-right"> |
| 494 | - <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Price', 'invoicing' ) ?></span> |
|
| 495 | - <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Rate', 'invoicing' ) ?></span> |
|
| 494 | + <span class="getpaid-hide-if-hours"><?php esc_html_e('Price', 'invoicing') ?></span> |
|
| 495 | + <span class="getpaid-hide-if-quantity"><?php esc_html_e('Rate', 'invoicing') ?></span> |
|
| 496 | 496 | </th> |
| 497 | 497 | <th class="getpaid-item-subtotal text-right"> |
| 498 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php esc_html_e( 'Amount', 'invoicing' ) ?></span> |
|
| 499 | - <span class="hide-if-amount"><?php esc_html_e( 'Total', 'invoicing' ) ?></span> |
|
| 498 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php esc_html_e('Amount', 'invoicing') ?></span> |
|
| 499 | + <span class="hide-if-amount"><?php esc_html_e('Total', 'invoicing') ?></span> |
|
| 500 | 500 | </th> |
| 501 | 501 | <th class="getpaid-item-actions hide-if-not-editable" width="70px"> </th> |
| 502 | 502 | </tr> |
@@ -504,8 +504,8 @@ discard block |
||
| 504 | 504 | <tbody class="getpaid_invoice_line_items"> |
| 505 | 505 | <tr class="hide-if-has-items hide-if-not-editable"> |
| 506 | 506 | <td colspan="2" class="pt-4 pb-4"> |
| 507 | - <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> |
|
| 508 | - <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> |
|
| 507 | + <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> |
|
| 508 | + <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> |
|
| 509 | 509 | </td> |
| 510 | 510 | <td class="hide-if-amount"> </th> |
| 511 | 511 | <td class="hide-if-amount"> </th> |
@@ -537,11 +537,11 @@ discard block |
||
| 537 | 537 | <div class="col-12 col-sm-6 offset-sm-6"> |
| 538 | 538 | <table class="getpaid-invoice-totals text-right w-100"> |
| 539 | 539 | <tbody> |
| 540 | - <?php foreach ( apply_filters( 'getpaid_invoice_subtotal_rows', $totals, $invoice ) as $key => $data ) : ?> |
|
| 541 | - <tr class="getpaid-totals-<?php echo esc_attr( $key ); ?>"> |
|
| 542 | - <td class="label"><?php echo esc_html( $data['label'] ) ?>:</td> |
|
| 540 | + <?php foreach (apply_filters('getpaid_invoice_subtotal_rows', $totals, $invoice) as $key => $data) : ?> |
|
| 541 | + <tr class="getpaid-totals-<?php echo esc_attr($key); ?>"> |
|
| 542 | + <td class="label"><?php echo esc_html($data['label']) ?>:</td> |
|
| 543 | 543 | <td width="1%"></td> |
| 544 | - <td class="value"><?php echo wp_kses_post( $data['value'] ) ?></td> |
|
| 544 | + <td class="value"><?php echo wp_kses_post($data['value']) ?></td> |
|
| 545 | 545 | </tr> |
| 546 | 546 | <?php endforeach; ?> |
| 547 | 547 | </tbody> |
@@ -554,18 +554,18 @@ discard block |
||
| 554 | 554 | <div class="getpaid-invoice-item-actions hide-if-no-items hide-if-not-editable"> |
| 555 | 555 | <div class="row"> |
| 556 | 556 | <div class="text-left col-12 col-sm-8"> |
| 557 | - <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> |
|
| 558 | - <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> |
|
| 559 | - <?php do_action( 'getpaid-invoice-items-actions', $invoice ); ?> |
|
| 557 | + <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> |
|
| 558 | + <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> |
|
| 559 | + <?php do_action('getpaid-invoice-items-actions', $invoice); ?> |
|
| 560 | 560 | </div> |
| 561 | 561 | <div class="text-right col-12 col-sm-4"> |
| 562 | - <button type="button" class="button button-primary recalculate-totals-button"><?php esc_html_e( 'Recalculate Totals', 'invoicing' ) ?></button> |
|
| 562 | + <button type="button" class="button button-primary recalculate-totals-button"><?php esc_html_e('Recalculate Totals', 'invoicing') ?></button> |
|
| 563 | 563 | </div> |
| 564 | 564 | </div> |
| 565 | 565 | </div> |
| 566 | 566 | |
| 567 | 567 | <div class="getpaid-invoice-item-actions hide-if-editable"> |
| 568 | - <p class="description m-2 text-right text-muted"><?php esc_html_e( 'This invoice is no longer editable', 'invoicing' ); ?></p> |
|
| 568 | + <p class="description m-2 text-right text-muted"><?php esc_html_e('This invoice is no longer editable', 'invoicing'); ?></p> |
|
| 569 | 569 | </div> |
| 570 | 570 | |
| 571 | 571 | <!-- Add items to an invoice --> |
@@ -573,9 +573,9 @@ discard block |
||
| 573 | 573 | <div class="modal-dialog modal-dialog-centered" role="document"> |
| 574 | 574 | <div class="modal-content"> |
| 575 | 575 | <div class="modal-header"> |
| 576 | - <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php esc_html_e( "Add Item(s)", 'invoicing' ); ?></h5> |
|
| 577 | - <button type="button" class="close btn-close" data-dismiss="modal" aria-label="<?php esc_html_e( "Close", 'invoicing' ); ?>"> |
|
| 578 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 576 | + <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php esc_html_e("Add Item(s)", 'invoicing'); ?></h5> |
|
| 577 | + <button type="button" class="close btn-close" data-dismiss="modal" aria-label="<?php esc_html_e("Close", 'invoicing'); ?>"> |
|
| 578 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
| 579 | 579 | <span aria-hidden="true">×</span> |
| 580 | 580 | <?php endif; ?> |
| 581 | 581 | </button> |
@@ -584,10 +584,10 @@ discard block |
||
| 584 | 584 | <table class="widefat"> |
| 585 | 585 | <thead> |
| 586 | 586 | <tr> |
| 587 | - <th class="pl-0 text-left"><?php esc_html_e( 'Item', 'invoicing' ) ?></th> |
|
| 587 | + <th class="pl-0 text-left"><?php esc_html_e('Item', 'invoicing') ?></th> |
|
| 588 | 588 | <th class="pr-0 text-right hide-if-amount"> |
| 589 | - <span class="getpaid-hide-if-hours"><?php esc_html_e( 'Quantity', 'invoicing' ) ?></span> |
|
| 590 | - <span class="getpaid-hide-if-quantity"><?php esc_html_e( 'Hours', 'invoicing' ) ?></span> |
|
| 589 | + <span class="getpaid-hide-if-hours"><?php esc_html_e('Quantity', 'invoicing') ?></span> |
|
| 590 | + <span class="getpaid-hide-if-quantity"><?php esc_html_e('Hours', 'invoicing') ?></span> |
|
| 591 | 591 | </th> |
| 592 | 592 | </tr> |
| 593 | 593 | </thead> |
@@ -595,9 +595,9 @@ discard block |
||
| 595 | 595 | <tr> |
| 596 | 596 | <td class="pl-0 text-left"> |
| 597 | 597 | <select class="regular-text getpaid-add-invoice-item-select"> |
| 598 | - <option value="" selected="selected" disabled><?php esc_html_e( 'Select an item…', 'invoicing' ); ?></option> |
|
| 599 | - <?php foreach ( get_posts( $item_args ) as $item ) : ?> |
|
| 600 | - <option value="<?php echo (int) $item->ID; ?>"><?php echo esc_html( $item->post_title ); ?></option> |
|
| 598 | + <option value="" selected="selected" disabled><?php esc_html_e('Select an item…', 'invoicing'); ?></option> |
|
| 599 | + <?php foreach (get_posts($item_args) as $item) : ?> |
|
| 600 | + <option value="<?php echo (int) $item->ID; ?>"><?php echo esc_html($item->post_title); ?></option> |
|
| 601 | 601 | <?php endforeach; ?> |
| 602 | 602 | </select> |
| 603 | 603 | </td> |
@@ -609,8 +609,8 @@ discard block |
||
| 609 | 609 | </table> |
| 610 | 610 | </div> |
| 611 | 611 | <div class="modal-footer"> |
| 612 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button> |
|
| 613 | - <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php esc_html_e( 'Add', 'invoicing' ); ?></button> |
|
| 612 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button> |
|
| 613 | + <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php esc_html_e('Add', 'invoicing'); ?></button> |
|
| 614 | 614 | </div> |
| 615 | 615 | </div> |
| 616 | 616 | </div> |
@@ -621,9 +621,9 @@ discard block |
||
| 621 | 621 | <div class="modal-dialog modal-dialog-centered" role="document"> |
| 622 | 622 | <div class="modal-content"> |
| 623 | 623 | <div class="modal-header"> |
| 624 | - <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php esc_html_e( "Create Item", 'invoicing' ); ?></h5> |
|
| 625 | - <button type="button" class="close btn-close" data-dismiss="modal" aria-label="<?php esc_html_e( "Close", 'invoicing' ); ?>"> |
|
| 626 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 624 | + <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php esc_html_e("Create Item", 'invoicing'); ?></h5> |
|
| 625 | + <button type="button" class="close btn-close" data-dismiss="modal" aria-label="<?php esc_html_e("Close", 'invoicing'); ?>"> |
|
| 626 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
| 627 | 627 | <span aria-hidden="true">×</span> |
| 628 | 628 | <?php endif; ?> |
| 629 | 629 | </button> |
@@ -632,27 +632,27 @@ discard block |
||
| 632 | 632 | <div class="getpaid-create-item-div"> |
| 633 | 633 | <input type="hidden" name="id" value="new" class="form-control form-control-sm item-id"> |
| 634 | 634 | <label class="form-group mb-3 w-100"> |
| 635 | - <span><?php esc_html_e( 'Name', 'invoicing' ); ?></span> |
|
| 636 | - <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name"> |
|
| 635 | + <span><?php esc_html_e('Name', 'invoicing'); ?></span> |
|
| 636 | + <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name"> |
|
| 637 | 637 | </label> |
| 638 | 638 | <label class="form-group mb-3 w-100"> |
| 639 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e( 'Amount', 'invoicing' ); ?></span> |
|
| 640 | - <span class="hide-if-amount"><?php esc_html_e( 'Price', 'invoicing' ); ?></span> |
|
| 641 | - <input type="text" name="price" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control form-control-sm item-price"> |
|
| 639 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e('Amount', 'invoicing'); ?></span> |
|
| 640 | + <span class="hide-if-amount"><?php esc_html_e('Price', 'invoicing'); ?></span> |
|
| 641 | + <input type="text" name="price" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control form-control-sm item-price"> |
|
| 642 | 642 | </label> |
| 643 | 643 | <label class="form-group mb-3 w-100 hide-if-amount"> |
| 644 | - <span><?php esc_html_e( 'Quantity', 'invoicing' ); ?></span> |
|
| 644 | + <span><?php esc_html_e('Quantity', 'invoicing'); ?></span> |
|
| 645 | 645 | <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity"> |
| 646 | 646 | </label> |
| 647 | 647 | <label class="form-group mb-3 w-100"> |
| 648 | - <span><?php esc_html_e( 'Item Description', 'invoicing' ); ?></span> |
|
| 649 | - <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea> |
|
| 648 | + <span><?php esc_html_e('Item Description', 'invoicing'); ?></span> |
|
| 649 | + <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea> |
|
| 650 | 650 | </label> |
| 651 | 651 | </div> |
| 652 | 652 | </div> |
| 653 | 653 | <div class="modal-footer"> |
| 654 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button> |
|
| 655 | - <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e( 'Create', 'invoicing' ); ?></button> |
|
| 654 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button> |
|
| 655 | + <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e('Create', 'invoicing'); ?></button> |
|
| 656 | 656 | </div> |
| 657 | 657 | </div> |
| 658 | 658 | </div> |
@@ -663,9 +663,9 @@ discard block |
||
| 663 | 663 | <div class="modal-dialog modal-dialog-centered" role="document"> |
| 664 | 664 | <div class="modal-content"> |
| 665 | 665 | <div class="modal-header"> |
| 666 | - <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php esc_html_e( "Edit Item", 'invoicing' ); ?></h5> |
|
| 667 | - <button type="button" class="close close" data-dismiss="modal" aria-label="<?php esc_html_e( "Close", 'invoicing' ); ?>"> |
|
| 668 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 666 | + <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php esc_html_e("Edit Item", 'invoicing'); ?></h5> |
|
| 667 | + <button type="button" class="close close" data-dismiss="modal" aria-label="<?php esc_html_e("Close", 'invoicing'); ?>"> |
|
| 668 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
| 669 | 669 | <span aria-hidden="true">×</span> |
| 670 | 670 | <?php endif; ?> |
| 671 | 671 | </button> |
@@ -674,27 +674,27 @@ discard block |
||
| 674 | 674 | <div class="getpaid-edit-item-div"> |
| 675 | 675 | <input type="hidden" name="id" class="form-control form-control-sm item-id"> |
| 676 | 676 | <label class="form-group mb-3 w-100"> |
| 677 | - <span><?php esc_html_e( 'Name', 'invoicing' ); ?></span> |
|
| 678 | - <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name"> |
|
| 677 | + <span><?php esc_html_e('Name', 'invoicing'); ?></span> |
|
| 678 | + <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name"> |
|
| 679 | 679 | </label> |
| 680 | 680 | <label class="form-group mb-3 w-100"> |
| 681 | - <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e( 'Amount', 'invoicing' ); ?></span> |
|
| 682 | - <span class="hide-if-amount"><?php esc_html_e( 'Price', 'invoicing' ); ?></span> |
|
| 683 | - <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price"> |
|
| 681 | + <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php esc_html_e('Amount', 'invoicing'); ?></span> |
|
| 682 | + <span class="hide-if-amount"><?php esc_html_e('Price', 'invoicing'); ?></span> |
|
| 683 | + <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price"> |
|
| 684 | 684 | </label> |
| 685 | 685 | <label class="form-group mb-3 w-100 hide-if-amount"> |
| 686 | - <span><?php esc_html_e( 'Quantity', 'invoicing' ); ?></span> |
|
| 686 | + <span><?php esc_html_e('Quantity', 'invoicing'); ?></span> |
|
| 687 | 687 | <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity"> |
| 688 | 688 | </label> |
| 689 | 689 | <label class="form-group mb-3 w-100"> |
| 690 | - <span><?php esc_html_e( 'Item Description', 'invoicing' ); ?></span> |
|
| 691 | - <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea> |
|
| 690 | + <span><?php esc_html_e('Item Description', 'invoicing'); ?></span> |
|
| 691 | + <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea> |
|
| 692 | 692 | </label> |
| 693 | 693 | </div> |
| 694 | 694 | </div> |
| 695 | 695 | <div class="modal-footer"> |
| 696 | - <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e( 'Cancel', 'invoicing' ); ?></button> |
|
| 697 | - <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e( 'Save', 'invoicing' ); ?></button> |
|
| 696 | + <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php esc_html_e('Cancel', 'invoicing'); ?></button> |
|
| 697 | + <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php esc_html_e('Save', 'invoicing'); ?></button> |
|
| 698 | 698 | </div> |
| 699 | 699 | </div> |
| 700 | 700 | </div> |
@@ -19,16 +19,16 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | // Define constants. |
| 21 | 21 | if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) { |
| 22 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
| 22 | + define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | if ( ! defined( 'WPINV_VERSION' ) ) { |
| 26 | - define( 'WPINV_VERSION', '2.7.9' ); |
|
| 26 | + define( 'WPINV_VERSION', '2.7.9' ); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | // Include the main Invoicing class. |
| 30 | 30 | if ( ! class_exists( 'WPInv_Plugin', false ) ) { |
| 31 | - require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
| 31 | + require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $GLOBALS['invoicing'] = new WPInv_Plugin(); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - return $GLOBALS['invoicing']; |
|
| 46 | + return $GLOBALS['invoicing']; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -15,20 +15,20 @@ discard block |
||
| 15 | 15 | * @package GetPaid |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -defined( 'ABSPATH' ) || exit; |
|
| 18 | +defined('ABSPATH') || exit; |
|
| 19 | 19 | |
| 20 | 20 | // Define constants. |
| 21 | -if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) { |
|
| 22 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
| 21 | +if (!defined('WPINV_PLUGIN_FILE')) { |
|
| 22 | + define('WPINV_PLUGIN_FILE', __FILE__); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -if ( ! defined( 'WPINV_VERSION' ) ) { |
|
| 26 | - define( 'WPINV_VERSION', '2.7.9' ); |
|
| 25 | +if (!defined('WPINV_VERSION')) { |
|
| 26 | + define('WPINV_VERSION', '2.7.9'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | // Include the main Invoicing class. |
| 30 | -if ( ! class_exists( 'WPInv_Plugin', false ) ) { |
|
| 31 | - require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
| 30 | +if (!class_exists('WPInv_Plugin', false)) { |
|
| 31 | + require_once plugin_dir_path(WPINV_PLUGIN_FILE) . 'includes/class-wpinv.php'; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | function getpaid() { |
| 41 | 41 | |
| 42 | - if ( empty( $GLOBALS['invoicing'] ) ) { |
|
| 42 | + if (empty($GLOBALS['invoicing'])) { |
|
| 43 | 43 | $GLOBALS['invoicing'] = new WPInv_Plugin(); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * @since 2.0.8 |
| 53 | 53 | */ |
| 54 | 54 | function getpaid_deactivation_hook() { |
| 55 | - update_option( 'wpinv_flush_permalinks', 1 ); |
|
| 55 | + update_option('wpinv_flush_permalinks', 1); |
|
| 56 | 56 | } |
| 57 | -register_deactivation_hook( __FILE__, 'getpaid_deactivation_hook' ); |
|
| 57 | +register_deactivation_hook(__FILE__, 'getpaid_deactivation_hook'); |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * @deprecated |
@@ -64,4 +64,4 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // Kickstart the plugin. |
| 67 | -add_action( 'plugins_loaded', 'getpaid', -100 ); |
|
| 67 | +add_action('plugins_loaded', 'getpaid', -100); |
|