@@ -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 |
@@ -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); ?> |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if (!defined('ABSPATH')) { |
|
10 | 10 | exit; // Exit if accessed directly |
11 | 11 | } |
12 | 12 | |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @param WP_Post $post |
22 | 22 | */ |
23 | - public static function output( $post ) { |
|
23 | + public static function output($post) { |
|
24 | 24 | |
25 | 25 | // Retrieve shipping address. |
26 | - $shipping_address = get_post_meta( $post->ID, 'shipping_address', true ); |
|
26 | + $shipping_address = get_post_meta($post->ID, 'shipping_address', true); |
|
27 | 27 | |
28 | 28 | // Abort if it is invalid. |
29 | - if ( ! is_array( $shipping_address ) ) { |
|
29 | + if (!is_array($shipping_address)) { |
|
30 | 30 | return; |
31 | 31 | } |
32 | 32 | |
@@ -34,29 +34,29 @@ discard block |
||
34 | 34 | |
35 | 35 | <div class="bsui"> |
36 | 36 | |
37 | - <?php if ( ! empty( $shipping_address['method'] ) ) : ?> |
|
37 | + <?php if (!empty($shipping_address['method'])) : ?> |
|
38 | 38 | |
39 | 39 | <div class="form-group mb-3 form-row row" style="color: green;"> |
40 | 40 | <div class="col"> |
41 | - <span style="font-weight: 600"><?php esc_html_e( 'Shipping Method', 'invoicing' ); ?>:</span> |
|
41 | + <span style="font-weight: 600"><?php esc_html_e('Shipping Method', 'invoicing'); ?>:</span> |
|
42 | 42 | </div> |
43 | 43 | <div class="col"> |
44 | - <?php echo wp_kses_post( $shipping_address['method'] ); ?> |
|
44 | + <?php echo wp_kses_post($shipping_address['method']); ?> |
|
45 | 45 | </div> |
46 | 46 | </div> |
47 | 47 | |
48 | 48 | <?php endif; ?> |
49 | 49 | |
50 | - <?php foreach ( getpaid_user_address_fields() as $key => $label ) : ?> |
|
50 | + <?php foreach (getpaid_user_address_fields() as $key => $label) : ?> |
|
51 | 51 | |
52 | - <?php if ( ! empty( $shipping_address[ $key ] ) ) : ?> |
|
52 | + <?php if (!empty($shipping_address[$key])) : ?> |
|
53 | 53 | |
54 | 54 | <div class="form-group mb-3 form-row row"> |
55 | 55 | <div class="col"> |
56 | - <span style="font-weight: 600"><?php echo esc_html( $label ); ?>:</span> |
|
56 | + <span style="font-weight: 600"><?php echo esc_html($label); ?>:</span> |
|
57 | 57 | </div> |
58 | 58 | <div class="col"> |
59 | - <?php echo esc_html( self::prepare_for_display( $shipping_address, $key ) ); ?> |
|
59 | + <?php echo esc_html(self::prepare_for_display($shipping_address, $key)); ?> |
|
60 | 60 | </div> |
61 | 61 | </div> |
62 | 62 | |
@@ -77,21 +77,21 @@ discard block |
||
77 | 77 | * @param string $key |
78 | 78 | * @return string |
79 | 79 | */ |
80 | - public static function prepare_for_display( $address, $key ) { |
|
80 | + public static function prepare_for_display($address, $key) { |
|
81 | 81 | |
82 | 82 | // Prepare the value. |
83 | - $value = $address[ $key ]; |
|
83 | + $value = $address[$key]; |
|
84 | 84 | |
85 | - if ( $key == 'country' ) { |
|
86 | - $value = wpinv_country_name( $value ); |
|
85 | + if ($key == 'country') { |
|
86 | + $value = wpinv_country_name($value); |
|
87 | 87 | } |
88 | 88 | |
89 | - if ( $key == 'state' ) { |
|
90 | - $country = isset( $address['country'] ) ? $address['country'] : wpinv_get_default_country(); |
|
91 | - $value = wpinv_state_name( $value, $country ); |
|
89 | + if ($key == 'state') { |
|
90 | + $country = isset($address['country']) ? $address['country'] : wpinv_get_default_country(); |
|
91 | + $value = wpinv_state_name($value, $country); |
|
92 | 92 | } |
93 | 93 | |
94 | - return esc_html( $value ); |
|
94 | + return esc_html($value); |
|
95 | 95 | |
96 | 96 | } |
97 | 97 |
@@ -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 | |
@@ -21,54 +21,54 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the form. |
27 | - $form = new GetPaid_Payment_Form( $post ); |
|
27 | + $form = new GetPaid_Payment_Form($post); |
|
28 | 28 | |
29 | 29 | ?> |
30 | 30 | |
31 | 31 | <div class='bsui' style='padding-top: 10px;'> |
32 | - <?php do_action( 'wpinv_payment_form_before_info_metabox', $form ); ?> |
|
32 | + <?php do_action('wpinv_payment_form_before_info_metabox', $form); ?> |
|
33 | 33 | |
34 | 34 | <div class="wpinv_payment_form_shortcode form-group mb-3 row"> |
35 | 35 | <label for="wpinv_payment_form_shortcode" class="col-sm-12 col-form-label"> |
36 | - <?php esc_html_e( 'Payment Form Shortcode', 'invoicing' ); ?> |
|
37 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a payment form', 'invoicing' ); ?>"></span> |
|
36 | + <?php esc_html_e('Payment Form Shortcode', 'invoicing'); ?> |
|
37 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a payment form', 'invoicing'); ?>"></span> |
|
38 | 38 | </label> |
39 | 39 | |
40 | 40 | <div class="col-sm-12"> |
41 | - <input onClick="this.select()" type="text" id="wpinv_payment_form_shortcode" value="[getpaid form=<?php echo esc_attr( $form->get_id() ); ?>]" style="width: 100%;" /> |
|
41 | + <input onClick="this.select()" type="text" id="wpinv_payment_form_shortcode" value="[getpaid form=<?php echo esc_attr($form->get_id()); ?>]" style="width: 100%;" /> |
|
42 | 42 | </div> |
43 | 43 | </div> |
44 | 44 | |
45 | 45 | <div class="wpinv_payment_form_buy_shortcode form-group mb-3 row"> |
46 | 46 | <label for="wpinv_payment_form_buy_shortcode" class="col-sm-12 col-form-label"> |
47 | - <?php esc_html_e( 'Payment Button Shortcode', 'invoicing' ); ?> |
|
48 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a buy now button', 'invoicing' ); ?>"></span> |
|
47 | + <?php esc_html_e('Payment Button Shortcode', 'invoicing'); ?> |
|
48 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a buy now button', 'invoicing'); ?>"></span> |
|
49 | 49 | </label> |
50 | 50 | |
51 | 51 | <div class="col-sm-12"> |
52 | - <input onClick="this.select()" type="text" id="wpinv_payment_form_buy_shortcode" value="[getpaid form=<?php echo esc_attr( $form->get_id() ); ?> button='Buy Now']" style="width: 100%;" /> |
|
52 | + <input onClick="this.select()" type="text" id="wpinv_payment_form_buy_shortcode" value="[getpaid form=<?php echo esc_attr($form->get_id()); ?> button='Buy Now']" style="width: 100%;" /> |
|
53 | 53 | <small class="form-text text-muted"> |
54 | - <?php esc_html_e( 'Or use the following URL in a link:', 'invoicing' ); ?> |
|
55 | - <code>#getpaid-form-<?php echo intval( $form->get_id() ); ?></code> |
|
54 | + <?php esc_html_e('Or use the following URL in a link:', 'invoicing'); ?> |
|
55 | + <code>#getpaid-form-<?php echo intval($form->get_id()); ?></code> |
|
56 | 56 | </small> |
57 | 57 | </div> |
58 | 58 | </div> |
59 | 59 | |
60 | 60 | <div class="wpinv_item_buy_url form-group row mb-3"> |
61 | 61 | <label for="wpinv_item_buy_url" class="col-sm-12 col-form-label"> |
62 | - <?php esc_html_e( 'Direct Payment URL', 'invoicing' ); ?> |
|
63 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'You can use this in an iFrame to embed the payment form on another website', 'invoicing' ); ?>"></span> |
|
62 | + <?php esc_html_e('Direct Payment URL', 'invoicing'); ?> |
|
63 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('You can use this in an iFrame to embed the payment form on another website', 'invoicing'); ?>"></span> |
|
64 | 64 | </label> |
65 | 65 | |
66 | 66 | <div class="col-sm-12"> |
67 | - <input onClick="this.select()" type="text" id="wpinv_item_buy_url" value="<?php echo esc_url( getpaid_embed_url( $form->get_id(), false ) ); ?>" style="width: 100%;" readonly/> |
|
67 | + <input onClick="this.select()" type="text" id="wpinv_item_buy_url" value="<?php echo esc_url(getpaid_embed_url($form->get_id(), false)); ?>" style="width: 100%;" readonly/> |
|
68 | 68 | </div> |
69 | 69 | </div> |
70 | 70 | |
71 | - <?php do_action( 'wpinv_payment_form_info_metabox', $form ); ?> |
|
71 | + <?php do_action('wpinv_payment_form_info_metabox', $form); ?> |
|
72 | 72 | </div> |
73 | 73 | <?php |
74 | 74 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if (!defined('ABSPATH')) { |
|
10 | 10 | exit; // Exit if accessed directly |
11 | 11 | } |
12 | 12 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @param WP_Post $post |
22 | 22 | */ |
23 | - public static function output( $post ) { |
|
23 | + public static function output($post) { |
|
24 | 24 | ?> |
25 | 25 | <style> |
26 | 26 | .wpinv-form-builder-edit-field-wrapper label.d-block > span:first-child{ |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | <div class="col-sm-4"> |
34 | 34 | |
35 | 35 | <!-- Builder tabs --> |
36 | - <button class="button button-primary" v-if="active_tab!='new_item'" @click.prevent="active_tab='new_item'"><?php esc_html_e( 'Go Back', 'invoicing' ); ?></button> |
|
36 | + <button class="button button-primary" v-if="active_tab!='new_item'" @click.prevent="active_tab='new_item'"><?php esc_html_e('Go Back', 'invoicing'); ?></button> |
|
37 | 37 | |
38 | 38 | <!-- Builder tab content --> |
39 | 39 | <div class="mt-4"> |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | <!-- Available builder elements --> |
42 | 42 | <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='new_item'"> |
43 | 43 | <div class="wpinv-form-builder-add-field-types"> |
44 | - <small class='form-text text-muted'><?php esc_html_e( 'Add an element by dragging it to the payment form.', 'invoicing' ); ?></small> |
|
44 | + <small class='form-text text-muted'><?php esc_html_e('Add an element by dragging it to the payment form.', 'invoicing'); ?></small> |
|
45 | 45 | <draggable class="section mt-2" style="display: flex; flex-flow: wrap; justify-content: space-between;" v-model="elements" :group="{ name: 'fields', pull: 'clone', put: false }" :sort="false" :clone="addDraggedField" tag="ul" filter=".wpinv-undraggable"> |
46 | 46 | <li v-for="element in elements" class= "wpinv-payment-form-left-fields-field" @click.prevent="addField(element)" :class="{ 'd-none': element.defaults.premade }"> |
47 | 47 | <button class="button btn text-dark"> |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | <!-- Edit an element --> |
57 | 57 | <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='edit_item'" style="font-size: 14px;"> |
58 | 58 | <div class="wpinv-form-builder-edit-field-wrapper"> |
59 | - <?php do_action( 'wpinv_payment_form_edit_element_template', 'active_form_element', $post ); ?> |
|
60 | - <?php do_action( 'getpaid_payment_form_edit_element_template', $post ); ?> |
|
59 | + <?php do_action('wpinv_payment_form_edit_element_template', 'active_form_element', $post); ?> |
|
60 | + <?php do_action('getpaid_payment_form_edit_element_template', $post); ?> |
|
61 | 61 | <div class='form-group mb-3'> |
62 | - <label :for="active_form_element.id + '_grid_width'"><?php esc_html_e( 'Width', 'invoicing' ); ?></label> |
|
62 | + <label :for="active_form_element.id + '_grid_width'"><?php esc_html_e('Width', 'invoicing'); ?></label> |
|
63 | 63 | <select class='form-control custom-select' :id="active_form_element.id + '_grid_width'" v-model='gridWidth'> |
64 | - <option value='full'><?php esc_html_e( 'Full Width', 'invoicing' ); ?></option> |
|
65 | - <option value='half'><?php esc_html_e( 'Half Width', 'invoicing' ); ?></option> |
|
66 | - <option value='third'><?php esc_html_e( '1/3 Width', 'invoicing' ); ?></option> |
|
64 | + <option value='full'><?php esc_html_e('Full Width', 'invoicing'); ?></option> |
|
65 | + <option value='half'><?php esc_html_e('Half Width', 'invoicing'); ?></option> |
|
66 | + <option value='third'><?php esc_html_e('1/3 Width', 'invoicing'); ?></option> |
|
67 | 67 | </select> |
68 | 68 | </div> |
69 | 69 | <div> |
70 | - <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php esc_html_e( 'Delete Element', 'invoicing' ); ?></button> |
|
70 | + <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php esc_html_e('Delete Element', 'invoicing'); ?></button> |
|
71 | 71 | </div> |
72 | 72 | </div> |
73 | 73 | </div> |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | |
77 | 77 | </div> |
78 | 78 | <div class="col-sm-8 border-left"> |
79 | - <small class='form-text text-muted' v-if='form_elements.length'><?php esc_html_e( 'Click on any element to edit or delete it.', 'invoicing' ); ?></small> |
|
80 | - <p class='form-text text-muted' v-if='! form_elements.length'><?php esc_html_e( 'This form is empty. Add new elements by dragging them from the right.', 'invoicing' ); ?></p> |
|
79 | + <small class='form-text text-muted' v-if='form_elements.length'><?php esc_html_e('Click on any element to edit or delete it.', 'invoicing'); ?></small> |
|
80 | + <p class='form-text text-muted' v-if='! form_elements.length'><?php esc_html_e('This form is empty. Add new elements by dragging them from the right.', 'invoicing'); ?></p> |
|
81 | 81 | |
82 | 82 | <div class="container-fluid"> |
83 | 83 | <draggable class="section row" v-model="form_elements" @add="highlightLastDroppedField" group="fields" tag="div" style="min-height: 100%; font-size: 14px;"> |
84 | 84 | <div v-for="form_element in form_elements" class="wpinv-form-builder-element-preview" :class="[{ active: active_form_element==form_element && active_tab=='edit_item' }, form_element.type, grid_class( form_element ) ]" @click="active_tab = 'edit_item'; active_form_element = form_element"> |
85 | 85 | <div class="wpinv-form-builder-element-preview-inner"> |
86 | 86 | <div class="wpinv-payment-form-field-preview-overlay"></div> |
87 | - <?php do_action( 'wpinv_payment_form_render_element_template', 'form_element', $post ); ?> |
|
87 | + <?php do_action('wpinv_payment_form_render_element_template', 'form_element', $post); ?> |
|
88 | 88 | </div> |
89 | 89 | </div> |
90 | 90 | </draggable> |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | </script> |
104 | 104 | <?php |
105 | 105 | |
106 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
106 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -111,33 +111,33 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @param int $post_id |
113 | 113 | */ |
114 | - public static function save( $post_id ) { |
|
114 | + public static function save($post_id) { |
|
115 | 115 | |
116 | 116 | // Prepare the form. |
117 | - $form = new GetPaid_Payment_Form( $post_id ); |
|
117 | + $form = new GetPaid_Payment_Form($post_id); |
|
118 | 118 | |
119 | 119 | // Fetch form items. |
120 | - $form_items = json_decode( wp_unslash( $_POST['wpinv_form_items'] ), true ); |
|
120 | + $form_items = json_decode(wp_unslash($_POST['wpinv_form_items']), true); |
|
121 | 121 | |
122 | 122 | // Ensure that we have an array... |
123 | - if ( empty( $form_items ) ) { |
|
123 | + if (empty($form_items)) { |
|
124 | 124 | $form_items = array(); |
125 | 125 | } |
126 | 126 | |
127 | 127 | // Add it to the form. |
128 | - $form->set_items( self::item_to_objects( wp_kses_post_deep( $form_items ) ) ); |
|
128 | + $form->set_items(self::item_to_objects(wp_kses_post_deep($form_items))); |
|
129 | 129 | |
130 | 130 | // Save form elements. |
131 | - $form_elements = json_decode( wp_unslash( $_POST['wpinv_form_elements'] ), true ); |
|
132 | - if ( empty( $form_elements ) ) { |
|
131 | + $form_elements = json_decode(wp_unslash($_POST['wpinv_form_elements']), true); |
|
132 | + if (empty($form_elements)) { |
|
133 | 133 | $form_elements = array(); |
134 | 134 | } |
135 | 135 | |
136 | - $form->set_elements( wp_kses_post_deep( $form_elements ) ); |
|
136 | + $form->set_elements(wp_kses_post_deep($form_elements)); |
|
137 | 137 | |
138 | 138 | // Persist data to the datastore. |
139 | 139 | $form->save(); |
140 | - do_action( 'getpaid_payment_form_metabox_save', $post_id, $form ); |
|
140 | + do_action('getpaid_payment_form_metabox_save', $post_id, $form); |
|
141 | 141 | |
142 | 142 | } |
143 | 143 | |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @param array $items |
148 | 148 | */ |
149 | - public static function item_to_objects( $items ) { |
|
149 | + public static function item_to_objects($items) { |
|
150 | 150 | |
151 | 151 | $objects = array(); |
152 | 152 | |
153 | - foreach ( $items as $item ) { |
|
154 | - $_item = new GetPaid_Form_Item( $item['id'] ); |
|
155 | - $_item->set_allow_quantities( (bool) $item['allow_quantities'] ); |
|
156 | - $_item->set_is_required( (bool) $item['required'] ); |
|
153 | + foreach ($items as $item) { |
|
154 | + $_item = new GetPaid_Form_Item($item['id']); |
|
155 | + $_item->set_allow_quantities((bool) $item['allow_quantities']); |
|
156 | + $_item->set_is_required((bool) $item['required']); |
|
157 | 157 | $objects[] = $_item; |
158 | 158 | } |
159 | 159 |
@@ -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 | |
@@ -21,26 +21,26 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the item. |
27 | - $item = new WPInv_Item( $post ); |
|
27 | + $item = new WPInv_Item($post); |
|
28 | 28 | |
29 | 29 | echo "<div class='bsui' style='max-width: 600px;padding-top: 10px;'>"; |
30 | 30 | |
31 | - do_action( 'wpinv_item_before_vat_metabox', $item ); |
|
31 | + do_action('wpinv_item_before_vat_metabox', $item); |
|
32 | 32 | |
33 | 33 | // Output the vat rules settings. |
34 | - do_action( 'wpinv_item_vat_metabox_before_vat_rules', $item ); |
|
35 | - self::output_vat_rules( $item ); |
|
36 | - do_action( 'wpinv_item_vat_metabox_vat_rules', $item ); |
|
34 | + do_action('wpinv_item_vat_metabox_before_vat_rules', $item); |
|
35 | + self::output_vat_rules($item); |
|
36 | + do_action('wpinv_item_vat_metabox_vat_rules', $item); |
|
37 | 37 | |
38 | 38 | // Output vat class settings. |
39 | - do_action( 'wpinv_item_vat_metabox_before_vat_rules', $item ); |
|
40 | - self::output_vat_classes( $item ); |
|
41 | - do_action( 'wpinv_item_vat_metabox_vat_class', $item ); |
|
39 | + do_action('wpinv_item_vat_metabox_before_vat_rules', $item); |
|
40 | + self::output_vat_classes($item); |
|
41 | + do_action('wpinv_item_vat_metabox_vat_class', $item); |
|
42 | 42 | |
43 | - do_action( 'wpinv_item_vat_metabox', $item ); |
|
43 | + do_action('wpinv_item_vat_metabox', $item); |
|
44 | 44 | |
45 | 45 | echo '</div>'; |
46 | 46 | } |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @param WPInv_Item $item |
52 | 52 | */ |
53 | - public static function output_vat_rules( $item ) { |
|
53 | + public static function output_vat_rules($item) { |
|
54 | 54 | ?> |
55 | 55 | |
56 | 56 | <div class="wpinv_vat_rules"> |
57 | 57 | |
58 | 58 | <div class="form-group mb-3 row"> |
59 | 59 | <label for="wpinv_vat_rules" class="col-sm-3 col-form-label"> |
60 | - <?php esc_html_e( 'Tax Rule', 'invoicing' ); ?> |
|
60 | + <?php esc_html_e('Tax Rule', 'invoicing'); ?> |
|
61 | 61 | </label> |
62 | 62 | <div class="col-sm-8"> |
63 | 63 | <?php |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | array( |
66 | 66 | 'id' => 'wpinv_vat_rules', |
67 | 67 | 'name' => 'wpinv_vat_rules', |
68 | - 'placeholder' => __( 'Select tax rule', 'invoicing' ), |
|
69 | - 'value' => $item->get_vat_rule( 'edit' ), |
|
68 | + 'placeholder' => __('Select tax rule', 'invoicing'), |
|
69 | + 'value' => $item->get_vat_rule('edit'), |
|
70 | 70 | 'select2' => true, |
71 | 71 | 'data-allow-clear' => 'false', |
72 | 72 | 'no_wrap' => true, |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @param WPInv_Item $item |
91 | 91 | */ |
92 | - public static function output_vat_classes( $item ) { |
|
92 | + public static function output_vat_classes($item) { |
|
93 | 93 | ?> |
94 | 94 | |
95 | 95 | <div class="wpinv_vat_classes"> |
96 | 96 | |
97 | 97 | <div class="form-group mb-3 row"> |
98 | 98 | <label for="wpinv_vat_class" class="col-sm-3 col-form-label"> |
99 | - <?php esc_html_e( 'Tax Class', 'invoicing' ); ?> |
|
99 | + <?php esc_html_e('Tax Class', 'invoicing'); ?> |
|
100 | 100 | </label> |
101 | 101 | <div class="col-sm-8"> |
102 | 102 | <?php |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | array( |
105 | 105 | 'id' => 'wpinv_vat_class', |
106 | 106 | 'name' => 'wpinv_vat_class', |
107 | - 'placeholder' => __( 'Select tax class', 'invoicing' ), |
|
108 | - 'value' => $item->get_vat_class( 'edit' ), |
|
107 | + 'placeholder' => __('Select tax class', 'invoicing'), |
|
108 | + 'value' => $item->get_vat_class('edit'), |
|
109 | 109 | 'select2' => true, |
110 | 110 | 'data-allow-clear' => 'false', |
111 | 111 | 'no_wrap' => true, |
@@ -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 mb-3'>$value</div>" ); |
|
30 | + echo wp_kses_post("<div class='col-12'><strong>$key:</strong></div><div class='col-12 form-group mb-3'>$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 |
@@ -7,14 +7,14 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -if ( empty( $text ) ) { |
|
13 | - $text = __( 'Your IP address is:', 'invoicing' ); |
|
12 | +if (empty($text)) { |
|
13 | + $text = __('Your IP address is:', 'invoicing'); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | ?> |
17 | 17 | <div class="form-group mb-3 getpaid-ip-info"> |
18 | - <span><?php echo wp_kses_post( $text ); ?></span> |
|
19 | - <strong><?php echo esc_html( wpinv_get_ip() ); ?></strong> |
|
18 | + <span><?php echo wp_kses_post($text); ?></span> |
|
19 | + <strong><?php echo esc_html(wpinv_get_ip()); ?></strong> |
|
20 | 20 | </div> |