@@ -26,76 +26,76 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | 28 | |
| 29 | - // Fires before printing a line item column. |
|
| 30 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
| 29 | + // Fires before printing a line item column. |
|
| 30 | + do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
| 31 | 31 | |
| 32 | - // Item name. |
|
| 33 | - if ( 'name' == $key ) { |
|
| 32 | + // Item name. |
|
| 33 | + if ( 'name' == $key ) { |
|
| 34 | 34 | |
| 35 | - // Display the name. |
|
| 36 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
| 35 | + // Display the name. |
|
| 36 | + echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
| 37 | 37 | |
| 38 | - // And an optional description. |
|
| 38 | + // And an optional description. |
|
| 39 | 39 | $description = $item->get_description(); |
| 40 | 40 | |
| 41 | 41 | if ( ! empty( $description ) ) { |
| 42 | 42 | $description = wp_kses_post( $description ); |
| 43 | 43 | echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - // Price help text. |
|
| 46 | + // Price help text. |
|
| 47 | 47 | $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
| 48 | 48 | if ( $description ) { |
| 49 | 49 | echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
| 50 | - } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 52 | + if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 53 | 53 | |
| 54 | - edit_post_link( |
|
| 55 | - __( 'Edit this item.', 'invoicing' ), |
|
| 56 | - '<small class="form-text text-muted">', |
|
| 57 | - '</small>', |
|
| 58 | - $item->get_id(), |
|
| 59 | - 'text-danger' |
|
| 60 | - ); |
|
| 54 | + edit_post_link( |
|
| 55 | + __( 'Edit this item.', 'invoicing' ), |
|
| 56 | + '<small class="form-text text-muted">', |
|
| 57 | + '</small>', |
|
| 58 | + $item->get_id(), |
|
| 59 | + 'text-danger' |
|
| 60 | + ); |
|
| 61 | 61 | |
| 62 | - } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - // Item price. |
|
| 67 | - if ( 'price' == $key ) { |
|
| 66 | + // Item price. |
|
| 67 | + if ( 'price' == $key ) { |
|
| 68 | 68 | |
| 69 | - // Set the currency position. |
|
| 70 | - $position = wpinv_currency_position(); |
|
| 69 | + // Set the currency position. |
|
| 70 | + $position = wpinv_currency_position(); |
|
| 71 | 71 | |
| 72 | - if ( $position == 'left_space' ) { |
|
| 73 | - $position = 'left'; |
|
| 74 | - } |
|
| 72 | + if ( $position == 'left_space' ) { |
|
| 73 | + $position = 'left'; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - if ( $position == 'right_space' ) { |
|
| 77 | - $position = 'right'; |
|
| 78 | - } |
|
| 76 | + if ( $position == 'right_space' ) { |
|
| 77 | + $position = 'right'; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - if ( $item->user_can_set_their_price() ) { |
|
| 81 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
| 82 | - $minimum = (float) $item->get_minimum_price(); |
|
| 83 | - $validate_minimum = ''; |
|
| 84 | - $class = ''; |
|
| 85 | - $data_minimum = ''; |
|
| 80 | + if ( $item->user_can_set_their_price() ) { |
|
| 81 | + $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
| 82 | + $minimum = (float) $item->get_minimum_price(); |
|
| 83 | + $validate_minimum = ''; |
|
| 84 | + $class = ''; |
|
| 85 | + $data_minimum = ''; |
|
| 86 | 86 | |
| 87 | - if ( $minimum > 0 ) { |
|
| 88 | - $validate_minimum = sprintf( |
|
| 89 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
| 90 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
| 91 | - ); |
|
| 87 | + if ( $minimum > 0 ) { |
|
| 88 | + $validate_minimum = sprintf( |
|
| 89 | + esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
| 90 | + strip_tags( wpinv_price( $minimum, $currency ) ) |
|
| 91 | + ); |
|
| 92 | 92 | |
| 93 | - $class = 'getpaid-validate-minimum-amount'; |
|
| 93 | + $class = 'getpaid-validate-minimum-amount'; |
|
| 94 | 94 | |
| 95 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
| 96 | - } |
|
| 95 | + $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - ?> |
|
| 98 | + ?> |
|
| 99 | 99 | <div class="input-group input-group-sm"> |
| 100 | 100 | <?php if( 'left' == $position ) : ?> |
| 101 | 101 | <div class="input-group-prepend"> |
@@ -119,38 +119,38 @@ discard block |
||
| 119 | 119 | </div> |
| 120 | 120 | |
| 121 | 121 | <?php |
| 122 | - } else { |
|
| 123 | - echo wpinv_price( $item->get_price(), $currency ); |
|
| 124 | - ?> |
|
| 122 | + } else { |
|
| 123 | + echo wpinv_price( $item->get_price(), $currency ); |
|
| 124 | + ?> |
|
| 125 | 125 | <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() ); ?>'> |
| 126 | 126 | <?php |
| 127 | - } |
|
| 128 | - } |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - // Item quantity. |
|
| 131 | - if ( 'quantity' == $key ) { |
|
| 130 | + // Item quantity. |
|
| 131 | + if ( 'quantity' == $key ) { |
|
| 132 | 132 | |
| 133 | - if ( $item->allows_quantities() ) { |
|
| 134 | - ?> |
|
| 133 | + if ( $item->allows_quantities() ) { |
|
| 134 | + ?> |
|
| 135 | 135 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' 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' required> |
| 136 | 136 | <?php |
| 137 | - } else { |
|
| 138 | - echo (float) $item->get_quantity(); |
|
| 139 | - echo ' '; |
|
| 140 | - ?> |
|
| 137 | + } else { |
|
| 138 | + echo (float) $item->get_quantity(); |
|
| 139 | + echo ' '; |
|
| 140 | + ?> |
|
| 141 | 141 | <input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'> |
| 142 | 142 | <?php |
| 143 | - } |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | - } |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - // Item sub total. |
|
| 148 | - if ( 'subtotal' == $key ) { |
|
| 149 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
| 150 | - } |
|
| 147 | + // Item sub total. |
|
| 148 | + if ( 'subtotal' == $key ) { |
|
| 149 | + echo wpinv_price( $item->get_sub_total(), $currency ); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
| 153 | - ?> |
|
| 152 | + do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
| 153 | + ?> |
|
| 154 | 154 | |
| 155 | 155 | </div> |
| 156 | 156 | |
@@ -9,50 +9,50 @@ 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 | 17 | |
| 18 | 18 | ?> |
| 19 | -<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo $item->get_id(); ?> border-bottom py-2 px-3'> |
|
| 19 | +<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo $item->get_id(); ?> border-bottom py-2 px-3'> |
|
| 20 | 20 | |
| 21 | 21 | <div class="form-row 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-12 col-sm-6' : 'col-12 col-sm' ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?> getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?>-<?php echo $item->get_id(); ?>"> |
|
| 25 | + <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?> getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?>-<?php echo $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 | // Display the name. |
| 36 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>'; |
|
| 36 | + echo '<div class="mb-1">' . esc_html($item->get_name()) . '</div>'; |
|
| 37 | 37 | |
| 38 | 38 | // And an optional description. |
| 39 | 39 | $description = $item->get_description(); |
| 40 | 40 | |
| 41 | - if ( ! empty( $description ) ) { |
|
| 42 | - $description = wp_kses_post( $description ); |
|
| 41 | + if (!empty($description)) { |
|
| 42 | + $description = wp_kses_post($description); |
|
| 43 | 43 | echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | // Price help text. |
| 47 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
| 48 | - if ( $description ) { |
|
| 47 | + $description = getpaid_item_recurring_price_help_text($item, $currency); |
|
| 48 | + if ($description) { |
|
| 49 | 49 | echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 52 | + if (wpinv_current_user_can_manage_invoicing()) { |
|
| 53 | 53 | |
| 54 | 54 | edit_post_link( |
| 55 | - __( 'Edit this item.', 'invoicing' ), |
|
| 55 | + __('Edit this item.', 'invoicing'), |
|
| 56 | 56 | '<small class="form-text text-muted">', |
| 57 | 57 | '</small>', |
| 58 | 58 | $item->get_id(), |
@@ -64,73 +64,73 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // Item price. |
| 67 | - if ( 'price' == $key ) { |
|
| 67 | + if ('price' == $key) { |
|
| 68 | 68 | |
| 69 | 69 | // Set the currency position. |
| 70 | 70 | $position = wpinv_currency_position(); |
| 71 | 71 | |
| 72 | - if ( $position == 'left_space' ) { |
|
| 72 | + if ($position == 'left_space') { |
|
| 73 | 73 | $position = 'left'; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if ( $position == 'right_space' ) { |
|
| 76 | + if ($position == 'right_space') { |
|
| 77 | 77 | $position = 'right'; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if ( $item->user_can_set_their_price() ) { |
|
| 81 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
| 80 | + if ($item->user_can_set_their_price()) { |
|
| 81 | + $price = max((float) $item->get_price(), (float) $item->get_minimum_price()); |
|
| 82 | 82 | $minimum = (float) $item->get_minimum_price(); |
| 83 | 83 | $validate_minimum = ''; |
| 84 | 84 | $class = ''; |
| 85 | 85 | $data_minimum = ''; |
| 86 | 86 | |
| 87 | - if ( $minimum > 0 ) { |
|
| 87 | + if ($minimum > 0) { |
|
| 88 | 88 | $validate_minimum = sprintf( |
| 89 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
| 90 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
| 89 | + esc_attr__('The minimum allowed amount is %s', 'invoicing'), |
|
| 90 | + strip_tags(wpinv_price($minimum, $currency)) |
|
| 91 | 91 | ); |
| 92 | 92 | |
| 93 | 93 | $class = 'getpaid-validate-minimum-amount'; |
| 94 | 94 | |
| 95 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
| 95 | + $data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'"; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | ?> |
| 99 | 99 | <div class="input-group input-group-sm"> |
| 100 | - <?php if( 'left' == $position ) : ?> |
|
| 100 | + <?php if ('left' == $position) : ?> |
|
| 101 | 101 | <div class="input-group-prepend"> |
| 102 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
| 102 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
| 103 | 103 | </div> |
| 104 | 104 | <?php endif; ?> |
| 105 | 105 | |
| 106 | - <input type="text" <?php echo $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 $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;"> |
|
| 106 | + <input type="text" <?php echo $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 $class; ?>" style="width: 64px; line-height: 1; min-height: 35px;"> |
|
| 107 | 107 | |
| 108 | - <?php if ( ! empty( $validate_minimum ) ) : ?> |
|
| 108 | + <?php if (!empty($validate_minimum)) : ?> |
|
| 109 | 109 | <div class="invalid-tooltip"> |
| 110 | 110 | <?php echo $validate_minimum; ?> |
| 111 | 111 | </div> |
| 112 | 112 | <?php endif; ?> |
| 113 | 113 | |
| 114 | - <?php if( 'left' != $position ) : ?> |
|
| 114 | + <?php if ('left' != $position) : ?> |
|
| 115 | 115 | <div class="input-group-append"> |
| 116 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
| 116 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
| 117 | 117 | </div> |
| 118 | 118 | <?php endif; ?> |
| 119 | 119 | </div> |
| 120 | 120 | |
| 121 | 121 | <?php |
| 122 | 122 | } else { |
| 123 | - echo wpinv_price( $item->get_price(), $currency ); |
|
| 123 | + echo wpinv_price($item->get_price(), $currency); |
|
| 124 | 124 | ?> |
| 125 | - <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() ); ?>'> |
|
| 125 | + <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()); ?>'> |
|
| 126 | 126 | <?php |
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | // Item quantity. |
| 131 | - if ( 'quantity' == $key ) { |
|
| 131 | + if ('quantity' == $key) { |
|
| 132 | 132 | |
| 133 | - if ( $item->allows_quantities() ) { |
|
| 133 | + if ($item->allows_quantities()) { |
|
| 134 | 134 | ?> |
| 135 | 135 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' 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' required> |
| 136 | 136 | <?php |
@@ -145,11 +145,11 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // Item sub total. |
| 148 | - if ( 'subtotal' == $key ) { |
|
| 149 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
| 148 | + if ('subtotal' == $key) { |
|
| 149 | + echo wpinv_price($item->get_sub_total(), $currency); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
| 152 | + do_action("getpaid_payment_form_cart_item_$key", $item, $form); |
|
| 153 | 153 | ?> |
| 154 | 154 | |
| 155 | 155 | </div> |
@@ -160,4 +160,4 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | </div> |
| 162 | 162 | <?php |
| 163 | -do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
|
| 163 | +do_action('getpaid_payment_form_cart_item', $form, $item); |
|