@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if (!defined('ABSPATH')) { |
|
| 11 | 11 | exit; // Exit if accessed directly |
| 12 | 12 | } |
| 13 | 13 | |
@@ -21,26 +21,26 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param WP_Post $post |
| 23 | 23 | */ |
| 24 | - public static function output( $post ) { |
|
| 24 | + public static function output($post) { |
|
| 25 | 25 | |
| 26 | 26 | // Prepare the item. |
| 27 | - $item = new WPInv_Item( $post ); |
|
| 27 | + $item = new WPInv_Item($post); |
|
| 28 | 28 | |
| 29 | 29 | echo "<div class='bsui' style='max-width: 600px;padding-top: 10px;'>"; |
| 30 | 30 | |
| 31 | - do_action( 'wpinv_item_before_vat_metabox', $item ); |
|
| 31 | + do_action('wpinv_item_before_vat_metabox', $item); |
|
| 32 | 32 | |
| 33 | 33 | // Output the vat rules settings. |
| 34 | - do_action( 'wpinv_item_vat_metabox_before_vat_rules', $item ); |
|
| 35 | - self::output_vat_rules( $item ); |
|
| 36 | - do_action( 'wpinv_item_vat_metabox_vat_rules', $item ); |
|
| 34 | + do_action('wpinv_item_vat_metabox_before_vat_rules', $item); |
|
| 35 | + self::output_vat_rules($item); |
|
| 36 | + do_action('wpinv_item_vat_metabox_vat_rules', $item); |
|
| 37 | 37 | |
| 38 | 38 | // Output vat class settings. |
| 39 | - do_action( 'wpinv_item_vat_metabox_before_vat_rules', $item ); |
|
| 40 | - self::output_vat_classes( $item ); |
|
| 41 | - do_action( 'wpinv_item_vat_metabox_vat_class', $item ); |
|
| 39 | + do_action('wpinv_item_vat_metabox_before_vat_rules', $item); |
|
| 40 | + self::output_vat_classes($item); |
|
| 41 | + do_action('wpinv_item_vat_metabox_vat_class', $item); |
|
| 42 | 42 | |
| 43 | - do_action( 'wpinv_item_vat_metabox', $item ); |
|
| 43 | + do_action('wpinv_item_vat_metabox', $item); |
|
| 44 | 44 | |
| 45 | 45 | echo '</div>'; |
| 46 | 46 | } |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @param WPInv_Item $item |
| 52 | 52 | */ |
| 53 | - public static function output_vat_rules( $item ) { |
|
| 53 | + public static function output_vat_rules($item) { |
|
| 54 | 54 | ?> |
| 55 | 55 | |
| 56 | 56 | <div class="wpinv_vat_rules"> |
| 57 | 57 | |
| 58 | 58 | <div class="form-group row"> |
| 59 | 59 | <label for="wpinv_vat_rules" class="col-sm-3 col-form-label"> |
| 60 | - <?php esc_html_e( 'Tax Rule', 'invoicing' ); ?> |
|
| 60 | + <?php esc_html_e('Tax Rule', 'invoicing'); ?> |
|
| 61 | 61 | </label> |
| 62 | 62 | <div class="col-sm-8"> |
| 63 | 63 | <?php |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | array( |
| 66 | 66 | 'id' => 'wpinv_vat_rules', |
| 67 | 67 | 'name' => 'wpinv_vat_rules', |
| 68 | - 'placeholder' => __( 'Select tax rule', 'invoicing' ), |
|
| 69 | - 'value' => $item->get_vat_rule( 'edit' ), |
|
| 68 | + 'placeholder' => __('Select tax rule', 'invoicing'), |
|
| 69 | + 'value' => $item->get_vat_rule('edit'), |
|
| 70 | 70 | 'select2' => true, |
| 71 | 71 | 'data-allow-clear' => 'false', |
| 72 | 72 | 'no_wrap' => true, |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @param WPInv_Item $item |
| 90 | 90 | */ |
| 91 | - public static function output_vat_classes( $item ) { |
|
| 91 | + public static function output_vat_classes($item) { |
|
| 92 | 92 | ?> |
| 93 | 93 | |
| 94 | 94 | <div class="wpinv_vat_classes"> |
| 95 | 95 | |
| 96 | 96 | <div class="form-group row"> |
| 97 | 97 | <label for="wpinv_vat_class" class="col-sm-3 col-form-label"> |
| 98 | - <?php esc_html_e( 'Tax Class', 'invoicing' ); ?> |
|
| 98 | + <?php esc_html_e('Tax Class', 'invoicing'); ?> |
|
| 99 | 99 | </label> |
| 100 | 100 | <div class="col-sm-8"> |
| 101 | 101 | <?php |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | array( |
| 104 | 104 | 'id' => 'wpinv_vat_class', |
| 105 | 105 | 'name' => 'wpinv_vat_class', |
| 106 | - 'placeholder' => __( 'Select tax class', 'invoicing' ), |
|
| 107 | - 'value' => $item->get_vat_class( 'edit' ), |
|
| 106 | + 'placeholder' => __('Select tax class', 'invoicing'), |
|
| 107 | + 'value' => $item->get_vat_class('edit'), |
|
| 108 | 108 | 'select2' => true, |
| 109 | 109 | 'data-allow-clear' => 'false', |
| 110 | 110 | 'no_wrap' => true, |
@@ -1,38 +1,38 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // MUST have WordPress. |
| 3 | -if ( ! defined( 'WPINC' ) ) { |
|
| 4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
| 3 | +if (!defined('WPINC')) { |
|
| 4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | class WPInv_Meta_Box_Notes { |
| 8 | - public static function output( $post ) { |
|
| 8 | + public static function output($post) { |
|
| 9 | 9 | global $post; |
| 10 | 10 | |
| 11 | - $notes = wpinv_get_invoice_notes( $post->ID ); |
|
| 11 | + $notes = wpinv_get_invoice_notes($post->ID); |
|
| 12 | 12 | |
| 13 | 13 | echo '<ul class="invoice_notes">'; |
| 14 | 14 | |
| 15 | - if ( $notes ) { |
|
| 16 | - foreach ( $notes as $note ) { |
|
| 17 | - wpinv_get_invoice_note_line_item( $note ); |
|
| 15 | + if ($notes) { |
|
| 16 | + foreach ($notes as $note) { |
|
| 17 | + wpinv_get_invoice_note_line_item($note); |
|
| 18 | 18 | } |
| 19 | 19 | } else { |
| 20 | - echo '<li>' . __( 'There are no notes yet.', 'invoicing' ) . '</li>'; |
|
| 20 | + echo '<li>' . __('There are no notes yet.', 'invoicing') . '</li>'; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | echo '</ul>'; |
| 24 | 24 | ?> |
| 25 | 25 | <div class="add_note"> |
| 26 | - <h4><?php esc_html_e( 'Add note', 'invoicing' ); ?></h4> |
|
| 26 | + <h4><?php esc_html_e('Add note', 'invoicing'); ?></h4> |
|
| 27 | 27 | <p> |
| 28 | 28 | <textarea type="text" name="invoice_note" id="add_invoice_note" class="input-text" cols="20" rows="5"></textarea> |
| 29 | 29 | </p> |
| 30 | 30 | <p> |
| 31 | 31 | <select name="invoice_note_type" id="invoice_note_type" class="regular-text"> |
| 32 | - <option value=""><?php esc_html_e( 'Private note', 'invoicing' ); ?></option> |
|
| 33 | - <option value="customer"><?php esc_html_e( 'Note to customer', 'invoicing' ); ?></option> |
|
| 32 | + <option value=""><?php esc_html_e('Private note', 'invoicing'); ?></option> |
|
| 33 | + <option value="customer"><?php esc_html_e('Note to customer', 'invoicing'); ?></option> |
|
| 34 | 34 | </select> |
| 35 | - <a href="#" class="add_note button"><?php esc_html_e( 'Add', 'invoicing' ); ?></a> <span class="description"><?php esc_html_e( 'Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing' ); ?></span> |
|
| 35 | + <a href="#" class="add_note button"><?php esc_html_e('Add', 'invoicing'); ?></a> <span class="description"><?php esc_html_e('Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing'); ?></span> |
|
| 36 | 36 | </p> |
| 37 | 37 | </div> |
| 38 | 38 | <?php |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 8 | +if (!defined('ABSPATH')) { |
|
| 9 | 9 | exit; // Exit if accessed directly |
| 10 | 10 | } |
| 11 | 11 | |
@@ -19,12 +19,12 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @param WP_Post $post |
| 21 | 21 | */ |
| 22 | - public static function output( $post ) { |
|
| 22 | + public static function output($post) { |
|
| 23 | 23 | |
| 24 | 24 | // Fetch the invoice. |
| 25 | - $invoice = new WPInv_Invoice( $post ); |
|
| 25 | + $invoice = new WPInv_Invoice($post); |
|
| 26 | 26 | |
| 27 | - do_action( 'wpinv_metabox_resend_invoice_before', $invoice ); |
|
| 27 | + do_action('wpinv_metabox_resend_invoice_before', $invoice); |
|
| 28 | 28 | |
| 29 | 29 | $invoice_actions = array( |
| 30 | 30 | 'resend-email' => array( |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | 'getpaid-nonce', |
| 39 | 39 | 'getpaid-nonce' |
| 40 | 40 | ), |
| 41 | - 'label' => __( 'Resend Invoice', 'invoicing' ), |
|
| 41 | + 'label' => __('Resend Invoice', 'invoicing'), |
|
| 42 | 42 | ), |
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | - if ( $invoice->needs_payment() ) { |
|
| 45 | + if ($invoice->needs_payment()) { |
|
| 46 | 46 | |
| 47 | 47 | $invoice_actions['send-reminder'] = array( |
| 48 | 48 | 'url' => wp_nonce_url( |
@@ -55,29 +55,29 @@ discard block |
||
| 55 | 55 | 'getpaid-nonce', |
| 56 | 56 | 'getpaid-nonce' |
| 57 | 57 | ), |
| 58 | - 'label' => __( 'Send Reminder', 'invoicing' ), |
|
| 58 | + 'label' => __('Send Reminder', 'invoicing'), |
|
| 59 | 59 | ); |
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - $invoice_actions = apply_filters( 'getpaid_edit_invoice_actions', $invoice_actions, $invoice ); |
|
| 63 | + $invoice_actions = apply_filters('getpaid_edit_invoice_actions', $invoice_actions, $invoice); |
|
| 64 | 64 | |
| 65 | - foreach ( $invoice_actions as $key => $action ) { |
|
| 65 | + foreach ($invoice_actions as $key => $action) { |
|
| 66 | 66 | |
| 67 | - if ( 'resend-email' === $key ) { |
|
| 68 | - echo wp_kses_post( wpautop( __( "This will send a copy of the invoice to the customer's email address.", 'invoicing' ) ) ); |
|
| 67 | + if ('resend-email' === $key) { |
|
| 68 | + echo wp_kses_post(wpautop(__("This will send a copy of the invoice to the customer's email address.", 'invoicing'))); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | printf( |
| 72 | 72 | '<p class="wpi-meta-row wpi-%s"><a href="%s" class="button button-secondary">%s</a>', |
| 73 | - esc_attr( $key ), |
|
| 74 | - esc_url( $action['url'] ), |
|
| 75 | - esc_html( $action['label'] ) |
|
| 73 | + esc_attr($key), |
|
| 74 | + esc_url($action['url']), |
|
| 75 | + esc_html($action['label']) |
|
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - do_action( 'wpinv_metabox_resend_invoice_after', $invoice ); |
|
| 80 | + do_action('wpinv_metabox_resend_invoice_after', $invoice); |
|
| 81 | 81 | |
| 82 | 82 | } |
| 83 | 83 | |
@@ -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">'; |
| 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'>$value</div>" ); |
|
| 30 | + echo wp_kses_post("<div class='col-12'><strong>$key:</strong></div><div class='col-12 form-group'>$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,7 +7,7 @@ discard block |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if (!defined('ABSPATH')) { |
|
| 11 | 11 | exit; // Exit if accessed directly |
| 12 | 12 | } |
| 13 | 13 | |
@@ -21,54 +21,54 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param WP_Post $post |
| 23 | 23 | */ |
| 24 | - public static function output( $post ) { |
|
| 24 | + public static function output($post) { |
|
| 25 | 25 | |
| 26 | 26 | // Prepare the form. |
| 27 | - $form = new GetPaid_Payment_Form( $post ); |
|
| 27 | + $form = new GetPaid_Payment_Form($post); |
|
| 28 | 28 | |
| 29 | 29 | ?> |
| 30 | 30 | |
| 31 | 31 | <div class='bsui' style='padding-top: 10px;'> |
| 32 | - <?php do_action( 'wpinv_payment_form_before_info_metabox', $form ); ?> |
|
| 32 | + <?php do_action('wpinv_payment_form_before_info_metabox', $form); ?> |
|
| 33 | 33 | |
| 34 | 34 | <div class="wpinv_payment_form_shortcode form-group row"> |
| 35 | 35 | <label for="wpinv_payment_form_shortcode" class="col-sm-12 col-form-label"> |
| 36 | - <?php esc_html_e( 'Payment Form Shortcode', 'invoicing' ); ?> |
|
| 37 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a payment form', 'invoicing' ); ?>"></span> |
|
| 36 | + <?php esc_html_e('Payment Form Shortcode', 'invoicing'); ?> |
|
| 37 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a payment form', 'invoicing'); ?>"></span> |
|
| 38 | 38 | </label> |
| 39 | 39 | |
| 40 | 40 | <div class="col-sm-12"> |
| 41 | - <input onClick="this.select()" type="text" id="wpinv_payment_form_shortcode" value="[getpaid form=<?php echo esc_attr( $form->get_id() ); ?>]" style="width: 100%;" /> |
|
| 41 | + <input onClick="this.select()" type="text" id="wpinv_payment_form_shortcode" value="[getpaid form=<?php echo esc_attr($form->get_id()); ?>]" style="width: 100%;" /> |
|
| 42 | 42 | </div> |
| 43 | 43 | </div> |
| 44 | 44 | |
| 45 | 45 | <div class="wpinv_payment_form_buy_shortcode form-group row"> |
| 46 | 46 | <label for="wpinv_payment_form_buy_shortcode" class="col-sm-12 col-form-label"> |
| 47 | - <?php esc_html_e( 'Payment Button Shortcode', 'invoicing' ); ?> |
|
| 48 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a buy now button', 'invoicing' ); ?>"></span> |
|
| 47 | + <?php esc_html_e('Payment Button Shortcode', 'invoicing'); ?> |
|
| 48 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a buy now button', 'invoicing'); ?>"></span> |
|
| 49 | 49 | </label> |
| 50 | 50 | |
| 51 | 51 | <div class="col-sm-12"> |
| 52 | - <input onClick="this.select()" type="text" id="wpinv_payment_form_buy_shortcode" value="[getpaid form=<?php echo esc_attr( $form->get_id() ); ?> button='Buy Now']" style="width: 100%;" /> |
|
| 52 | + <input onClick="this.select()" type="text" id="wpinv_payment_form_buy_shortcode" value="[getpaid form=<?php echo esc_attr($form->get_id()); ?> button='Buy Now']" style="width: 100%;" /> |
|
| 53 | 53 | <small class="form-text text-muted"> |
| 54 | - <?php esc_html_e( 'Or use the following URL in a link:', 'invoicing' ); ?> |
|
| 55 | - <code>#getpaid-form-<?php echo intval( $form->get_id() ); ?></code> |
|
| 54 | + <?php esc_html_e('Or use the following URL in a link:', 'invoicing'); ?> |
|
| 55 | + <code>#getpaid-form-<?php echo intval($form->get_id()); ?></code> |
|
| 56 | 56 | </small> |
| 57 | 57 | </div> |
| 58 | 58 | </div> |
| 59 | 59 | |
| 60 | 60 | <div class="wpinv_item_buy_url form-group row"> |
| 61 | 61 | <label for="wpinv_item_buy_url" class="col-sm-12 col-form-label"> |
| 62 | - <?php esc_html_e( 'Direct Payment URL', 'invoicing' ); ?> |
|
| 63 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'You can use this in an iFrame to embed the payment form on another website', 'invoicing' ); ?>"></span> |
|
| 62 | + <?php esc_html_e('Direct Payment URL', 'invoicing'); ?> |
|
| 63 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('You can use this in an iFrame to embed the payment form on another website', 'invoicing'); ?>"></span> |
|
| 64 | 64 | </label> |
| 65 | 65 | |
| 66 | 66 | <div class="col-sm-12"> |
| 67 | - <input onClick="this.select()" type="text" id="wpinv_item_buy_url" value="<?php echo esc_url( getpaid_embed_url( $form->get_id(), false ) ); ?>" style="width: 100%;" readonly/> |
|
| 67 | + <input onClick="this.select()" type="text" id="wpinv_item_buy_url" value="<?php echo esc_url(getpaid_embed_url($form->get_id(), false)); ?>" style="width: 100%;" readonly/> |
|
| 68 | 68 | </div> |
| 69 | 69 | </div> |
| 70 | 70 | |
| 71 | - <?php do_action( 'wpinv_payment_form_info_metabox', $form ); ?> |
|
| 71 | + <?php do_action('wpinv_payment_form_info_metabox', $form); ?> |
|
| 72 | 72 | </div> |
| 73 | 73 | <?php |
| 74 | 74 | |
@@ -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,27 +21,27 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param WP_Post $post |
| 23 | 23 | */ |
| 24 | - public static function output( $post ) { |
|
| 24 | + public static function output($post) { |
|
| 25 | 25 | |
| 26 | 26 | // Prepare the item. |
| 27 | - $item = new WPInv_Item( $post ); |
|
| 27 | + $item = new WPInv_Item($post); |
|
| 28 | 28 | |
| 29 | 29 | // 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 | 32 | // Set the currency position. |
| 33 | 33 | $position = wpinv_currency_position(); |
| 34 | 34 | |
| 35 | - if ( $position == 'left_space' ) { |
|
| 35 | + if ($position == 'left_space') { |
|
| 36 | 36 | $position = 'left'; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if ( $position == 'right_space' ) { |
|
| 39 | + if ($position == 'right_space') { |
|
| 40 | 40 | $position = 'right'; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | ?> |
| 44 | - <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr( $item->get_type( 'edit' ) ); ?>" /> |
|
| 44 | + <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr($item->get_type('edit')); ?>" /> |
|
| 45 | 45 | <style> |
| 46 | 46 | #poststuff .input-group-text, |
| 47 | 47 | #poststuff .form-control { |
@@ -55,21 +55,21 @@ discard block |
||
| 55 | 55 | </style> |
| 56 | 56 | <div class='bsui' style='max-width: 600px;padding-top: 10px;'> |
| 57 | 57 | |
| 58 | - <?php do_action( 'wpinv_item_details_metabox_before_price', $item ); ?> |
|
| 58 | + <?php do_action('wpinv_item_details_metabox_before_price', $item); ?> |
|
| 59 | 59 | <div class="form-group row"> |
| 60 | - <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php esc_html_e( 'Item Price', 'invoicing' ); ?></span></label> |
|
| 60 | + <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php esc_html_e('Item Price', 'invoicing'); ?></span></label> |
|
| 61 | 61 | <div class="col-sm-8"> |
| 62 | 62 | <div class="row"> |
| 63 | 63 | <div class="col-sm-4 getpaid-price-input"> |
| 64 | 64 | <div class="input-group input-group-sm"> |
| 65 | - <?php if ( 'left' == $position ) : ?> |
|
| 65 | + <?php if ('left' == $position) : ?> |
|
| 66 | 66 | <div class="input-group-prepend"> |
| 67 | 67 | <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
| 68 | 68 | </div> |
| 69 | 69 | <?php endif; ?> |
| 70 | - <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_price( 'edit' ) ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
| 70 | + <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_price('edit'))); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
| 71 | 71 | |
| 72 | - <?php if ( 'left' != $position ) : ?> |
|
| 72 | + <?php if ('left' != $position) : ?> |
|
| 73 | 73 | <div class="input-group-append"> |
| 74 | 74 | <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
| 75 | 75 | </div> |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | </div> |
| 80 | 80 | <div class="col-sm-4 wpinv_show_if_recurring"> |
| 81 | 81 | <?php |
| 82 | - _e( 'every' ); |
|
| 82 | + _e('every'); |
|
| 83 | 83 | echo ' '; |
| 84 | 84 | ?> |
| 85 | - <input type="number" style="max-width: 60px;" value="<?php echo esc_attr( $item->get_recurring_interval( 'edit' ) ); ?>" placeholder="1" name="wpinv_recurring_interval" id="wpinv_recurring_interval" /> |
|
| 85 | + <input type="number" style="max-width: 60px;" value="<?php echo esc_attr($item->get_recurring_interval('edit')); ?>" placeholder="1" name="wpinv_recurring_interval" id="wpinv_recurring_interval" /> |
|
| 86 | 86 | </div> |
| 87 | 87 | <div class="col-sm-4 wpinv_show_if_recurring"> |
| 88 | 88 | <?php |
@@ -90,16 +90,16 @@ discard block |
||
| 90 | 90 | array( |
| 91 | 91 | 'id' => 'wpinv_recurring_period', |
| 92 | 92 | 'name' => 'wpinv_recurring_period', |
| 93 | - 'label' => __( 'Period', 'invoicing' ), |
|
| 94 | - 'placeholder' => __( 'Select Period', 'invoicing' ), |
|
| 95 | - 'value' => $item->get_recurring_period( 'edit' ), |
|
| 93 | + 'label' => __('Period', 'invoicing'), |
|
| 94 | + 'placeholder' => __('Select Period', 'invoicing'), |
|
| 95 | + 'value' => $item->get_recurring_period('edit'), |
|
| 96 | 96 | 'select2' => true, |
| 97 | 97 | 'data-allow-clear' => 'false', |
| 98 | 98 | 'options' => array( |
| 99 | - 'D' => __( 'day(s)', 'invoicing' ), |
|
| 100 | - 'W' => __( 'week(s)', 'invoicing' ), |
|
| 101 | - 'M' => __( 'month(s)', 'invoicing' ), |
|
| 102 | - 'Y' => __( 'year(s)', 'invoicing' ), |
|
| 99 | + 'D' => __('day(s)', 'invoicing'), |
|
| 100 | + 'W' => __('week(s)', 'invoicing'), |
|
| 101 | + 'M' => __('month(s)', 'invoicing'), |
|
| 102 | + 'Y' => __('year(s)', 'invoicing'), |
|
| 103 | 103 | ), |
| 104 | 104 | ) |
| 105 | 105 | ); |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | <?php |
| 112 | 112 | |
| 113 | 113 | // Dynamic pricing. |
| 114 | - if ( $item->supports_dynamic_pricing() ) { |
|
| 114 | + if ($item->supports_dynamic_pricing()) { |
|
| 115 | 115 | |
| 116 | - do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); |
|
| 116 | + do_action('wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item); |
|
| 117 | 117 | |
| 118 | 118 | // NYP toggle. |
| 119 | 119 | echo aui()->input( |
@@ -121,31 +121,31 @@ discard block |
||
| 121 | 121 | 'id' => 'wpinv_name_your_price', |
| 122 | 122 | 'name' => 'wpinv_name_your_price', |
| 123 | 123 | 'type' => 'checkbox', |
| 124 | - 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
| 124 | + 'label' => apply_filters('wpinv_name_your_price_toggle_text', __('Let customers name their price', 'invoicing')), |
|
| 125 | 125 | 'value' => '1', |
| 126 | 126 | 'checked' => $item->user_can_set_their_price(), |
| 127 | 127 | 'no_wrap' => true, |
| 128 | 128 | ) |
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | - do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); |
|
| 131 | + do_action('wpinv_item_details_metabox_dynamic_pricing_checkbox', $item); |
|
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | // Subscriptions. |
| 136 | - do_action( 'wpinv_item_details_metabox_before_subscription_checkbox', $item ); |
|
| 136 | + do_action('wpinv_item_details_metabox_before_subscription_checkbox', $item); |
|
| 137 | 137 | echo aui()->input( |
| 138 | 138 | array( |
| 139 | 139 | 'id' => 'wpinv_is_recurring', |
| 140 | 140 | 'name' => 'wpinv_is_recurring', |
| 141 | 141 | 'type' => 'checkbox', |
| 142 | - 'label' => apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Charge customers a recurring amount for this item', 'invoicing' ) ), |
|
| 142 | + 'label' => apply_filters('wpinv_is_recurring_toggle_text', __('Charge customers a recurring amount for this item', 'invoicing')), |
|
| 143 | 143 | 'value' => '1', |
| 144 | 144 | 'checked' => $item->is_recurring(), |
| 145 | 145 | 'no_wrap' => true, |
| 146 | 146 | ) |
| 147 | 147 | ); |
| 148 | - do_action( 'wpinv_item_details_metabox_subscription_checkbox', $item ); |
|
| 148 | + do_action('wpinv_item_details_metabox_subscription_checkbox', $item); |
|
| 149 | 149 | |
| 150 | 150 | ?> |
| 151 | 151 | <div class="wpinv_show_if_recurring"> |
@@ -155,30 +155,30 @@ discard block |
||
| 155 | 155 | </div> |
| 156 | 156 | </div> |
| 157 | 157 | <div class="col-sm-1 pt-2 pl-0"> |
| 158 | - <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e( 'Set the subscription price, billing interval and period.', 'invoicing' ); ?>"></span> |
|
| 158 | + <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e('Set the subscription price, billing interval and period.', 'invoicing'); ?>"></span> |
|
| 159 | 159 | </div> |
| 160 | 160 | </div> |
| 161 | - <?php do_action( 'wpinv_item_details_metabox_after_price', $item ); ?> |
|
| 161 | + <?php do_action('wpinv_item_details_metabox_after_price', $item); ?> |
|
| 162 | 162 | |
| 163 | - <?php if ( $item->supports_dynamic_pricing() ) : ?> |
|
| 164 | - <?php do_action( 'wpinv_item_details_metabox_before_minimum_price', $item ); ?> |
|
| 163 | + <?php if ($item->supports_dynamic_pricing()) : ?> |
|
| 164 | + <?php do_action('wpinv_item_details_metabox_before_minimum_price', $item); ?> |
|
| 165 | 165 | <div class="wpinv_show_if_dynamic wpinv_minimum_price"> |
| 166 | 166 | |
| 167 | 167 | <div class="form-group row"> |
| 168 | 168 | <label for="wpinv_minimum_price" class="col-sm-3 col-form-label"> |
| 169 | - <?php esc_html_e( 'Minimum Price', 'invoicing' ); ?> |
|
| 169 | + <?php esc_html_e('Minimum Price', 'invoicing'); ?> |
|
| 170 | 170 | </label> |
| 171 | 171 | <div class="col-sm-8"> |
| 172 | 172 | <div class="input-group input-group-sm"> |
| 173 | - <?php if ( 'left' == $position ) : ?> |
|
| 173 | + <?php if ('left' == $position) : ?> |
|
| 174 | 174 | <div class="input-group-prepend"> |
| 175 | 175 | <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
| 176 | 176 | </div> |
| 177 | 177 | <?php endif; ?> |
| 178 | 178 | |
| 179 | - <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_minimum_price( 'edit' ) ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
| 179 | + <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_minimum_price('edit'))); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
| 180 | 180 | |
| 181 | - <?php if ( 'left' != $position ) : ?> |
|
| 181 | + <?php if ('left' != $position) : ?> |
|
| 182 | 182 | <div class="input-group-append"> |
| 183 | 183 | <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
| 184 | 184 | </div> |
@@ -187,45 +187,45 @@ discard block |
||
| 187 | 187 | </div> |
| 188 | 188 | |
| 189 | 189 | <div class="col-sm-1 pt-2 pl-0"> |
| 190 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the minimum amount that users are allowed to set', 'invoicing' ); ?>"></span> |
|
| 190 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the minimum amount that users are allowed to set', 'invoicing'); ?>"></span> |
|
| 191 | 191 | </div> |
| 192 | 192 | </div> |
| 193 | 193 | |
| 194 | 194 | </div> |
| 195 | - <?php do_action( 'wpinv_item_details_metabox_minimum_price', $item ); ?> |
|
| 195 | + <?php do_action('wpinv_item_details_metabox_minimum_price', $item); ?> |
|
| 196 | 196 | <?php endif; ?> |
| 197 | 197 | |
| 198 | - <?php do_action( 'wpinv_item_details_metabox_before_maximum_renewals', $item ); ?> |
|
| 198 | + <?php do_action('wpinv_item_details_metabox_before_maximum_renewals', $item); ?> |
|
| 199 | 199 | <div class="wpinv_show_if_recurring wpinv_maximum_renewals"> |
| 200 | 200 | |
| 201 | 201 | <div class="form-group row"> |
| 202 | 202 | <label for="wpinv_recurring_limit" class="col-sm-3 col-form-label"> |
| 203 | - <?php esc_html_e( 'Maximum Renewals', 'invoicing' ); ?> |
|
| 203 | + <?php esc_html_e('Maximum Renewals', 'invoicing'); ?> |
|
| 204 | 204 | </label> |
| 205 | 205 | <div class="col-sm-8"> |
| 206 | - <input type="number" value="<?php echo esc_attr( $item->get_recurring_limit( 'edit' ) ); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" /> |
|
| 206 | + <input type="number" value="<?php echo esc_attr($item->get_recurring_limit('edit')); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" /> |
|
| 207 | 207 | </div> |
| 208 | 208 | <div class="col-sm-1 pt-2 pl-0"> |
| 209 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing' ); ?>"></span> |
|
| 209 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing'); ?>"></span> |
|
| 210 | 210 | </div> |
| 211 | 211 | </div> |
| 212 | 212 | |
| 213 | 213 | </div> |
| 214 | - <?php do_action( 'wpinv_item_details_metabox_maximum_renewals', $item ); ?> |
|
| 214 | + <?php do_action('wpinv_item_details_metabox_maximum_renewals', $item); ?> |
|
| 215 | 215 | |
| 216 | - <?php do_action( 'wpinv_item_details_metabox_before_free_trial', $item ); ?> |
|
| 216 | + <?php do_action('wpinv_item_details_metabox_before_free_trial', $item); ?> |
|
| 217 | 217 | <div class="wpinv_show_if_recurring wpinv_free_trial"> |
| 218 | 218 | |
| 219 | 219 | <div class="form-group row"> |
| 220 | - <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php defined( 'GETPAID_PAID_TRIALS_VERSION' ) ? _e( 'Free/Paid Trial', 'invoicing' ) : _e( 'Free Trial', 'invoicing' ); ?></label> |
|
| 220 | + <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php defined('GETPAID_PAID_TRIALS_VERSION') ? _e('Free/Paid Trial', 'invoicing') : _e('Free Trial', 'invoicing'); ?></label> |
|
| 221 | 221 | |
| 222 | 222 | <div class="col-sm-8"> |
| 223 | 223 | <div class="row"> |
| 224 | 224 | <div class="col-sm-6"> |
| 225 | - <?php $value = $item->has_free_trial() ? $item->get_trial_interval( 'edit' ) : 0; ?> |
|
| 225 | + <?php $value = $item->has_free_trial() ? $item->get_trial_interval('edit') : 0; ?> |
|
| 226 | 226 | |
| 227 | 227 | <div> |
| 228 | - <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr( $value ); ?>" > |
|
| 228 | + <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr($value); ?>" > |
|
| 229 | 229 | </div> |
| 230 | 230 | </div> |
| 231 | 231 | <div class="col-sm-6"> |
@@ -234,17 +234,17 @@ discard block |
||
| 234 | 234 | array( |
| 235 | 235 | 'id' => 'wpinv_trial_period', |
| 236 | 236 | 'name' => 'wpinv_trial_period', |
| 237 | - 'label' => __( 'Trial Period', 'invoicing' ), |
|
| 238 | - 'placeholder' => __( 'Trial Period', 'invoicing' ), |
|
| 239 | - 'value' => $item->get_trial_period( 'edit' ), |
|
| 237 | + 'label' => __('Trial Period', 'invoicing'), |
|
| 238 | + 'placeholder' => __('Trial Period', 'invoicing'), |
|
| 239 | + 'value' => $item->get_trial_period('edit'), |
|
| 240 | 240 | 'select2' => true, |
| 241 | 241 | 'data-allow-clear' => 'false', |
| 242 | 242 | 'no_wrap' => true, |
| 243 | 243 | 'options' => array( |
| 244 | - 'D' => __( 'day(s)', 'invoicing' ), |
|
| 245 | - 'W' => __( 'week(s)', 'invoicing' ), |
|
| 246 | - 'M' => __( 'month(s)', 'invoicing' ), |
|
| 247 | - 'Y' => __( 'year(s)', 'invoicing' ), |
|
| 244 | + 'D' => __('day(s)', 'invoicing'), |
|
| 245 | + 'W' => __('week(s)', 'invoicing'), |
|
| 246 | + 'M' => __('month(s)', 'invoicing'), |
|
| 247 | + 'Y' => __('year(s)', 'invoicing'), |
|
| 248 | 248 | ), |
| 249 | 249 | ) |
| 250 | 250 | ); |
@@ -255,15 +255,15 @@ discard block |
||
| 255 | 255 | </div> |
| 256 | 256 | |
| 257 | 257 | <div class="col-sm-1 pt-2 pl-0"> |
| 258 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'An optional period of time to wait before charging the first recurring payment.', 'invoicing' ); ?>"></span> |
|
| 258 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('An optional period of time to wait before charging the first recurring payment.', 'invoicing'); ?>"></span> |
|
| 259 | 259 | </div> |
| 260 | 260 | |
| 261 | 261 | </div> |
| 262 | 262 | |
| 263 | 263 | </div> |
| 264 | - <?php do_action( 'wpinv_item_details_metabox__free_trial', $item ); ?> |
|
| 264 | + <?php do_action('wpinv_item_details_metabox__free_trial', $item); ?> |
|
| 265 | 265 | |
| 266 | - <?php do_action( 'wpinv_item_details_metabox_item_details', $item ); ?> |
|
| 266 | + <?php do_action('wpinv_item_details_metabox_item_details', $item); ?> |
|
| 267 | 267 | </div> |
| 268 | 268 | <?php |
| 269 | 269 | |
@@ -274,31 +274,31 @@ discard block |
||
| 274 | 274 | * |
| 275 | 275 | * @param int $post_id |
| 276 | 276 | */ |
| 277 | - public static function save( $post_id ) { |
|
| 277 | + public static function save($post_id) { |
|
| 278 | 278 | |
| 279 | 279 | // Prepare the item. |
| 280 | - $item = new WPInv_Item( $post_id ); |
|
| 280 | + $item = new WPInv_Item($post_id); |
|
| 281 | 281 | |
| 282 | 282 | // Load new data. |
| 283 | 283 | $item->set_props( |
| 284 | 284 | array( |
| 285 | - 'price' => isset( $_POST['wpinv_item_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_item_price'] ) : null, |
|
| 286 | - 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
| 287 | - 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
| 288 | - 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
| 289 | - 'is_dynamic_pricing' => ! empty( $_POST['wpinv_name_your_price'] ), |
|
| 290 | - 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? getpaid_standardize_amount( $_POST['wpinv_minimum_price'] ) : null, |
|
| 291 | - 'is_recurring' => ! empty( $_POST['wpinv_is_recurring'] ), |
|
| 292 | - 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
| 293 | - 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : 1, |
|
| 294 | - 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
| 295 | - 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
| 296 | - 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
| 297 | - 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
| 285 | + 'price' => isset($_POST['wpinv_item_price']) ? getpaid_standardize_amount($_POST['wpinv_item_price']) : null, |
|
| 286 | + 'vat_rule' => isset($_POST['wpinv_vat_rules']) ? wpinv_clean($_POST['wpinv_vat_rules']) : null, |
|
| 287 | + 'vat_class' => isset($_POST['wpinv_vat_class']) ? wpinv_clean($_POST['wpinv_vat_class']) : null, |
|
| 288 | + 'type' => isset($_POST['wpinv_item_type']) ? wpinv_clean($_POST['wpinv_item_type']) : null, |
|
| 289 | + 'is_dynamic_pricing' => !empty($_POST['wpinv_name_your_price']), |
|
| 290 | + 'minimum_price' => isset($_POST['wpinv_minimum_price']) ? getpaid_standardize_amount($_POST['wpinv_minimum_price']) : null, |
|
| 291 | + 'is_recurring' => !empty($_POST['wpinv_is_recurring']), |
|
| 292 | + 'recurring_period' => isset($_POST['wpinv_recurring_period']) ? wpinv_clean($_POST['wpinv_recurring_period']) : null, |
|
| 293 | + 'recurring_interval' => isset($_POST['wpinv_recurring_interval']) ? (int) $_POST['wpinv_recurring_interval'] : 1, |
|
| 294 | + 'recurring_limit' => isset($_POST['wpinv_recurring_limit']) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
| 295 | + 'is_free_trial' => isset($_POST['wpinv_trial_interval']) ? (0 != (int) $_POST['wpinv_trial_interval']) : null, |
|
| 296 | + 'trial_period' => isset($_POST['wpinv_trial_period']) ? wpinv_clean($_POST['wpinv_trial_period']) : null, |
|
| 297 | + 'trial_interval' => isset($_POST['wpinv_trial_interval']) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
| 298 | 298 | ) |
| 299 | 299 | ); |
| 300 | 300 | |
| 301 | 301 | $item->save(); |
| 302 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
| 302 | + do_action('getpaid_item_metabox_save', $post_id, $item); |
|
| 303 | 303 | } |
| 304 | 304 | } |
@@ -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,66 +52,66 @@ 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 | <div class="form-group row"> |
| 59 | 59 | <label for="wpinv_discount_code" class="col-sm-3 col-form-label"> |
| 60 | - <?php esc_html_e( 'Discount Code', 'invoicing' ); ?> |
|
| 60 | + <?php esc_html_e('Discount Code', 'invoicing'); ?> |
|
| 61 | 61 | </label> |
| 62 | 62 | <div class="col-sm-8"> |
| 63 | 63 | <div class="row"> |
| 64 | 64 | <div class="col-sm-12 form-group"> |
| 65 | - <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%;" /> |
|
| 65 | + <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 | 66 | </div> |
| 67 | 67 | <div class="col-sm-12"> |
| 68 | 68 | <?php |
| 69 | - do_action( 'wpinv_discount_form_before_single_use', $discount ); |
|
| 69 | + do_action('wpinv_discount_form_before_single_use', $discount); |
|
| 70 | 70 | |
| 71 | 71 | echo aui()->input( |
| 72 | 72 | array( |
| 73 | 73 | 'id' => 'wpinv_discount_single_use', |
| 74 | 74 | 'name' => 'wpinv_discount_single_use', |
| 75 | 75 | 'type' => 'checkbox', |
| 76 | - 'label' => __( 'Each customer can only use this discount once', 'invoicing' ), |
|
| 76 | + 'label' => __('Each customer can only use this discount once', 'invoicing'), |
|
| 77 | 77 | 'value' => '1', |
| 78 | 78 | 'checked' => $discount->is_single_use(), |
| 79 | 79 | ) |
| 80 | 80 | ); |
| 81 | 81 | |
| 82 | - do_action( 'wpinv_discount_form_single_use', $discount ); |
|
| 82 | + do_action('wpinv_discount_form_single_use', $discount); |
|
| 83 | 83 | ?> |
| 84 | 84 | </div> |
| 85 | 85 | <div class="col-sm-12"> |
| 86 | 86 | <?php |
| 87 | - do_action( 'wpinv_discount_form_before_recurring', $discount ); |
|
| 87 | + do_action('wpinv_discount_form_before_recurring', $discount); |
|
| 88 | 88 | |
| 89 | 89 | echo aui()->input( |
| 90 | 90 | array( |
| 91 | 91 | 'id' => 'wpinv_discount_recurring', |
| 92 | 92 | 'name' => 'wpinv_discount_recurring', |
| 93 | 93 | 'type' => 'checkbox', |
| 94 | - 'label' => __( 'Apply this discount to all recurring payments for subscriptions', 'invoicing' ), |
|
| 94 | + 'label' => __('Apply this discount to all recurring payments for subscriptions', 'invoicing'), |
|
| 95 | 95 | 'value' => '1', |
| 96 | 96 | 'checked' => $discount->is_recurring(), |
| 97 | 97 | ) |
| 98 | 98 | ); |
| 99 | 99 | |
| 100 | - do_action( 'wpinv_discount_form_recurring', $discount ); |
|
| 100 | + do_action('wpinv_discount_form_recurring', $discount); |
|
| 101 | 101 | ?> |
| 102 | 102 | </div> |
| 103 | 103 | </div> |
| 104 | 104 | </div> |
| 105 | 105 | <div class="col-sm-1 pt-2 pl-0"> |
| 106 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter a discount code such as 10OFF.', 'invoicing' ); ?>"></span> |
|
| 106 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter a discount code such as 10OFF.', 'invoicing'); ?>"></span> |
|
| 107 | 107 | </div> |
| 108 | 108 | </div> |
| 109 | - <?php do_action( 'wpinv_discount_form_code', $discount ); ?> |
|
| 109 | + <?php do_action('wpinv_discount_form_code', $discount); ?> |
|
| 110 | 110 | |
| 111 | - <?php do_action( 'wpinv_discount_form_before_type', $discount ); ?> |
|
| 111 | + <?php do_action('wpinv_discount_form_before_type', $discount); ?> |
|
| 112 | 112 | <div class="form-group row"> |
| 113 | 113 | <label for="wpinv_discount_type" class="col-sm-3 col-form-label"> |
| 114 | - <?php esc_html_e( 'Discount Type', 'invoicing' ); ?> |
|
| 114 | + <?php esc_html_e('Discount Type', 'invoicing'); ?> |
|
| 115 | 115 | </label> |
| 116 | 116 | <div class="col-sm-8"> |
| 117 | 117 | <?php |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | array( |
| 120 | 120 | 'id' => 'wpinv_discount_type', |
| 121 | 121 | 'name' => 'wpinv_discount_type', |
| 122 | - 'label' => __( 'Discount Type', 'invoicing' ), |
|
| 123 | - 'placeholder' => __( 'Select Discount Type', 'invoicing' ), |
|
| 124 | - 'value' => $discount->get_type( 'edit' ), |
|
| 122 | + 'label' => __('Discount Type', 'invoicing'), |
|
| 123 | + 'placeholder' => __('Select Discount Type', 'invoicing'), |
|
| 124 | + 'value' => $discount->get_type('edit'), |
|
| 125 | 125 | 'select2' => true, |
| 126 | 126 | 'data-allow-clear' => 'false', |
| 127 | 127 | 'options' => wpinv_get_discount_types(), |
@@ -130,19 +130,19 @@ discard block |
||
| 130 | 130 | ?> |
| 131 | 131 | </div> |
| 132 | 132 | <div class="col-sm-1 pt-2 pl-0"> |
| 133 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Discount type.', 'invoicing' ); ?>"></span> |
|
| 133 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Discount type.', 'invoicing'); ?>"></span> |
|
| 134 | 134 | </div> |
| 135 | 135 | </div> |
| 136 | - <?php do_action( 'wpinv_discount_form_type', $discount ); ?> |
|
| 136 | + <?php do_action('wpinv_discount_form_type', $discount); ?> |
|
| 137 | 137 | |
| 138 | - <?php do_action( 'wpinv_discount_form_before_amount', $discount ); ?> |
|
| 139 | - <div class="form-group row <?php echo esc_attr( $discount->get_type( 'edit' ) ); ?>" id="wpinv_discount_amount_wrap"> |
|
| 138 | + <?php do_action('wpinv_discount_form_before_amount', $discount); ?> |
|
| 139 | + <div class="form-group row <?php echo esc_attr($discount->get_type('edit')); ?>" id="wpinv_discount_amount_wrap"> |
|
| 140 | 140 | <label for="wpinv_discount_amount" class="col-sm-3 col-form-label"> |
| 141 | - <?php esc_html_e( 'Discount Amount', 'invoicing' ); ?> |
|
| 141 | + <?php esc_html_e('Discount Amount', 'invoicing'); ?> |
|
| 142 | 142 | </label> |
| 143 | 143 | <div class="col-sm-8"> |
| 144 | 144 | <div class="input-group input-group-sm"> |
| 145 | - <?php if ( 'left' == $position ) : ?> |
|
| 145 | + <?php if ('left' == $position) : ?> |
|
| 146 | 146 | <div class="input-group-prepend left wpinv-if-flat"> |
| 147 | 147 | <span class="input-group-text"> |
| 148 | 148 | <?php echo wpinv_currency_symbol(); ?> |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | </div> |
| 151 | 151 | <?php endif; ?> |
| 152 | 152 | |
| 153 | - <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"> |
|
| 153 | + <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"> |
|
| 154 | 154 | |
| 155 | - <?php if ( 'right' == $position ) : ?> |
|
| 155 | + <?php if ('right' == $position) : ?> |
|
| 156 | 156 | <div class="input-group-prepend left wpinv-if-flat"> |
| 157 | 157 | <span class="input-group-text"> |
| 158 | 158 | <?php echo wpinv_currency_symbol(); ?> |
@@ -165,15 +165,15 @@ discard block |
||
| 165 | 165 | </div> |
| 166 | 166 | </div> |
| 167 | 167 | <div class="col-sm-1 pt-2 pl-0"> |
| 168 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the discount value. Ex: 10', 'invoicing' ); ?>"></span> |
|
| 168 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the discount value. Ex: 10', 'invoicing'); ?>"></span> |
|
| 169 | 169 | </div> |
| 170 | 170 | </div> |
| 171 | - <?php do_action( 'wpinv_discount_form_amount', $discount ); ?> |
|
| 171 | + <?php do_action('wpinv_discount_form_amount', $discount); ?> |
|
| 172 | 172 | |
| 173 | - <?php do_action( 'wpinv_discount_form_before_items', $discount ); ?> |
|
| 173 | + <?php do_action('wpinv_discount_form_before_items', $discount); ?> |
|
| 174 | 174 | <div class="form-group row"> |
| 175 | 175 | <label for="wpinv_discount_items" class="col-sm-3 col-form-label"> |
| 176 | - <?php esc_html_e( 'Items', 'invoicing' ); ?> |
|
| 176 | + <?php esc_html_e('Items', 'invoicing'); ?> |
|
| 177 | 177 | </label> |
| 178 | 178 | <div class="col-sm-8"> |
| 179 | 179 | <?php |
@@ -181,9 +181,9 @@ discard block |
||
| 181 | 181 | array( |
| 182 | 182 | 'id' => 'wpinv_discount_items', |
| 183 | 183 | 'name' => 'wpinv_discount_items[]', |
| 184 | - 'label' => __( 'Items', 'invoicing' ), |
|
| 185 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
| 186 | - 'value' => $discount->get_items( 'edit' ), |
|
| 184 | + 'label' => __('Items', 'invoicing'), |
|
| 185 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
| 186 | + 'value' => $discount->get_items('edit'), |
|
| 187 | 187 | 'select2' => true, |
| 188 | 188 | 'multiple' => true, |
| 189 | 189 | 'data-allow-clear' => 'false', |
@@ -193,15 +193,15 @@ discard block |
||
| 193 | 193 | ?> |
| 194 | 194 | </div> |
| 195 | 195 | <div class="col-sm-1 pt-2 pl-0"> |
| 196 | - <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> |
|
| 196 | + <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> |
|
| 197 | 197 | </div> |
| 198 | 198 | </div> |
| 199 | - <?php do_action( 'wpinv_discount_form_items', $discount ); ?> |
|
| 199 | + <?php do_action('wpinv_discount_form_items', $discount); ?> |
|
| 200 | 200 | |
| 201 | - <?php do_action( 'wpinv_discount_form_before_excluded_items', $discount ); ?> |
|
| 201 | + <?php do_action('wpinv_discount_form_before_excluded_items', $discount); ?> |
|
| 202 | 202 | <div class="form-group row"> |
| 203 | 203 | <label for="wpinv_discount_excluded_items" class="col-sm-3 col-form-label"> |
| 204 | - <?php esc_html_e( 'Excluded Items', 'invoicing' ); ?> |
|
| 204 | + <?php esc_html_e('Excluded Items', 'invoicing'); ?> |
|
| 205 | 205 | </label> |
| 206 | 206 | <div class="col-sm-8"> |
| 207 | 207 | <?php |
@@ -209,9 +209,9 @@ discard block |
||
| 209 | 209 | array( |
| 210 | 210 | 'id' => 'wpinv_discount_excluded_items', |
| 211 | 211 | 'name' => 'wpinv_discount_excluded_items[]', |
| 212 | - 'label' => __( 'Excluded Items', 'invoicing' ), |
|
| 213 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
| 214 | - 'value' => $discount->get_excluded_items( 'edit' ), |
|
| 212 | + 'label' => __('Excluded Items', 'invoicing'), |
|
| 213 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
| 214 | + 'value' => $discount->get_excluded_items('edit'), |
|
| 215 | 215 | 'select2' => true, |
| 216 | 216 | 'multiple' => true, |
| 217 | 217 | 'data-allow-clear' => 'false', |
@@ -221,15 +221,15 @@ discard block |
||
| 221 | 221 | ?> |
| 222 | 222 | </div> |
| 223 | 223 | <div class="col-sm-1 pt-2 pl-0"> |
| 224 | - <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> |
|
| 224 | + <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> |
|
| 225 | 225 | </div> |
| 226 | 226 | </div> |
| 227 | - <?php do_action( 'wpinv_discount_form_excluded_items', $discount ); ?> |
|
| 227 | + <?php do_action('wpinv_discount_form_excluded_items', $discount); ?> |
|
| 228 | 228 | |
| 229 | - <?php do_action( 'wpinv_discount_form_before_required_items', $discount ); ?> |
|
| 229 | + <?php do_action('wpinv_discount_form_before_required_items', $discount); ?> |
|
| 230 | 230 | <div class="form-group row"> |
| 231 | 231 | <label for="wpinv_discount_required_items" class="col-sm-3 col-form-label"> |
| 232 | - <?php esc_html_e( 'Required Items', 'invoicing' ); ?> |
|
| 232 | + <?php esc_html_e('Required Items', 'invoicing'); ?> |
|
| 233 | 233 | </label> |
| 234 | 234 | <div class="col-sm-8"> |
| 235 | 235 | <?php |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | array( |
| 238 | 238 | 'id' => 'wpinv_discount_required_items', |
| 239 | 239 | 'name' => 'wpinv_discount_required_items[]', |
| 240 | - 'label' => __( 'Required Items', 'invoicing' ), |
|
| 241 | - 'placeholder' => __( 'Select Items', 'invoicing' ), |
|
| 242 | - 'value' => $discount->get_required_items( 'edit' ), |
|
| 240 | + 'label' => __('Required Items', 'invoicing'), |
|
| 241 | + 'placeholder' => __('Select Items', 'invoicing'), |
|
| 242 | + 'value' => $discount->get_required_items('edit'), |
|
| 243 | 243 | 'select2' => true, |
| 244 | 244 | 'multiple' => true, |
| 245 | 245 | 'data-allow-clear' => 'false', |
@@ -249,15 +249,15 @@ discard block |
||
| 249 | 249 | ?> |
| 250 | 250 | </div> |
| 251 | 251 | <div class="col-sm-1 pt-2 pl-0"> |
| 252 | - <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> |
|
| 252 | + <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> |
|
| 253 | 253 | </div> |
| 254 | 254 | </div> |
| 255 | - <?php do_action( 'wpinv_discount_form_required_items', $discount ); ?> |
|
| 255 | + <?php do_action('wpinv_discount_form_required_items', $discount); ?> |
|
| 256 | 256 | |
| 257 | - <?php do_action( 'wpinv_discount_form_before_start', $discount ); ?> |
|
| 257 | + <?php do_action('wpinv_discount_form_before_start', $discount); ?> |
|
| 258 | 258 | <div class="form-group row"> |
| 259 | 259 | <label for="wpinv_discount_start" class="col-sm-3 col-form-label"> |
| 260 | - <?php esc_html_e( 'Start Date', 'invoicing' ); ?> |
|
| 260 | + <?php esc_html_e('Start Date', 'invoicing'); ?> |
|
| 261 | 261 | </label> |
| 262 | 262 | <div class="col-sm-8"> |
| 263 | 263 | <?php |
@@ -266,10 +266,10 @@ discard block |
||
| 266 | 266 | 'type' => 'datepicker', |
| 267 | 267 | 'id' => 'wpinv_discount_start', |
| 268 | 268 | 'name' => 'wpinv_discount_start', |
| 269 | - 'label' => __( 'Start Date', 'invoicing' ), |
|
| 269 | + 'label' => __('Start Date', 'invoicing'), |
|
| 270 | 270 | 'placeholder' => 'YYYY-MM-DD 00:00', |
| 271 | 271 | 'class' => 'form-control-sm', |
| 272 | - 'value' => $discount->get_start_date( 'edit' ), |
|
| 272 | + 'value' => $discount->get_start_date('edit'), |
|
| 273 | 273 | 'extra_attributes' => array( |
| 274 | 274 | 'data-enable-time' => 'true', |
| 275 | 275 | 'data-time_24hr' => 'true', |
@@ -280,15 +280,15 @@ discard block |
||
| 280 | 280 | ?> |
| 281 | 281 | </div> |
| 282 | 282 | <div class="col-sm-1 pt-2 pl-0"> |
| 283 | - <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> |
|
| 283 | + <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> |
|
| 284 | 284 | </div> |
| 285 | 285 | </div> |
| 286 | - <?php do_action( 'wpinv_discount_form_start', $discount ); ?> |
|
| 286 | + <?php do_action('wpinv_discount_form_start', $discount); ?> |
|
| 287 | 287 | |
| 288 | - <?php do_action( 'wpinv_discount_form_before_expiration', $discount ); ?> |
|
| 288 | + <?php do_action('wpinv_discount_form_before_expiration', $discount); ?> |
|
| 289 | 289 | <div class="form-group row"> |
| 290 | 290 | <label for="wpinv_discount_expiration" class="col-sm-3 col-form-label"> |
| 291 | - <?php esc_html_e( 'Expiration Date', 'invoicing' ); ?> |
|
| 291 | + <?php esc_html_e('Expiration Date', 'invoicing'); ?> |
|
| 292 | 292 | </label> |
| 293 | 293 | <div class="col-sm-8"> |
| 294 | 294 | <?php |
@@ -297,10 +297,10 @@ discard block |
||
| 297 | 297 | 'type' => 'datepicker', |
| 298 | 298 | 'id' => 'wpinv_discount_expiration', |
| 299 | 299 | 'name' => 'wpinv_discount_expiration', |
| 300 | - 'label' => __( 'Expiration Date', 'invoicing' ), |
|
| 300 | + 'label' => __('Expiration Date', 'invoicing'), |
|
| 301 | 301 | 'placeholder' => 'YYYY-MM-DD 00:00', |
| 302 | 302 | 'class' => 'form-control-sm', |
| 303 | - 'value' => $discount->get_end_date( 'edit' ), |
|
| 303 | + 'value' => $discount->get_end_date('edit'), |
|
| 304 | 304 | 'extra_attributes' => array( |
| 305 | 305 | 'data-enable-time' => 'true', |
| 306 | 306 | 'data-time_24hr' => 'true', |
@@ -313,27 +313,27 @@ discard block |
||
| 313 | 313 | ?> |
| 314 | 314 | </div> |
| 315 | 315 | <div class="col-sm-1 pt-2 pl-0"> |
| 316 | - <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> |
|
| 316 | + <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> |
|
| 317 | 317 | </div> |
| 318 | 318 | </div> |
| 319 | - <?php do_action( 'wpinv_discount_form_expiration', $discount ); ?> |
|
| 319 | + <?php do_action('wpinv_discount_form_expiration', $discount); ?> |
|
| 320 | 320 | |
| 321 | - <?php do_action( 'wpinv_discount_form_before_min_total', $discount ); ?> |
|
| 321 | + <?php do_action('wpinv_discount_form_before_min_total', $discount); ?> |
|
| 322 | 322 | <div class="form-group row"> |
| 323 | 323 | <label for="wpinv_discount_min_total" class="col-sm-3 col-form-label"> |
| 324 | - <?php esc_html_e( 'Minimum Amount', 'invoicing' ); ?> |
|
| 324 | + <?php esc_html_e('Minimum Amount', 'invoicing'); ?> |
|
| 325 | 325 | </label> |
| 326 | 326 | <div class="col-sm-8"> |
| 327 | 327 | <div class="input-group input-group-sm"> |
| 328 | - <?php if ( 'left' == $position ) : ?> |
|
| 328 | + <?php if ('left' == $position) : ?> |
|
| 329 | 329 | <div class="input-group-prepend"> |
| 330 | 330 | <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span> |
| 331 | 331 | </div> |
| 332 | 332 | <?php endif; ?> |
| 333 | 333 | |
| 334 | - <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"> |
|
| 334 | + <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"> |
|
| 335 | 335 | |
| 336 | - <?php if ( 'left' != $position ) : ?> |
|
| 336 | + <?php if ('left' != $position) : ?> |
|
| 337 | 337 | <div class="input-group-append"> |
| 338 | 338 | <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span> |
| 339 | 339 | </div> |
@@ -341,27 +341,27 @@ discard block |
||
| 341 | 341 | </div> |
| 342 | 342 | </div> |
| 343 | 343 | <div class="col-sm-1 pt-2 pl-0"> |
| 344 | - <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> |
|
| 344 | + <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> |
|
| 345 | 345 | </div> |
| 346 | 346 | </div> |
| 347 | - <?php do_action( 'wpinv_discount_form_min_total', $discount ); ?> |
|
| 347 | + <?php do_action('wpinv_discount_form_min_total', $discount); ?> |
|
| 348 | 348 | |
| 349 | - <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?> |
|
| 349 | + <?php do_action('wpinv_discount_form_before_max_total', $discount); ?> |
|
| 350 | 350 | <div class="form-group row"> |
| 351 | 351 | <label for="wpinv_discount_max_total" class="col-sm-3 col-form-label"> |
| 352 | - <?php esc_html_e( 'Maximum Amount', 'invoicing' ); ?> |
|
| 352 | + <?php esc_html_e('Maximum Amount', 'invoicing'); ?> |
|
| 353 | 353 | </label> |
| 354 | 354 | <div class="col-sm-8"> |
| 355 | 355 | <div class="input-group input-group-sm"> |
| 356 | - <?php if ( 'left' == $position ) : ?> |
|
| 356 | + <?php if ('left' == $position) : ?> |
|
| 357 | 357 | <div class="input-group-prepend"> |
| 358 | 358 | <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span> |
| 359 | 359 | </div> |
| 360 | 360 | <?php endif; ?> |
| 361 | 361 | |
| 362 | - <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"> |
|
| 362 | + <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"> |
|
| 363 | 363 | |
| 364 | - <?php if ( 'left' != $position ) : ?> |
|
| 364 | + <?php if ('left' != $position) : ?> |
|
| 365 | 365 | <div class="input-group-append"> |
| 366 | 366 | <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span> |
| 367 | 367 | </div> |
@@ -369,30 +369,30 @@ discard block |
||
| 369 | 369 | </div> |
| 370 | 370 | </div> |
| 371 | 371 | <div class="col-sm-1 pt-2 pl-0"> |
| 372 | - <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> |
|
| 372 | + <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> |
|
| 373 | 373 | </div> |
| 374 | 374 | </div> |
| 375 | - <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?> |
|
| 375 | + <?php do_action('wpinv_discount_form_before_max_total', $discount); ?> |
|
| 376 | 376 | |
| 377 | - <?php do_action( 'wpinv_discount_form_before_max_uses', $discount ); ?> |
|
| 377 | + <?php do_action('wpinv_discount_form_before_max_uses', $discount); ?> |
|
| 378 | 378 | <div class="form-group row"> |
| 379 | 379 | <label for="wpinv_discount_max_uses" class="col-sm-3 col-form-label"> |
| 380 | - <?php esc_html_e( 'Maximum Uses', 'invoicing' ); ?> |
|
| 380 | + <?php esc_html_e('Maximum Uses', 'invoicing'); ?> |
|
| 381 | 381 | </label> |
| 382 | 382 | <div class="col-sm-8"> |
| 383 | - <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%;" /> |
|
| 383 | + <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%;" /> |
|
| 384 | 384 | </div> |
| 385 | 385 | <div class="col-sm-1 pt-2 pl-0"> |
| 386 | - <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> |
|
| 386 | + <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> |
|
| 387 | 387 | </div> |
| 388 | 388 | </div> |
| 389 | - <?php do_action( 'wpinv_discount_form_max_uses', $discount ); ?> |
|
| 389 | + <?php do_action('wpinv_discount_form_max_uses', $discount); ?> |
|
| 390 | 390 | |
| 391 | - <?php do_action( 'wpinv_discount_form_last', $discount ); ?> |
|
| 391 | + <?php do_action('wpinv_discount_form_last', $discount); ?> |
|
| 392 | 392 | |
| 393 | 393 | </div> |
| 394 | 394 | <?php |
| 395 | - do_action( 'wpinv_discount_form_bottom', $post ); |
|
| 395 | + do_action('wpinv_discount_form_bottom', $post); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | /** |
@@ -400,31 +400,31 @@ discard block |
||
| 400 | 400 | * |
| 401 | 401 | * @param int $post_id |
| 402 | 402 | */ |
| 403 | - public static function save( $post_id ) { |
|
| 403 | + public static function save($post_id) { |
|
| 404 | 404 | |
| 405 | 405 | // Prepare the discount. |
| 406 | - $discount = new WPInv_Discount( $post_id ); |
|
| 406 | + $discount = new WPInv_Discount($post_id); |
|
| 407 | 407 | |
| 408 | 408 | // Load new data. |
| 409 | 409 | $discount->set_props( |
| 410 | 410 | array( |
| 411 | - 'code' => isset( $_POST['wpinv_discount_code'] ) ? wpinv_clean( $_POST['wpinv_discount_code'] ) : null, |
|
| 412 | - 'amount' => isset( $_POST['wpinv_discount_amount'] ) ? floatval( $_POST['wpinv_discount_amount'] ) : null, |
|
| 413 | - 'start' => isset( $_POST['wpinv_discount_start'] ) ? wpinv_clean( $_POST['wpinv_discount_start'] ) : null, |
|
| 414 | - 'expiration' => isset( $_POST['wpinv_discount_expiration'] ) ? wpinv_clean( $_POST['wpinv_discount_expiration'] ) : null, |
|
| 415 | - 'is_single_use' => ! empty( $_POST['wpinv_discount_single_use'] ), |
|
| 416 | - 'type' => isset( $_POST['wpinv_discount_type'] ) ? wpinv_clean( $_POST['wpinv_discount_type'] ) : null, |
|
| 417 | - 'is_recurring' => ! empty( $_POST['wpinv_discount_recurring'] ), |
|
| 418 | - 'items' => isset( $_POST['wpinv_discount_items'] ) ? wpinv_clean( $_POST['wpinv_discount_items'] ) : array(), |
|
| 419 | - 'excluded_items' => isset( $_POST['wpinv_discount_excluded_items'] ) ? wpinv_clean( $_POST['wpinv_discount_excluded_items'] ) : array(), |
|
| 420 | - 'required_items' => isset( $_POST['wpinv_discount_required_items'] ) ? wpinv_clean( $_POST['wpinv_discount_required_items'] ) : array(), |
|
| 421 | - 'max_uses' => isset( $_POST['wpinv_discount_max_uses'] ) ? intval( $_POST['wpinv_discount_max_uses'] ) : null, |
|
| 422 | - 'min_total' => isset( $_POST['wpinv_discount_min_total'] ) ? floatval( $_POST['wpinv_discount_min_total'] ) : null, |
|
| 423 | - 'max_total' => isset( $_POST['wpinv_discount_max_total'] ) ? floatval( $_POST['wpinv_discount_max_total'] ) : null, |
|
| 411 | + 'code' => isset($_POST['wpinv_discount_code']) ? wpinv_clean($_POST['wpinv_discount_code']) : null, |
|
| 412 | + 'amount' => isset($_POST['wpinv_discount_amount']) ? floatval($_POST['wpinv_discount_amount']) : null, |
|
| 413 | + 'start' => isset($_POST['wpinv_discount_start']) ? wpinv_clean($_POST['wpinv_discount_start']) : null, |
|
| 414 | + 'expiration' => isset($_POST['wpinv_discount_expiration']) ? wpinv_clean($_POST['wpinv_discount_expiration']) : null, |
|
| 415 | + 'is_single_use' => !empty($_POST['wpinv_discount_single_use']), |
|
| 416 | + 'type' => isset($_POST['wpinv_discount_type']) ? wpinv_clean($_POST['wpinv_discount_type']) : null, |
|
| 417 | + 'is_recurring' => !empty($_POST['wpinv_discount_recurring']), |
|
| 418 | + 'items' => isset($_POST['wpinv_discount_items']) ? wpinv_clean($_POST['wpinv_discount_items']) : array(), |
|
| 419 | + 'excluded_items' => isset($_POST['wpinv_discount_excluded_items']) ? wpinv_clean($_POST['wpinv_discount_excluded_items']) : array(), |
|
| 420 | + 'required_items' => isset($_POST['wpinv_discount_required_items']) ? wpinv_clean($_POST['wpinv_discount_required_items']) : array(), |
|
| 421 | + 'max_uses' => isset($_POST['wpinv_discount_max_uses']) ? intval($_POST['wpinv_discount_max_uses']) : null, |
|
| 422 | + 'min_total' => isset($_POST['wpinv_discount_min_total']) ? floatval($_POST['wpinv_discount_min_total']) : null, |
|
| 423 | + 'max_total' => isset($_POST['wpinv_discount_max_total']) ? floatval($_POST['wpinv_discount_max_total']) : null, |
|
| 424 | 424 | ) |
| 425 | 425 | ); |
| 426 | 426 | |
| 427 | 427 | $discount->save(); |
| 428 | - do_action( 'getpaid_discount_metabox_save', $post_id, $discount ); |
|
| 428 | + do_action('getpaid_discount_metabox_save', $post_id, $discount); |
|
| 429 | 429 | } |
| 430 | 430 | } |
@@ -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,20 +21,20 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param WP_Post $post |
| 23 | 23 | */ |
| 24 | - public static function output( $post ) { |
|
| 24 | + public static function output($post) { |
|
| 25 | 25 | |
| 26 | 26 | // Prepare the item. |
| 27 | - $item = new WPInv_Item( $post ); |
|
| 27 | + $item = new WPInv_Item($post); |
|
| 28 | 28 | |
| 29 | 29 | ?> |
| 30 | 30 | |
| 31 | 31 | <div class='bsui' style='padding-top: 10px;'> |
| 32 | - <?php do_action( 'wpinv_item_before_info_metabox', $item ); ?> |
|
| 32 | + <?php do_action('wpinv_item_before_info_metabox', $item); ?> |
|
| 33 | 33 | |
| 34 | 34 | <div class="wpinv_item_type form-group row"> |
| 35 | 35 | <label for="wpinv_item_type" class="col-sm-12 col-form-label"> |
| 36 | - <?php esc_html_e( 'Item Type', 'invoicing' ); ?> |
|
| 37 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php echo esc_attr( self::get_tooltip( $post ) ); ?>"></span> |
|
| 36 | + <?php esc_html_e('Item Type', 'invoicing'); ?> |
|
| 37 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php echo esc_attr(self::get_tooltip($post)); ?>"></span> |
|
| 38 | 38 | </label> |
| 39 | 39 | |
| 40 | 40 | <div class="col-sm-12"> |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | array( |
| 45 | 45 | 'id' => 'wpinv_item_type', |
| 46 | 46 | 'name' => 'wpinv_item_type', |
| 47 | - 'placeholder' => __( 'Select item type', 'invoicing' ), |
|
| 48 | - 'value' => $item->get_type( 'edit' ), |
|
| 47 | + 'placeholder' => __('Select item type', 'invoicing'), |
|
| 48 | + 'value' => $item->get_type('edit'), |
|
| 49 | 49 | 'select2' => true, |
| 50 | 50 | 'data-allow-clear' => 'false', |
| 51 | 51 | 'no_wrap' => true, |
@@ -57,59 +57,59 @@ discard block |
||
| 57 | 57 | </div> |
| 58 | 58 | </div> |
| 59 | 59 | |
| 60 | - <?php if ( 'fee' === $item->get_type( 'edit' ) || 'custom' === $item->get_type( 'edit' ) ) : ?> |
|
| 60 | + <?php if ('fee' === $item->get_type('edit') || 'custom' === $item->get_type('edit')) : ?> |
|
| 61 | 61 | |
| 62 | 62 | <div class="wpinv_item_shortcode form-group row"> |
| 63 | 63 | <label for="wpinv_item_shortcode" class="col-sm-12 col-form-label"> |
| 64 | - <?php esc_html_e( 'Payment Form Shortcode', 'invoicing' ); ?> |
|
| 65 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a payment form', 'invoicing' ); ?>"></span> |
|
| 64 | + <?php esc_html_e('Payment Form Shortcode', 'invoicing'); ?> |
|
| 65 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a payment form', 'invoicing'); ?>"></span> |
|
| 66 | 66 | </label> |
| 67 | 67 | |
| 68 | 68 | <div class="col-sm-12"> |
| 69 | - <input onClick="this.select()" type="text" id="wpinv_item_shortcode" value="[getpaid item=<?php echo esc_attr( $item->get_id() ); ?>]" style="width: 100%;" readonly/> |
|
| 69 | + <input onClick="this.select()" type="text" id="wpinv_item_shortcode" value="[getpaid item=<?php echo esc_attr($item->get_id()); ?>]" style="width: 100%;" readonly/> |
|
| 70 | 70 | </div> |
| 71 | 71 | </div> |
| 72 | 72 | |
| 73 | 73 | <div class="wpinv_item_buy_shortcode form-group row"> |
| 74 | 74 | <label for="wpinv_item_button_shortcode" class="col-sm-12 col-form-label"> |
| 75 | - <?php esc_html_e( 'Payment Button Shortcode', 'invoicing' ); ?> |
|
| 76 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a buy now button', 'invoicing' ); ?>"></span> |
|
| 75 | + <?php esc_html_e('Payment Button Shortcode', 'invoicing'); ?> |
|
| 76 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a buy now button', 'invoicing'); ?>"></span> |
|
| 77 | 77 | </label> |
| 78 | 78 | |
| 79 | 79 | <div class="col-sm-12"> |
| 80 | - <input onClick="this.select()" type="text" id="wpinv_item_button_shortcode" value="[getpaid item=<?php echo esc_attr( $item->get_id() ); ?> button='Buy Now']" style="width: 100%;" readonly/> |
|
| 80 | + <input onClick="this.select()" type="text" id="wpinv_item_button_shortcode" value="[getpaid item=<?php echo esc_attr($item->get_id()); ?> button='Buy Now']" style="width: 100%;" readonly/> |
|
| 81 | 81 | <small class="form-text text-muted"> |
| 82 | - <?php esc_html_e( 'Or use the following URL in a link:', 'invoicing' ); ?> |
|
| 83 | - <code>#getpaid-item-<?php echo intval( $item->get_id() ); ?>|0</code> |
|
| 82 | + <?php esc_html_e('Or use the following URL in a link:', 'invoicing'); ?> |
|
| 83 | + <code>#getpaid-item-<?php echo intval($item->get_id()); ?>|0</code> |
|
| 84 | 84 | </small> |
| 85 | 85 | </div> |
| 86 | 86 | </div> |
| 87 | 87 | |
| 88 | 88 | <div class="wpinv_item_buy_url form-group row"> |
| 89 | 89 | <label for="wpinv_item_buy_url" class="col-sm-12 col-form-label"> |
| 90 | - <?php esc_html_e( 'Direct Payment URL', 'invoicing' ); ?> |
|
| 91 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'You can use this in an iFrame to embed the payment form on another website', 'invoicing' ); ?>"></span> |
|
| 90 | + <?php esc_html_e('Direct Payment URL', 'invoicing'); ?> |
|
| 91 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('You can use this in an iFrame to embed the payment form on another website', 'invoicing'); ?>"></span> |
|
| 92 | 92 | </label> |
| 93 | 93 | |
| 94 | 94 | <div class="col-sm-12"> |
| 95 | - <input onClick="this.select()" type="text" id="wpinv_item_buy_url" value="<?php echo esc_url( getpaid_embed_url( false, $item->get_id() . '|0' ) ); ?>" style="width: 100%;" readonly/> |
|
| 95 | + <input onClick="this.select()" type="text" id="wpinv_item_buy_url" value="<?php echo esc_url(getpaid_embed_url(false, $item->get_id() . '|0')); ?>" style="width: 100%;" readonly/> |
|
| 96 | 96 | </div> |
| 97 | 97 | </div> |
| 98 | 98 | |
| 99 | 99 | <?php endif; ?> |
| 100 | 100 | |
| 101 | 101 | <div class="wpinv_item_custom_id form-group"> |
| 102 | - <?php esc_html_e( 'Custom ID', 'invoicing' ); ?> — <?php echo esc_html( $item->get_custom_id() ); ?> |
|
| 102 | + <?php esc_html_e('Custom ID', 'invoicing'); ?> — <?php echo esc_html($item->get_custom_id()); ?> |
|
| 103 | 103 | </div> |
| 104 | 104 | |
| 105 | - <?php do_action( 'wpinv_meta_values_metabox_before', $post ); ?> |
|
| 106 | - <?php foreach ( apply_filters( 'wpinv_show_meta_values_for_keys', array() ) as $meta_key ) : ?> |
|
| 105 | + <?php do_action('wpinv_meta_values_metabox_before', $post); ?> |
|
| 106 | + <?php foreach (apply_filters('wpinv_show_meta_values_for_keys', array()) as $meta_key) : ?> |
|
| 107 | 107 | <div class="wpinv_item_custom_id form-group"> |
| 108 | - <?php echo esc_html( $meta_key ); ?> — <?php echo esc_html( get_post_meta( $item->get_id(), '_wpinv_' . $meta_key, true ) ); ?> |
|
| 108 | + <?php echo esc_html($meta_key); ?> — <?php echo esc_html(get_post_meta($item->get_id(), '_wpinv_' . $meta_key, true)); ?> |
|
| 109 | 109 | </div> |
| 110 | 110 | <?php endforeach; ?> |
| 111 | - <?php do_action( 'wpinv_meta_values_metabox_after', $post ); ?> |
|
| 112 | - <?php do_action( 'wpinv_item_info_metabox', $item ); ?> |
|
| 111 | + <?php do_action('wpinv_meta_values_metabox_after', $post); ?> |
|
| 112 | + <?php do_action('wpinv_item_info_metabox', $item); ?> |
|
| 113 | 113 | </div> |
| 114 | 114 | <?php |
| 115 | 115 | |
@@ -119,16 +119,16 @@ discard block |
||
| 119 | 119 | * Returns item type tolltip. |
| 120 | 120 | * |
| 121 | 121 | */ |
| 122 | - public static function get_tooltip( $post ) { |
|
| 122 | + public static function get_tooltip($post) { |
|
| 123 | 123 | |
| 124 | 124 | ob_start(); |
| 125 | 125 | ?> |
| 126 | 126 | |
| 127 | - <?php esc_html_e( 'Standard: Standard item type', 'invoicing' ); ?> |
|
| 128 | - <?php esc_html_e( 'Fee: Like Registration Fee, Sign up Fee etc', 'invoicing' ); ?> |
|
| 127 | + <?php esc_html_e('Standard: Standard item type', 'invoicing'); ?> |
|
| 128 | + <?php esc_html_e('Fee: Like Registration Fee, Sign up Fee etc', 'invoicing'); ?> |
|
| 129 | 129 | |
| 130 | 130 | <?php |
| 131 | - do_action( 'wpinv_item_info_metabox_after', $post ); |
|
| 131 | + do_action('wpinv_item_info_metabox_after', $post); |
|
| 132 | 132 | |
| 133 | 133 | return ob_get_clean(); |
| 134 | 134 | |
@@ -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,13 +21,13 @@ 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 invoice. |
| 27 | - $invoice = new WPInv_Invoice( $post ); |
|
| 27 | + $invoice = new WPInv_Invoice($post); |
|
| 28 | 28 | |
| 29 | 29 | // Nonce field. |
| 30 | - wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ; |
|
| 30 | + wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | ?> |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | <div class="bsui" style="margin-top: 1.5rem"> |
| 48 | 48 | |
| 49 | - <?php do_action( 'getpaid_invoice_edit_before_viewed_by_customer', $invoice ); ?> |
|
| 50 | - <?php if ( ! $invoice->is_draft() ) : ?> |
|
| 49 | + <?php do_action('getpaid_invoice_edit_before_viewed_by_customer', $invoice); ?> |
|
| 50 | + <?php if (!$invoice->is_draft()) : ?> |
|
| 51 | 51 | <div class="form-group"> |
| 52 | - <strong><?php esc_html_e( 'Viewed by Customer:', 'invoicing' );?></strong> |
|
| 53 | - <?php ( $invoice->get_is_viewed() ) ? _e( 'Yes', 'invoicing' ) : _e( 'No', 'invoicing' ); ?> |
|
| 52 | + <strong><?php esc_html_e('Viewed by Customer:', 'invoicing'); ?></strong> |
|
| 53 | + <?php ($invoice->get_is_viewed()) ? _e('Yes', 'invoicing') : _e('No', 'invoicing'); ?> |
|
| 54 | 54 | </div> |
| 55 | 55 | <?php endif; ?> |
| 56 | 56 | |
@@ -58,13 +58,13 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | // Date created. |
| 60 | 60 | $label = sprintf( |
| 61 | - __( '%s Date:', 'invoicing' ), |
|
| 62 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 61 | + __('%s Date:', 'invoicing'), |
|
| 62 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 63 | 63 | ); |
| 64 | 64 | |
| 65 | - $info = sprintf( |
|
| 66 | - __( 'The date this %s was created.', 'invoicing' ), |
|
| 67 | - strtolower( $invoice->get_invoice_quote_type() ) |
|
| 65 | + $info = sprintf( |
|
| 66 | + __('The date this %s was created.', 'invoicing'), |
|
| 67 | + strtolower($invoice->get_invoice_quote_type()) |
|
| 68 | 68 | ); |
| 69 | 69 | |
| 70 | 70 | echo aui()->input( |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | 'type' => 'datepicker', |
| 73 | 73 | 'id' => 'wpinv_date_created', |
| 74 | 74 | 'name' => 'date_created', |
| 75 | - 'label' => $label . getpaid_get_help_tip( $info ), |
|
| 75 | + 'label' => $label . getpaid_get_help_tip($info), |
|
| 76 | 76 | 'label_type' => 'vertical', |
| 77 | 77 | 'placeholder' => 'YYYY-MM-DD 00:00', |
| 78 | 78 | 'class' => 'form-control-sm', |
| 79 | - 'value' => $invoice->get_date_created( 'edit' ), |
|
| 79 | + 'value' => $invoice->get_date_created('edit'), |
|
| 80 | 80 | 'extra_attributes' => array( |
| 81 | 81 | 'data-enable-time' => 'true', |
| 82 | 82 | 'data-time_24hr' => 'true', |
@@ -87,15 +87,15 @@ discard block |
||
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | 89 | // Date paid. |
| 90 | - $date_paid = $invoice->get_date_completed( 'edit' ); |
|
| 91 | - if ( ! empty( $date_paid ) && $invoice->is_paid() ) { |
|
| 90 | + $date_paid = $invoice->get_date_completed('edit'); |
|
| 91 | + if (!empty($date_paid) && $invoice->is_paid()) { |
|
| 92 | 92 | |
| 93 | 93 | echo aui()->input( |
| 94 | 94 | array( |
| 95 | 95 | 'type' => 'text', |
| 96 | 96 | 'id' => 'wpinv_date_completed', |
| 97 | 97 | 'name' => 'wpinv_date_completed', |
| 98 | - 'label' => __( 'Date Completed:', 'invoicing' ), |
|
| 98 | + 'label' => __('Date Completed:', 'invoicing'), |
|
| 99 | 99 | 'label_type' => 'vertical', |
| 100 | 100 | 'class' => 'form-control-sm', |
| 101 | 101 | 'value' => $date_paid, |
@@ -105,18 +105,18 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Due date. |
| 108 | - if ( $invoice->is_type( 'invoice' ) && wpinv_get_option( 'overdue_active' ) && ( ! $invoice->is_paid() || $invoice->is_draft() ) ) { |
|
| 108 | + if ($invoice->is_type('invoice') && wpinv_get_option('overdue_active') && (!$invoice->is_paid() || $invoice->is_draft())) { |
|
| 109 | 109 | |
| 110 | 110 | echo aui()->input( |
| 111 | 111 | array( |
| 112 | 112 | 'type' => 'datepicker', |
| 113 | 113 | 'id' => 'wpinv_due_date', |
| 114 | 114 | 'name' => 'wpinv_due_date', |
| 115 | - 'label' => __( 'Due Date:', 'invoicing' ) . getpaid_get_help_tip( __( 'Leave blank to disable automated reminder emails for this invoice.', 'invoicing' ) ), |
|
| 115 | + 'label' => __('Due Date:', 'invoicing') . getpaid_get_help_tip(__('Leave blank to disable automated reminder emails for this invoice.', 'invoicing')), |
|
| 116 | 116 | 'label_type' => 'vertical', |
| 117 | - 'placeholder' => __( 'No due date', 'invoicing' ), |
|
| 117 | + 'placeholder' => __('No due date', 'invoicing'), |
|
| 118 | 118 | 'class' => 'form-control-sm', |
| 119 | - 'value' => $invoice->get_due_date( 'edit' ), |
|
| 119 | + 'value' => $invoice->get_due_date('edit'), |
|
| 120 | 120 | 'extra_attributes' => array( |
| 121 | 121 | 'data-enable-time' => 'true', |
| 122 | 122 | 'data-time_24hr' => 'true', |
@@ -128,39 +128,39 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - do_action( 'wpinv_meta_box_details_after_due_date', $invoice->get_id() ); |
|
| 132 | - do_action( 'getpaid_metabox_after_due_date', $invoice ); |
|
| 131 | + do_action('wpinv_meta_box_details_after_due_date', $invoice->get_id()); |
|
| 132 | + do_action('getpaid_metabox_after_due_date', $invoice); |
|
| 133 | 133 | |
| 134 | 134 | // Status. |
| 135 | 135 | $label = sprintf( |
| 136 | - __( '%s Status:', 'invoicing' ), |
|
| 137 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 136 | + __('%s Status:', 'invoicing'), |
|
| 137 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | - $status = $invoice->get_status( 'edit' ); |
|
| 140 | + $status = $invoice->get_status('edit'); |
|
| 141 | 141 | echo aui()->select( |
| 142 | 142 | array( |
| 143 | 143 | 'id' => 'wpinv_status', |
| 144 | 144 | 'name' => 'wpinv_status', |
| 145 | 145 | 'label' => $label, |
| 146 | 146 | 'label_type' => 'vertical', |
| 147 | - 'placeholder' => __( 'Select Status', 'invoicing' ), |
|
| 148 | - 'value' => array_key_exists( $status, $invoice->get_all_statuses() ) ? $status : $invoice->get_default_status(), |
|
| 147 | + 'placeholder' => __('Select Status', 'invoicing'), |
|
| 148 | + 'value' => array_key_exists($status, $invoice->get_all_statuses()) ? $status : $invoice->get_default_status(), |
|
| 149 | 149 | 'select2' => true, |
| 150 | 150 | 'data-allow-clear' => 'false', |
| 151 | - 'options' => wpinv_get_invoice_statuses( true, false, $invoice ) |
|
| 151 | + 'options' => wpinv_get_invoice_statuses(true, false, $invoice) |
|
| 152 | 152 | ) |
| 153 | 153 | ); |
| 154 | 154 | |
| 155 | 155 | // Invoice number. |
| 156 | 156 | $label = sprintf( |
| 157 | - __( '%s Number:', 'invoicing' ), |
|
| 158 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
| 157 | + __('%s Number:', 'invoicing'), |
|
| 158 | + ucfirst($invoice->get_invoice_quote_type()) |
|
| 159 | 159 | ); |
| 160 | 160 | |
| 161 | - $info = sprintf( |
|
| 162 | - __( 'Each %s number must be unique.', 'invoicing' ), |
|
| 163 | - strtolower( $invoice->get_invoice_quote_type() ) |
|
| 161 | + $info = sprintf( |
|
| 162 | + __('Each %s number must be unique.', 'invoicing'), |
|
| 163 | + strtolower($invoice->get_invoice_quote_type()) |
|
| 164 | 164 | ); |
| 165 | 165 | |
| 166 | 166 | echo aui()->input( |
@@ -168,11 +168,11 @@ discard block |
||
| 168 | 168 | 'type' => 'text', |
| 169 | 169 | 'id' => 'wpinv_number', |
| 170 | 170 | 'name' => 'wpinv_number', |
| 171 | - 'label' => $label . getpaid_get_help_tip( $info ), |
|
| 171 | + 'label' => $label . getpaid_get_help_tip($info), |
|
| 172 | 172 | 'label_type' => 'vertical', |
| 173 | - 'placeholder' => __( 'Autogenerate', 'invoicing' ), |
|
| 173 | + 'placeholder' => __('Autogenerate', 'invoicing'), |
|
| 174 | 174 | 'class' => 'form-control-sm', |
| 175 | - 'value' => $invoice->get_number( 'edit' ), |
|
| 175 | + 'value' => $invoice->get_number('edit'), |
|
| 176 | 176 | ) |
| 177 | 177 | ); |
| 178 | 178 | |
@@ -182,15 +182,15 @@ discard block |
||
| 182 | 182 | 'type' => 'text', |
| 183 | 183 | 'id' => 'wpinv_cc', |
| 184 | 184 | 'name' => 'wpinv_cc', |
| 185 | - 'label' => __( 'Email CC:', 'invoicing' ) . getpaid_get_help_tip( __( 'Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing' ) ), |
|
| 185 | + 'label' => __('Email CC:', 'invoicing') . getpaid_get_help_tip(__('Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing')), |
|
| 186 | 186 | 'label_type' => 'vertical', |
| 187 | - 'placeholder' => __( '[email protected], [email protected]', 'invoicing' ), |
|
| 187 | + 'placeholder' => __('[email protected], [email protected]', 'invoicing'), |
|
| 188 | 188 | 'class' => 'form-control-sm', |
| 189 | - 'value' => $invoice->get_email_cc( 'edit' ), |
|
| 189 | + 'value' => $invoice->get_email_cc('edit'), |
|
| 190 | 190 | ) |
| 191 | 191 | ); |
| 192 | 192 | |
| 193 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
| 193 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
| 194 | 194 | |
| 195 | 195 | // Apply a discount. |
| 196 | 196 | echo aui()->input( |
@@ -198,25 +198,25 @@ discard block |
||
| 198 | 198 | 'type' => 'text', |
| 199 | 199 | 'id' => 'wpinv_discount_code', |
| 200 | 200 | 'name' => 'wpinv_discount_code', |
| 201 | - 'label' => __( 'Discount Code:', 'invoicing' ), |
|
| 202 | - 'placeholder' => __( 'Apply Discount', 'invoicing' ), |
|
| 201 | + 'label' => __('Discount Code:', 'invoicing'), |
|
| 202 | + 'placeholder' => __('Apply Discount', 'invoicing'), |
|
| 203 | 203 | 'label_type' => 'vertical', |
| 204 | 204 | 'class' => 'form-control-sm getpaid-recalculate-prices-on-change', |
| 205 | - 'value' => $invoice->get_discount_code( 'edit' ), |
|
| 205 | + 'value' => $invoice->get_discount_code('edit'), |
|
| 206 | 206 | ) |
| 207 | 207 | ); |
| 208 | 208 | |
| 209 | - } else if ( $invoice->get_discount_code( 'edit' ) ) { |
|
| 209 | + } else if ($invoice->get_discount_code('edit')) { |
|
| 210 | 210 | |
| 211 | 211 | echo aui()->input( |
| 212 | 212 | array( |
| 213 | 213 | 'type' => 'text', |
| 214 | 214 | 'id' => 'wpinv_discount_code', |
| 215 | 215 | 'name' => 'wpinv_discount_code', |
| 216 | - 'label' => __( 'Discount Code:', 'invoicing' ), |
|
| 216 | + 'label' => __('Discount Code:', 'invoicing'), |
|
| 217 | 217 | 'label_type' => 'vertical', |
| 218 | 218 | 'class' => 'form-control-sm', |
| 219 | - 'value' => $invoice->get_discount_code( 'edit' ), |
|
| 219 | + 'value' => $invoice->get_discount_code('edit'), |
|
| 220 | 220 | 'extra_attributes' => array( |
| 221 | 221 | 'onclick' => 'this.select();', |
| 222 | 222 | 'readonly' => 'true', |
@@ -226,17 +226,17 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - do_action( 'wpinv_meta_box_details_inner', $invoice->get_id() ); |
|
| 229 | + do_action('wpinv_meta_box_details_inner', $invoice->get_id()); |
|
| 230 | 230 | |
| 231 | 231 | // Disable taxes. |
| 232 | - if ( wpinv_use_taxes() && ! ( $invoice->is_paid() || $invoice->is_refunded() ) ) { |
|
| 232 | + if (wpinv_use_taxes() && !($invoice->is_paid() || $invoice->is_refunded())) { |
|
| 233 | 233 | |
| 234 | 234 | echo aui()->input( |
| 235 | 235 | array( |
| 236 | 236 | 'id' => 'wpinv_taxable', |
| 237 | 237 | 'name' => 'disable_taxes', |
| 238 | 238 | 'type' => 'checkbox', |
| 239 | - 'label' => __( 'Disable taxes', 'invoicing' ), |
|
| 239 | + 'label' => __('Disable taxes', 'invoicing'), |
|
| 240 | 240 | 'value' => '1', |
| 241 | 241 | 'checked' => (bool) $invoice->get_disable_taxes(), |
| 242 | 242 | 'class' => 'getpaid-recalculate-prices-on-change', |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - if ( $invoice->is_type( 'invoice' ) ) { |
|
| 248 | + if ($invoice->is_type('invoice')) { |
|
| 249 | 249 | |
| 250 | 250 | // Send to customer. |
| 251 | 251 | echo aui()->input( |
@@ -253,15 +253,15 @@ discard block |
||
| 253 | 253 | 'id' => 'wpinv_send_to_customer', |
| 254 | 254 | 'name' => 'send_to_customer', |
| 255 | 255 | 'type' => 'checkbox', |
| 256 | - 'label' => __( 'Send invoice to customer after saving', 'invoicing' ), |
|
| 256 | + 'label' => __('Send invoice to customer after saving', 'invoicing'), |
|
| 257 | 257 | 'value' => '1', |
| 258 | - 'checked' => $invoice->is_draft() && (bool) wpinv_get_option( 'email_user_invoice_active', true ), |
|
| 258 | + 'checked' => $invoice->is_draft() && (bool) wpinv_get_option('email_user_invoice_active', true), |
|
| 259 | 259 | ) |
| 260 | 260 | ); |
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - do_action( 'getpaid_metabox_after_invoice_details', $invoice ); |
|
| 264 | + do_action('getpaid_metabox_after_invoice_details', $invoice); |
|
| 265 | 265 | |
| 266 | 266 | ?> |
| 267 | 267 | |