@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // MUST have WordPress. |
| 3 | -if ( ! defined( 'WPINC' ) ) { |
|
| 3 | +if (!defined('WPINC')) { |
|
| 4 | 4 | exit; |
| 5 | 5 | } |
| 6 | 6 | |
@@ -11,23 +11,23 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | * @param WP_Post $post |
| 13 | 13 | */ |
| 14 | - public static function output_details( $post ) { |
|
| 15 | - $details = get_post_meta( $post->ID, 'payment_form_data', true ); |
|
| 14 | + public static function output_details($post) { |
|
| 15 | + $details = get_post_meta($post->ID, 'payment_form_data', true); |
|
| 16 | 16 | |
| 17 | - if ( ! is_array( $details ) ) { |
|
| 17 | + if (!is_array($details)) { |
|
| 18 | 18 | return; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | echo '<div class="bsui"> <div class="form-row row">'; |
| 22 | 22 | |
| 23 | - foreach ( $details as $key => $value ) { |
|
| 24 | - $key = esc_html( $key ); |
|
| 23 | + foreach ($details as $key => $value) { |
|
| 24 | + $key = esc_html($key); |
|
| 25 | 25 | |
| 26 | - if ( is_array( $value ) ) { |
|
| 27 | - $value = implode( ',', $value ); |
|
| 26 | + if (is_array($value)) { |
|
| 27 | + $value = implode(',', $value); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - echo wp_kses_post( "<div class='col-12'><strong>$key:</strong></div><div class='col-12 form-group mb-3'>$value</div>" ); |
|
| 30 | + echo wp_kses_post("<div class='col-12'><strong>$key:</strong></div><div class='col-12 form-group mb-3'>$value</div>"); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | echo '</div></div>'; |
@@ -39,18 +39,18 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @param WP_Post $post |
| 41 | 41 | */ |
| 42 | - public static function output_shortcode( $post ) { |
|
| 42 | + public static function output_shortcode($post) { |
|
| 43 | 43 | |
| 44 | - if ( ! is_numeric( $post ) ) { |
|
| 44 | + if (!is_numeric($post)) { |
|
| 45 | 45 | $post = $post->ID; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if ( $post == wpinv_get_default_payment_form() ) { |
|
| 48 | + if ($post == wpinv_get_default_payment_form()) { |
|
| 49 | 49 | echo '—'; |
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - echo "<input type='text' style='min-width: 220px;' value='[getpaid form=" . absint( $post ) . "]' disabled>"; |
|
| 53 | + echo "<input type='text' style='min-width: 220px;' value='[getpaid form=" . absint($post) . "]' disabled>"; |
|
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | |
@@ -7,14 +7,14 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -if ( empty( $text ) ) { |
|
| 13 | - $text = __( 'Your IP address is:', 'invoicing' ); |
|
| 12 | +if (empty($text)) { |
|
| 13 | + $text = __('Your IP address is:', 'invoicing'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | ?> |
| 17 | 17 | <div class="form-group mb-3 getpaid-ip-info"> |
| 18 | - <span><?php echo wp_kses_post( $text ); ?></span> |
|
| 19 | - <strong><?php echo esc_html( wpinv_get_ip() ); ?></strong> |
|
| 18 | + <span><?php echo wp_kses_post($text); ?></span> |
|
| 19 | + <strong><?php echo esc_html(wpinv_get_ip()); ?></strong> |
|
| 20 | 20 | </div> |
@@ -7,33 +7,33 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 11 | - |
|
| 12 | -$label = empty( $label ) ? '' : wp_kses_post( $label ); |
|
| 13 | -$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) ); |
|
| 14 | -$id = esc_attr( $id ); |
|
| 15 | -$_id = $id . uniqid( '_' ); |
|
| 16 | -$max_file_num = empty( $max_file_num ) ? 1 : absint( $max_file_num ); |
|
| 17 | -$file_types = empty( $file_types ) ? array( 'jpg|jpeg|jpe', 'gif', 'png' ) : $file_types; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | + |
|
| 12 | +$label = empty($label) ? '' : wp_kses_post($label); |
|
| 13 | +$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label)); |
|
| 14 | +$id = esc_attr($id); |
|
| 15 | +$_id = $id . uniqid('_'); |
|
| 16 | +$max_file_num = empty($max_file_num) ? 1 : absint($max_file_num); |
|
| 17 | +$file_types = empty($file_types) ? array('jpg|jpeg|jpe', 'gif', 'png') : $file_types; |
|
| 18 | 18 | $all_types = getpaid_get_allowed_mime_types(); |
| 19 | 19 | $types = array(); |
| 20 | 20 | $_types = array(); |
| 21 | 21 | |
| 22 | -foreach ( $file_types as $file_type ) { |
|
| 22 | +foreach ($file_types as $file_type) { |
|
| 23 | 23 | |
| 24 | - if ( isset( $all_types[ $file_type ] ) ) { |
|
| 25 | - $types[] = $all_types[ $file_type ]; |
|
| 26 | - $file_type = explode( '|', $file_type ); |
|
| 24 | + if (isset($all_types[$file_type])) { |
|
| 25 | + $types[] = $all_types[$file_type]; |
|
| 26 | + $file_type = explode('|', $file_type); |
|
| 27 | 27 | |
| 28 | - foreach ( $file_type as $type ) { |
|
| 29 | - $type = trim( $type ); |
|
| 28 | + foreach ($file_type as $type) { |
|
| 29 | + $type = trim($type); |
|
| 30 | 30 | $types[] = ".$type"; |
| 31 | 31 | $_types[] = $type; |
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | -if ( ! empty( $required ) ) { |
|
| 36 | +if (!empty($required)) { |
|
| 37 | 37 | $label .= "<span class='text-danger'> *</span>"; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -41,16 +41,16 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | <label><span v-html="form_element.label"></span></label> |
| 43 | 43 | |
| 44 | -<div class="form-group mb-3 <?php echo esc_attr( $label_class ); ?>" data-name="<?php echo esc_attr( $id ); ?>" data-max="<?php echo esc_attr( $max_file_num ); ?>"> |
|
| 45 | - <label for="<?php echo esc_attr( $id ); ?>"><?php echo wp_kses_post( $label ); ?></label> |
|
| 46 | - <input type="file" class="sr-only getpaid-files-input" id="<?php echo esc_attr( $id ); ?>" accept="<?php echo esc_attr( implode( ', ', $types ) ); ?>" data-extensions="<?php echo esc_attr( wp_json_encode( $_types ) ); ?>" <?php echo $max_file_num == 1 ? '' : 'multiple="multiple"'; ?>> |
|
| 44 | +<div class="form-group mb-3 <?php echo esc_attr($label_class); ?>" data-name="<?php echo esc_attr($id); ?>" data-max="<?php echo esc_attr($max_file_num); ?>"> |
|
| 45 | + <label for="<?php echo esc_attr($id); ?>"><?php echo wp_kses_post($label); ?></label> |
|
| 46 | + <input type="file" class="sr-only getpaid-files-input" id="<?php echo esc_attr($id); ?>" accept="<?php echo esc_attr(implode(', ', $types)); ?>" data-extensions="<?php echo esc_attr(wp_json_encode($_types)); ?>" <?php echo $max_file_num == 1 ? '' : 'multiple="multiple"'; ?>> |
|
| 47 | 47 | |
| 48 | - <label for="<?php echo esc_attr( $id ); ?>" class="getpaid-file-upload-element d-flex w-100 flex-column align-items-center justify-content-center p-2 mb-2"> |
|
| 48 | + <label for="<?php echo esc_attr($id); ?>" class="getpaid-file-upload-element d-flex w-100 flex-column align-items-center justify-content-center p-2 mb-2"> |
|
| 49 | 49 | <div class="h5 text-dark"> |
| 50 | - <?php echo esc_html( _n( 'Drag your file to this area or click to upload', 'Drag files to this area or click to upload', $max_file_num, 'invoicing' ) ); ?> |
|
| 50 | + <?php echo esc_html(_n('Drag your file to this area or click to upload', 'Drag files to this area or click to upload', $max_file_num, 'invoicing')); ?> |
|
| 51 | 51 | </div> |
| 52 | - <?php if ( ! empty( $description ) ) : ?> |
|
| 53 | - <small class="form-text text-muted"><?php echo wp_kses_post( $description ); ?></small> |
|
| 52 | + <?php if (!empty($description)) : ?> |
|
| 53 | + <small class="form-text text-muted"><?php echo wp_kses_post($description); ?></small> |
|
| 54 | 54 | <?php endif; ?> |
| 55 | 55 | </label> |
| 56 | 56 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | <div class="form-row row mb-3 d-none getpaid-progress-template"> |
| 60 | 60 | |
| 61 | 61 | <div class="overflow-hidden text-nowrap col-7 col-sm-4"> |
| 62 | - <a href="" class="close float-none" title="<?php esc_attr_e( 'Remove File', 'invoicing' ); ?>">×<span class="sr-only"><?php esc_html_e( 'Close', 'invoicing' ); ?></span></a> |
|
| 62 | + <a href="" class="close float-none" title="<?php esc_attr_e('Remove File', 'invoicing'); ?>">×<span class="sr-only"><?php esc_html_e('Close', 'invoicing'); ?></span></a> |
|
| 63 | 63 | <i class="fa fa-file" aria-hidden="true"></i> <span class="getpaid-progress-file-name"></span> |
| 64 | 64 | </div> |
| 65 | 65 | |
@@ -7,13 +7,13 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | -if ( empty( $text ) ) { |
|
| 13 | - $text = __( 'Total to pay:', 'invoicing' ); |
|
| 12 | +if (empty($text)) { |
|
| 13 | + $text = __('Total to pay:', 'invoicing'); |
|
| 14 | 14 | } |
| 15 | 15 | ?> |
| 16 | 16 | <div class="form-group mb-3 mt-4"> |
| 17 | - <strong><?php echo esc_html( $text ); ?></strong> |
|
| 17 | + <strong><?php echo esc_html($text); ?></strong> |
|
| 18 | 18 | <span class="getpaid-checkout-total-payable"></span> |
| 19 | 19 | </div> |
@@ -7,34 +7,34 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | // Cart table columns. |
| 13 | 13 | $columns = array( |
| 14 | - 'name' => __( 'Item', 'invoicing' ), |
|
| 15 | - 'price' => __( 'Price', 'invoicing' ), |
|
| 16 | - 'quantity' => __( 'Qty', 'invoicing' ), |
|
| 17 | - 'subtotal' => __( 'Subtotal', 'invoicing' ), |
|
| 14 | + 'name' => __('Item', 'invoicing'), |
|
| 15 | + 'price' => __('Price', 'invoicing'), |
|
| 16 | + 'quantity' => __('Qty', 'invoicing'), |
|
| 17 | + 'subtotal' => __('Subtotal', 'invoicing'), |
|
| 18 | 18 | ); |
| 19 | 19 | |
| 20 | -if ( ! empty( $form->invoice ) ) { |
|
| 21 | - $columns = getpaid_invoice_item_columns( $form->invoice ); |
|
| 20 | +if (!empty($form->invoice)) { |
|
| 21 | + $columns = getpaid_invoice_item_columns($form->invoice); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -if ( isset( $columns['tax_rate'] ) ) { |
|
| 25 | - unset( $columns['tax_rate'] ); |
|
| 24 | +if (isset($columns['tax_rate'])) { |
|
| 25 | + unset($columns['tax_rate']); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | -$columns = apply_filters( 'getpaid_payment_form_cart_table_columns', $columns, $form ); |
|
| 28 | +$columns = apply_filters('getpaid_payment_form_cart_table_columns', $columns, $form); |
|
| 29 | 29 | |
| 30 | 30 | ?> |
| 31 | 31 | <div class="getpaid-payment-form-items-cart border form-group mb-3"> |
| 32 | 32 | |
| 33 | 33 | <div class="getpaid-payment-form-items-cart-header font-weight-bold bg-light border-bottom py-2 px-3"> |
| 34 | 34 | <div class="form-row row"> |
| 35 | - <?php foreach ( $columns as $key => $label ) : ?> |
|
| 36 | - <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ) ) ) ? 'd-none d-sm-block' : ''; ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>"> |
|
| 37 | - <span><?php echo esc_html( $label ); ?></span> |
|
| 35 | + <?php foreach ($columns as $key => $label) : ?> |
|
| 36 | + <div class="<?php echo 'name' == $key ? 'col-6' : 'col'; ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'))) ? 'd-none d-sm-block' : ''; ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?>"> |
|
| 37 | + <span><?php echo esc_html($label); ?></span> |
|
| 38 | 38 | </div> |
| 39 | 39 | <?php endforeach; ?> |
| 40 | 40 | </div> |
@@ -43,16 +43,16 @@ discard block |
||
| 43 | 43 | <?php |
| 44 | 44 | |
| 45 | 45 | // Display the item totals. |
| 46 | - foreach ( $form->get_items() as $item ) { |
|
| 47 | - wpinv_get_template( 'payment-forms/cart-item.php', compact( 'form', 'item', 'columns' ) ); |
|
| 46 | + foreach ($form->get_items() as $item) { |
|
| 47 | + wpinv_get_template('payment-forms/cart-item.php', compact('form', 'item', 'columns')); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // Display the cart totals. |
| 51 | - wpinv_get_template( 'payment-forms/cart-totals.php', compact( 'form' ) ); |
|
| 51 | + wpinv_get_template('payment-forms/cart-totals.php', compact('form')); |
|
| 52 | 52 | |
| 53 | 53 | ?> |
| 54 | 54 | </div> |
| 55 | 55 | |
| 56 | 56 | <?php |
| 57 | 57 | |
| 58 | -do_action( 'getpaid_after_payment_form_cart', $form ); |
|
| 58 | +do_action('getpaid_after_payment_form_cart', $form); |
|
@@ -7,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 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 | 30 | 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,11 +7,11 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | 14 | <div class='form-group mb-3'> |
| 15 | - <label :for="active_form_element.id + '_edit'"><?php esc_html_e( 'The total payable text', 'invoicing' ); ?></label> |
|
| 15 | + <label :for="active_form_element.id + '_edit'"><?php esc_html_e('The total payable text', 'invoicing'); ?></label> |
|
| 16 | 16 | <textarea :id="active_form_element.id + '_edit'" v-model='active_form_element.text' class='form-control' rows='3'></textarea> |
| 17 | 17 | </div> |
@@ -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 company name. |
| 13 | -$company_name = wpinv_get_option( 'vat_company_name' ); |
|
| 13 | +$company_name = wpinv_get_option('vat_company_name'); |
|
| 14 | 14 | |
| 15 | -if ( empty( $company_name ) ) { |
|
| 15 | +if (empty($company_name)) { |
|
| 16 | 16 | $company_name = wpinv_get_business_name(); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | // Prepare the VAT number. |
| 20 | -$vat_number = wpinv_get_option( 'vat_number' ); |
|
| 20 | +$vat_number = wpinv_get_option('vat_number'); |
|
| 21 | 21 | |
| 22 | 22 | ?> |
| 23 | 23 | <div class="getpaid-company-address form-group mb-3"> |
@@ -25,36 +25,36 @@ discard block |
||
| 25 | 25 | <div class="row"> |
| 26 | 26 | |
| 27 | 27 | <div class="invoice-company-address-label col-2"> |
| 28 | - <strong><?php esc_html_e( 'From:', 'invoicing' ); ?></strong> |
|
| 28 | + <strong><?php esc_html_e('From:', 'invoicing'); ?></strong> |
|
| 29 | 29 | </div> |
| 30 | 30 | |
| 31 | 31 | <div class="invoice-company-address-value col-10"> |
| 32 | 32 | |
| 33 | - <?php do_action( 'getpaid_company_address_top' ); ?> |
|
| 33 | + <?php do_action('getpaid_company_address_top'); ?> |
|
| 34 | 34 | |
| 35 | 35 | <div class="name"> |
| 36 | - <a target="_blank" class="text-dark" href="<?php echo esc_url( wpinv_get_business_website() ); ?>"> |
|
| 37 | - <?php echo esc_html( $company_name ); ?> |
|
| 36 | + <a target="_blank" class="text-dark" href="<?php echo esc_url(wpinv_get_business_website()); ?>"> |
|
| 37 | + <?php echo esc_html($company_name); ?> |
|
| 38 | 38 | </a> |
| 39 | 39 | </div> |
| 40 | 40 | |
| 41 | - <?php if ( $address = wpinv_get_business_address() ) { ?> |
|
| 42 | - <?php echo wp_kses_post( $address ); ?> |
|
| 41 | + <?php if ($address = wpinv_get_business_address()) { ?> |
|
| 42 | + <?php echo wp_kses_post($address); ?> |
|
| 43 | 43 | <?php } ?> |
| 44 | 44 | |
| 45 | - <?php if ( $email_from = wpinv_mail_get_from_address() ) { ?> |
|
| 45 | + <?php if ($email_from = wpinv_mail_get_from_address()) { ?> |
|
| 46 | 46 | <div class="email_from"> |
| 47 | - <?php echo wp_sprintf( esc_html__( 'Email: %s', 'invoicing' ), esc_html( $email_from ) ); ?> |
|
| 47 | + <?php echo wp_sprintf(esc_html__('Email: %s', 'invoicing'), esc_html($email_from)); ?> |
|
| 48 | 48 | </div> |
| 49 | 49 | <?php } ?> |
| 50 | 50 | |
| 51 | - <?php if ( ! empty( $vat_number ) ) { ?> |
|
| 51 | + <?php if (!empty($vat_number)) { ?> |
|
| 52 | 52 | <div class="email_from"> |
| 53 | - <?php echo wp_sprintf( esc_html__( 'VAT Number: %s', 'invoicing' ), esc_html( $vat_number ) ); ?> |
|
| 53 | + <?php echo wp_sprintf(esc_html__('VAT Number: %s', 'invoicing'), esc_html($vat_number)); ?> |
|
| 54 | 54 | </div> |
| 55 | 55 | <?php } ?> |
| 56 | 56 | |
| 57 | - <?php do_action( 'getpaid_company_address_bottom' ); ?> |
|
| 57 | + <?php do_action('getpaid_company_address_bottom'); ?> |
|
| 58 | 58 | |
| 59 | 59 | </div> |
| 60 | 60 | |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if (!defined('ABSPATH')) { |
|
| 11 | 11 | exit; // Exit if accessed directly |
| 12 | 12 | } |
| 13 | 13 | |
@@ -21,24 +21,24 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param WP_Post $post |
| 23 | 23 | */ |
| 24 | - public static function output( $post ) { |
|
| 24 | + public static function output($post) { |
|
| 25 | 25 | |
| 26 | 26 | // Prepare the discount. |
| 27 | - $discount = new WPInv_Discount( $post ); |
|
| 27 | + $discount = new WPInv_Discount($post); |
|
| 28 | 28 | |
| 29 | 29 | // Nonce field. |
| 30 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
| 30 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
| 31 | 31 | |
| 32 | - do_action( 'wpinv_discount_form_top', $discount ); |
|
| 32 | + do_action('wpinv_discount_form_top', $discount); |
|
| 33 | 33 | |
| 34 | 34 | // Set the currency position. |
| 35 | 35 | $position = wpinv_currency_position(); |
| 36 | 36 | |
| 37 | - if ( $position == 'left_space' ) { |
|
| 37 | + if ($position == 'left_space') { |
|
| 38 | 38 | $position = 'left'; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if ( $position == 'right_space' ) { |
|
| 41 | + if ($position == 'right_space') { |
|
| 42 | 42 | $position = 'right'; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -52,69 +52,69 @@ discard block |
||
| 52 | 52 | </style> |
| 53 | 53 | <div class='bsui' style='max-width: 600px;padding-top: 10px;'> |
| 54 | 54 | |
| 55 | - <?php do_action( 'wpinv_discount_form_first', $discount ); ?> |
|
| 55 | + <?php do_action('wpinv_discount_form_first', $discount); ?> |
|
| 56 | 56 | |
| 57 | - <?php do_action( 'wpinv_discount_form_before_code', $discount ); ?> |
|
| 57 | + <?php do_action('wpinv_discount_form_before_code', $discount); ?> |
|
| 58 | 58 | |
| 59 | 59 | <div class="form-group mb-3 row"> |
| 60 | 60 | <label for="wpinv_discount_code" class="col-sm-3 col-form-label"> |
| 61 | - <?php esc_html_e( 'Discount Code', 'invoicing' ); ?> |
|
| 61 | + <?php esc_html_e('Discount Code', 'invoicing'); ?> |
|
| 62 | 62 | </label> |
| 63 | 63 | <div class="col-sm-8"> |
| 64 | 64 | <div class="row"> |
| 65 | 65 | <div class="col-sm-12 form-group mb-3"> |
| 66 | - <input type="text" value="<?php echo esc_attr( $discount->get_code( 'edit' ) ); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" /> |
|
| 66 | + <input type="text" value="<?php echo esc_attr($discount->get_code('edit')); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" /> |
|
| 67 | 67 | </div> |
| 68 | 68 | <div class="col-sm-12"> |
| 69 | 69 | <?php |
| 70 | - do_action( 'wpinv_discount_form_before_single_use', $discount ); |
|
| 70 | + do_action('wpinv_discount_form_before_single_use', $discount); |
|
| 71 | 71 | |
| 72 | 72 | aui()->input( |
| 73 | 73 | array( |
| 74 | 74 | 'id' => 'wpinv_discount_single_use', |
| 75 | 75 | 'name' => 'wpinv_discount_single_use', |
| 76 | 76 | 'type' => 'checkbox', |
| 77 | - 'label' => __( 'Each customer can only use this discount once', 'invoicing' ), |
|
| 77 | + 'label' => __('Each customer can only use this discount once', 'invoicing'), |
|
| 78 | 78 | 'value' => '1', |
| 79 | 79 | 'checked' => $discount->is_single_use(), |
| 80 | 80 | ), |
| 81 | 81 | true |
| 82 | 82 | ); |
| 83 | 83 | |
| 84 | - do_action( 'wpinv_discount_form_single_use', $discount ); |
|
| 84 | + do_action('wpinv_discount_form_single_use', $discount); |
|
| 85 | 85 | ?> |
| 86 | 86 | </div> |
| 87 | 87 | <div class="col-sm-12"> |
| 88 | 88 | <?php |
| 89 | - do_action( 'wpinv_discount_form_before_recurring', $discount ); |
|
| 89 | + do_action('wpinv_discount_form_before_recurring', $discount); |
|
| 90 | 90 | |
| 91 | 91 | aui()->input( |
| 92 | 92 | array( |
| 93 | 93 | 'id' => 'wpinv_discount_recurring', |
| 94 | 94 | 'name' => 'wpinv_discount_recurring', |
| 95 | 95 | 'type' => 'checkbox', |
| 96 | - 'label' => __( 'Apply this discount to all recurring payments for subscriptions', 'invoicing' ), |
|
| 96 | + 'label' => __('Apply this discount to all recurring payments for subscriptions', 'invoicing'), |
|
| 97 | 97 | 'value' => '1', |
| 98 | 98 | 'checked' => $discount->is_recurring(), |
| 99 | 99 | ), |
| 100 | 100 | true |
| 101 | 101 | ); |
| 102 | 102 | |
| 103 | - do_action( 'wpinv_discount_form_recurring', $discount ); |
|
| 103 | + do_action('wpinv_discount_form_recurring', $discount); |
|
| 104 | 104 | ?> |
| 105 | 105 | </div> |
| 106 | 106 | </div> |
| 107 | 107 | </div> |
| 108 | 108 | <div class="col-sm-1 pt-2 pl-0"> |
| 109 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter a discount code such as 10OFF.', 'invoicing' ); ?>"></span> |
|
| 109 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter a discount code such as 10OFF.', 'invoicing'); ?>"></span> |
|
| 110 | 110 | </div> |
| 111 | 111 | </div> |
| 112 | - <?php do_action( 'wpinv_discount_form_code', $discount ); ?> |
|
| 112 | + <?php do_action('wpinv_discount_form_code', $discount); ?> |
|
| 113 | 113 | |
| 114 | - <?php do_action( 'wpinv_discount_form_before_type', $discount ); ?> |
|
| 114 | + <?php do_action('wpinv_discount_form_before_type', $discount); ?> |
|
| 115 | 115 | <div class="form-group mb-3 row"> |
| 116 | 116 | <label for="wpinv_discount_type" class="col-sm-3 col-form-label"> |
| 117 | - <?php esc_html_e( 'Discount Type', 'invoicing' ); ?> |
|
| 117 | + <?php esc_html_e('Discount Type', 'invoicing'); ?> |
|
| 118 | 118 | </label> |
| 119 | 119 | <div class="col-sm-8"> |
| 120 | 120 | <?php |
@@ -122,9 +122,9 @@ discard block |
||
| 122 | 122 | array( |
| 123 | 123 | 'id' => 'wpinv_discount_type', |
| 124 | 124 | 'name' => 'wpinv_discount_type', |
| 125 | - 'label' => __( 'Discount Type', 'invoicing' ), |
|
| 126 | - 'placeholder' => __( 'Select Discount Type', 'invoicing' ), |
|
| 127 | - 'value' => $discount->get_type( 'edit' ), |
|
| 125 | + 'label' => __('Discount Type', 'invoicing'), |
|
| 126 | + 'placeholder' => __('Select Discount Type', 'invoicing'), |
|
| 127 | + 'value' => $discount->get_type('edit'), |
|
| 128 | 128 | 'select2' => true, |
| 129 | 129 | 'data-allow-clear' => 'false', |
| 130 | 130 | 'options' => wpinv_get_discount_types(), |
@@ -134,49 +134,49 @@ discard block |
||
| 134 | 134 | ?> |
| 135 | 135 | </div> |
| 136 | 136 | <div class="col-sm-1 pt-2 pl-0"> |
| 137 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Discount type.', 'invoicing' ); ?>"></span> |
|
| 137 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Discount type.', 'invoicing'); ?>"></span> |
|
| 138 | 138 | </div> |
| 139 | 139 | </div> |
| 140 | - <?php do_action( 'wpinv_discount_form_type', $discount ); ?> |
|
| 140 | + <?php do_action('wpinv_discount_form_type', $discount); ?> |
|
| 141 | 141 | |
| 142 | - <?php do_action( 'wpinv_discount_form_before_amount', $discount ); ?> |
|
| 143 | - <div class="form-group mb-3 row <?php echo esc_attr( $discount->get_type( 'edit' ) ); ?>" id="wpinv_discount_amount_wrap"> |
|
| 142 | + <?php do_action('wpinv_discount_form_before_amount', $discount); ?> |
|
| 143 | + <div class="form-group mb-3 row <?php echo esc_attr($discount->get_type('edit')); ?>" id="wpinv_discount_amount_wrap"> |
|
| 144 | 144 | <label for="wpinv_discount_amount" class="col-sm-3 col-form-label"> |
| 145 | - <?php esc_html_e( 'Discount Amount', 'invoicing' ); ?> |
|
| 145 | + <?php esc_html_e('Discount Amount', 'invoicing'); ?> |
|
| 146 | 146 | </label> |
| 147 | 147 | <div class="col-sm-8"> |
| 148 | 148 | <div class="input-group input-group-sm"> |
| 149 | 149 | |
| 150 | - <?php if ( 'left' == $position ) : ?> |
|
| 151 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 150 | + <?php if ('left' == $position) : ?> |
|
| 151 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
| 152 | 152 | <div class="input-group-prepend left wpinv-if-flat"> |
| 153 | 153 | <span class="input-group-text"> |
| 154 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
| 154 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
| 155 | 155 | </span> |
| 156 | 156 | </div> |
| 157 | 157 | <?php else : ?> |
| 158 | 158 | <span class="input-group-text left wpinv-if-flat"> |
| 159 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
| 159 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
| 160 | 160 | </span> |
| 161 | 161 | <?php endif; ?> |
| 162 | 162 | <?php endif; ?> |
| 163 | 163 | |
| 164 | - <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr( $discount->get_amount( 'edit' ) ); ?>" placeholder="0" class="form-control"> |
|
| 164 | + <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr($discount->get_amount('edit')); ?>" placeholder="0" class="form-control"> |
|
| 165 | 165 | |
| 166 | - <?php if ( 'right' == $position ) : ?> |
|
| 167 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 166 | + <?php if ('right' == $position) : ?> |
|
| 167 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
| 168 | 168 | <div class="input-group-append right wpinv-if-flat"> |
| 169 | 169 | <span class="input-group-text"> |
| 170 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
| 170 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
| 171 | 171 | </span> |
| 172 | 172 | </div> |
| 173 | 173 | <?php else : ?> |
| 174 | 174 | <span class="input-group-text left wpinv-if-flat"> |
| 175 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
| 175 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
| 176 | 176 | </span> |
| 177 | 177 | <?php endif; ?> |
| 178 | 178 | <?php endif; ?> |
| 179 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 179 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
| 180 | 180 | <div class="input-group-append right wpinv-if-percent"> |
| 181 | 181 | <span class="input-group-text">%</span> |
| 182 | 182 | </div> |
@@ -186,15 +186,15 @@ discard block |
||
| 186 | 186 | </div> |
| 187 | 187 | </div> |
| 188 | 188 | <div class="col-sm-1 pt-2 pl-0"> |
| 189 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the discount value. Ex: 10', 'invoicing' ); ?>"></span> |
|
| 189 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the discount value. Ex: 10', 'invoicing'); ?>"></span> |
|
| 190 | 190 | </div> |
| 191 | 191 | </div> |
| 192 | - <?php do_action( 'wpinv_discount_form_amount', $discount ); ?> |
|
| 192 | + <?php do_action('wpinv_discount_form_amount', $discount); ?> |
|
| 193 | 193 | |
| 194 | - <?php do_action( 'wpinv_discount_form_before_items', $discount ); ?> |
|
| 194 | + <?php do_action('wpinv_discount_form_before_items', $discount); ?> |
|
| 195 | 195 | <div class="form-group mb-3 row"> |
| 196 | 196 | <label for="wpinv_discount_items" class="col-sm-3 col-form-label"> |
| 197 | - <?php esc_html_e( 'Items', 'invoicing' ); ?> |
|
| 197 | + <?php esc_html_e('Items', 'invoicing'); ?> |
|
| 198 | 198 | </label> |
| 199 | 199 | <div class="col-sm-8"> |
| 200 | 200 | <?php |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | array( |
| 203 | 203 | 'id' => 'wpinv_discount_items', |
| 204 | 204 | 'name' => 'wpinv_discount_items[]', |
| 205 | - 'label' => __( 'Items', 'invoicing' ), |
|
| 206 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
| 207 | - 'value' => $discount->get_items( 'edit' ), |
|
| 205 | + 'label' => __('Items', 'invoicing'), |
|
| 206 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
| 207 | + 'value' => $discount->get_items('edit'), |
|
| 208 | 208 | 'select2' => true, |
| 209 | 209 | 'multiple' => true, |
| 210 | 210 | 'data-allow-clear' => 'false', |
@@ -215,15 +215,15 @@ discard block |
||
| 215 | 215 | ?> |
| 216 | 216 | </div> |
| 217 | 217 | <div class="col-sm-1 pt-2 pl-0"> |
| 218 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing' ); ?>"></span> |
|
| 218 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing'); ?>"></span> |
|
| 219 | 219 | </div> |
| 220 | 220 | </div> |
| 221 | - <?php do_action( 'wpinv_discount_form_items', $discount ); ?> |
|
| 221 | + <?php do_action('wpinv_discount_form_items', $discount); ?> |
|
| 222 | 222 | |
| 223 | - <?php do_action( 'wpinv_discount_form_before_excluded_items', $discount ); ?> |
|
| 223 | + <?php do_action('wpinv_discount_form_before_excluded_items', $discount); ?> |
|
| 224 | 224 | <div class="form-group mb-3 row"> |
| 225 | 225 | <label for="wpinv_discount_excluded_items" class="col-sm-3 col-form-label"> |
| 226 | - <?php esc_html_e( 'Excluded Items', 'invoicing' ); ?> |
|
| 226 | + <?php esc_html_e('Excluded Items', 'invoicing'); ?> |
|
| 227 | 227 | </label> |
| 228 | 228 | <div class="col-sm-8"> |
| 229 | 229 | <?php |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | array( |
| 232 | 232 | 'id' => 'wpinv_discount_excluded_items', |
| 233 | 233 | 'name' => 'wpinv_discount_excluded_items[]', |
| 234 | - 'label' => __( 'Excluded Items', 'invoicing' ), |
|
| 235 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
| 236 | - 'value' => $discount->get_excluded_items( 'edit' ), |
|
| 234 | + 'label' => __('Excluded Items', 'invoicing'), |
|
| 235 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
| 236 | + 'value' => $discount->get_excluded_items('edit'), |
|
| 237 | 237 | 'select2' => true, |
| 238 | 238 | 'multiple' => true, |
| 239 | 239 | 'data-allow-clear' => 'false', |
@@ -244,15 +244,15 @@ discard block |
||
| 244 | 244 | ?> |
| 245 | 245 | </div> |
| 246 | 246 | <div class="col-sm-1 pt-2 pl-0"> |
| 247 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select all the items that are not allowed to use this discount.', 'invoicing' ); ?>"></span> |
|
| 247 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select all the items that are not allowed to use this discount.', 'invoicing'); ?>"></span> |
|
| 248 | 248 | </div> |
| 249 | 249 | </div> |
| 250 | - <?php do_action( 'wpinv_discount_form_excluded_items', $discount ); ?> |
|
| 250 | + <?php do_action('wpinv_discount_form_excluded_items', $discount); ?> |
|
| 251 | 251 | |
| 252 | - <?php do_action( 'wpinv_discount_form_before_required_items', $discount ); ?> |
|
| 252 | + <?php do_action('wpinv_discount_form_before_required_items', $discount); ?> |
|
| 253 | 253 | <div class="form-group mb-3 row"> |
| 254 | 254 | <label for="wpinv_discount_required_items" class="col-sm-3 col-form-label"> |
| 255 | - <?php esc_html_e( 'Required Items', 'invoicing' ); ?> |
|
| 255 | + <?php esc_html_e('Required Items', 'invoicing'); ?> |
|
| 256 | 256 | </label> |
| 257 | 257 | <div class="col-sm-8"> |
| 258 | 258 | <?php |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | array( |
| 261 | 261 | 'id' => 'wpinv_discount_required_items', |
| 262 | 262 | 'name' => 'wpinv_discount_required_items[]', |
| 263 | - 'label' => __( 'Required Items', 'invoicing' ), |
|
| 264 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
| 265 | - 'value' => $discount->get_required_items( 'edit' ), |
|
| 263 | + 'label' => __('Required Items', 'invoicing'), |
|
| 264 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
| 265 | + 'value' => $discount->get_required_items('edit'), |
|
| 266 | 266 | 'select2' => true, |
| 267 | 267 | 'multiple' => true, |
| 268 | 268 | 'data-allow-clear' => 'false', |
@@ -273,15 +273,15 @@ discard block |
||
| 273 | 273 | ?> |
| 274 | 274 | </div> |
| 275 | 275 | <div class="col-sm-1 pt-2 pl-0"> |
| 276 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select all the items that are required to be in the cart before using this discount.', 'invoicing' ); ?>"></span> |
|
| 276 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select all the items that are required to be in the cart before using this discount.', 'invoicing'); ?>"></span> |
|
| 277 | 277 | </div> |
| 278 | 278 | </div> |
| 279 | - <?php do_action( 'wpinv_discount_form_required_items', $discount ); ?> |
|
| 279 | + <?php do_action('wpinv_discount_form_required_items', $discount); ?> |
|
| 280 | 280 | |
| 281 | - <?php do_action( 'wpinv_discount_form_before_start', $discount ); ?> |
|
| 281 | + <?php do_action('wpinv_discount_form_before_start', $discount); ?> |
|
| 282 | 282 | <div class="form-group mb-3 row"> |
| 283 | 283 | <label for="wpinv_discount_start" class="col-sm-3 col-form-label"> |
| 284 | - <?php esc_html_e( 'Start Date', 'invoicing' ); ?> |
|
| 284 | + <?php esc_html_e('Start Date', 'invoicing'); ?> |
|
| 285 | 285 | </label> |
| 286 | 286 | <div class="col-sm-8"> |
| 287 | 287 | <?php |
@@ -290,10 +290,10 @@ discard block |
||
| 290 | 290 | 'type' => 'datepicker', |
| 291 | 291 | 'id' => 'wpinv_discount_start', |
| 292 | 292 | 'name' => 'wpinv_discount_start', |
| 293 | - 'label' => __( 'Start Date', 'invoicing' ), |
|
| 293 | + 'label' => __('Start Date', 'invoicing'), |
|
| 294 | 294 | 'placeholder' => 'YYYY-MM-DD 00:00', |
| 295 | 295 | 'class' => 'form-control-sm', |
| 296 | - 'value' => $discount->get_start_date( 'edit' ), |
|
| 296 | + 'value' => $discount->get_start_date('edit'), |
|
| 297 | 297 | 'extra_attributes' => array( |
| 298 | 298 | 'data-enable-time' => 'true', |
| 299 | 299 | 'data-time_24hr' => 'true', |
@@ -305,15 +305,15 @@ discard block |
||
| 305 | 305 | ?> |
| 306 | 306 | </div> |
| 307 | 307 | <div class="col-sm-1 pt-2 pl-0"> |
| 308 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing' ); ?>"></span> |
|
| 308 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing'); ?>"></span> |
|
| 309 | 309 | </div> |
| 310 | 310 | </div> |
| 311 | - <?php do_action( 'wpinv_discount_form_start', $discount ); ?> |
|
| 311 | + <?php do_action('wpinv_discount_form_start', $discount); ?> |
|
| 312 | 312 | |
| 313 | - <?php do_action( 'wpinv_discount_form_before_expiration', $discount ); ?> |
|
| 313 | + <?php do_action('wpinv_discount_form_before_expiration', $discount); ?> |
|
| 314 | 314 | <div class="form-group mb-3 row"> |
| 315 | 315 | <label for="wpinv_discount_expiration" class="col-sm-3 col-form-label"> |
| 316 | - <?php esc_html_e( 'Expiration Date', 'invoicing' ); ?> |
|
| 316 | + <?php esc_html_e('Expiration Date', 'invoicing'); ?> |
|
| 317 | 317 | </label> |
| 318 | 318 | <div class="col-sm-8"> |
| 319 | 319 | <?php |
@@ -322,10 +322,10 @@ discard block |
||
| 322 | 322 | 'type' => 'datepicker', |
| 323 | 323 | 'id' => 'wpinv_discount_expiration', |
| 324 | 324 | 'name' => 'wpinv_discount_expiration', |
| 325 | - 'label' => __( 'Expiration Date', 'invoicing' ), |
|
| 325 | + 'label' => __('Expiration Date', 'invoicing'), |
|
| 326 | 326 | 'placeholder' => 'YYYY-MM-DD 00:00', |
| 327 | 327 | 'class' => 'form-control-sm', |
| 328 | - 'value' => $discount->get_end_date( 'edit' ), |
|
| 328 | + 'value' => $discount->get_end_date('edit'), |
|
| 329 | 329 | 'extra_attributes' => array( |
| 330 | 330 | 'data-enable-time' => 'true', |
| 331 | 331 | 'data-time_24hr' => 'true', |
@@ -339,111 +339,111 @@ discard block |
||
| 339 | 339 | ?> |
| 340 | 340 | </div> |
| 341 | 341 | <div class="col-sm-1 pt-2 pl-0"> |
| 342 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the date after which the discount will expire.', 'invoicing' ); ?>"></span> |
|
| 342 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the date after which the discount will expire.', 'invoicing'); ?>"></span> |
|
| 343 | 343 | </div> |
| 344 | 344 | </div> |
| 345 | - <?php do_action( 'wpinv_discount_form_expiration', $discount ); ?> |
|
| 345 | + <?php do_action('wpinv_discount_form_expiration', $discount); ?> |
|
| 346 | 346 | |
| 347 | - <?php do_action( 'wpinv_discount_form_before_min_total', $discount ); ?> |
|
| 347 | + <?php do_action('wpinv_discount_form_before_min_total', $discount); ?> |
|
| 348 | 348 | <div class="form-group mb-3 row"> |
| 349 | 349 | <label for="wpinv_discount_min_total" class="col-sm-3 col-form-label"> |
| 350 | - <?php esc_html_e( 'Minimum Amount', 'invoicing' ); ?> |
|
| 350 | + <?php esc_html_e('Minimum Amount', 'invoicing'); ?> |
|
| 351 | 351 | </label> |
| 352 | 352 | <div class="col-sm-8"> |
| 353 | 353 | <div class="input-group input-group-sm"> |
| 354 | 354 | |
| 355 | - <?php if ( 'left' == $position ) : ?> |
|
| 356 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 355 | + <?php if ('left' == $position) : ?> |
|
| 356 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
| 357 | 357 | <div class="input-group-prepend"> |
| 358 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
| 358 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
| 359 | 359 | </div> |
| 360 | 360 | <?php else : ?> |
| 361 | 361 | <span class="input-group-text"> |
| 362 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
| 362 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
| 363 | 363 | </span> |
| 364 | 364 | <?php endif; ?> |
| 365 | 365 | <?php endif; ?> |
| 366 | 366 | |
| 367 | - <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr( $discount->get_minimum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No minimum', 'invoicing' ); ?>" class="form-control"> |
|
| 367 | + <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr($discount->get_minimum_total('edit')); ?>" placeholder="<?php esc_attr_e('No minimum', 'invoicing'); ?>" class="form-control"> |
|
| 368 | 368 | |
| 369 | - <?php if ( 'left' != $position ) : ?> |
|
| 370 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 369 | + <?php if ('left' != $position) : ?> |
|
| 370 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
| 371 | 371 | <div class="input-group-append"> |
| 372 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
| 372 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
| 373 | 373 | </div> |
| 374 | 374 | <?php else : ?> |
| 375 | 375 | <span class="input-group-text"> |
| 376 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
| 376 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
| 377 | 377 | </span> |
| 378 | 378 | <?php endif; ?> |
| 379 | 379 | <?php endif; ?> |
| 380 | 380 | </div> |
| 381 | 381 | </div> |
| 382 | 382 | <div class="col-sm-1 pt-2 pl-0"> |
| 383 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing' ); ?>"></span> |
|
| 383 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing'); ?>"></span> |
|
| 384 | 384 | </div> |
| 385 | 385 | </div> |
| 386 | - <?php do_action( 'wpinv_discount_form_min_total', $discount ); ?> |
|
| 386 | + <?php do_action('wpinv_discount_form_min_total', $discount); ?> |
|
| 387 | 387 | |
| 388 | - <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?> |
|
| 388 | + <?php do_action('wpinv_discount_form_before_max_total', $discount); ?> |
|
| 389 | 389 | <div class="form-group mb-3 row"> |
| 390 | 390 | <label for="wpinv_discount_max_total" class="col-sm-3 col-form-label"> |
| 391 | - <?php esc_html_e( 'Maximum Amount', 'invoicing' ); ?> |
|
| 391 | + <?php esc_html_e('Maximum Amount', 'invoicing'); ?> |
|
| 392 | 392 | </label> |
| 393 | 393 | <div class="col-sm-8"> |
| 394 | 394 | <div class="input-group input-group-sm"> |
| 395 | - <?php if ( 'left' == $position ) : ?> |
|
| 396 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 395 | + <?php if ('left' == $position) : ?> |
|
| 396 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
| 397 | 397 | <div class="input-group-prepend"> |
| 398 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
| 398 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
| 399 | 399 | </div> |
| 400 | 400 | <?php else : ?> |
| 401 | 401 | <span class="input-group-text"> |
| 402 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
| 402 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
| 403 | 403 | </span> |
| 404 | 404 | <?php endif; ?> |
| 405 | 405 | <?php endif; ?> |
| 406 | 406 | |
| 407 | - <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr( $discount->get_maximum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No maximum', 'invoicing' ); ?>" class="form-control"> |
|
| 407 | + <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr($discount->get_maximum_total('edit')); ?>" placeholder="<?php esc_attr_e('No maximum', 'invoicing'); ?>" class="form-control"> |
|
| 408 | 408 | |
| 409 | - <?php if ( 'left' != $position ) : ?> |
|
| 410 | - <?php if ( empty( $GLOBALS['aui_bs5'] ) ) : ?> |
|
| 409 | + <?php if ('left' != $position) : ?> |
|
| 410 | + <?php if (empty($GLOBALS['aui_bs5'])) : ?> |
|
| 411 | 411 | <div class="input-group-append"> |
| 412 | - <span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol() ); ?></span> |
|
| 412 | + <span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol()); ?></span> |
|
| 413 | 413 | </div> |
| 414 | 414 | <?php else : ?> |
| 415 | 415 | <span class="input-group-text"> |
| 416 | - <?php echo wp_kses_post( wpinv_currency_symbol() ); ?> |
|
| 416 | + <?php echo wp_kses_post(wpinv_currency_symbol()); ?> |
|
| 417 | 417 | </span> |
| 418 | 418 | <?php endif; ?> |
| 419 | 419 | <?php endif; ?> |
| 420 | 420 | </div> |
| 421 | 421 | </div> |
| 422 | 422 | <div class="col-sm-1 pt-2 pl-0"> |
| 423 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing' ); ?>"></span> |
|
| 423 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing'); ?>"></span> |
|
| 424 | 424 | </div> |
| 425 | 425 | </div> |
| 426 | - <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?> |
|
| 426 | + <?php do_action('wpinv_discount_form_before_max_total', $discount); ?> |
|
| 427 | 427 | |
| 428 | - <?php do_action( 'wpinv_discount_form_before_max_uses', $discount ); ?> |
|
| 428 | + <?php do_action('wpinv_discount_form_before_max_uses', $discount); ?> |
|
| 429 | 429 | <div class="form-group mb-3 row"> |
| 430 | 430 | <label for="wpinv_discount_max_uses" class="col-sm-3 col-form-label"> |
| 431 | - <?php esc_html_e( 'Maximum Uses', 'invoicing' ); ?> |
|
| 431 | + <?php esc_html_e('Maximum Uses', 'invoicing'); ?> |
|
| 432 | 432 | </label> |
| 433 | 433 | <div class="col-sm-8"> |
| 434 | - <input type="text" value="<?php echo esc_attr( $discount->get_max_uses( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'Unlimited', 'invoicing' ); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" /> |
|
| 434 | + <input type="text" value="<?php echo esc_attr($discount->get_max_uses('edit')); ?>" placeholder="<?php esc_attr_e('Unlimited', 'invoicing'); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" /> |
|
| 435 | 435 | </div> |
| 436 | 436 | <div class="col-sm-1 pt-2 pl-0"> |
| 437 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum number of times that this discount code can be used.', 'invoicing' ); ?>"></span> |
|
| 437 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum number of times that this discount code can be used.', 'invoicing'); ?>"></span> |
|
| 438 | 438 | </div> |
| 439 | 439 | </div> |
| 440 | - <?php do_action( 'wpinv_discount_form_max_uses', $discount ); ?> |
|
| 440 | + <?php do_action('wpinv_discount_form_max_uses', $discount); ?> |
|
| 441 | 441 | |
| 442 | - <?php do_action( 'wpinv_discount_form_last', $discount ); ?> |
|
| 442 | + <?php do_action('wpinv_discount_form_last', $discount); ?> |
|
| 443 | 443 | |
| 444 | 444 | </div> |
| 445 | 445 | <?php |
| 446 | - do_action( 'wpinv_discount_form_bottom', $post ); |
|
| 446 | + do_action('wpinv_discount_form_bottom', $post); |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | /** |
@@ -451,31 +451,31 @@ discard block |
||
| 451 | 451 | * |
| 452 | 452 | * @param int $post_id |
| 453 | 453 | */ |
| 454 | - public static function save( $post_id ) { |
|
| 454 | + public static function save($post_id) { |
|
| 455 | 455 | |
| 456 | 456 | // Prepare the discount. |
| 457 | - $discount = new WPInv_Discount( $post_id ); |
|
| 457 | + $discount = new WPInv_Discount($post_id); |
|
| 458 | 458 | |
| 459 | 459 | // Load new data. |
| 460 | 460 | $discount->set_props( |
| 461 | 461 | array( |
| 462 | - 'code' => isset( $_POST['wpinv_discount_code'] ) ? wpinv_clean( $_POST['wpinv_discount_code'] ) : null, |
|
| 463 | - 'amount' => isset( $_POST['wpinv_discount_amount'] ) ? floatval( $_POST['wpinv_discount_amount'] ) : null, |
|
| 464 | - 'start' => isset( $_POST['wpinv_discount_start'] ) ? wpinv_clean( $_POST['wpinv_discount_start'] ) : null, |
|
| 465 | - 'expiration' => isset( $_POST['wpinv_discount_expiration'] ) ? wpinv_clean( $_POST['wpinv_discount_expiration'] ) : null, |
|
| 466 | - 'is_single_use' => ! empty( $_POST['wpinv_discount_single_use'] ), |
|
| 467 | - 'type' => isset( $_POST['wpinv_discount_type'] ) ? wpinv_clean( $_POST['wpinv_discount_type'] ) : null, |
|
| 468 | - 'is_recurring' => ! empty( $_POST['wpinv_discount_recurring'] ), |
|
| 469 | - 'items' => isset( $_POST['wpinv_discount_items'] ) ? wpinv_clean( $_POST['wpinv_discount_items'] ) : array(), |
|
| 470 | - 'excluded_items' => isset( $_POST['wpinv_discount_excluded_items'] ) ? wpinv_clean( $_POST['wpinv_discount_excluded_items'] ) : array(), |
|
| 471 | - 'required_items' => isset( $_POST['wpinv_discount_required_items'] ) ? wpinv_clean( $_POST['wpinv_discount_required_items'] ) : array(), |
|
| 472 | - 'max_uses' => isset( $_POST['wpinv_discount_max_uses'] ) ? intval( $_POST['wpinv_discount_max_uses'] ) : null, |
|
| 473 | - 'min_total' => isset( $_POST['wpinv_discount_min_total'] ) ? floatval( $_POST['wpinv_discount_min_total'] ) : null, |
|
| 474 | - 'max_total' => isset( $_POST['wpinv_discount_max_total'] ) ? floatval( $_POST['wpinv_discount_max_total'] ) : null, |
|
| 462 | + 'code' => isset($_POST['wpinv_discount_code']) ? wpinv_clean($_POST['wpinv_discount_code']) : null, |
|
| 463 | + 'amount' => isset($_POST['wpinv_discount_amount']) ? floatval($_POST['wpinv_discount_amount']) : null, |
|
| 464 | + 'start' => isset($_POST['wpinv_discount_start']) ? wpinv_clean($_POST['wpinv_discount_start']) : null, |
|
| 465 | + 'expiration' => isset($_POST['wpinv_discount_expiration']) ? wpinv_clean($_POST['wpinv_discount_expiration']) : null, |
|
| 466 | + 'is_single_use' => !empty($_POST['wpinv_discount_single_use']), |
|
| 467 | + 'type' => isset($_POST['wpinv_discount_type']) ? wpinv_clean($_POST['wpinv_discount_type']) : null, |
|
| 468 | + 'is_recurring' => !empty($_POST['wpinv_discount_recurring']), |
|
| 469 | + 'items' => isset($_POST['wpinv_discount_items']) ? wpinv_clean($_POST['wpinv_discount_items']) : array(), |
|
| 470 | + 'excluded_items' => isset($_POST['wpinv_discount_excluded_items']) ? wpinv_clean($_POST['wpinv_discount_excluded_items']) : array(), |
|
| 471 | + 'required_items' => isset($_POST['wpinv_discount_required_items']) ? wpinv_clean($_POST['wpinv_discount_required_items']) : array(), |
|
| 472 | + 'max_uses' => isset($_POST['wpinv_discount_max_uses']) ? intval($_POST['wpinv_discount_max_uses']) : null, |
|
| 473 | + 'min_total' => isset($_POST['wpinv_discount_min_total']) ? floatval($_POST['wpinv_discount_min_total']) : null, |
|
| 474 | + 'max_total' => isset($_POST['wpinv_discount_max_total']) ? floatval($_POST['wpinv_discount_max_total']) : null, |
|
| 475 | 475 | ) |
| 476 | 476 | ); |
| 477 | 477 | |
| 478 | 478 | $discount->save(); |
| 479 | - do_action( 'getpaid_discount_metabox_save', $post_id, $discount ); |
|
| 479 | + do_action('getpaid_discount_metabox_save', $post_id, $discount); |
|
| 480 | 480 | } |
| 481 | 481 | } |