@@ -7,24 +7,24 @@ |
||
| 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 ) ) { |
|
| 15 | +if (!empty($required)) { |
|
| 16 | 16 | $label .= "<span class='text-danger'> *</span>"; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | echo aui()->input( |
| 20 | 20 | array( |
| 21 | - 'name' => esc_attr( $id ), |
|
| 22 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 23 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 24 | - 'required' => ! empty( $required ), |
|
| 21 | + 'name' => esc_attr($id), |
|
| 22 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 23 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
| 24 | + 'required' => !empty($required), |
|
| 25 | 25 | 'label' => $label, |
| 26 | 26 | 'label_type' => 'vertical', |
| 27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 27 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 28 | 28 | 'type' => 'number', |
| 29 | 29 | 'class' => $label_class, |
| 30 | 30 | ) |
@@ -12,57 +12,57 @@ |
||
| 12 | 12 | $label = empty( $label ) ? '' : wp_kses_post( $label ); |
| 13 | 13 | $label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
| 14 | 14 | if ( ! empty( $required ) ) { |
| 15 | - $label .= "<span class='text-danger'> *</span>"; |
|
| 15 | + $label .= "<span class='text-danger'> *</span>"; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | $disable_dates = array(); |
| 19 | 19 | |
| 20 | 20 | if ( ! empty( $disabled_dates ) ) { |
| 21 | - $disabled_dates = preg_replace( '/\s+/', '', $disabled_dates ); |
|
| 22 | - $disabled_dates = str_ireplace( 'today', current_time( 'Y-m-d' ), $disabled_dates ); |
|
| 23 | - $disabled_dates = array_filter( explode( ',', $disabled_dates ) ); |
|
| 21 | + $disabled_dates = preg_replace( '/\s+/', '', $disabled_dates ); |
|
| 22 | + $disabled_dates = str_ireplace( 'today', current_time( 'Y-m-d' ), $disabled_dates ); |
|
| 23 | + $disabled_dates = array_filter( explode( ',', $disabled_dates ) ); |
|
| 24 | 24 | |
| 25 | - foreach ( $disabled_dates as $disabled_date ) { |
|
| 25 | + foreach ( $disabled_dates as $disabled_date ) { |
|
| 26 | 26 | |
| 27 | - $disabled_date = trim( $disabled_date ); |
|
| 27 | + $disabled_date = trim( $disabled_date ); |
|
| 28 | 28 | |
| 29 | - if ( false === strpos( $disabled_date, '|' ) ) { |
|
| 30 | - $disable_dates[] = $disabled_date; |
|
| 31 | - continue; |
|
| 32 | - } |
|
| 29 | + if ( false === strpos( $disabled_date, '|' ) ) { |
|
| 30 | + $disable_dates[] = $disabled_date; |
|
| 31 | + continue; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - $disabled_date = explode( '|', $disabled_date ); |
|
| 35 | - $disable_dates[] = array( |
|
| 36 | - 'from' => trim( $disabled_date[0] ), |
|
| 37 | - 'to' => trim( $disabled_date[1] ), |
|
| 38 | - ); |
|
| 34 | + $disabled_date = explode( '|', $disabled_date ); |
|
| 35 | + $disable_dates[] = array( |
|
| 36 | + 'from' => trim( $disabled_date[0] ), |
|
| 37 | + 'to' => trim( $disabled_date[1] ), |
|
| 38 | + ); |
|
| 39 | 39 | |
| 40 | - } |
|
| 40 | + } |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $options = array( |
| 44 | - 'data-default-date' => empty( 'default_date' ) ? false : $default_date, |
|
| 45 | - 'data-min-date' => empty( 'min_date' ) ? false : $min_date, |
|
| 46 | - 'data-max-date' => empty( 'max_date' ) ? false : $max_date, |
|
| 47 | - 'data-mode' => empty( 'mode' ) ? 'single' : $mode, |
|
| 48 | - 'data-alt-format' => get_option( 'date_format', 'F j, Y' ), |
|
| 49 | - 'data-date-format' => 'Y-m-d', |
|
| 50 | - 'data-alt-input' => 'true', |
|
| 51 | - 'data-disable_alt' => empty( $disabled_dates ) ? false : wp_json_encode( $disable_dates ), |
|
| 52 | - 'data-disable_days_alt' => empty( $disable_days ) ? false : wp_json_encode( wp_parse_id_list( $disable_days ) ), |
|
| 44 | + 'data-default-date' => empty( 'default_date' ) ? false : $default_date, |
|
| 45 | + 'data-min-date' => empty( 'min_date' ) ? false : $min_date, |
|
| 46 | + 'data-max-date' => empty( 'max_date' ) ? false : $max_date, |
|
| 47 | + 'data-mode' => empty( 'mode' ) ? 'single' : $mode, |
|
| 48 | + 'data-alt-format' => get_option( 'date_format', 'F j, Y' ), |
|
| 49 | + 'data-date-format' => 'Y-m-d', |
|
| 50 | + 'data-alt-input' => 'true', |
|
| 51 | + 'data-disable_alt' => empty( $disabled_dates ) ? false : wp_json_encode( $disable_dates ), |
|
| 52 | + 'data-disable_days_alt' => empty( $disable_days ) ? false : wp_json_encode( wp_parse_id_list( $disable_days ) ), |
|
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | 55 | echo aui()->input( |
| 56 | - array( |
|
| 57 | - 'name' => esc_attr( $id ), |
|
| 58 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 59 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 60 | - 'required' => ! empty( $required ), |
|
| 61 | - 'label' => $label, |
|
| 62 | - 'label_type' => 'vertical', |
|
| 63 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 64 | - 'type' => 'datepicker', |
|
| 65 | - 'class' => $label_class . ' getpaid-init-flatpickr flatpickr-input', |
|
| 66 | - 'extra_attributes' => array_filter( apply_filters( 'getpaid_date_field_attributes', $options ) ), |
|
| 67 | - ) |
|
| 56 | + array( |
|
| 57 | + 'name' => esc_attr( $id ), |
|
| 58 | + 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 59 | + 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 60 | + 'required' => ! empty( $required ), |
|
| 61 | + 'label' => $label, |
|
| 62 | + 'label_type' => 'vertical', |
|
| 63 | + 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 64 | + 'type' => 'datepicker', |
|
| 65 | + 'class' => $label_class . ' getpaid-init-flatpickr flatpickr-input', |
|
| 66 | + 'extra_attributes' => array_filter( apply_filters( 'getpaid_date_field_attributes', $options ) ), |
|
| 67 | + ) |
|
| 68 | 68 | ); |
@@ -7,62 +7,62 @@ |
||
| 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 ) ); |
|
| 14 | -if ( ! empty( $required ) ) { |
|
| 12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
| 13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
| 14 | +if (!empty($required)) { |
|
| 15 | 15 | $label .= "<span class='text-danger'> *</span>"; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | $disable_dates = array(); |
| 19 | 19 | |
| 20 | -if ( ! empty( $disabled_dates ) ) { |
|
| 21 | - $disabled_dates = preg_replace( '/\s+/', '', $disabled_dates ); |
|
| 22 | - $disabled_dates = str_ireplace( 'today', current_time( 'Y-m-d' ), $disabled_dates ); |
|
| 23 | - $disabled_dates = array_filter( explode( ',', $disabled_dates ) ); |
|
| 20 | +if (!empty($disabled_dates)) { |
|
| 21 | + $disabled_dates = preg_replace('/\s+/', '', $disabled_dates); |
|
| 22 | + $disabled_dates = str_ireplace('today', current_time('Y-m-d'), $disabled_dates); |
|
| 23 | + $disabled_dates = array_filter(explode(',', $disabled_dates)); |
|
| 24 | 24 | |
| 25 | - foreach ( $disabled_dates as $disabled_date ) { |
|
| 25 | + foreach ($disabled_dates as $disabled_date) { |
|
| 26 | 26 | |
| 27 | - $disabled_date = trim( $disabled_date ); |
|
| 27 | + $disabled_date = trim($disabled_date); |
|
| 28 | 28 | |
| 29 | - if ( false === strpos( $disabled_date, '|' ) ) { |
|
| 29 | + if (false === strpos($disabled_date, '|')) { |
|
| 30 | 30 | $disable_dates[] = $disabled_date; |
| 31 | 31 | continue; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - $disabled_date = explode( '|', $disabled_date ); |
|
| 34 | + $disabled_date = explode('|', $disabled_date); |
|
| 35 | 35 | $disable_dates[] = array( |
| 36 | - 'from' => trim( $disabled_date[0] ), |
|
| 37 | - 'to' => trim( $disabled_date[1] ), |
|
| 36 | + 'from' => trim($disabled_date[0]), |
|
| 37 | + 'to' => trim($disabled_date[1]), |
|
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $options = array( |
| 44 | - 'data-default-date' => empty( 'default_date' ) ? false : $default_date, |
|
| 45 | - 'data-min-date' => empty( 'min_date' ) ? false : $min_date, |
|
| 46 | - 'data-max-date' => empty( 'max_date' ) ? false : $max_date, |
|
| 47 | - 'data-mode' => empty( 'mode' ) ? 'single' : $mode, |
|
| 48 | - 'data-alt-format' => get_option( 'date_format', 'F j, Y' ), |
|
| 44 | + 'data-default-date' => empty('default_date') ? false : $default_date, |
|
| 45 | + 'data-min-date' => empty('min_date') ? false : $min_date, |
|
| 46 | + 'data-max-date' => empty('max_date') ? false : $max_date, |
|
| 47 | + 'data-mode' => empty('mode') ? 'single' : $mode, |
|
| 48 | + 'data-alt-format' => get_option('date_format', 'F j, Y'), |
|
| 49 | 49 | 'data-date-format' => 'Y-m-d', |
| 50 | 50 | 'data-alt-input' => 'true', |
| 51 | - 'data-disable_alt' => empty( $disabled_dates ) ? false : wp_json_encode( $disable_dates ), |
|
| 52 | - 'data-disable_days_alt' => empty( $disable_days ) ? false : wp_json_encode( wp_parse_id_list( $disable_days ) ), |
|
| 51 | + 'data-disable_alt' => empty($disabled_dates) ? false : wp_json_encode($disable_dates), |
|
| 52 | + 'data-disable_days_alt' => empty($disable_days) ? false : wp_json_encode(wp_parse_id_list($disable_days)), |
|
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | 55 | echo aui()->input( |
| 56 | 56 | array( |
| 57 | - 'name' => esc_attr( $id ), |
|
| 58 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 59 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 60 | - 'required' => ! empty( $required ), |
|
| 57 | + 'name' => esc_attr($id), |
|
| 58 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 59 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
| 60 | + 'required' => !empty($required), |
|
| 61 | 61 | 'label' => $label, |
| 62 | 62 | 'label_type' => 'vertical', |
| 63 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 63 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 64 | 64 | 'type' => 'datepicker', |
| 65 | 65 | 'class' => $label_class . ' getpaid-init-flatpickr flatpickr-input', |
| 66 | - 'extra_attributes' => array_filter( apply_filters( 'getpaid_date_field_attributes', $options ) ), |
|
| 66 | + 'extra_attributes' => array_filter(apply_filters('getpaid_date_field_attributes', $options)), |
|
| 67 | 67 | ) |
| 68 | 68 | ); |
@@ -7,25 +7,25 @@ |
||
| 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 ) ) { |
|
| 15 | +if (!empty($required)) { |
|
| 16 | 16 | $label .= "<span class='text-danger'> *</span>"; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | echo aui()->select( |
| 20 | 20 | array( |
| 21 | - 'name' => esc_attr( $id ), |
|
| 22 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 23 | - 'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ), |
|
| 24 | - 'required' => ! empty( $required ), |
|
| 21 | + 'name' => esc_attr($id), |
|
| 22 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 23 | + 'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder), |
|
| 24 | + 'required' => !empty($required), |
|
| 25 | 25 | 'label' => $label, |
| 26 | 26 | 'label_type' => 'vertical', |
| 27 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | - 'options' => empty( $options ) ? array() : array_combine( $options, $options ), |
|
| 27 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 28 | + 'options' => empty($options) ? array() : array_combine($options, $options), |
|
| 29 | 29 | 'class' => $label_class, |
| 30 | 30 | ) |
| 31 | 31 | ); |
@@ -7,44 +7,44 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -if ( empty( $form->get_items() ) ) { |
|
| 12 | +if (empty($form->get_items())) { |
|
| 13 | 13 | return; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! empty( $GLOBALS['getpaid_force_checkbox'] ) ) { |
|
| 16 | +if (!empty($GLOBALS['getpaid_force_checkbox'])) { |
|
| 17 | 17 | $items_type = 'checkbox'; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( empty( $items_type ) ) { |
|
| 20 | +if (empty($items_type)) { |
|
| 21 | 21 | $items_type = 'total'; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -do_action( 'getpaid_before_payment_form_items', $form ); |
|
| 24 | +do_action('getpaid_before_payment_form_items', $form); |
|
| 25 | 25 | |
| 26 | -switch ( $items_type ) { |
|
| 26 | +switch ($items_type) { |
|
| 27 | 27 | case 'radio': |
| 28 | - wpinv_get_template( 'payment-forms/variations/radio.php', compact( 'form', 'items_type' ) ); |
|
| 28 | + wpinv_get_template('payment-forms/variations/radio.php', compact('form', 'items_type')); |
|
| 29 | 29 | break; |
| 30 | 30 | case 'checkbox': |
| 31 | - wpinv_get_template( 'payment-forms/variations/checkbox.php', compact( 'form', 'items_type' ) ); |
|
| 31 | + wpinv_get_template('payment-forms/variations/checkbox.php', compact('form', 'items_type')); |
|
| 32 | 32 | break; |
| 33 | 33 | case 'select': |
| 34 | - wpinv_get_template( 'payment-forms/variations/select.php', compact( 'form', 'items_type' ) ); |
|
| 34 | + wpinv_get_template('payment-forms/variations/select.php', compact('form', 'items_type')); |
|
| 35 | 35 | break; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -do_action( 'getpaid_before_payment_form_cart', $form ); |
|
| 38 | +do_action('getpaid_before_payment_form_cart', $form); |
|
| 39 | 39 | |
| 40 | 40 | // Display the cart totals. |
| 41 | -if ( ! empty( $hide_cart ) ) { |
|
| 41 | +if (!empty($hide_cart)) { |
|
| 42 | 42 | echo '<div class="d-none">'; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // Display the cart totals. |
| 46 | -wpinv_get_template( 'payment-forms/cart.php', compact( 'form', 'items_type' ) ); |
|
| 46 | +wpinv_get_template('payment-forms/cart.php', compact('form', 'items_type')); |
|
| 47 | 47 | |
| 48 | -if ( ! empty( $hide_cart ) ) { |
|
| 48 | +if (!empty($hide_cart)) { |
|
| 49 | 49 | echo '</div>'; |
| 50 | 50 | } |
@@ -7,26 +7,26 @@ |
||
| 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 ) ) { |
|
| 15 | +if (!empty($required)) { |
|
| 16 | 16 | $label .= "<span class='text-danger'> *</span>"; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | echo aui()->radio( |
| 20 | 20 | array( |
| 21 | - 'name' => esc_attr( $id ), |
|
| 22 | - 'id' => esc_attr( $id ) . uniqid( '_' ), |
|
| 23 | - 'required' => ! empty( $required ), |
|
| 21 | + 'name' => esc_attr($id), |
|
| 22 | + 'id' => esc_attr($id) . uniqid('_'), |
|
| 23 | + 'required' => !empty($required), |
|
| 24 | 24 | 'label' => $label, |
| 25 | 25 | 'label_type' => 'vertical', |
| 26 | 26 | 'class' => 'w-auto', |
| 27 | 27 | 'inline' => false, |
| 28 | - 'options' => empty( $options ) ? array() : array_combine( $options, $options ), |
|
| 29 | - 'help_text' => empty( $description ) ? '' : wp_kses_post( $description ), |
|
| 28 | + 'options' => empty($options) ? array() : array_combine($options, $options), |
|
| 29 | + 'help_text' => empty($description) ? '' : wp_kses_post($description), |
|
| 30 | 30 | 'class' => $label_class, |
| 31 | 31 | ) |
| 32 | 32 | ); |
@@ -26,58 +26,58 @@ 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 ); |
|
| 31 | - |
|
| 32 | - // Item name. |
|
| 33 | - if ( 'name' == $key ) { |
|
| 34 | - |
|
| 35 | - ob_start(); |
|
| 36 | - // And an optional description. |
|
| 37 | - $description = $item->get_description(); |
|
| 38 | - |
|
| 39 | - if ( ! empty( $description ) ) { |
|
| 40 | - $description = wp_kses_post( $description ); |
|
| 41 | - echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - // Price help text. |
|
| 45 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
| 46 | - if ( $description ) { |
|
| 47 | - echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
| 51 | - |
|
| 52 | - if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 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 | - ); |
|
| 61 | - |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - $description = ob_get_clean(); |
|
| 65 | - |
|
| 66 | - // Display the name. |
|
| 67 | - $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
| 68 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
| 69 | - |
|
| 70 | - if ( ! empty( $description ) ) { |
|
| 71 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - if ( $item->allows_quantities() ) { |
|
| 75 | - printf( |
|
| 76 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 77 | - sprintf( |
|
| 78 | - __( 'Qty %s', 'invoicing' ), |
|
| 79 | - sprintf( |
|
| 80 | - '<input |
|
| 29 | + // Fires before printing a line item column. |
|
| 30 | + do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
| 31 | + |
|
| 32 | + // Item name. |
|
| 33 | + if ( 'name' == $key ) { |
|
| 34 | + |
|
| 35 | + ob_start(); |
|
| 36 | + // And an optional description. |
|
| 37 | + $description = $item->get_description(); |
|
| 38 | + |
|
| 39 | + if ( ! empty( $description ) ) { |
|
| 40 | + $description = wp_kses_post( $description ); |
|
| 41 | + echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + // Price help text. |
|
| 45 | + $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
| 46 | + if ( $description ) { |
|
| 47 | + echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
| 51 | + |
|
| 52 | + if ( wpinv_current_user_can_manage_invoicing() ) { |
|
| 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 | + ); |
|
| 61 | + |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + $description = ob_get_clean(); |
|
| 65 | + |
|
| 66 | + // Display the name. |
|
| 67 | + $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
| 68 | + echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
| 69 | + |
|
| 70 | + if ( ! empty( $description ) ) { |
|
| 71 | + printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + if ( $item->allows_quantities() ) { |
|
| 75 | + printf( |
|
| 76 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 77 | + sprintf( |
|
| 78 | + __( 'Qty %s', 'invoicing' ), |
|
| 79 | + sprintf( |
|
| 80 | + '<input |
|
| 81 | 81 | type="number" |
| 82 | 82 | step="0.01" |
| 83 | 83 | style="width: 48px;" |
@@ -87,53 +87,53 @@ discard block |
||
| 87 | 87 | %s>', |
| 88 | 88 | (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(), |
| 89 | 89 | null !== $max_qty ? 'max="' . (float) $max_qty . '"' : '' |
| 90 | - ) |
|
| 91 | - ) |
|
| 92 | - ); |
|
| 93 | - } else { |
|
| 94 | - printf( |
|
| 95 | - '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 96 | - sprintf( |
|
| 97 | - __( 'Qty %s', 'invoicing' ), |
|
| 98 | - (float) $item->get_quantity() |
|
| 99 | - ) |
|
| 100 | - ); |
|
| 101 | - } |
|
| 90 | + ) |
|
| 91 | + ) |
|
| 92 | + ); |
|
| 93 | + } else { |
|
| 94 | + printf( |
|
| 95 | + '<small class="d-sm-none text-muted form-text">%s</small>', |
|
| 96 | + sprintf( |
|
| 97 | + __( 'Qty %s', 'invoicing' ), |
|
| 98 | + (float) $item->get_quantity() |
|
| 99 | + ) |
|
| 100 | + ); |
|
| 101 | + } |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - // Item price. |
|
| 105 | - if ( 'price' == $key ) { |
|
| 104 | + // Item price. |
|
| 105 | + if ( 'price' == $key ) { |
|
| 106 | 106 | |
| 107 | - // Set the currency position. |
|
| 108 | - $position = wpinv_currency_position(); |
|
| 107 | + // Set the currency position. |
|
| 108 | + $position = wpinv_currency_position(); |
|
| 109 | 109 | |
| 110 | - if ( $position == 'left_space' ) { |
|
| 111 | - $position = 'left'; |
|
| 112 | - } |
|
| 110 | + if ( $position == 'left_space' ) { |
|
| 111 | + $position = 'left'; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - if ( $position == 'right_space' ) { |
|
| 115 | - $position = 'right'; |
|
| 116 | - } |
|
| 114 | + if ( $position == 'right_space' ) { |
|
| 115 | + $position = 'right'; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - if ( $item->user_can_set_their_price() ) { |
|
| 119 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
| 120 | - $minimum = (float) $item->get_minimum_price(); |
|
| 121 | - $validate_minimum = ''; |
|
| 122 | - $class = ''; |
|
| 123 | - $data_minimum = ''; |
|
| 118 | + if ( $item->user_can_set_their_price() ) { |
|
| 119 | + $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
| 120 | + $minimum = (float) $item->get_minimum_price(); |
|
| 121 | + $validate_minimum = ''; |
|
| 122 | + $class = ''; |
|
| 123 | + $data_minimum = ''; |
|
| 124 | 124 | |
| 125 | - if ( $minimum > 0 ) { |
|
| 126 | - $validate_minimum = sprintf( |
|
| 127 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
| 128 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
| 129 | - ); |
|
| 125 | + if ( $minimum > 0 ) { |
|
| 126 | + $validate_minimum = sprintf( |
|
| 127 | + esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
| 128 | + strip_tags( wpinv_price( $minimum, $currency ) ) |
|
| 129 | + ); |
|
| 130 | 130 | |
| 131 | - $class = 'getpaid-validate-minimum-amount'; |
|
| 131 | + $class = 'getpaid-validate-minimum-amount'; |
|
| 132 | 132 | |
| 133 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
| 134 | - } |
|
| 133 | + $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - ?> |
|
| 136 | + ?> |
|
| 137 | 137 | <div class="input-group input-group-sm"> |
| 138 | 138 | <?php if ( 'left' == $position ) : ?> |
| 139 | 139 | <div class="input-group-prepend"> |
@@ -158,43 +158,43 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | <?php |
| 160 | 160 | |
| 161 | - } else { |
|
| 162 | - echo wpinv_price( $item->get_price(), $currency ); |
|
| 161 | + } else { |
|
| 162 | + echo wpinv_price( $item->get_price(), $currency ); |
|
| 163 | 163 | |
| 164 | - ?> |
|
| 164 | + ?> |
|
| 165 | 165 | <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() ); ?>'> |
| 166 | 166 | <?php |
| 167 | - } |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - printf( |
|
| 170 | - '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
| 171 | - sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
| 172 | - ); |
|
| 173 | - } |
|
| 169 | + printf( |
|
| 170 | + '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
|
| 171 | + sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
| 172 | + ); |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | - // Item quantity. |
|
| 176 | - if ( 'quantity' == $key ) { |
|
| 175 | + // Item quantity. |
|
| 176 | + if ( 'quantity' == $key ) { |
|
| 177 | 177 | |
| 178 | - if ( $item->allows_quantities() ) { |
|
| 179 | - ?> |
|
| 178 | + if ( $item->allows_quantities() ) { |
|
| 179 | + ?> |
|
| 180 | 180 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="0.01" 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> |
| 181 | 181 | <?php |
| 182 | - } else { |
|
| 183 | - echo (float) $item->get_quantity(); |
|
| 184 | - echo ' '; |
|
| 185 | - ?> |
|
| 182 | + } else { |
|
| 183 | + echo (float) $item->get_quantity(); |
|
| 184 | + echo ' '; |
|
| 185 | + ?> |
|
| 186 | 186 | <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(); ?>'> |
| 187 | 187 | <?php |
| 188 | - } |
|
| 188 | + } |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - // Item sub total. |
|
| 192 | - if ( 'subtotal' == $key ) { |
|
| 193 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
| 194 | - } |
|
| 191 | + // Item sub total. |
|
| 192 | + if ( 'subtotal' == $key ) { |
|
| 193 | + echo wpinv_price( $item->get_sub_total(), $currency ); |
|
| 194 | + } |
|
| 195 | 195 | |
| 196 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
| 197 | - ?> |
|
| 196 | + do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
| 197 | + ?> |
|
| 198 | 198 | |
| 199 | 199 | </div> |
| 200 | 200 | |
@@ -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 | -$max_qty = wpinv_item_max_buyable_quantity( $item->get_id() ); |
|
| 17 | +$max_qty = wpinv_item_max_buyable_quantity($item->get_id()); |
|
| 18 | 18 | ?> |
| 19 | 19 | <div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo (int) $item->get_id(); ?> border-bottom py-2 px-3'> |
| 20 | 20 | |
| 21 | 21 | <div class="form-row needs-validation"> |
| 22 | 22 | |
| 23 | - <?php foreach ( array_keys( $columns ) as $key ) : ?> |
|
| 23 | + <?php foreach (array_keys($columns) as $key) : ?> |
|
| 24 | 24 | |
| 25 | - <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ) ) ) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?> getpaid-form-cart-item-<?php echo sanitize_html_class( $key ); ?>-<?php echo (int) $item->get_id(); ?>"> |
|
| 25 | + <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'))) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?> getpaid-form-cart-item-<?php echo sanitize_html_class($key); ?>-<?php echo (int) $item->get_id(); ?>"> |
|
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | 28 | |
| 29 | 29 | // Fires before printing a line item column. |
| 30 | - do_action( "getpaid_form_cart_item_before_$key", $item, $form ); |
|
| 30 | + do_action("getpaid_form_cart_item_before_$key", $item, $form); |
|
| 31 | 31 | |
| 32 | 32 | // Item name. |
| 33 | - if ( 'name' == $key ) { |
|
| 33 | + if ('name' == $key) { |
|
| 34 | 34 | |
| 35 | 35 | ob_start(); |
| 36 | 36 | // And an optional description. |
| 37 | 37 | $description = $item->get_description(); |
| 38 | 38 | |
| 39 | - if ( ! empty( $description ) ) { |
|
| 40 | - $description = wp_kses_post( $description ); |
|
| 39 | + if (!empty($description)) { |
|
| 40 | + $description = wp_kses_post($description); |
|
| 41 | 41 | echo "<small class='form-text text-muted pr-2 m-0'>$description</small>"; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // Price help text. |
| 45 | - $description = getpaid_item_recurring_price_help_text( $item, $currency ); |
|
| 46 | - if ( $description ) { |
|
| 45 | + $description = getpaid_item_recurring_price_help_text($item, $currency); |
|
| 46 | + if ($description) { |
|
| 47 | 47 | echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>"; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - do_action( 'getpaid_payment_form_cart_item_description', $item, $form ); |
|
| 50 | + do_action('getpaid_payment_form_cart_item_description', $item, $form); |
|
| 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,18 +64,18 @@ discard block |
||
| 64 | 64 | $description = ob_get_clean(); |
| 65 | 65 | |
| 66 | 66 | // Display the name. |
| 67 | - $tootip = empty( $description ) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
| 68 | - echo '<div class="mb-1">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>'; |
|
| 67 | + $tootip = empty($description) ? '' : ' ' . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>'; |
|
| 68 | + echo '<div class="mb-1">' . esc_html($item->get_name()) . wp_kses_post($tootip) . '</div>'; |
|
| 69 | 69 | |
| 70 | - if ( ! empty( $description ) ) { |
|
| 71 | - printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description ); |
|
| 70 | + if (!empty($description)) { |
|
| 71 | + printf('<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if ( $item->allows_quantities() ) { |
|
| 74 | + if ($item->allows_quantities()) { |
|
| 75 | 75 | printf( |
| 76 | 76 | '<small class="d-sm-none text-muted form-text">%s</small>', |
| 77 | 77 | sprintf( |
| 78 | - __( 'Qty %s', 'invoicing' ), |
|
| 78 | + __('Qty %s', 'invoicing'), |
|
| 79 | 79 | sprintf( |
| 80 | 80 | '<input |
| 81 | 81 | type="number" |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | printf( |
| 95 | 95 | '<small class="d-sm-none text-muted form-text">%s</small>', |
| 96 | 96 | sprintf( |
| 97 | - __( 'Qty %s', 'invoicing' ), |
|
| 97 | + __('Qty %s', 'invoicing'), |
|
| 98 | 98 | (float) $item->get_quantity() |
| 99 | 99 | ) |
| 100 | 100 | ); |
@@ -102,56 +102,56 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | // Item price. |
| 105 | - if ( 'price' == $key ) { |
|
| 105 | + if ('price' == $key) { |
|
| 106 | 106 | |
| 107 | 107 | // Set the currency position. |
| 108 | 108 | $position = wpinv_currency_position(); |
| 109 | 109 | |
| 110 | - if ( $position == 'left_space' ) { |
|
| 110 | + if ($position == 'left_space') { |
|
| 111 | 111 | $position = 'left'; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if ( $position == 'right_space' ) { |
|
| 114 | + if ($position == 'right_space') { |
|
| 115 | 115 | $position = 'right'; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if ( $item->user_can_set_their_price() ) { |
|
| 119 | - $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() ); |
|
| 118 | + if ($item->user_can_set_their_price()) { |
|
| 119 | + $price = max((float) $item->get_price(), (float) $item->get_minimum_price()); |
|
| 120 | 120 | $minimum = (float) $item->get_minimum_price(); |
| 121 | 121 | $validate_minimum = ''; |
| 122 | 122 | $class = ''; |
| 123 | 123 | $data_minimum = ''; |
| 124 | 124 | |
| 125 | - if ( $minimum > 0 ) { |
|
| 125 | + if ($minimum > 0) { |
|
| 126 | 126 | $validate_minimum = sprintf( |
| 127 | - esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ), |
|
| 128 | - strip_tags( wpinv_price( $minimum, $currency ) ) |
|
| 127 | + esc_attr__('The minimum allowed amount is %s', 'invoicing'), |
|
| 128 | + strip_tags(wpinv_price($minimum, $currency)) |
|
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | 131 | $class = 'getpaid-validate-minimum-amount'; |
| 132 | 132 | |
| 133 | - $data_minimum = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'"; |
|
| 133 | + $data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'"; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | ?> |
| 137 | 137 | <div class="input-group input-group-sm"> |
| 138 | - <?php if ( 'left' == $position ) : ?> |
|
| 138 | + <?php if ('left' == $position) : ?> |
|
| 139 | 139 | <div class="input-group-prepend"> |
| 140 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
| 140 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
| 141 | 141 | </div> |
| 142 | 142 | <?php endif; ?> |
| 143 | 143 | |
| 144 | - <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;"> |
|
| 144 | + <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;"> |
|
| 145 | 145 | |
| 146 | - <?php if ( ! empty( $validate_minimum ) ) : ?> |
|
| 146 | + <?php if (!empty($validate_minimum)) : ?> |
|
| 147 | 147 | <div class="invalid-tooltip"> |
| 148 | 148 | <?php echo $validate_minimum; ?> |
| 149 | 149 | </div> |
| 150 | 150 | <?php endif; ?> |
| 151 | 151 | |
| 152 | - <?php if ( 'left' != $position ) : ?> |
|
| 152 | + <?php if ('left' != $position) : ?> |
|
| 153 | 153 | <div class="input-group-append"> |
| 154 | - <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span> |
|
| 154 | + <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span> |
|
| 155 | 155 | </div> |
| 156 | 156 | <?php endif; ?> |
| 157 | 157 | </div> |
@@ -159,23 +159,23 @@ discard block |
||
| 159 | 159 | <?php |
| 160 | 160 | |
| 161 | 161 | } else { |
| 162 | - echo wpinv_price( $item->get_price(), $currency ); |
|
| 162 | + echo wpinv_price($item->get_price(), $currency); |
|
| 163 | 163 | |
| 164 | 164 | ?> |
| 165 | - <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() ); ?>'> |
|
| 165 | + <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()); ?>'> |
|
| 166 | 166 | <?php |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | printf( |
| 170 | 170 | '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>', |
| 171 | - sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) ) |
|
| 171 | + sprintf(__('Subtotal: %s', 'invoicing'), wpinv_price($item->get_sub_total(), $currency)) |
|
| 172 | 172 | ); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // Item quantity. |
| 176 | - if ( 'quantity' == $key ) { |
|
| 176 | + if ('quantity' == $key) { |
|
| 177 | 177 | |
| 178 | - if ( $item->allows_quantities() ) { |
|
| 178 | + if ($item->allows_quantities()) { |
|
| 179 | 179 | ?> |
| 180 | 180 | <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="0.01" 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> |
| 181 | 181 | <?php |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | // Item sub total. |
| 192 | - if ( 'subtotal' == $key ) { |
|
| 193 | - echo wpinv_price( $item->get_sub_total(), $currency ); |
|
| 192 | + if ('subtotal' == $key) { |
|
| 193 | + echo wpinv_price($item->get_sub_total(), $currency); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - do_action( "getpaid_payment_form_cart_item_$key", $item, $form ); |
|
| 196 | + do_action("getpaid_payment_form_cart_item_$key", $item, $form); |
|
| 197 | 197 | ?> |
| 198 | 198 | |
| 199 | 199 | </div> |
@@ -204,4 +204,4 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | </div> |
| 206 | 206 | <?php |
| 207 | -do_action( 'getpaid_payment_form_cart_item', $form, $item ); |
|
| 207 | +do_action('getpaid_payment_form_cart_item', $form, $item); |
|
@@ -11,26 +11,26 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | // Totals rows. |
| 13 | 13 | $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 |
|
| 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 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | $currency = $form->get_currency(); |
| 26 | 26 | $country = wpinv_get_default_country(); |
| 27 | 27 | |
| 28 | 28 | if ( ! empty( $form->invoice ) ) { |
| 29 | - $country = $form->invoice->get_country(); |
|
| 29 | + $country = $form->invoice->get_country(); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | if ( ! wpinv_use_taxes() && isset( $totals['tax'] ) ) { |
| 33 | - unset( $totals['tax'] ); |
|
| 33 | + unset( $totals['tax'] ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | do_action( 'getpaid_before_payment_form_cart_totals', $form, $totals ); |
@@ -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' ) ) ) { |
|
| 66 | - echo wpinv_price( 0, $currency ); |
|
| 67 | - } |
|
| 64 | + // Total tax. |
|
| 65 | + if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ) ) ) { |
|
| 66 | + echo wpinv_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 | |
@@ -7,17 +7,17 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // Totals rows. |
| 13 | 13 | $totals = apply_filters( |
| 14 | 14 | 'getpaid_payment_form_cart_table_totals', |
| 15 | 15 | array( |
| 16 | - 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
| 17 | - 'tax' => __( 'Tax', 'invoicing' ), |
|
| 18 | - 'fees' => __( 'Fee', 'invoicing' ), |
|
| 19 | - 'discount' => __( 'Discount', 'invoicing' ), |
|
| 20 | - 'total' => __( 'Total', 'invoicing' ), |
|
| 16 | + 'subtotal' => __('Subtotal', 'invoicing'), |
|
| 17 | + 'tax' => __('Tax', 'invoicing'), |
|
| 18 | + 'fees' => __('Fee', 'invoicing'), |
|
| 19 | + 'discount' => __('Discount', 'invoicing'), |
|
| 20 | + 'total' => __('Total', 'invoicing'), |
|
| 21 | 21 | ), |
| 22 | 22 | $form |
| 23 | 23 | ); |
@@ -25,15 +25,15 @@ discard block |
||
| 25 | 25 | $currency = $form->get_currency(); |
| 26 | 26 | $country = wpinv_get_default_country(); |
| 27 | 27 | |
| 28 | -if ( ! empty( $form->invoice ) ) { |
|
| 29 | - $country = $form->invoice->get_country(); |
|
| 28 | +if (!empty($form->invoice)) { |
|
| 29 | + $country = $form->invoice->get_country(); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | -if ( ! wpinv_use_taxes() && isset( $totals['tax'] ) ) { |
|
| 33 | - unset( $totals['tax'] ); |
|
| 32 | +if (!wpinv_use_taxes() && isset($totals['tax'])) { |
|
| 33 | + unset($totals['tax']); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | -do_action( 'getpaid_before_payment_form_cart_totals', $form, $totals ); |
|
| 36 | +do_action('getpaid_before_payment_form_cart_totals', $form, $totals); |
|
| 37 | 37 | |
| 38 | 38 | ?> |
| 39 | 39 | <style> |
@@ -47,26 +47,26 @@ discard block |
||
| 47 | 47 | <div class="row"> |
| 48 | 48 | <div class="col-12 offset-sm-6 col-sm-6 border-sm-left pl-sm-0"> |
| 49 | 49 | |
| 50 | - <?php foreach ( $totals as $key => $label ) : ?> |
|
| 50 | + <?php foreach ($totals as $key => $label) : ?> |
|
| 51 | 51 | |
| 52 | - <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr( $key ); ?> font-weight-bold py-2 px-3 <?php echo 'total' == $key ? 'bg-light' : 'border-bottom'; ?>"> |
|
| 52 | + <div class="getpaid-form-cart-totals-col getpaid-form-cart-totals-<?php echo esc_attr($key); ?> font-weight-bold py-2 px-3 <?php echo 'total' == $key ? 'bg-light' : 'border-bottom'; ?>"> |
|
| 53 | 53 | |
| 54 | 54 | <div class="form-row"> |
| 55 | 55 | |
| 56 | 56 | <div class="col-8 pl-sm-0 getpaid-payment-form-line-totals-label"> |
| 57 | - <?php echo esc_html( $label ); ?> |
|
| 57 | + <?php echo esc_html($label); ?> |
|
| 58 | 58 | </div> |
| 59 | 59 | |
| 60 | - <div class="col-4 getpaid-payment-form-line-totals-value getpaid-form-cart-totals-total-<?php echo esc_attr( $key ); ?>"> |
|
| 60 | + <div class="col-4 getpaid-payment-form-line-totals-value getpaid-form-cart-totals-total-<?php echo esc_attr($key); ?>"> |
|
| 61 | 61 | |
| 62 | 62 | <?php |
| 63 | 63 | |
| 64 | 64 | // Total tax. |
| 65 | - if ( in_array( $key, array( 'tax', 'discount', 'subtotal', 'total', 'fees' ) ) ) { |
|
| 66 | - echo wpinv_price( 0, $currency ); |
|
| 65 | + if (in_array($key, array('tax', 'discount', 'subtotal', 'total', 'fees'))) { |
|
| 66 | + echo wpinv_price(0, $currency); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - do_action( "getpaid_payment_form_cart_totals_$key", $form ); |
|
| 69 | + do_action("getpaid_payment_form_cart_totals_$key", $form); |
|
| 70 | 70 | ?> |
| 71 | 71 | |
| 72 | 72 | </div> |
@@ -82,4 +82,4 @@ discard block |
||
| 82 | 82 | </div> |
| 83 | 83 | |
| 84 | 84 | <?php |
| 85 | -do_action( 'getpaid_payment_form_cart_totals', $form, $totals ); |
|
| 85 | +do_action('getpaid_payment_form_cart_totals', $form, $totals); |
|
@@ -7,31 +7,31 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // Prepare the selectable items. |
| 13 | 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() ); |
|
| 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 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( empty( $selectable ) ) { |
|
| 20 | +if (empty($selectable)) { |
|
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | echo '<div class="getpaid-payment-form-items-checkbox form-group">'; |
| 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 | 30 | echo aui()->input( |
| 31 | 31 | array( |
| 32 | 32 | 'type' => 'checkbox', |
| 33 | 33 | 'name' => 'getpaid-payment-form-selected-item', |
| 34 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ) . $item_id, |
|
| 34 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid('_') . $item_id, |
|
| 35 | 35 | 'label' => $item_name, |
| 36 | 36 | 'value' => $item_id, |
| 37 | 37 | 'no_wrap' => true, |
@@ -7,17 +7,17 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // Prepare the selectable items. |
| 13 | 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() ) ); |
|
| 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 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if ( empty( $selectable ) ) { |
|
| 20 | +if (empty($selectable)) { |
|
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | echo aui()->select( |
| 28 | 28 | array( |
| 29 | 29 | 'name' => 'getpaid-payment-form-selected-item', |
| 30 | - 'id' => 'getpaid-payment-form-selected-item' . uniqid( '_' ), |
|
| 30 | + 'id' => 'getpaid-payment-form-selected-item' . uniqid('_'), |
|
| 31 | 31 | 'required' => true, |
| 32 | - 'label' => __( 'Select Item', 'invoicing' ), |
|
| 32 | + 'label' => __('Select Item', 'invoicing'), |
|
| 33 | 33 | 'label_type' => 'vertical', |
| 34 | 34 | 'inline' => false, |
| 35 | 35 | 'options' => $selectable, |