@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | * @var array $fee |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | -do_action( 'getpaid_before_invoice_fee_item', $invoice, $fee ); |
|
14 | +do_action('getpaid_before_invoice_fee_item', $invoice, $fee); |
|
15 | 15 | |
16 | 16 | ?> |
17 | 17 | |
@@ -19,64 +19,64 @@ discard block |
||
19 | 19 | |
20 | 20 | <div class="form-row row"> |
21 | 21 | |
22 | - <?php foreach ( array_keys( $columns ) as $column ) : ?> |
|
22 | + <?php foreach (array_keys($columns) as $column) : ?> |
|
23 | 23 | |
24 | - <div class="<?php echo 'name' == $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr( $column ); ?>"> |
|
24 | + <div class="<?php echo 'name' == $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr($column); ?>"> |
|
25 | 25 | |
26 | 26 | <?php |
27 | 27 | |
28 | 28 | // Fires before printing a fee item column. |
29 | - do_action( "getpaid_invoice_fee_item_before_$column", $fee, $invoice ); |
|
29 | + do_action("getpaid_invoice_fee_item_before_$column", $fee, $invoice); |
|
30 | 30 | |
31 | 31 | // Item name. |
32 | - if ( 'name' == $column ) { |
|
32 | + if ('name' == $column) { |
|
33 | 33 | |
34 | 34 | // Display the name. |
35 | - echo '<div class="mb-1">' . esc_html( $fee['name'] ) . '</div>'; |
|
35 | + echo '<div class="mb-1">' . esc_html($fee['name']) . '</div>'; |
|
36 | 36 | |
37 | 37 | // And an optional description. |
38 | - $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] ); |
|
39 | - echo wp_kses_post( "<small class='form-text text-muted pr-2 m-0'>$description</small>" ); |
|
38 | + $description = empty($fee['description']) ? esc_html__('Fee', 'invoicing') : esc_html($fee['description']); |
|
39 | + echo wp_kses_post("<small class='form-text text-muted pr-2 m-0'>$description</small>"); |
|
40 | 40 | |
41 | 41 | } |
42 | 42 | |
43 | 43 | // Item price. |
44 | - if ( 'price' == $column ) { |
|
44 | + if ('price' == $column) { |
|
45 | 45 | |
46 | 46 | // Display the item price (or recurring price if this is a renewal invoice) |
47 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
48 | - wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
47 | + if ($invoice->is_recurring() && $invoice->is_renewal()) { |
|
48 | + wpinv_the_price($fee['recurring_fee'], $invoice->get_currency()); |
|
49 | 49 | } else { |
50 | - wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() ); |
|
50 | + wpinv_the_price($fee['initial_fee'], $invoice->get_currency()); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | 54 | // Item quantity. |
55 | - if ( 'quantity' == $column ) { |
|
55 | + if ('quantity' == $column) { |
|
56 | 56 | echo '—'; |
57 | 57 | } |
58 | 58 | |
59 | 59 | // Item tax. |
60 | - if ( 'tax_rate' == $column ) { |
|
60 | + if ('tax_rate' == $column) { |
|
61 | 61 | echo '—'; |
62 | 62 | } |
63 | 63 | |
64 | 64 | // Item sub total. |
65 | - if ( 'subtotal' == $column ) { |
|
65 | + if ('subtotal' == $column) { |
|
66 | 66 | |
67 | 67 | // Display the item price (or recurring price if this is a renewal invoice) |
68 | - if ( $invoice->is_recurring() && $invoice->is_renewal() ) { |
|
69 | - wpinv_the_price( $fee['recurring_fee'], $invoice->get_currency() ); |
|
68 | + if ($invoice->is_recurring() && $invoice->is_renewal()) { |
|
69 | + wpinv_the_price($fee['recurring_fee'], $invoice->get_currency()); |
|
70 | 70 | } else { |
71 | - wpinv_the_price( $fee['initial_fee'], $invoice->get_currency() ); |
|
71 | + wpinv_the_price($fee['initial_fee'], $invoice->get_currency()); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | 75 | // Fires when printing a fee item column. |
76 | - do_action( "getpaid_invoice_fee_item_$column", $fee, $invoice ); |
|
76 | + do_action("getpaid_invoice_fee_item_$column", $fee, $invoice); |
|
77 | 77 | |
78 | 78 | // Fires after printing a fee item column. |
79 | - do_action( "getpaid_invoice_fee_item_after_$column", $fee, $invoice ); |
|
79 | + do_action("getpaid_invoice_fee_item_after_$column", $fee, $invoice); |
|
80 | 80 | |
81 | 81 | ?> |
82 | 82 |
@@ -9,26 +9,26 @@ discard block |
||
9 | 9 | * @var WPInv_Invoice $invoice |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | 14 | // Totals rows. |
15 | -$totals = getpaid_invoice_totals_rows( $invoice ); |
|
15 | +$totals = getpaid_invoice_totals_rows($invoice); |
|
16 | 16 | |
17 | -do_action( 'getpaid_before_invoice_line_totals', $invoice, $totals ); |
|
17 | +do_action('getpaid_before_invoice_line_totals', $invoice, $totals); |
|
18 | 18 | |
19 | 19 | ?> |
20 | 20 | <div class='getpaid-invoice-line-totals'> |
21 | 21 | <div class="row"> |
22 | 22 | <div class="col-12 offset-sm-6 col-sm-6 border-sm-left pl-sm-0"> |
23 | 23 | |
24 | - <?php foreach ( $totals as $key => $label ) : ?> |
|
24 | + <?php foreach ($totals as $key => $label) : ?> |
|
25 | 25 | |
26 | - <div class="getpaid-invoice-line-totals-col <?php echo esc_attr( $key ); ?>"> |
|
26 | + <div class="getpaid-invoice-line-totals-col <?php echo esc_attr($key); ?>"> |
|
27 | 27 | |
28 | 28 | <div class="form-row row"> |
29 | 29 | |
30 | 30 | <div class="col-8 getpaid-invoice-line-totals-label"> |
31 | - <?php echo esc_html( $label ); ?> |
|
31 | + <?php echo esc_html($label); ?> |
|
32 | 32 | </div> |
33 | 33 | |
34 | 34 | <div class="col-4 getpaid-invoice-line-totals-value pl-0"> |
@@ -36,47 +36,47 @@ discard block |
||
36 | 36 | <?php |
37 | 37 | |
38 | 38 | // Total tax. |
39 | - if ( 'tax' === $key ) { |
|
40 | - wpinv_the_price( $invoice->get_total_tax(), $invoice->get_currency() ); |
|
39 | + if ('tax' === $key) { |
|
40 | + wpinv_the_price($invoice->get_total_tax(), $invoice->get_currency()); |
|
41 | 41 | |
42 | - if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) { |
|
42 | + if (wpinv_use_taxes() && !$invoice->get_disable_taxes()) { |
|
43 | 43 | |
44 | 44 | $taxes = $invoice->get_total_tax(); |
45 | - if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) { |
|
45 | + if (empty($taxes) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction($invoice->get_country())) { |
|
46 | 46 | echo ' <em class="text-muted small">'; |
47 | - _x( '(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing' ); |
|
47 | + _x('(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing'); |
|
48 | 48 | echo '</em>'; |
49 | 49 | } |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | 53 | // Total Fee. |
54 | - if ( 'fee' === $key ) { |
|
55 | - wpinv_the_price( $invoice->get_total_fees(), $invoice->get_currency() ); |
|
54 | + if ('fee' === $key) { |
|
55 | + wpinv_the_price($invoice->get_total_fees(), $invoice->get_currency()); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | // Total discount. |
59 | - if ( 'discount' === $key ) { |
|
60 | - wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() ); |
|
59 | + if ('discount' === $key) { |
|
60 | + wpinv_the_price($invoice->get_total_discount(), $invoice->get_currency()); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // Shipping. |
64 | - if ( 'shipping' === $key ) { |
|
65 | - wpinv_the_price( $invoice->get_shipping(), $invoice->get_currency() ); |
|
64 | + if ('shipping' === $key) { |
|
65 | + wpinv_the_price($invoice->get_shipping(), $invoice->get_currency()); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // Sub total. |
69 | - if ( 'subtotal' === $key ) { |
|
70 | - wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() ); |
|
69 | + if ('subtotal' === $key) { |
|
70 | + wpinv_the_price($invoice->get_subtotal(), $invoice->get_currency()); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Total. |
74 | - if ( 'total' === $key ) { |
|
75 | - wpinv_the_price( $invoice->get_total(), $invoice->get_currency() ); |
|
74 | + if ('total' === $key) { |
|
75 | + wpinv_the_price($invoice->get_total(), $invoice->get_currency()); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | // Fires when printing a cart total. |
79 | - do_action( "getpaid_invoice_cart_totals_$key", $invoice ); |
|
79 | + do_action("getpaid_invoice_cart_totals_$key", $invoice); |
|
80 | 80 | |
81 | 81 | ?> |
82 | 82 | |
@@ -90,4 +90,4 @@ discard block |
||
90 | 90 | </div> |
91 | 91 | </div> <!-- end .getpaid-invoice-line-totals --> |
92 | 92 | |
93 | -<?php do_action( 'getpaid_after_invoice_line_totals', $invoice, $totals ); ?> |
|
93 | +<?php do_action('getpaid_after_invoice_line_totals', $invoice, $totals); ?> |
@@ -10,104 +10,104 @@ |
||
10 | 10 | * @var array $columns |
11 | 11 | */ |
12 | 12 | |
13 | -defined( 'ABSPATH' ) || exit; |
|
13 | +defined('ABSPATH') || exit; |
|
14 | 14 | |
15 | -do_action( 'getpaid_before_invoice_line_item', $invoice, $item ); |
|
15 | +do_action('getpaid_before_invoice_line_item', $invoice, $item); |
|
16 | 16 | |
17 | 17 | ?> |
18 | 18 | |
19 | -<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo esc_attr( $item->get_type() ); ?> border-bottom'> |
|
19 | +<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo esc_attr($item->get_type()); ?> border-bottom'> |
|
20 | 20 | |
21 | 21 | <div class="form-row row align-items-center"> |
22 | 22 | |
23 | - <?php foreach ( array_keys( $columns ) as $column ) : ?> |
|
23 | + <?php foreach (array_keys($columns) as $column) : ?> |
|
24 | 24 | |
25 | - <div class="<?php echo 'name' === $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr( $column ); ?>"> |
|
25 | + <div class="<?php echo 'name' === $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr($column); ?>"> |
|
26 | 26 | |
27 | 27 | <?php |
28 | 28 | |
29 | 29 | // Fires before printing a line item column. |
30 | - do_action( "getpaid_invoice_line_item_before_$column", $item, $invoice ); |
|
30 | + do_action("getpaid_invoice_line_item_before_$column", $item, $invoice); |
|
31 | 31 | |
32 | 32 | // Item name. |
33 | - if ( 'name' === $column ) { |
|
33 | + if ('name' === $column) { |
|
34 | 34 | |
35 | - $has_featured_image = has_post_thumbnail( $item->get_id() ); |
|
35 | + $has_featured_image = has_post_thumbnail($item->get_id()); |
|
36 | 36 | |
37 | - if ( $has_featured_image ) { |
|
37 | + if ($has_featured_image) { |
|
38 | 38 | echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">'; |
39 | 39 | echo '<div class="getpaid-form-item-image-container mr-2">'; |
40 | - echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) ); |
|
40 | + echo get_the_post_thumbnail($item->get_id(), 'thumbnail', array('class' => 'getpaid-form-item-image mb-0')); |
|
41 | 41 | echo '</div>'; |
42 | 42 | echo '<div class="getpaid-form-item-name-container">'; |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Display the name. |
46 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
46 | + echo '<div class="mb-1">' . esc_html($item->get_name()) . '</div>'; |
|
47 | 47 | |
48 | 48 | // And an optional description. |
49 | 49 | $description = $item->get_description(); |
50 | 50 | |
51 | - if ( ! empty( $description ) ) { |
|
52 | - echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
51 | + if (!empty($description)) { |
|
52 | + echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post($description) . '</small>'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // Fires before printing the line item actions. |
56 | - do_action( 'getpaid_before_invoice_line_item_actions', $item, $invoice ); |
|
56 | + do_action('getpaid_before_invoice_line_item_actions', $item, $invoice); |
|
57 | 57 | |
58 | - $actions = apply_filters( 'getpaid-invoice-page-line-item-actions', array(), $item, $invoice ); |
|
58 | + $actions = apply_filters('getpaid-invoice-page-line-item-actions', array(), $item, $invoice); |
|
59 | 59 | |
60 | - if ( ! empty( $actions ) ) { |
|
60 | + if (!empty($actions)) { |
|
61 | 61 | |
62 | - $sanitized = array(); |
|
63 | - foreach ( $actions as $key => $item_action ) { |
|
64 | - $key = sanitize_html_class( $key ); |
|
65 | - $item_action = wp_kses_post( $item_action ); |
|
62 | + $sanitized = array(); |
|
63 | + foreach ($actions as $key => $item_action) { |
|
64 | + $key = sanitize_html_class($key); |
|
65 | + $item_action = wp_kses_post($item_action); |
|
66 | 66 | $sanitized[] = "<span class='$key'>$item_action</span>"; |
67 | 67 | } |
68 | 68 | |
69 | 69 | echo "<small class='form-text getpaid-line-item-actions'>"; |
70 | - echo wp_kses_post( implode( ' | ', $sanitized ) ); |
|
70 | + echo wp_kses_post(implode(' | ', $sanitized)); |
|
71 | 71 | echo '</small>'; |
72 | 72 | |
73 | 73 | } |
74 | 74 | |
75 | - if ( $has_featured_image ) { |
|
75 | + if ($has_featured_image) { |
|
76 | 76 | echo '</div>'; |
77 | 77 | echo '</div>'; |
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | 81 | // Item price. |
82 | - if ( 'price' === $column ) { |
|
82 | + if ('price' === $column) { |
|
83 | 83 | |
84 | 84 | // Display the item price (or recurring price if this is a renewal invoice) |
85 | 85 | $price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price(); |
86 | - wpinv_the_price( $price, $invoice->get_currency() ); |
|
86 | + wpinv_the_price($price, $invoice->get_currency()); |
|
87 | 87 | |
88 | 88 | } |
89 | 89 | |
90 | 90 | // Tax rate. |
91 | - if ( 'tax_rate' === $column ) { |
|
92 | - echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%'; |
|
91 | + if ('tax_rate' === $column) { |
|
92 | + echo floatval(round(getpaid_get_invoice_tax_rate($invoice, $item), 2)) . '%'; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // Item quantity. |
96 | - if ( 'quantity' === $column ) { |
|
96 | + if ('quantity' === $column) { |
|
97 | 97 | echo (float) $item->get_quantity(); |
98 | 98 | } |
99 | 99 | |
100 | 100 | // Item sub total. |
101 | - if ( 'subtotal' === $column ) { |
|
101 | + if ('subtotal' === $column) { |
|
102 | 102 | $subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total(); |
103 | - wpinv_the_price( $subtotal, $invoice->get_currency() ); |
|
103 | + wpinv_the_price($subtotal, $invoice->get_currency()); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | // Fires when printing a line item column. |
107 | - do_action( "getpaid_invoice_line_item_$column", $item, $invoice ); |
|
107 | + do_action("getpaid_invoice_line_item_$column", $item, $invoice); |
|
108 | 108 | |
109 | 109 | // Fires after printing a line item column. |
110 | - do_action( "getpaid_invoice_line_item_after_$column", $item, $invoice ); |
|
110 | + do_action("getpaid_invoice_line_item_after_$column", $item, $invoice); |
|
111 | 111 | |
112 | 112 | ?> |
113 | 113 |
@@ -8,21 +8,21 @@ discard block |
||
8 | 8 | * @var WPInv_Invoice $invoice |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | ?> |
14 | 14 | |
15 | -<?php do_action( 'getpaid_invoice_before_line_items', $invoice ); ?> |
|
15 | +<?php do_action('getpaid_invoice_before_line_items', $invoice); ?> |
|
16 | 16 | |
17 | - <h2 class="mt-5 mb-1 h4"><?php echo sprintf( esc_html__( '%s Items', 'invoicing' ), esc_html( ucfirst( $invoice->get_invoice_quote_type() ) ) ); ?></h2> |
|
17 | + <h2 class="mt-5 mb-1 h4"><?php echo sprintf(esc_html__('%s Items', 'invoicing'), esc_html(ucfirst($invoice->get_invoice_quote_type()))); ?></h2> |
|
18 | 18 | <div class="getpaid-invoice-items mb-4 border"> |
19 | 19 | |
20 | 20 | |
21 | - <div class="getpaid-invoice-items-header <?php echo esc_attr( $invoice->get_template() ); ?>"> |
|
21 | + <div class="getpaid-invoice-items-header <?php echo esc_attr($invoice->get_template()); ?>"> |
|
22 | 22 | <div class="form-row row"> |
23 | - <?php foreach ( $columns as $key => $label ) : ?> |
|
24 | - <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-line-item-col-<?php echo esc_attr( $key ); ?>"> |
|
25 | - <?php echo esc_html( $label ); ?> |
|
23 | + <?php foreach ($columns as $key => $label) : ?> |
|
24 | + <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-line-item-col-<?php echo esc_attr($key); ?>"> |
|
25 | + <?php echo esc_html($label); ?> |
|
26 | 26 | </div> |
27 | 27 | <?php endforeach; ?> |
28 | 28 | </div> |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | <?php |
33 | 33 | |
34 | 34 | // Display the item totals. |
35 | - foreach ( $invoice->get_items() as $item ) { |
|
36 | - wpinv_get_template( 'invoice/line-item.php', compact( 'invoice', 'item', 'columns' ) ); |
|
35 | + foreach ($invoice->get_items() as $item) { |
|
36 | + wpinv_get_template('invoice/line-item.php', compact('invoice', 'item', 'columns')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Display the fee totals. |
40 | - foreach ( $invoice->get_fees() as $fee ) { |
|
41 | - wpinv_get_template( 'invoice/fee-item.php', compact( 'invoice', 'fee', 'columns' ) ); |
|
40 | + foreach ($invoice->get_fees() as $fee) { |
|
41 | + wpinv_get_template('invoice/fee-item.php', compact('invoice', 'fee', 'columns')); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // Display the cart totals. |
45 | - wpinv_get_template( 'invoice/line-totals.php', compact( 'invoice' ) ); |
|
45 | + wpinv_get_template('invoice/line-totals.php', compact('invoice')); |
|
46 | 46 | |
47 | 47 | ?> |
48 | 48 | |
49 | 49 | </div> |
50 | 50 | |
51 | -<?php do_action( 'getpaid_invoice_after_line_items', $invoice ); ?> |
|
51 | +<?php do_action('getpaid_invoice_after_line_items', $invoice); ?> |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Totals rows. |
13 | 13 | $totals = apply_filters( |
14 | 14 | 'getpaid_payment_form_cart_table_totals', |
15 | 15 | array( |
16 | - 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
17 | - 'tax' => __( 'Tax', 'invoicing' ), |
|
18 | - 'fees' => __( 'Fee', 'invoicing' ), |
|
19 | - 'discount' => __( 'Discount', 'invoicing' ), |
|
20 | - 'total' => __( 'Total', 'invoicing' ), |
|
16 | + 'subtotal' => __('Subtotal', 'invoicing'), |
|
17 | + 'tax' => __('Tax', 'invoicing'), |
|
18 | + 'fees' => __('Fee', 'invoicing'), |
|
19 | + 'discount' => __('Discount', 'invoicing'), |
|
20 | + 'total' => __('Total', 'invoicing'), |
|
21 | 21 | ), |
22 | 22 | $form |
23 | 23 | ); |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | $currency = $form->get_currency(); |
26 | 26 | $country = wpinv_get_default_country(); |
27 | 27 | |
28 | -if ( ! empty( $form->invoice ) ) { |
|
29 | - $country = $form->invoice->get_country(); |
|
28 | +if (!empty($form->invoice)) { |
|
29 | + $country = $form->invoice->get_country(); |
|
30 | 30 | } |
31 | 31 | |
32 | -if ( ! wpinv_use_taxes() && isset( $totals['tax'] ) ) { |
|
33 | - unset( $totals['tax'] ); |
|
32 | +if (!wpinv_use_taxes() && isset($totals['tax'])) { |
|
33 | + unset($totals['tax']); |
|
34 | 34 | } |
35 | 35 | |
36 | -do_action( 'getpaid_before_payment_form_cart_totals', $form, $totals ); |
|
36 | +do_action('getpaid_before_payment_form_cart_totals', $form, $totals); |
|
37 | 37 | |
38 | 38 | ?> |
39 | 39 | <style> |
@@ -47,26 +47,26 @@ discard block |
||
47 | 47 | <div class="row"> |
48 | 48 | <div class="col-12 offset-sm-6 col-sm-6 border-sm-left pl-sm-0"> |
49 | 49 | |
50 | - <?php foreach ( $totals as $key => $label ) : ?> |
|
50 | + <?php foreach ($totals as $key => $label) : ?> |
|
51 | 51 | |
52 | - <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr( $key ); ?> font-weight-bold py-2 px-3 <?php echo 'total' == $key ? 'bg-light' : 'border-bottom'; ?>"> |
|
52 | + <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr($key); ?> font-weight-bold py-2 px-3 <?php echo 'total' == $key ? 'bg-light' : 'border-bottom'; ?>"> |
|
53 | 53 | |
54 | 54 | <div class="form-row row"> |
55 | 55 | |
56 | 56 | <div class="col-8 pl-sm-0 getpaid-payment-form-line-totals-label"> |
57 | - <?php echo esc_html( $label ); ?> |
|
57 | + <?php echo esc_html($label); ?> |
|
58 | 58 | </div> |
59 | 59 | |
60 | - <div class="col-4 getpaid-payment-form-line-totals-value getpaid-form-cart-totals-total-<?php echo esc_attr( $key ); ?>"> |
|
60 | + <div class="col-4 getpaid-payment-form-line-totals-value getpaid-form-cart-totals-total-<?php echo esc_attr($key); ?>"> |
|
61 | 61 | |
62 | 62 | <?php |
63 | 63 | |
64 | 64 | // Total tax. |
65 | - if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ) ) ) { |
|
66 | - wpinv_the_price( 0, $currency ); |
|
65 | + if (in_array($key, array('tax', 'discount', 'subtotal', 'total', 'fees'))) { |
|
66 | + wpinv_the_price(0, $currency); |
|
67 | 67 | } |
68 | 68 | |
69 | - do_action( "getpaid_payment_form_cart_totals_$key", $form ); |
|
69 | + do_action("getpaid_payment_form_cart_totals_$key", $form); |
|
70 | 70 | ?> |
71 | 71 | |
72 | 72 | </div> |
@@ -82,4 +82,4 @@ discard block |
||
82 | 82 | </div> |
83 | 83 | |
84 | 84 | <?php |
85 | -do_action( 'getpaid_payment_form_cart_totals', $form, $totals ); |
|
85 | +do_action('getpaid_payment_form_cart_totals', $form, $totals); |
@@ -9,28 +9,28 @@ discard block |
||
9 | 9 | * @var GetPaid_Form_Item $item |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) || exit; |
|
12 | +defined('ABSPATH') || exit; |
|
13 | 13 | |
14 | -do_action( 'getpaid_before_payment_form_cart_item', $form, $item ); |
|
14 | +do_action('getpaid_before_payment_form_cart_item', $form, $item); |
|
15 | 15 | |
16 | 16 | $currency = $form->get_currency(); |
17 | -$max_qty = wpinv_item_max_buyable_quantity( $item->get_id() ); |
|
17 | +$max_qty = wpinv_item_max_buyable_quantity($item->get_id()); |
|
18 | 18 | ?> |
19 | 19 | <div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo (int) $item->get_id(); ?> border-bottom py-2 px-3'> |
20 | 20 | |
21 | 21 | <div class="form-row row align-items-center needs-validation"> |
22 | 22 | |
23 | - <?php foreach ( array_keys( $columns ) as $key ) : ?> |
|
23 | + <?php foreach (array_keys($columns) as $key) : ?> |
|
24 | 24 | |
25 | - <div class="<?php echo 'name' === $key ? 'col-6' : 'col'; ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ), true ) ) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo esc_attr( $key ); ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>-<?php echo (int) $item->get_id(); ?>"> |
|
25 | + <div class="<?php echo 'name' === $key ? 'col-6' : 'col'; ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'), true)) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo esc_attr($key); ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?>-<?php echo (int) $item->get_id(); ?>"> |
|
26 | 26 | |
27 | 27 | <?php |
28 | 28 | |
29 | 29 | // Fires before printing a line item column. |
30 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
30 | + do_action("getpaid_form_cart_item_before_$key", $item, $form); |
|
31 | 31 | |
32 | 32 | // Item name. |
33 | - if ( 'name' === $key ) { |
|
33 | + if ('name' === $key) { |
|
34 | 34 | |
35 | 35 | |
36 | 36 | ob_start(); |
@@ -38,22 +38,22 @@ discard block |
||
38 | 38 | // Add an optional description. |
39 | 39 | $description = $item->get_description(); |
40 | 40 | |
41 | - if ( ! empty( $description ) ) { |
|
42 | - echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
41 | + if (!empty($description)) { |
|
42 | + echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post($description) . '</small>'; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // Price help text. |
46 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
47 | - if ( $description ) { |
|
48 | - echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
46 | + $description = getpaid_item_recurring_price_help_text($item, $currency); |
|
47 | + if ($description) { |
|
48 | + echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post($description) . '</small>'; |
|
49 | 49 | } |
50 | 50 | |
51 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
51 | + do_action('getpaid_payment_form_cart_item_description', $item, $form); |
|
52 | 52 | |
53 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
53 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
54 | 54 | |
55 | 55 | edit_post_link( |
56 | - __( 'Edit this item.', 'invoicing' ), |
|
56 | + __('Edit this item.', 'invoicing'), |
|
57 | 57 | '<small class="form-text text-muted">', |
58 | 58 | '</small>', |
59 | 59 | $item->get_id(), |
@@ -65,30 +65,30 @@ discard block |
||
65 | 65 | $description = ob_get_clean(); |
66 | 66 | |
67 | 67 | // Display the name. |
68 | - $tootip = empty( $description ) ? '' : ' <i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
68 | + $tootip = empty($description) ? '' : ' <i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
69 | 69 | |
70 | - $has_featured_image = has_post_thumbnail( $item->get_id() ); |
|
70 | + $has_featured_image = has_post_thumbnail($item->get_id()); |
|
71 | 71 | |
72 | - if ( $has_featured_image ) { |
|
72 | + if ($has_featured_image) { |
|
73 | 73 | echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">'; |
74 | 74 | echo '<div class="getpaid-form-item-image-container mr-2">'; |
75 | - echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) ); |
|
75 | + echo get_the_post_thumbnail($item->get_id(), 'thumbnail', array('class' => 'getpaid-form-item-image mb-0')); |
|
76 | 76 | echo '</div>'; |
77 | 77 | echo '<div class="getpaid-form-item-name-container">'; |
78 | 78 | } |
79 | 79 | |
80 | - echo '<div class="mb-1 font-weight-bold">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
80 | + echo '<div class="mb-1 font-weight-bold">' . esc_html($item->get_name()) . wp_kses_post($tootip) . '</div>'; |
|
81 | 81 | |
82 | - if ( ! empty( $description ) ) { |
|
83 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) ); |
|
82 | + if (!empty($description)) { |
|
83 | + printf('<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post($description)); |
|
84 | 84 | } |
85 | 85 | |
86 | - if ( $item->allows_quantities() ) { |
|
86 | + if ($item->allows_quantities()) { |
|
87 | 87 | printf( |
88 | 88 | '<small class="d-sm-none text-muted form-text">%s</small>', |
89 | 89 | sprintf( |
90 | 90 | // translators: %s is the item quantity. |
91 | - esc_html__( 'Qty %s', 'invoicing' ), |
|
91 | + esc_html__('Qty %s', 'invoicing'), |
|
92 | 92 | sprintf( |
93 | 93 | '<input |
94 | 94 | type="number" |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | max="%s" |
101 | 101 | >', |
102 | 102 | (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
103 | - floatval( null !== $max_qty ? $max_qty : 1000000000000 ) |
|
103 | + floatval(null !== $max_qty ? $max_qty : 1000000000000) |
|
104 | 104 | ) |
105 | 105 | ) |
106 | 106 | ); |
@@ -109,70 +109,70 @@ discard block |
||
109 | 109 | '<small class="d-sm-none text-muted form-text">%s</small>', |
110 | 110 | sprintf( |
111 | 111 | // translators: %s is the item quantity. |
112 | - esc_html__( 'Qty %s', 'invoicing' ), |
|
112 | + esc_html__('Qty %s', 'invoicing'), |
|
113 | 113 | (float) $item->get_quantity() |
114 | 114 | ) |
115 | 115 | ); |
116 | 116 | } |
117 | 117 | |
118 | - if ( $has_featured_image ) { |
|
118 | + if ($has_featured_image) { |
|
119 | 119 | echo '</div>'; |
120 | 120 | echo '</div>'; |
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
124 | 124 | // Item price. |
125 | - if ( 'price' === $key ) { |
|
125 | + if ('price' === $key) { |
|
126 | 126 | |
127 | 127 | // Set the currency position. |
128 | 128 | $position = wpinv_currency_position(); |
129 | 129 | |
130 | - if ( 'left_space' === $position ) { |
|
130 | + if ('left_space' === $position) { |
|
131 | 131 | $position = 'left'; |
132 | 132 | } |
133 | 133 | |
134 | - if ( 'right_space' === $position ) { |
|
134 | + if ('right_space' === $position) { |
|
135 | 135 | $position = 'right'; |
136 | 136 | } |
137 | 137 | |
138 | - if ( $item->user_can_set_their_price() ) { |
|
139 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
138 | + if ($item->user_can_set_their_price()) { |
|
139 | + $price = max((float) $item->get_price(), (float) $item->get_minimum_price()); |
|
140 | 140 | $minimum = (float) $item->get_minimum_price(); |
141 | 141 | $validate_minimum = ''; |
142 | 142 | $class = ''; |
143 | 143 | $data_minimum = ''; |
144 | 144 | |
145 | - if ( $minimum > 0 ) { |
|
145 | + if ($minimum > 0) { |
|
146 | 146 | $validate_minimum = sprintf( |
147 | 147 | // translators: %s is the minimum price. |
148 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
149 | - wp_strip_all_tags( wpinv_price( $minimum, $currency ) ) |
|
148 | + esc_attr__('The minimum allowed amount is %s', 'invoicing'), |
|
149 | + wp_strip_all_tags(wpinv_price($minimum, $currency)) |
|
150 | 150 | ); |
151 | 151 | |
152 | 152 | $class = 'getpaid-validate-minimum-amount'; |
153 | 153 | |
154 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
154 | + $data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'"; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | ?> |
158 | 158 | <div class="input-group input-group-sm"> |
159 | - <?php if ( 'left' === $position ) : ?> |
|
159 | + <?php if ('left' === $position) : ?> |
|
160 | 160 | <div class="input-group-prepend"> |
161 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
|
161 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span> |
|
162 | 162 | </div> |
163 | 163 | <?php endif; ?> |
164 | 164 | |
165 | - <input type="text" <?php echo wp_kses_post( $data_minimum ); ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr( getpaid_unstandardize_amount( $price ) ); ?>" placeholder="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_minimum_price() ) ); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo esc_attr( $class ); ?>" style="width: 64px; line-height: 1; min-height: 35px;"> |
|
165 | + <input type="text" <?php echo wp_kses_post($data_minimum); ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr(getpaid_unstandardize_amount($price)); ?>" placeholder="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_minimum_price())); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo esc_attr($class); ?>" style="width: 64px; line-height: 1; min-height: 35px;"> |
|
166 | 166 | |
167 | - <?php if ( ! empty( $validate_minimum ) ) : ?> |
|
167 | + <?php if (!empty($validate_minimum)) : ?> |
|
168 | 168 | <div class="invalid-tooltip"> |
169 | - <?php echo wp_kses_post( $validate_minimum ); ?> |
|
169 | + <?php echo wp_kses_post($validate_minimum); ?> |
|
170 | 170 | </div> |
171 | 171 | <?php endif; ?> |
172 | 172 | |
173 | - <?php if ( 'left' !== $position ) : ?> |
|
173 | + <?php if ('left' !== $position) : ?> |
|
174 | 174 | <div class="input-group-append"> |
175 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
|
175 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span> |
|
176 | 176 | </div> |
177 | 177 | <?php endif; ?> |
178 | 178 | </div> |
@@ -180,24 +180,24 @@ discard block |
||
180 | 180 | <?php |
181 | 181 | |
182 | 182 | } else { |
183 | - echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) ); |
|
183 | + echo wp_kses_post(wpinv_price($item->get_price(), $currency)); |
|
184 | 184 | |
185 | 185 | ?> |
186 | - <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'> |
|
186 | + <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr($item->get_price()); ?>'> |
|
187 | 187 | <?php |
188 | 188 | } |
189 | 189 | |
190 | 190 | printf( |
191 | 191 | '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
192 | 192 | // translators: %s is the item subtotal. |
193 | - sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) ) |
|
193 | + sprintf(esc_html__('Subtotal: %s', 'invoicing'), wp_kses_post(wpinv_price($item->get_sub_total(), $currency))) |
|
194 | 194 | ); |
195 | 195 | } |
196 | 196 | |
197 | 197 | // Item quantity. |
198 | - if ( 'quantity' === $key ) { |
|
198 | + if ('quantity' === $key) { |
|
199 | 199 | |
200 | - if ( $item->allows_quantities() ) { |
|
200 | + if ($item->allows_quantities()) { |
|
201 | 201 | ?> |
202 | 202 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="any" style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' <?php echo null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''; ?> required> |
203 | 203 | <?php |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | // Item sub total. |
214 | - if ( 'subtotal' === $key ) { |
|
215 | - echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ); |
|
214 | + if ('subtotal' === $key) { |
|
215 | + echo wp_kses_post(wpinv_price($item->get_sub_total(), $currency)); |
|
216 | 216 | } |
217 | 217 | |
218 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
218 | + do_action("getpaid_payment_form_cart_item_$key", $item, $form); |
|
219 | 219 | ?> |
220 | 220 | |
221 | 221 | </div> |
@@ -226,4 +226,4 @@ discard block |
||
226 | 226 | |
227 | 227 | </div> |
228 | 228 | <?php |
229 | -do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
|
229 | +do_action('getpaid_payment_form_cart_item', $form, $item); |
@@ -7,34 +7,34 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | // Cart table columns. |
13 | 13 | $columns = array( |
14 | - 'name' => __( 'Item', 'invoicing' ), |
|
15 | - 'price' => __( 'Price', 'invoicing' ), |
|
16 | - 'quantity' => __( 'Qty', 'invoicing' ), |
|
17 | - 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
14 | + 'name' => __('Item', 'invoicing'), |
|
15 | + 'price' => __('Price', 'invoicing'), |
|
16 | + 'quantity' => __('Qty', 'invoicing'), |
|
17 | + 'subtotal' => __('Subtotal', 'invoicing'), |
|
18 | 18 | ); |
19 | 19 | |
20 | -if ( ! empty( $form->invoice ) ) { |
|
21 | - $columns = getpaid_invoice_item_columns( $form->invoice ); |
|
20 | +if (!empty($form->invoice)) { |
|
21 | + $columns = getpaid_invoice_item_columns($form->invoice); |
|
22 | 22 | } |
23 | 23 | |
24 | -if ( isset( $columns['tax_rate'] ) ) { |
|
25 | - unset( $columns['tax_rate'] ); |
|
24 | +if (isset($columns['tax_rate'])) { |
|
25 | + unset($columns['tax_rate']); |
|
26 | 26 | } |
27 | 27 | |
28 | -$columns = apply_filters( 'getpaid_payment_form_cart_table_columns', $columns, $form ); |
|
28 | +$columns = apply_filters('getpaid_payment_form_cart_table_columns', $columns, $form); |
|
29 | 29 | |
30 | 30 | ?> |
31 | 31 | <div class="getpaid-payment-form-items-cart border form-group"> |
32 | 32 | |
33 | 33 | <div class="getpaid-payment-form-items-cart-header font-weight-bold bg-light border-bottom py-2 px-3"> |
34 | 34 | <div class="form-row row"> |
35 | - <?php foreach ( $columns as $key => $label ) : ?> |
|
36 | - <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ) ) ) ? 'd-none d-sm-block' : ''; ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>"> |
|
37 | - <span><?php echo esc_html( $label ); ?></span> |
|
35 | + <?php foreach ($columns as $key => $label) : ?> |
|
36 | + <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'))) ? 'd-none d-sm-block' : ''; ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?>"> |
|
37 | + <span><?php echo esc_html($label); ?></span> |
|
38 | 38 | </div> |
39 | 39 | <?php endforeach; ?> |
40 | 40 | </div> |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | <?php |
44 | 44 | |
45 | 45 | // Display the item totals. |
46 | - foreach ( $form->get_items() as $item ) { |
|
47 | - wpinv_get_template( 'payment-forms/cart-item.php', compact( 'form', 'item', 'columns' ) ); |
|
46 | + foreach ($form->get_items() as $item) { |
|
47 | + wpinv_get_template('payment-forms/cart-item.php', compact('form', 'item', 'columns')); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // Display the cart totals. |
51 | - wpinv_get_template( 'payment-forms/cart-totals.php', compact( 'form' ) ); |
|
51 | + wpinv_get_template('payment-forms/cart-totals.php', compact('form')); |
|
52 | 52 | |
53 | 53 | ?> |
54 | 54 | </div> |
55 | 55 | |
56 | 56 | <?php |
57 | 57 | |
58 | -do_action( 'getpaid_after_payment_form_cart', $form ); |
|
58 | +do_action('getpaid_after_payment_form_cart', $form); |
@@ -7,33 +7,33 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
11 | - |
|
12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
14 | -$id = esc_attr( $id ); |
|
15 | -$_id = $id . uniqid( '_' ); |
|
16 | -$max_file_num = empty( $max_file_num ) ? 1 : absint( $max_file_num ); |
|
17 | -$file_types = empty( $file_types ) ? array( 'jpg|jpeg|jpe', 'gif', 'png' ) : $file_types; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | + |
|
12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
14 | +$id = esc_attr($id); |
|
15 | +$_id = $id . uniqid('_'); |
|
16 | +$max_file_num = empty($max_file_num) ? 1 : absint($max_file_num); |
|
17 | +$file_types = empty($file_types) ? array('jpg|jpeg|jpe', 'gif', 'png') : $file_types; |
|
18 | 18 | $all_types = getpaid_get_allowed_mime_types(); |
19 | 19 | $types = array(); |
20 | 20 | $_types = array(); |
21 | 21 | |
22 | -foreach ( $file_types as $file_type ) { |
|
22 | +foreach ($file_types as $file_type) { |
|
23 | 23 | |
24 | - if ( isset( $all_types[ $file_type ] ) ) { |
|
25 | - $types[] = $all_types[ $file_type ]; |
|
26 | - $file_type = explode( '|', $file_type ); |
|
24 | + if (isset($all_types[$file_type])) { |
|
25 | + $types[] = $all_types[$file_type]; |
|
26 | + $file_type = explode('|', $file_type); |
|
27 | 27 | |
28 | - foreach ( $file_type as $type ) { |
|
29 | - $type = trim( $type ); |
|
28 | + foreach ($file_type as $type) { |
|
29 | + $type = trim($type); |
|
30 | 30 | $types[] = ".$type"; |
31 | 31 | $_types[] = $type; |
32 | 32 | } |
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | -if ( ! empty( $required ) ) { |
|
36 | +if (!empty($required)) { |
|
37 | 37 | $label .= "<span class='text-danger'> *</span>"; |
38 | 38 | } |
39 | 39 | |
@@ -41,16 +41,16 @@ discard block |
||
41 | 41 | |
42 | 42 | <label><span v-html="form_element.label"></span></label> |
43 | 43 | |
44 | -<div class="form-group <?php echo esc_attr( $label_class ); ?>" data-name="<?php echo esc_attr( $id ); ?>" data-max="<?php echo esc_attr( $max_file_num ); ?>"> |
|
45 | - <label for="<?php echo esc_attr( $id ); ?>"><?php echo wp_kses_post( $label ); ?></label> |
|
46 | - <input type="file" class="sr-only getpaid-files-input" id="<?php echo esc_attr( $id ); ?>" accept="<?php echo esc_attr( implode( ', ', $types ) ); ?>" data-extensions="<?php echo esc_attr( wp_json_encode( $_types ) ); ?>" <?php echo $max_file_num == 1 ? '' : 'multiple="multiple"'; ?>> |
|
44 | +<div class="form-group <?php echo esc_attr($label_class); ?>" data-name="<?php echo esc_attr($id); ?>" data-max="<?php echo esc_attr($max_file_num); ?>"> |
|
45 | + <label for="<?php echo esc_attr($id); ?>"><?php echo wp_kses_post($label); ?></label> |
|
46 | + <input type="file" class="sr-only getpaid-files-input" id="<?php echo esc_attr($id); ?>" accept="<?php echo esc_attr(implode(', ', $types)); ?>" data-extensions="<?php echo esc_attr(wp_json_encode($_types)); ?>" <?php echo $max_file_num == 1 ? '' : 'multiple="multiple"'; ?>> |
|
47 | 47 | |
48 | - <label for="<?php echo esc_attr( $id ); ?>" class="getpaid-file-upload-element d-flex w-100 flex-column align-items-center justify-content-center p-2 mb-2"> |
|
48 | + <label for="<?php echo esc_attr($id); ?>" class="getpaid-file-upload-element d-flex w-100 flex-column align-items-center justify-content-center p-2 mb-2"> |
|
49 | 49 | <div class="h5 text-dark"> |
50 | - <?php echo esc_html( _n( 'Drag your file to this area or click to upload', 'Drag files to this area or click to upload', $max_file_num, 'invoicing' ) ); ?> |
|
50 | + <?php echo esc_html(_n('Drag your file to this area or click to upload', 'Drag files to this area or click to upload', $max_file_num, 'invoicing')); ?> |
|
51 | 51 | </div> |
52 | - <?php if ( ! empty( $description ) ) : ?> |
|
53 | - <small class="form-text text-muted"><?php echo wp_kses_post( $description ); ?></small> |
|
52 | + <?php if (!empty($description)) : ?> |
|
53 | + <small class="form-text text-muted"><?php echo wp_kses_post($description); ?></small> |
|
54 | 54 | <?php endif; ?> |
55 | 55 | </label> |
56 | 56 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | <div class="form-row row mb-3 d-none getpaid-progress-template"> |
60 | 60 | |
61 | 61 | <div class="overflow-hidden text-nowrap col-7 col-sm-4"> |
62 | - <a href="" class="close float-none" title="<?php esc_attr_e( 'Remove File', 'invoicing' ); ?>">×<span class="sr-only"><?php esc_html_e( 'Close', 'invoicing' ); ?></span></a> |
|
62 | + <a href="" class="close float-none" title="<?php esc_attr_e('Remove File', 'invoicing'); ?>">×<span class="sr-only"><?php esc_html_e('Close', 'invoicing'); ?></span></a> |
|
63 | 63 | <i class="fa fa-file" aria-hidden="true"></i> <span class="getpaid-progress-file-name"></span> |
64 | 64 | </div> |
65 | 65 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( ! defined( 'WPINC' ) ) { |
|
3 | +if (!defined('WPINC')) { |
|
4 | 4 | exit; |
5 | 5 | } |
6 | 6 | |
@@ -11,23 +11,23 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @param WP_Post $post |
13 | 13 | */ |
14 | - public static function output_details( $post ) { |
|
15 | - $details = get_post_meta( $post->ID, 'payment_form_data', true ); |
|
14 | + public static function output_details($post) { |
|
15 | + $details = get_post_meta($post->ID, 'payment_form_data', true); |
|
16 | 16 | |
17 | - if ( ! is_array( $details ) ) { |
|
17 | + if (!is_array($details)) { |
|
18 | 18 | return; |
19 | 19 | } |
20 | 20 | |
21 | 21 | echo '<div class="bsui"> <div class="form-row row">'; |
22 | 22 | |
23 | - foreach ( $details as $key => $value ) { |
|
24 | - $key = esc_html( $key ); |
|
23 | + foreach ($details as $key => $value) { |
|
24 | + $key = esc_html($key); |
|
25 | 25 | |
26 | - if ( is_array( $value ) ) { |
|
27 | - $value = implode( ',', $value ); |
|
26 | + if (is_array($value)) { |
|
27 | + $value = implode(',', $value); |
|
28 | 28 | } |
29 | 29 | |
30 | - echo wp_kses_post( "<div class='col-12'><strong>$key:</strong></div><div class='col-12 form-group'>$value</div>" ); |
|
30 | + echo wp_kses_post("<div class='col-12'><strong>$key:</strong></div><div class='col-12 form-group'>$value</div>"); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | echo '</div></div>'; |
@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param WP_Post $post |
41 | 41 | */ |
42 | - public static function output_shortcode( $post ) { |
|
42 | + public static function output_shortcode($post) { |
|
43 | 43 | |
44 | - if ( ! is_numeric( $post ) ) { |
|
44 | + if (!is_numeric($post)) { |
|
45 | 45 | $post = $post->ID; |
46 | 46 | } |
47 | 47 | |
48 | - if ( $post == wpinv_get_default_payment_form() ) { |
|
48 | + if ($post == wpinv_get_default_payment_form()) { |
|
49 | 49 | echo '—'; |
50 | 50 | return; |
51 | 51 | } |
52 | 52 | |
53 | - echo "<input type='text' style='min-width: 220px;' value='[getpaid form=" . absint( $post ) . "]' disabled>"; |
|
53 | + echo "<input type='text' style='min-width: 220px;' value='[getpaid form=" . absint($post) . "]' disabled>"; |
|
54 | 54 | |
55 | 55 | } |
56 | 56 |