@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays a radio in payment form |
| 4 | 4 | * |
@@ -7,115 +7,115 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | + defined( 'ABSPATH' ) || exit; |
|
| 11 | 11 | |
| 12 | -// Ensure that we have options. |
|
| 13 | -if ( empty( $options ) ) { |
|
| 14 | - return; |
|
| 12 | + // Ensure that we have options. |
|
| 13 | + if ( empty( $options ) ) { |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | -// Prepare price options. |
|
| 18 | -$options = getpaid_convert_price_string_to_options( $options ); |
|
| 19 | -$keys = array_keys( $options ); |
|
| 20 | -$value = empty( $options ) ? '' : $keys[0]; |
|
| 17 | + // Prepare price options. |
|
| 18 | + $options = getpaid_convert_price_string_to_options( $options ); |
|
| 19 | + $keys = array_keys( $options ); |
|
| 20 | + $value = empty( $options ) ? '' : $keys[0]; |
|
| 21 | 21 | |
| 22 | -if ( ! empty( $query_value ) ) { |
|
| 23 | - $value = $query_value; |
|
| 22 | + if ( ! empty( $query_value ) ) { |
|
| 23 | + $value = $query_value; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | -$select_type = empty( $select_type ) ? 'select' : $select_type; |
|
| 27 | - |
|
| 28 | -// Item select; |
|
| 29 | -if ( $select_type == 'select' ) { |
|
| 30 | - aui()->select( |
|
| 31 | - array( |
|
| 32 | - 'name' => $id, |
|
| 33 | - 'id' => esc_attr( $element_id ), |
|
| 34 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 35 | - 'value' => $value, |
|
| 36 | - 'label' => empty( $label ) ? '' : esc_html( $label ), |
|
| 37 | - 'label_type' => 'vertical', |
|
| 38 | - 'class' => 'getpaid-price-select-dropdown getpaid-refresh-on-change', |
|
| 39 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 40 | - 'options' => $options, |
|
| 41 | - ), |
|
| 42 | - true |
|
| 43 | - ); |
|
| 44 | - return; |
|
| 26 | + $select_type = empty( $select_type ) ? 'select' : $select_type; |
|
| 27 | + |
|
| 28 | + // Item select; |
|
| 29 | + if ( $select_type == 'select' ) { |
|
| 30 | + aui()->select( |
|
| 31 | + array( |
|
| 32 | + 'name' => $id, |
|
| 33 | + 'id' => esc_attr( $element_id ), |
|
| 34 | + 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 35 | + 'value' => $value, |
|
| 36 | + 'label' => empty( $label ) ? '' : esc_html( $label ), |
|
| 37 | + 'label_type' => 'vertical', |
|
| 38 | + 'class' => 'getpaid-price-select-dropdown getpaid-refresh-on-change', |
|
| 39 | + 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 40 | + 'options' => $options, |
|
| 41 | + ), |
|
| 42 | + true |
|
| 43 | + ); |
|
| 44 | + return; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -// Item radios; |
|
| 48 | -if ( $select_type == 'radios' ) { |
|
| 49 | - aui()->radio( |
|
| 50 | - array( |
|
| 51 | - 'name' => esc_attr( $id ), |
|
| 52 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 53 | - 'label' => empty( $label ) ? '' : esc_html( $label ), |
|
| 54 | - 'label_type' => 'vertical', |
|
| 55 | - 'class' => 'getpaid-price-select-radio getpaid-refresh-on-change w-100', |
|
| 56 | - 'value' => $value, |
|
| 57 | - 'inline' => false, |
|
| 58 | - 'options' => $options, |
|
| 59 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 60 | - ), |
|
| 61 | - true |
|
| 62 | - ); |
|
| 63 | - return; |
|
| 47 | + // Item radios; |
|
| 48 | + if ( $select_type == 'radios' ) { |
|
| 49 | + aui()->radio( |
|
| 50 | + array( |
|
| 51 | + 'name' => esc_attr( $id ), |
|
| 52 | + 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 53 | + 'label' => empty( $label ) ? '' : esc_html( $label ), |
|
| 54 | + 'label_type' => 'vertical', |
|
| 55 | + 'class' => 'getpaid-price-select-radio getpaid-refresh-on-change w-100', |
|
| 56 | + 'value' => $value, |
|
| 57 | + 'inline' => false, |
|
| 58 | + 'options' => $options, |
|
| 59 | + 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 60 | + ), |
|
| 61 | + true |
|
| 62 | + ); |
|
| 63 | + return; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
| 67 | -// Display the label. |
|
| 68 | -if ( ! empty( $label ) ) { |
|
| 69 | - echo '<label class="form-label">' . esc_html( $label ) . '</label>'; |
|
| 67 | + // Display the label. |
|
| 68 | + if ( ! empty( $label ) ) { |
|
| 69 | + echo '<label class="form-label">' . esc_html( $label ) . '</label>'; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | -// Item buttons; |
|
| 73 | -if ( $select_type == 'buttons' || $select_type == 'circles' ) { |
|
| 72 | + // Item buttons; |
|
| 73 | + if ( $select_type == 'buttons' || $select_type == 'circles' ) { |
|
| 74 | 74 | |
| 75 | - $class = 'getpaid-price-buttons'; |
|
| 75 | + $class = 'getpaid-price-buttons'; |
|
| 76 | 76 | |
| 77 | - if ( $select_type == 'circles' ) { |
|
| 78 | - $class .= ' getpaid-price-circles'; |
|
| 79 | - } |
|
| 80 | - echo "<div class='" . esc_attr( $class ) . "'>"; |
|
| 77 | + if ( $select_type == 'circles' ) { |
|
| 78 | + $class .= ' getpaid-price-circles'; |
|
| 79 | + } |
|
| 80 | + echo "<div class='" . esc_attr( $class ) . "'>"; |
|
| 81 | 81 | |
| 82 | - foreach ( $options as $price => $label ) { |
|
| 83 | - $_id = $id . uniqid( '_' ); |
|
| 82 | + foreach ( $options as $price => $label ) { |
|
| 83 | + $_id = $id . uniqid( '_' ); |
|
| 84 | 84 | |
| 85 | - $class = 'rounded'; |
|
| 85 | + $class = 'rounded'; |
|
| 86 | 86 | |
| 87 | - if ( $select_type == 'circles' ) { |
|
| 88 | - $class = ''; |
|
| 89 | - } |
|
| 90 | - echo " |
|
| 87 | + if ( $select_type == 'circles' ) { |
|
| 88 | + $class = ''; |
|
| 89 | + } |
|
| 90 | + echo " |
|
| 91 | 91 | <span class='d-inline-block'> |
| 92 | 92 | <input type='radio' class='getpaid-price-select-button getpaid-refresh-on-change w-auto' id='" . esc_attr( $_id ) . "' value='" . esc_attr( $price ) . "' name='" . esc_attr( $id ) . "' " . checked( $price, $value, false ) . " /> |
| 93 | 93 | <label for='" . esc_attr( $_id ) . "' class='" . esc_attr( $class ) . "'><span>" . esc_html( $label ) . '</span></label> |
| 94 | 94 | </span> |
| 95 | 95 | '; |
| 96 | - } |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - echo '</div>'; |
|
| 98 | + echo '</div>'; |
|
| 99 | 99 | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | -// Item checkboxes; |
|
| 103 | -if ( $select_type == 'checkboxes' ) { |
|
| 104 | - echo '<div class="form-group mb-3">'; |
|
| 102 | + // Item checkboxes; |
|
| 103 | + if ( $select_type == 'checkboxes' ) { |
|
| 104 | + echo '<div class="form-group mb-3">'; |
|
| 105 | 105 | |
| 106 | - foreach ( $options as $price => $label ) { |
|
| 107 | - echo " |
|
| 106 | + foreach ( $options as $price => $label ) { |
|
| 107 | + echo " |
|
| 108 | 108 | <label class='form-label d-block'> |
| 109 | 109 | <input type='checkbox' class='getpaid-price-select-checkbox getpaid-refresh-on-change w-auto' name='" . esc_attr( $id ) . "[]' value='" . esc_attr( $price ) . "' " . checked( $price, $value, false ) . ' /> |
| 110 | 110 | <span>' . esc_html( $label ) . '</span> |
| 111 | 111 | </label> |
| 112 | 112 | '; |
| 113 | - } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - echo '</div>'; |
|
| 115 | + echo '</div>'; |
|
| 116 | 116 | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | -if ( ! empty( $description ) ) { |
|
| 120 | - echo "<small class='form-text text-muted'>" . wp_kses_post( $description ) . '</small>'; |
|
| 119 | + if ( ! empty( $description ) ) { |
|
| 120 | + echo "<small class='form-text text-muted'>" . wp_kses_post( $description ) . '</small>'; |
|
| 121 | 121 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays an alert in payment form |
| 4 | 4 | * |
@@ -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 | -if ( empty( $text ) ) { |
|
| 13 | - return; |
|
| 12 | + if ( empty( $text ) ) { |
|
| 13 | + return; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -aui()->alert( |
|
| 17 | - array( |
|
| 18 | - 'content' => wp_kses_post( $text ), |
|
| 19 | - 'dismissible' => ! empty( $dismissible ), |
|
| 20 | - 'type' => empty( $class ) ? 'info' : str_replace( 'alert-', '', $class ), |
|
| 21 | - ), |
|
| 22 | - true |
|
| 23 | -); |
|
| 16 | + aui()->alert( |
|
| 17 | + array( |
|
| 18 | + 'content' => wp_kses_post( $text ), |
|
| 19 | + 'dismissible' => ! empty( $dismissible ), |
|
| 20 | + 'type' => empty( $class ) ? 'info' : str_replace( 'alert-', '', $class ), |
|
| 21 | + ), |
|
| 22 | + true |
|
| 23 | + ); |
|
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays a separator in payment form |
| 4 | 4 | * |
@@ -7,6 +7,6 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 11 | -?> |
|
| 12 | -<hr class="featurette-divider" /> |
|
| 10 | + defined( 'ABSPATH' ) || exit; |
|
| 11 | + ?> |
|
| 12 | + <hr class="featurette-divider" /> |
|
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays a email input in payment form |
| 4 | 4 | * |
@@ -7,27 +7,27 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | + defined( 'ABSPATH' ) || exit; |
|
| 11 | 11 | |
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 12 | + $label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | + $label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 14 | 14 | |
| 15 | -if ( ! empty( $required ) ) { |
|
| 16 | - $label .= "<span class='text-danger'> *</span>"; |
|
| 15 | + if ( ! empty( $required ) ) { |
|
| 16 | + $label .= "<span class='text-danger'> *</span>"; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -aui()->input( |
|
| 20 | - array( |
|
| 21 | - 'name' => esc_attr( $id ), |
|
| 22 | - 'id' => esc_attr( $element_id ), |
|
| 23 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 24 | - 'required' => ! empty( $required ), |
|
| 25 | - 'label' => $label, |
|
| 26 | - 'label_type' => 'vertical', |
|
| 27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | - 'type' => 'email', |
|
| 29 | - 'class' => $label_class, |
|
| 30 | - 'value' => $query_value, |
|
| 31 | - ), |
|
| 32 | - true |
|
| 33 | -); |
|
| 19 | + aui()->input( |
|
| 20 | + array( |
|
| 21 | + 'name' => esc_attr( $id ), |
|
| 22 | + 'id' => esc_attr( $element_id ), |
|
| 23 | + 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 24 | + 'required' => ! empty( $required ), |
|
| 25 | + 'label' => $label, |
|
| 26 | + 'label_type' => 'vertical', |
|
| 27 | + 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | + 'type' => 'email', |
|
| 29 | + 'class' => $label_class, |
|
| 30 | + 'value' => $query_value, |
|
| 31 | + ), |
|
| 32 | + true |
|
| 33 | + ); |
|
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays a checkbox item-select box in a payment form |
| 4 | 4 | * |
@@ -7,40 +7,40 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | + defined( 'ABSPATH' ) || exit; |
|
| 11 | 11 | |
| 12 | -// Prepare the selectable items. |
|
| 13 | -$selectable = array(); |
|
| 14 | -foreach ( $form->get_items() as $item ) { |
|
| 15 | - if ( ! $item->is_required ) { |
|
| 16 | - $selectable[ $item->get_id() ] = $item->get_name() . ' — ' . wpinv_price( $item->get_initial_price() ); |
|
| 17 | - } |
|
| 12 | + // Prepare the selectable items. |
|
| 13 | + $selectable = array(); |
|
| 14 | + foreach ( $form->get_items() as $item ) { |
|
| 15 | + if ( ! $item->is_required ) { |
|
| 16 | + $selectable[ $item->get_id() ] = $item->get_name() . ' — ' . wpinv_price( $item->get_initial_price() ); |
|
| 17 | + } |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( empty( $selectable ) ) { |
|
| 21 | - return; |
|
| 20 | + if ( empty( $selectable ) ) { |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -echo '<div class="getpaid-payment-form-items-checkbox form-group mb-3">'; |
|
| 24 | + echo '<div class="getpaid-payment-form-items-checkbox form-group mb-3">'; |
|
| 25 | 25 | |
| 26 | -foreach ( $selectable as $item_id => $item_name ) { |
|
| 26 | + foreach ( $selectable as $item_id => $item_name ) { |
|
| 27 | 27 | |
| 28 | - $is_checked = get_post_meta( $item_id, 'selected_by_default', true ); |
|
| 28 | + $is_checked = get_post_meta( $item_id, 'selected_by_default', true ); |
|
| 29 | 29 | |
| 30 | - aui()->input( |
|
| 31 | - array( |
|
| 32 | - 'type' => 'checkbox', |
|
| 33 | - 'name' => 'getpaid-payment-form-selected-item', |
|
| 34 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ) . $item_id, |
|
| 35 | - 'label' => $item_name, |
|
| 36 | - 'value' => $item_id, |
|
| 37 | - 'no_wrap' => true, |
|
| 38 | - 'class' => 'w-auto', |
|
| 39 | - 'checked' => '1' == $is_checked, |
|
| 40 | - ), |
|
| 41 | - true |
|
| 42 | - ); |
|
| 30 | + aui()->input( |
|
| 31 | + array( |
|
| 32 | + 'type' => 'checkbox', |
|
| 33 | + 'name' => 'getpaid-payment-form-selected-item', |
|
| 34 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ) . $item_id, |
|
| 35 | + 'label' => $item_name, |
|
| 36 | + 'value' => $item_id, |
|
| 37 | + 'no_wrap' => true, |
|
| 38 | + 'class' => 'w-auto', |
|
| 39 | + 'checked' => '1' == $is_checked, |
|
| 40 | + ), |
|
| 41 | + true |
|
| 42 | + ); |
|
| 43 | 43 | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | -echo '</div>'; |
|
| 46 | + echo '</div>'; |
|
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays an item-select box in a payment form |
| 4 | 4 | * |
@@ -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 | -// Prepare the selectable items. |
|
| 13 | -$selectable = array(); |
|
| 14 | -foreach ( $form->get_items() as $item ) { |
|
| 15 | - if ( ! $item->is_required ) { |
|
| 16 | - $selectable[ $item->get_id() ] = strip_tags( $item->get_name() . ' — ' . wpinv_price( $item->get_initial_price() ) ); |
|
| 17 | - } |
|
| 12 | + // Prepare the selectable items. |
|
| 13 | + $selectable = array(); |
|
| 14 | + foreach ( $form->get_items() as $item ) { |
|
| 15 | + if ( ! $item->is_required ) { |
|
| 16 | + $selectable[ $item->get_id() ] = strip_tags( $item->get_name() . ' — ' . wpinv_price( $item->get_initial_price() ) ); |
|
| 17 | + } |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( empty( $selectable ) ) { |
|
| 21 | - return; |
|
| 20 | + if ( empty( $selectable ) ) { |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -echo '<div class="getpaid-payment-form-items-select form-group mb-3">'; |
|
| 24 | + echo '<div class="getpaid-payment-form-items-select form-group mb-3">'; |
|
| 25 | 25 | |
| 26 | -// Display the selectable items. |
|
| 27 | -aui()->select( |
|
| 28 | - array( |
|
| 29 | - 'name' => 'getpaid-payment-form-selected-item', |
|
| 30 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
| 31 | - 'required' => true, |
|
| 32 | - 'label' => __( 'Select Item', 'invoicing' ), |
|
| 33 | - 'label_type' => 'vertical', |
|
| 34 | - 'inline' => false, |
|
| 35 | - 'options' => $selectable, |
|
| 36 | - ), |
|
| 37 | - true |
|
| 38 | -); |
|
| 26 | + // Display the selectable items. |
|
| 27 | + aui()->select( |
|
| 28 | + array( |
|
| 29 | + 'name' => 'getpaid-payment-form-selected-item', |
|
| 30 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
| 31 | + 'required' => true, |
|
| 32 | + 'label' => __( 'Select Item', 'invoicing' ), |
|
| 33 | + 'label_type' => 'vertical', |
|
| 34 | + 'inline' => false, |
|
| 35 | + 'options' => $selectable, |
|
| 36 | + ), |
|
| 37 | + true |
|
| 38 | + ); |
|
| 39 | 39 | |
| 40 | -echo '</div>'; |
|
| 40 | + echo '</div>'; |
|
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays a radio item-select box in a payment form |
| 4 | 4 | * |
@@ -7,35 +7,35 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | + defined( 'ABSPATH' ) || exit; |
|
| 11 | 11 | |
| 12 | -// Prepare the selectable items. |
|
| 13 | -$selectable = array(); |
|
| 14 | -foreach ( $form->get_items() as $item ) { |
|
| 15 | - if ( ! $item->is_required ) { |
|
| 16 | - $selectable[ $item->get_id() ] = $item->get_name() . ' — ' . wpinv_price( $item->get_initial_price() ); |
|
| 17 | - } |
|
| 12 | + // Prepare the selectable items. |
|
| 13 | + $selectable = array(); |
|
| 14 | + foreach ( $form->get_items() as $item ) { |
|
| 15 | + if ( ! $item->is_required ) { |
|
| 16 | + $selectable[ $item->get_id() ] = $item->get_name() . ' — ' . wpinv_price( $item->get_initial_price() ); |
|
| 17 | + } |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( empty( $selectable ) ) { |
|
| 21 | - return; |
|
| 20 | + if ( empty( $selectable ) ) { |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -echo '<div class="getpaid-payment-form-items-radio form-group mb-3">'; |
|
| 24 | + echo '<div class="getpaid-payment-form-items-radio form-group mb-3">'; |
|
| 25 | 25 | |
| 26 | -// Display the selectable items. |
|
| 27 | -aui()->radio( |
|
| 28 | - array( |
|
| 29 | - 'name' => 'getpaid-payment-form-selected-item', |
|
| 30 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
| 31 | - 'required' => true, |
|
| 32 | - 'label' => __( 'Select Item', 'invoicing' ), |
|
| 33 | - 'label_type' => 'vertical', |
|
| 34 | - 'class' => 'w-auto', |
|
| 35 | - 'inline' => false, |
|
| 36 | - 'options' => $selectable, |
|
| 37 | - ), |
|
| 38 | - true |
|
| 39 | -); |
|
| 26 | + // Display the selectable items. |
|
| 27 | + aui()->radio( |
|
| 28 | + array( |
|
| 29 | + 'name' => 'getpaid-payment-form-selected-item', |
|
| 30 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
| 31 | + 'required' => true, |
|
| 32 | + 'label' => __( 'Select Item', 'invoicing' ), |
|
| 33 | + 'label_type' => 'vertical', |
|
| 34 | + 'class' => 'w-auto', |
|
| 35 | + 'inline' => false, |
|
| 36 | + 'options' => $selectable, |
|
| 37 | + ), |
|
| 38 | + true |
|
| 39 | + ); |
|
| 40 | 40 | |
| 41 | -echo '</div>'; |
|
| 41 | + echo '</div>'; |
|
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays a cart totals in a payment form |
| 4 | 4 | * |
@@ -7,35 +7,35 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 11 | - |
|
| 12 | -// Totals rows. |
|
| 13 | -$cart_totals = apply_filters( |
|
| 14 | - 'getpaid_payment_form_cart_table_totals', |
|
| 15 | - array( |
|
| 16 | - 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
| 17 | - 'tax' => __( 'Tax', 'invoicing' ), |
|
| 18 | - 'fees' => __( 'Fee', 'invoicing' ), |
|
| 19 | - 'discount' => __( 'Discount', 'invoicing' ), |
|
| 20 | - 'total' => __( 'Total', 'invoicing' ), |
|
| 21 | - ), |
|
| 22 | - $form |
|
| 23 | -); |
|
| 24 | - |
|
| 25 | -$currency = $form->get_currency(); |
|
| 26 | -$country = wpinv_get_default_country(); |
|
| 27 | - |
|
| 28 | -if ( ! empty( $form->invoice ) ) { |
|
| 29 | - $country = $form->invoice->get_country(); |
|
| 10 | + defined( 'ABSPATH' ) || exit; |
|
| 11 | + |
|
| 12 | + // Totals rows. |
|
| 13 | + $cart_totals = apply_filters( |
|
| 14 | + 'getpaid_payment_form_cart_table_totals', |
|
| 15 | + array( |
|
| 16 | + 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
| 17 | + 'tax' => __( 'Tax', 'invoicing' ), |
|
| 18 | + 'fees' => __( 'Fee', 'invoicing' ), |
|
| 19 | + 'discount' => __( 'Discount', 'invoicing' ), |
|
| 20 | + 'total' => __( 'Total', 'invoicing' ), |
|
| 21 | + ), |
|
| 22 | + $form |
|
| 23 | + ); |
|
| 24 | + |
|
| 25 | + $currency = $form->get_currency(); |
|
| 26 | + $country = wpinv_get_default_country(); |
|
| 27 | + |
|
| 28 | + if ( ! empty( $form->invoice ) ) { |
|
| 29 | + $country = $form->invoice->get_country(); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | -if ( ! wpinv_use_taxes() && isset( $cart_totals['tax'] ) ) { |
|
| 33 | - unset( $cart_totals['tax'] ); |
|
| 32 | + if ( ! wpinv_use_taxes() && isset( $cart_totals['tax'] ) ) { |
|
| 33 | + unset( $cart_totals['tax'] ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | -do_action( 'getpaid_before_payment_form_cart_totals', $form, $cart_totals ); |
|
| 36 | + do_action( 'getpaid_before_payment_form_cart_totals', $form, $cart_totals ); |
|
| 37 | 37 | |
| 38 | -?> |
|
| 38 | + ?> |
|
| 39 | 39 | <style> |
| 40 | 40 | @media screen and (min-width: 576px) { |
| 41 | 41 | .bsui .border-sm-left { |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | <?php |
| 63 | 63 | |
| 64 | - // Total tax. |
|
| 65 | - if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ), true ) ) { |
|
| 66 | - wpinv_the_price( 0, $currency ); |
|
| 67 | - } |
|
| 64 | + // Total tax. |
|
| 65 | + if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ), true ) ) { |
|
| 66 | + wpinv_the_price( 0, $currency ); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - do_action( "getpaid_payment_form_cart_totals_$key", $form ); |
|
| 70 | - ?> |
|
| 69 | + do_action( "getpaid_payment_form_cart_totals_$key", $form ); |
|
| 70 | + ?> |
|
| 71 | 71 | |
| 72 | 72 | </div> |
| 73 | 73 | |
@@ -82,4 +82,4 @@ discard block |
||
| 82 | 82 | </div> |
| 83 | 83 | |
| 84 | 84 | <?php |
| 85 | -do_action( 'getpaid_payment_form_cart_totals', $form, $cart_totals ); |
|
| 85 | + do_action( 'getpaid_payment_form_cart_totals', $form, $cart_totals ); |
|
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | /** |
| 3 | 3 | * Displays a cart item in a payment form |
| 4 | 4 | * |
@@ -9,14 +9,14 @@ 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 | -$currency = $form->get_currency(); |
|
| 17 | -$max_qty = wpinv_item_max_buyable_quantity( $item->get_id() ); |
|
| 18 | -?> |
|
| 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'> |
|
| 16 | + $currency = $form->get_currency(); |
|
| 17 | + $max_qty = wpinv_item_max_buyable_quantity( $item->get_id() ); |
|
| 18 | + ?> |
|
| 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 | |
@@ -26,71 +26,71 @@ 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 | 35 | |
| 36 | - ob_start(); |
|
| 36 | + ob_start(); |
|
| 37 | 37 | |
| 38 | - // Add an optional description. |
|
| 39 | - $description = $item->get_description(); |
|
| 38 | + // Add an optional description. |
|
| 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>'; |
|
| 43 | - } |
|
| 41 | + if ( ! empty( $description ) ) { |
|
| 42 | + echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>'; |
|
| 43 | + } |
|
| 44 | 44 | |
| 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>'; |
|
| 49 | - } |
|
| 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>'; |
|
| 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 | - edit_post_link( |
|
| 56 | - __( 'Edit this item.', 'invoicing' ), |
|
| 57 | - '<small class="form-text text-muted">', |
|
| 58 | - '</small>', |
|
| 59 | - $item->get_id(), |
|
| 60 | - 'text-danger' |
|
| 61 | - ); |
|
| 55 | + edit_post_link( |
|
| 56 | + __( 'Edit this item.', 'invoicing' ), |
|
| 57 | + '<small class="form-text text-muted">', |
|
| 58 | + '</small>', |
|
| 59 | + $item->get_id(), |
|
| 60 | + 'text-danger' |
|
| 61 | + ); |
|
| 62 | 62 | |
| 63 | - } |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - $description = ob_get_clean(); |
|
| 65 | + $description = ob_get_clean(); |
|
| 66 | 66 | |
| 67 | - // Display the name. |
|
| 68 | - $tootip = empty( $description ) ? '' : ' <i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
| 67 | + // Display the name. |
|
| 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 ) { |
|
| 73 | - echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">'; |
|
| 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' ) ); |
|
| 76 | - echo '</div>'; |
|
| 77 | - echo '<div class="getpaid-form-item-name-container">'; |
|
| 78 | - } |
|
| 72 | + if ( $has_featured_image ) { |
|
| 73 | + echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">'; |
|
| 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' ) ); |
|
| 76 | + echo '</div>'; |
|
| 77 | + echo '<div class="getpaid-form-item-name-container">'; |
|
| 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 ) ); |
|
| 84 | - } |
|
| 82 | + if ( ! empty( $description ) ) { |
|
| 83 | + printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) ); |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - if ( $item->allows_quantities() ) { |
|
| 87 | - printf( |
|
| 88 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 89 | - sprintf( |
|
| 90 | - // translators: %s is the item quantity. |
|
| 91 | - esc_html__( 'Qty %s', 'invoicing' ), |
|
| 92 | - sprintf( |
|
| 93 | - '<input |
|
| 86 | + if ( $item->allows_quantities() ) { |
|
| 87 | + printf( |
|
| 88 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 89 | + sprintf( |
|
| 90 | + // translators: %s is the item quantity. |
|
| 91 | + esc_html__( 'Qty %s', 'invoicing' ), |
|
| 92 | + sprintf( |
|
| 93 | + '<input |
|
| 94 | 94 | type="number" |
| 95 | 95 | step="0.01" |
| 96 | 96 | style="width: 48px;" |
@@ -99,142 +99,142 @@ discard block |
||
| 99 | 99 | min="1" |
| 100 | 100 | max="%s" |
| 101 | 101 | >', |
| 102 | - (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
|
| 103 | - floatval( null !== $max_qty ? $max_qty : 1000000000000 ) |
|
| 104 | - ) |
|
| 105 | - ) |
|
| 106 | - ); |
|
| 107 | - } else { |
|
| 108 | - printf( |
|
| 109 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 110 | - sprintf( |
|
| 111 | - // translators: %s is the item quantity. |
|
| 112 | - esc_html__( 'Qty %s', 'invoicing' ), |
|
| 113 | - (float) $item->get_quantity() |
|
| 114 | - ) |
|
| 115 | - ); |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - if ( $has_featured_image ) { |
|
| 119 | - echo '</div>'; |
|
| 120 | - echo '</div>'; |
|
| 121 | - } |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - // Item price. |
|
| 125 | - if ( 'price' === $key ) { |
|
| 126 | - |
|
| 127 | - // Set the currency position. |
|
| 128 | - $position = wpinv_currency_position(); |
|
| 129 | - |
|
| 130 | - if ( 'left_space' === $position ) { |
|
| 131 | - $position = 'left'; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - if ( 'right_space' === $position ) { |
|
| 135 | - $position = 'right'; |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - if ( $item->user_can_set_their_price() ) { |
|
| 139 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
| 140 | - $minimum = (float) $item->get_minimum_price(); |
|
| 141 | - $validate_minimum = ''; |
|
| 142 | - $class = ''; |
|
| 143 | - $data_minimum = ''; |
|
| 144 | - |
|
| 145 | - if ( $minimum > 0 ) { |
|
| 146 | - $validate_minimum = sprintf( |
|
| 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 ) ) |
|
| 150 | - ); |
|
| 151 | - |
|
| 152 | - $class = 'getpaid-validate-minimum-amount'; |
|
| 153 | - |
|
| 154 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - ?> |
|
| 158 | - <div class="input-group input-group-sm"> |
|
| 102 | + (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
|
| 103 | + floatval( null !== $max_qty ? $max_qty : 1000000000000 ) |
|
| 104 | + ) |
|
| 105 | + ) |
|
| 106 | + ); |
|
| 107 | + } else { |
|
| 108 | + printf( |
|
| 109 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 110 | + sprintf( |
|
| 111 | + // translators: %s is the item quantity. |
|
| 112 | + esc_html__( 'Qty %s', 'invoicing' ), |
|
| 113 | + (float) $item->get_quantity() |
|
| 114 | + ) |
|
| 115 | + ); |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + if ( $has_featured_image ) { |
|
| 119 | + echo '</div>'; |
|
| 120 | + echo '</div>'; |
|
| 121 | + } |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + // Item price. |
|
| 125 | + if ( 'price' === $key ) { |
|
| 126 | + |
|
| 127 | + // Set the currency position. |
|
| 128 | + $position = wpinv_currency_position(); |
|
| 129 | + |
|
| 130 | + if ( 'left_space' === $position ) { |
|
| 131 | + $position = 'left'; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + if ( 'right_space' === $position ) { |
|
| 135 | + $position = 'right'; |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + if ( $item->user_can_set_their_price() ) { |
|
| 139 | + $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
| 140 | + $minimum = (float) $item->get_minimum_price(); |
|
| 141 | + $validate_minimum = ''; |
|
| 142 | + $class = ''; |
|
| 143 | + $data_minimum = ''; |
|
| 144 | + |
|
| 145 | + if ( $minimum > 0 ) { |
|
| 146 | + $validate_minimum = sprintf( |
|
| 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 ) ) |
|
| 150 | + ); |
|
| 151 | + |
|
| 152 | + $class = 'getpaid-validate-minimum-amount'; |
|
| 153 | + |
|
| 154 | + $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + ?> |
|
| 158 | + <div class="input-group input-group-sm"> |
|
| 159 | 159 | <?php if ( 'left' === $position ) : ?> |
| 160 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 160 | + <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 161 | 161 | <div class="input-group-prepend "> |
| 162 | 162 | <span class="input-group-text"> |
| 163 | 163 | <?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
| 164 | 164 | </span> |
| 165 | 165 | </div> |
| 166 | 166 | <?php else : ?> |
| 167 | - <span class="input-group-text"> |
|
| 167 | + <span class="input-group-text"> |
|
| 168 | 168 | <?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
| 169 | 169 | </span> |
| 170 | 170 | <?php endif; ?> |
| 171 | - <?php endif; ?> |
|
| 171 | + <?php endif; ?> |
|
| 172 | 172 | |
| 173 | 173 | <input type="number" step="0.01" <?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;"> |
| 174 | 174 | |
| 175 | 175 | <?php if ( ! empty( $validate_minimum ) ) : ?> |
| 176 | - <div class="invalid-tooltip"> |
|
| 176 | + <div class="invalid-tooltip"> |
|
| 177 | 177 | <?php echo wp_kses_post( $validate_minimum ); ?> |
| 178 | - </div> |
|
| 178 | + </div> |
|
| 179 | 179 | <?php endif; ?> |
| 180 | - |
|
| 180 | + |
|
| 181 | 181 | <?php if ( 'left' !== $position ) : ?> |
| 182 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 182 | + <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 183 | 183 | <div class="input-group-append "> |
| 184 | 184 | <span class="input-group-text"> |
| 185 | 185 | <?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
| 186 | 186 | </span> |
| 187 | 187 | </div> |
| 188 | 188 | <?php else : ?> |
| 189 | - <span class="input-group-text"> |
|
| 189 | + <span class="input-group-text"> |
|
| 190 | 190 | <?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span> |
| 191 | 191 | </span> |
| 192 | 192 | <?php endif; ?> |
| 193 | - <?php endif; ?> |
|
| 194 | - </div> |
|
| 193 | + <?php endif; ?> |
|
| 194 | + </div> |
|
| 195 | 195 | |
| 196 | 196 | <?php |
| 197 | 197 | |
| 198 | - } else { |
|
| 199 | - ?> |
|
| 200 | - <span class="getpaid-items-<?php echo (int) $item->get_id(); ?>-view-price"> |
|
| 198 | + } else { |
|
| 199 | + ?> |
|
| 200 | + <span class="getpaid-items-<?php echo (int) $item->get_id(); ?>-view-price"> |
|
| 201 | 201 | <?php echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) ); ?> |
| 202 | 202 | </span> |
| 203 | 203 | <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() ); ?>'> |
| 204 | 204 | <?php |
| 205 | - } |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | - printf( |
|
| 208 | - '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
| 209 | - // translators: %s is the item subtotal. |
|
| 210 | - sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) ) |
|
| 211 | - ); |
|
| 212 | - } |
|
| 207 | + printf( |
|
| 208 | + '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
| 209 | + // translators: %s is the item subtotal. |
|
| 210 | + sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) ) |
|
| 211 | + ); |
|
| 212 | + } |
|
| 213 | 213 | |
| 214 | - // Item quantity. |
|
| 215 | - if ( 'quantity' === $key ) { |
|
| 214 | + // Item quantity. |
|
| 215 | + if ( 'quantity' === $key ) { |
|
| 216 | 216 | |
| 217 | - if ( $item->allows_quantities() ) { |
|
| 218 | - ?> |
|
| 219 | - <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> |
|
| 217 | + if ( $item->allows_quantities() ) { |
|
| 218 | + ?> |
|
| 219 | + <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> |
|
| 220 | 220 | <?php |
| 221 | - } else { |
|
| 222 | - ?> |
|
| 223 | - <span class="getpaid-items-<?php echo (int) $item->get_id(); ?>-view-quantity"> |
|
| 221 | + } else { |
|
| 222 | + ?> |
|
| 223 | + <span class="getpaid-items-<?php echo (int) $item->get_id(); ?>-view-quantity"> |
|
| 224 | 224 | <?php echo (float) $item->get_quantity(); ?> |
| 225 | 225 | </span> |
| 226 | 226 | <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(); ?>'> |
| 227 | 227 | <?php |
| 228 | - } |
|
| 228 | + } |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - // Item sub total. |
|
| 232 | - if ( 'subtotal' === $key ) { |
|
| 233 | - echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ); |
|
| 234 | - } |
|
| 231 | + // Item sub total. |
|
| 232 | + if ( 'subtotal' === $key ) { |
|
| 233 | + echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ); |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
| 237 | - ?> |
|
| 236 | + do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
| 237 | + ?> |
|
| 238 | 238 | |
| 239 | 239 | </div> |
| 240 | 240 | |
@@ -244,4 +244,4 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | </div> |
| 246 | 246 | <?php |
| 247 | -do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
|
| 247 | + do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
|