@@ -1,32 +1,32 @@ discard block |
||
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_Details { |
8 | - public static function output( $post ) { |
|
8 | + public static function output($post) { |
|
9 | 9 | global $wpinv_euvat; |
10 | 10 | |
11 | 11 | $currency_symbol = wpinv_currency_symbol(); |
12 | - $statuses = wpinv_get_invoice_statuses( true ); |
|
12 | + $statuses = wpinv_get_invoice_statuses(true); |
|
13 | 13 | |
14 | - $post_id = !empty( $post->ID ) ? $post->ID : 0; |
|
15 | - $invoice = new WPInv_Invoice( $post_id ); |
|
16 | - $status = $invoice->get_status( false ); // Current status |
|
14 | + $post_id = !empty($post->ID) ? $post->ID : 0; |
|
15 | + $invoice = new WPInv_Invoice($post_id); |
|
16 | + $status = $invoice->get_status(false); // Current status |
|
17 | 17 | $discount = $invoice->get_discount(); |
18 | 18 | $discount_code = $discount > 0 ? $invoice->get_discount_code() : ''; |
19 | 19 | $invoice_number = $invoice->get_number(); |
20 | 20 | $taxable = $invoice->is_taxable(); |
21 | 21 | |
22 | 22 | $date_created = $invoice->get_created_date(); |
23 | - $datetime_created = strtotime( $date_created ); |
|
24 | - $date_created = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $datetime_created ) : ''; |
|
23 | + $datetime_created = strtotime($date_created); |
|
24 | + $date_created = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $datetime_created) : ''; |
|
25 | 25 | $date_completed = $invoice->get_completed_date(); |
26 | - $date_completed = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $date_completed ) ) : 'n/a'; |
|
27 | - $title['status'] = __( 'Invoice Status:', 'invoicing' ); |
|
28 | - $title['number'] = __( 'Invoice Number:', 'invoicing' ); |
|
29 | - $mail_notice = esc_attr__( 'After saving invoice, this will send a copy of the invoice to the user’s email address.', 'invoicing' ); |
|
26 | + $date_completed = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), strtotime($date_completed)) : 'n/a'; |
|
27 | + $title['status'] = __('Invoice Status:', 'invoicing'); |
|
28 | + $title['number'] = __('Invoice Number:', 'invoicing'); |
|
29 | + $mail_notice = esc_attr__('After saving invoice, this will send a copy of the invoice to the user’s email address.', 'invoicing'); |
|
30 | 30 | |
31 | 31 | $title = apply_filters('wpinv_details_metabox_titles', $title, $invoice); |
32 | 32 | $statuses = apply_filters('wpinv_invoice_statuses', $statuses, $invoice); |
@@ -36,36 +36,36 @@ discard block |
||
36 | 36 | <div class="gdmbx2-wrap form-table"> |
37 | 37 | <div class="gdmbx2-metabox gdmbx-field-list" id="gdmbx2-metabox-wpinv_details"> |
38 | 38 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-created"> |
39 | - <div class="gdmbx-th"><label><?php _e( 'Date Created:', 'invoicing' );?></label></div> |
|
40 | - <div class="gdmbx-td"><?php echo $date_created;?></div> |
|
39 | + <div class="gdmbx-th"><label><?php _e('Date Created:', 'invoicing'); ?></label></div> |
|
40 | + <div class="gdmbx-td"><?php echo $date_created; ?></div> |
|
41 | 41 | </div> |
42 | - <?php if ( $invoice->post_type == 'wpi_invoice' && wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->has_status( array( 'auto-draft', 'draft' ) ) ) ) { ?> |
|
42 | + <?php if ($invoice->post_type == 'wpi_invoice' && wpinv_get_option('overdue_active') && ($invoice->needs_payment() || $invoice->has_status(array('auto-draft', 'draft')))) { ?> |
|
43 | 43 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-overdue"> |
44 | - <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e( 'Due Date:', 'invoicing' );?></label></div> |
|
44 | + <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e('Due Date:', 'invoicing'); ?></label></div> |
|
45 | 45 | <div class="gdmbx-td"> |
46 | - <input type="text" placeholder="<?php esc_attr_e( 'Y-m-d', 'invoicing' );?>" value="<?php echo esc_attr( $invoice->get_due_date() );?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr( date_i18n( 'Y-m-d', $datetime_created ) );?>" data-dateFormat="yy-mm-dd"> |
|
47 | - <p class="wpi-meta-row wpi-meta-desc"><?php _e( 'Leave blank to disable sending auto reminder for this invoice.', 'invoicing' );?></p> |
|
46 | + <input type="text" placeholder="<?php esc_attr_e('Y-m-d', 'invoicing'); ?>" value="<?php echo esc_attr($invoice->get_due_date()); ?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr(date_i18n('Y-m-d', $datetime_created)); ?>" data-dateFormat="yy-mm-dd"> |
|
47 | + <p class="wpi-meta-row wpi-meta-desc"><?php _e('Leave blank to disable sending auto reminder for this invoice.', 'invoicing'); ?></p> |
|
48 | 48 | </div> |
49 | 49 | </div> |
50 | 50 | <?php } ?> |
51 | - <?php do_action( 'wpinv_meta_box_details_after_due_date', $post_id ); ?> |
|
52 | - <?php if ( $date_completed && $date_completed != 'n/a' ) { ?> |
|
51 | + <?php do_action('wpinv_meta_box_details_after_due_date', $post_id); ?> |
|
52 | + <?php if ($date_completed && $date_completed != 'n/a') { ?> |
|
53 | 53 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-completed"> |
54 | - <div class="gdmbx-th"><label><?php _e( 'Payment Date:', 'invoicing' );?></label></div> |
|
55 | - <div class="gdmbx-td"><?php echo $date_completed;?></div> |
|
54 | + <div class="gdmbx-th"><label><?php _e('Payment Date:', 'invoicing'); ?></label></div> |
|
55 | + <div class="gdmbx-td"><?php echo $date_completed; ?></div> |
|
56 | 56 | </div> |
57 | 57 | <?php } ?> |
58 | - <?php $is_viewed = wpinv_is_invoice_viewed( $post_id ); ?> |
|
58 | + <?php $is_viewed = wpinv_is_invoice_viewed($post_id); ?> |
|
59 | 59 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-customer-viewed"> |
60 | - <div class="gdmbx-th"><label><?php _e( 'Viewed by Customer:', 'invoicing' );?></label></div> |
|
61 | - <div class="gdmbx-td"><?php ( 1 == $is_viewed ) ? _e( 'Yes', 'invoicing' ) : _e( 'No', 'invoicing' ); ?></div> |
|
60 | + <div class="gdmbx-th"><label><?php _e('Viewed by Customer:', 'invoicing'); ?></label></div> |
|
61 | + <div class="gdmbx-td"><?php (1 == $is_viewed) ? _e('Yes', 'invoicing') : _e('No', 'invoicing'); ?></div> |
|
62 | 62 | </div> |
63 | 63 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-status"> |
64 | 64 | <div class="gdmbx-th"><label for="wpinv_status"><?php echo $title['status']; ?></label></div> |
65 | 65 | <div class="gdmbx-td"> |
66 | 66 | <select required="required" id="wpinv_status" name="wpinv_status" class="gdmbx2_select wpi_select2"> |
67 | - <?php foreach ( $statuses as $value => $label ) { ?> |
|
68 | - <option value="<?php echo $value;?>" <?php selected( $status, $value );?>><?php echo $label;?></option> |
|
67 | + <?php foreach ($statuses as $value => $label) { ?> |
|
68 | + <option value="<?php echo $value; ?>" <?php selected($status, $value); ?>><?php echo $label; ?></option> |
|
69 | 69 | <?php } ?> |
70 | 70 | </select> |
71 | 71 | </div> |
@@ -74,129 +74,129 @@ discard block |
||
74 | 74 | <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-number table-layout"> |
75 | 75 | <div class="gdmbx-th"><label for="wpinv_number"><?php echo $title['number']; ?></label></div> |
76 | 76 | <div class="gdmbx-td"> |
77 | - <input type="text" value="<?php echo esc_attr( $invoice_number );?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly> |
|
77 | + <input type="text" value="<?php echo esc_attr($invoice_number); ?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly> |
|
78 | 78 | </div> |
79 | 79 | </div> |
80 | - <?php do_action( 'wpinv_meta_box_details_inner', $post_id ); |
|
80 | + <?php do_action('wpinv_meta_box_details_inner', $post_id); |
|
81 | 81 | $disable_discount = apply_filters('wpinv_disable_apply_discount', false, $invoice, $post_id); |
82 | 82 | ?> |
83 | 83 | |
84 | - <?php if ( $wpinv_euvat->allow_vat_rules() && ! ( $invoice->is_paid() || $invoice->is_refunded() ) ) { ?> |
|
84 | + <?php if ($wpinv_euvat->allow_vat_rules() && !($invoice->is_paid() || $invoice->is_refunded())) { ?> |
|
85 | 85 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-taxable"> |
86 | 86 | <div class="gdmbx-th"> |
87 | 87 | <label for="wpinv_taxable"> |
88 | - <input type="checkbox" name="disable_taxes" value="1" <?php checked( $taxable, false ); ?> id="wpinv_taxable"> |
|
89 | - <?php _e( 'Disable taxes', 'invoicing' ); ?> |
|
88 | + <input type="checkbox" name="disable_taxes" value="1" <?php checked($taxable, false); ?> id="wpinv_taxable"> |
|
89 | + <?php _e('Disable taxes', 'invoicing'); ?> |
|
90 | 90 | </label> |
91 | 91 | </div> |
92 | 92 | </div> |
93 | 93 | <?php } ?> |
94 | 94 | |
95 | - <?php if ( !( $is_paid = ( $invoice->is_paid() || $invoice->is_refunded() ) ) && !$disable_discount || $discount_code ) { ?> |
|
95 | + <?php if (!($is_paid = ($invoice->is_paid() || $invoice->is_refunded())) && !$disable_discount || $discount_code) { ?> |
|
96 | 96 | <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-discount-code table-layout"> |
97 | - <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e( 'Discount Code:', 'invoicing' );?></label></div> |
|
97 | + <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e('Discount Code:', 'invoicing'); ?></label></div> |
|
98 | 98 | <div class="gdmbx-td"> |
99 | - <input type="text" value="<?php echo esc_attr( $discount_code ); ?>" id="wpinv_discount" class="medium-text" <?php echo ( $discount_code ? 'readonly' : '' ); ?> /><?php if ( !$is_paid && !$disable_discount ) { ?><input value="<?php echo esc_attr_e( 'Apply', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-hide' : 'wpi-inlineb' ); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e( 'Remove', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-inlineb' : 'wpi-hide' ); ?>" id="wpinv-remove-code" type="button" /><?php } ?> |
|
99 | + <input type="text" value="<?php echo esc_attr($discount_code); ?>" id="wpinv_discount" class="medium-text" <?php echo ($discount_code ? 'readonly' : ''); ?> /><?php if (!$is_paid && !$disable_discount) { ?><input value="<?php echo esc_attr_e('Apply', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-hide' : 'wpi-inlineb'); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e('Remove', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-inlineb' : 'wpi-hide'); ?>" id="wpinv-remove-code" type="button" /><?php } ?> |
|
100 | 100 | </div> |
101 | 101 | </div> |
102 | 102 | <?php } ?> |
103 | 103 | </div> |
104 | 104 | </div> |
105 | 105 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-save-send table-layout"> |
106 | - <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__( 'Send %s:', 'invoicing' ),$post_obj->labels->singular_name) ; ?></label> |
|
106 | + <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__('Send %s:', 'invoicing'), $post_obj->labels->singular_name); ?></label> |
|
107 | 107 | <select id="wpi_save_send" name="wpi_save_send" class="wpi_select2"> |
108 | - <option value="1"><?php _e( 'Yes', 'invoicing' ); ?></option> |
|
109 | - <option value="" selected="selected"><?php _e( 'No', 'invoicing' ); ?></option> |
|
108 | + <option value="1"><?php _e('Yes', 'invoicing'); ?></option> |
|
109 | + <option value="" selected="selected"><?php _e('No', 'invoicing'); ?></option> |
|
110 | 110 | </select> |
111 | 111 | </p> |
112 | 112 | <p class="wpi-meta-row wpi-send-info"><?php echo $mail_notice; ?></p> |
113 | 113 | </div> |
114 | -<?php wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ;?> |
|
114 | +<?php wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); ?> |
|
115 | 115 | <?php |
116 | 116 | } |
117 | 117 | |
118 | - public static function resend_invoice( $post ) { |
|
118 | + public static function resend_invoice($post) { |
|
119 | 119 | global $wpi_mb_invoice; |
120 | 120 | |
121 | - if ( empty( $wpi_mb_invoice ) ) { |
|
121 | + if (empty($wpi_mb_invoice)) { |
|
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
125 | 125 | $text = array( |
126 | - 'message' => esc_attr__( 'This will send a copy of the invoice to the customer’s email address.', 'invoicing' ), |
|
127 | - 'button_text' => __( 'Resend Invoice', 'invoicing' ), |
|
126 | + 'message' => esc_attr__('This will send a copy of the invoice to the customer’s email address.', 'invoicing'), |
|
127 | + 'button_text' => __('Resend Invoice', 'invoicing'), |
|
128 | 128 | ); |
129 | 129 | |
130 | 130 | $text = apply_filters('wpinv_resend_invoice_metabox_text', $text); |
131 | - do_action( 'wpinv_metabox_resend_invoice_before', $wpi_mb_invoice ); |
|
131 | + do_action('wpinv_metabox_resend_invoice_before', $wpi_mb_invoice); |
|
132 | 132 | |
133 | - if ( $email = $wpi_mb_invoice->get_email() ) { |
|
133 | + if ($email = $wpi_mb_invoice->get_email()) { |
|
134 | 134 | $email_actions = array(); |
135 | - $email_actions['email_url'] = remove_query_arg( 'wpinv-message', add_query_arg( array( 'wpi_action' => 'send_invoice', 'invoice_id' => $post->ID ) ) ); |
|
136 | - $email_actions['reminder_url'] = add_query_arg( array( 'wpi_action' => 'send_reminder', 'invoice_id' => $post->ID ) ); |
|
135 | + $email_actions['email_url'] = remove_query_arg('wpinv-message', add_query_arg(array('wpi_action' => 'send_invoice', 'invoice_id' => $post->ID))); |
|
136 | + $email_actions['reminder_url'] = add_query_arg(array('wpi_action' => 'send_reminder', 'invoice_id' => $post->ID)); |
|
137 | 137 | |
138 | - $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions ); |
|
138 | + $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions); |
|
139 | 139 | ?> |
140 | 140 | <p class="wpi-meta-row wpi-resend-info"><?php echo $text['message']; ?></p> |
141 | - <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url( $email_actions['email_url'] ); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p> |
|
142 | - <?php if ( wpinv_get_option( 'overdue_active' ) && "wpi_invoice" === $wpi_mb_invoice->post_type && $wpi_mb_invoice->needs_payment() && ( $due_date = $wpi_mb_invoice->get_due_date() ) ) { ?> |
|
143 | - <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e( 'Send overdue reminder notification to customer', 'invoicing' ); ?>" href="<?php echo esc_url( $email_actions['reminder_url'] ); ?>" class="button button-secondary"><?php esc_attr_e( 'Send Reminder', 'invoicing' ); ?></a></p> |
|
141 | + <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url($email_actions['email_url']); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p> |
|
142 | + <?php if (wpinv_get_option('overdue_active') && "wpi_invoice" === $wpi_mb_invoice->post_type && $wpi_mb_invoice->needs_payment() && ($due_date = $wpi_mb_invoice->get_due_date())) { ?> |
|
143 | + <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e('Send overdue reminder notification to customer', 'invoicing'); ?>" href="<?php echo esc_url($email_actions['reminder_url']); ?>" class="button button-secondary"><?php esc_attr_e('Send Reminder', 'invoicing'); ?></a></p> |
|
144 | 144 | <?php } ?> |
145 | 145 | <?php |
146 | 146 | } |
147 | 147 | |
148 | - do_action( 'wpinv_metabox_resend_invoice_after', $wpi_mb_invoice ); |
|
148 | + do_action('wpinv_metabox_resend_invoice_after', $wpi_mb_invoice); |
|
149 | 149 | } |
150 | 150 | |
151 | - public static function subscriptions( $post ) { |
|
152 | - $invoice = wpinv_get_invoice( $post->ID ); |
|
151 | + public static function subscriptions($post) { |
|
152 | + $invoice = wpinv_get_invoice($post->ID); |
|
153 | 153 | |
154 | - if ( ! empty( $invoice ) && $invoice->is_recurring() && $invoice->is_parent() ) { |
|
155 | - $subscription = wpinv_get_subscription( $invoice ); |
|
154 | + if (!empty($invoice) && $invoice->is_recurring() && $invoice->is_parent()) { |
|
155 | + $subscription = wpinv_get_subscription($invoice); |
|
156 | 156 | |
157 | - if ( empty( $subscription ) ) { |
|
157 | + if (empty($subscription)) { |
|
158 | 158 | ?> |
159 | - <p class="wpi-meta-row"><?php echo wp_sprintf( __( 'New Subscription will be created when customer will checkout and pay the invoice. Go to: %sSubscriptions%s', 'invoicing' ), '<a href="' . admin_url( 'admin.php?page=wpinv-subscriptions' ).'">', '</a>' ); ?></p> |
|
159 | + <p class="wpi-meta-row"><?php echo wp_sprintf(__('New Subscription will be created when customer will checkout and pay the invoice. Go to: %sSubscriptions%s', 'invoicing'), '<a href="' . admin_url('admin.php?page=wpinv-subscriptions') . '">', '</a>'); ?></p> |
|
160 | 160 | <?php |
161 | 161 | return; |
162 | 162 | } |
163 | - $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency( $subscription->period, $subscription->frequency ); |
|
164 | - $billing = wpinv_price(wpinv_format_amount( $subscription->recurring_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) ) . ' / ' . $frequency; |
|
165 | - $initial = wpinv_price(wpinv_format_amount( $subscription->initial_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) ); |
|
163 | + $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency($subscription->period, $subscription->frequency); |
|
164 | + $billing = wpinv_price(wpinv_format_amount($subscription->recurring_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id)) . ' / ' . $frequency; |
|
165 | + $initial = wpinv_price(wpinv_format_amount($subscription->initial_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id)); |
|
166 | 166 | $payments = $subscription->get_child_payments(); |
167 | 167 | ?> |
168 | 168 | <p class="wpi-meta-row wpi-sub-label <?php echo 'status-' . $subscription->status; ?>"><?php _e('Recurring Payment', 'invoicing'); ?></p> |
169 | - <?php if ( ! empty( $subscription ) && ! empty( $subscription->id ) ) { ?> |
|
169 | + <?php if (!empty($subscription) && !empty($subscription->id)) { ?> |
|
170 | 170 | <p class="wpi-meta-row wpi-sub-id"> |
171 | - <label><?php _e( 'Subscription ID:', 'invoicing' ); ?> </label><a href="<?php echo esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . $subscription->id ) ); ?>" title="<?php esc_attr_e( 'View or edit subscription', 'invoicing' ); ?>" target="_blank"><?php echo $subscription->id; ?></a></p> |
|
171 | + <label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . $subscription->id)); ?>" title="<?php esc_attr_e('View or edit subscription', 'invoicing'); ?>" target="_blank"><?php echo $subscription->id; ?></a></p> |
|
172 | 172 | <?php } ?> |
173 | 173 | <p class="wpi-meta-row wpi-bill-cycle"> |
174 | - <label><?php _e( 'Billing Cycle:', 'invoicing'); ?> </label><?php printf( _x( '%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing' ), $initial, $billing ); ?> |
|
174 | + <label><?php _e('Billing Cycle:', 'invoicing'); ?> </label><?php printf(_x('%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing'), $initial, $billing); ?> |
|
175 | 175 | </p> |
176 | 176 | <p class="wpi-meta-row wpi-billed-times"> |
177 | - <label><?php _e( 'Times Billed:', 'invoicing' ); ?> </label><?php echo $subscription->get_times_billed() . ' / ' . ( ( $subscription->bill_times == 0 ) ? 'Until Cancelled' : $subscription->bill_times ); ?> |
|
177 | + <label><?php _e('Times Billed:', 'invoicing'); ?> </label><?php echo $subscription->get_times_billed() . ' / ' . (($subscription->bill_times == 0) ? 'Until Cancelled' : $subscription->bill_times); ?> |
|
178 | 178 | </p> |
179 | 179 | <p class="wpi-meta-row wpi-start-date"> |
180 | - <label><?php _e( 'Start Date:', 'invoicing' ); ?> </label><?php echo date_i18n( get_option( 'date_format' ), strtotime( $subscription->created, current_time( 'timestamp' ) ) ); ?> |
|
180 | + <label><?php _e('Start Date:', 'invoicing'); ?> </label><?php echo date_i18n(get_option('date_format'), strtotime($subscription->created, current_time('timestamp'))); ?> |
|
181 | 181 | </p> |
182 | 182 | <p class="wpi-meta-row wpi-end-date"> |
183 | - <label><?php echo ( 'trialling' == $subscription->status ? __( 'Trialling Until:', 'invoicing' ) : __( 'Expiration Date:', 'invoicing' ) ); ?> </label><?php echo date_i18n( get_option( 'date_format' ), strtotime( $subscription->expiration, current_time( 'timestamp' ) ) ); ?> |
|
183 | + <label><?php echo ('trialling' == $subscription->status ? __('Trialling Until:', 'invoicing') : __('Expiration Date:', 'invoicing')); ?> </label><?php echo date_i18n(get_option('date_format'), strtotime($subscription->expiration, current_time('timestamp'))); ?> |
|
184 | 184 | </p> |
185 | - <?php if ( $subscription->status ) { ?> |
|
185 | + <?php if ($subscription->status) { ?> |
|
186 | 186 | <p class="wpi-meta-row wpi-sub-status"> |
187 | - <label><?php _e( 'Subscription Status:', 'invoicing'); ?> </label><?php echo $subscription->get_status_label(); ?> |
|
187 | + <label><?php _e('Subscription Status:', 'invoicing'); ?> </label><?php echo $subscription->get_status_label(); ?> |
|
188 | 188 | </p> |
189 | 189 | <?php } ?> |
190 | - <?php if ( !empty( $payments ) ) { ?> |
|
191 | - <p><strong><?php _e( 'Renewal Payments:', 'invoicing' ); ?></strong></p> |
|
190 | + <?php if (!empty($payments)) { ?> |
|
191 | + <p><strong><?php _e('Renewal Payments:', 'invoicing'); ?></strong></p> |
|
192 | 192 | <ul id="wpi-sub-payments"> |
193 | - <?php foreach ( $payments as $payment ) { |
|
193 | + <?php foreach ($payments as $payment) { |
|
194 | 194 | $invoice_id = $payment->ID; |
195 | 195 | ?> |
196 | 196 | <li> |
197 | - <a href="<?php echo esc_url( get_edit_post_link( $invoice_id ) ); ?>"><?php echo wpinv_get_invoice_number( $invoice_id ); ?></a> – |
|
198 | - <span><?php echo wpinv_get_invoice_date( $invoice_id ); ?> – </span> |
|
199 | - <span><?php echo wpinv_payment_total( $invoice_id, true ); ?></span> |
|
197 | + <a href="<?php echo esc_url(get_edit_post_link($invoice_id)); ?>"><?php echo wpinv_get_invoice_number($invoice_id); ?></a> – |
|
198 | + <span><?php echo wpinv_get_invoice_date($invoice_id); ?> – </span> |
|
199 | + <span><?php echo wpinv_payment_total($invoice_id, true); ?></span> |
|
200 | 200 | </li> |
201 | 201 | <?php } ?> |
202 | 202 | </ul> |
@@ -204,16 +204,16 @@ discard block |
||
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | - public static function renewals( $post ) { |
|
208 | - $invoice = wpinv_get_invoice( $post->ID ); |
|
207 | + public static function renewals($post) { |
|
208 | + $invoice = wpinv_get_invoice($post->ID); |
|
209 | 209 | |
210 | - if ( wpinv_is_subscription_payment( $invoice ) ) { |
|
211 | - $parent_url = get_edit_post_link( $invoice->parent_invoice ); |
|
212 | - $parent_id = wpinv_get_invoice_number( $invoice->parent_invoice ); |
|
213 | - $subscription = wpinv_get_subscription( $invoice ); |
|
210 | + if (wpinv_is_subscription_payment($invoice)) { |
|
211 | + $parent_url = get_edit_post_link($invoice->parent_invoice); |
|
212 | + $parent_id = wpinv_get_invoice_number($invoice->parent_invoice); |
|
213 | + $subscription = wpinv_get_subscription($invoice); |
|
214 | 214 | ?> |
215 | - <?php if ( ! empty( $subscription ) ) { ?><p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . $subscription->id ) ); ?>" title="<?php esc_attr_e( 'View or edit subscription', 'invoicing' ); ?>" target="_blank"><?php echo $subscription->id; ?></a></p><?php } ?> |
|
216 | - <p class="wpi-meta-row wpi-parent-id"><label><?php _e( 'Parent Invoice:', 'invoicing' );?> </label><a href="<?php echo esc_url( $parent_url ); ?>"><?php echo $parent_id; ?></a></p> |
|
215 | + <?php if (!empty($subscription)) { ?><p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . $subscription->id)); ?>" title="<?php esc_attr_e('View or edit subscription', 'invoicing'); ?>" target="_blank"><?php echo $subscription->id; ?></a></p><?php } ?> |
|
216 | + <p class="wpi-meta-row wpi-parent-id"><label><?php _e('Parent Invoice:', 'invoicing'); ?> </label><a href="<?php echo esc_url($parent_url); ?>"><?php echo $parent_id; ?></a></p> |
|
217 | 217 | <?php |
218 | 218 | } |
219 | 219 | } |
@@ -221,47 +221,47 @@ discard block |
||
221 | 221 | /** |
222 | 222 | * Renders a metabox to edit a payment form. |
223 | 223 | */ |
224 | - public static function payment_form( $post ) { |
|
225 | - WPInv_Meta_Box_Form_Items::output_options( $post ); |
|
224 | + public static function payment_form($post) { |
|
225 | + WPInv_Meta_Box_Form_Items::output_options($post); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
229 | 229 | * Renders a metabox to select items. |
230 | 230 | */ |
231 | - public static function payment_form_items( $post ) { |
|
232 | - WPInv_Meta_Box_Form_Items::output( $post ); |
|
231 | + public static function payment_form_items($post) { |
|
232 | + WPInv_Meta_Box_Form_Items::output($post); |
|
233 | 233 | } |
234 | 234 | |
235 | - public static function payment_meta( $post ) { |
|
235 | + public static function payment_meta($post) { |
|
236 | 236 | global $wpi_mb_invoice; |
237 | 237 | |
238 | - $set_dateway = empty( $wpi_mb_invoice->gateway ) ? true : false; |
|
239 | - if ( !$set_dateway && !$wpi_mb_invoice->get_meta( '_wpinv_checkout', true ) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded() ) { |
|
238 | + $set_dateway = empty($wpi_mb_invoice->gateway) ? true : false; |
|
239 | + if (!$set_dateway && !$wpi_mb_invoice->get_meta('_wpinv_checkout', true) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded()) { |
|
240 | 240 | $set_dateway = true; |
241 | 241 | } |
242 | 242 | |
243 | 243 | ?> |
244 | 244 | <p class="wpi-meta-row"> |
245 | - <?php if ( $set_dateway ) { $gateways = wpinv_get_enabled_payment_gateways( true ); ?> |
|
246 | - <label for="wpinv_gateway"><?php _e( 'Gateway:', 'invoicing' ) ; ?></label> |
|
245 | + <?php if ($set_dateway) { $gateways = wpinv_get_enabled_payment_gateways(true); ?> |
|
246 | + <label for="wpinv_gateway"><?php _e('Gateway:', 'invoicing'); ?></label> |
|
247 | 247 | <select required="required" id="wpinv_gateway" class="wpi_select2" name="wpinv_gateway"> |
248 | - <?php foreach ( $gateways as $name => $gateway ) { |
|
249 | - if ( $wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription( $name ) ) { |
|
248 | + <?php foreach ($gateways as $name => $gateway) { |
|
249 | + if ($wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription($name)) { |
|
250 | 250 | continue; |
251 | 251 | } |
252 | 252 | ?> |
253 | - <option value="<?php echo $name;?>" <?php selected( $wpi_mb_invoice->gateway, $name );?>><?php echo !empty( $gateway['admin_label'] ) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option> |
|
253 | + <option value="<?php echo $name; ?>" <?php selected($wpi_mb_invoice->gateway, $name); ?>><?php echo !empty($gateway['admin_label']) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option> |
|
254 | 254 | <?php } ?> |
255 | 255 | </select> |
256 | 256 | <?php } else { |
257 | - echo wp_sprintf( __( '<label>Gateway:</label> %s', 'invoicing' ), wpinv_get_gateway_admin_label( $wpi_mb_invoice->gateway ) ); |
|
257 | + echo wp_sprintf(__('<label>Gateway:</label> %s', 'invoicing'), wpinv_get_gateway_admin_label($wpi_mb_invoice->gateway)); |
|
258 | 258 | } ?> |
259 | 259 | </p> |
260 | - <?php if ( $key = $wpi_mb_invoice->get_key() ) { ?> |
|
261 | - <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Key:</label> %s', 'invoicing' ), $key ); ?></p> |
|
260 | + <?php if ($key = $wpi_mb_invoice->get_key()) { ?> |
|
261 | + <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Key:</label> %s', 'invoicing'), $key); ?></p> |
|
262 | 262 | <?php } ?> |
263 | - <?php if ( $wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded() ) { ?> |
|
264 | - <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Transaction ID:</label> %s', 'invoicing' ), wpinv_payment_link_transaction_id( $wpi_mb_invoice ) ); ?></p> |
|
263 | + <?php if ($wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded()) { ?> |
|
264 | + <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Transaction ID:</label> %s', 'invoicing'), wpinv_payment_link_transaction_id($wpi_mb_invoice)); ?></p> |
|
265 | 265 | <?php } ?> |
266 | 266 | <?php |
267 | 267 | } |
@@ -1,47 +1,47 @@ discard block |
||
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_Items { |
8 | - public static function output( $post ) { |
|
8 | + public static function output($post) { |
|
9 | 9 | global $wpinv_euvat, $ajax_cart_details; |
10 | 10 | |
11 | - $post_id = !empty( $post->ID ) ? $post->ID : 0; |
|
12 | - $invoice = new WPInv_Invoice( $post_id ); |
|
11 | + $post_id = !empty($post->ID) ? $post->ID : 0; |
|
12 | + $invoice = new WPInv_Invoice($post_id); |
|
13 | 13 | $ajax_cart_details = $invoice->get_cart_details(); |
14 | - $subtotal = $invoice->get_subtotal( true ); |
|
14 | + $subtotal = $invoice->get_subtotal(true); |
|
15 | 15 | $discount_raw = $invoice->get_discount(); |
16 | - $discount = wpinv_price( $discount_raw, $invoice->get_currency() ); |
|
16 | + $discount = wpinv_price($discount_raw, $invoice->get_currency()); |
|
17 | 17 | $discounts = $discount_raw > 0 ? $invoice->get_discounts() : ''; |
18 | - $tax = $invoice->get_tax( true ); |
|
19 | - $total = $invoice->get_total( true ); |
|
18 | + $tax = $invoice->get_tax(true); |
|
19 | + $total = $invoice->get_total(true); |
|
20 | 20 | $item_quantities = wpinv_item_quantities_enabled(); |
21 | 21 | $use_taxes = wpinv_use_taxes(); |
22 | - if ( !$use_taxes && (float)$invoice->get_tax() > 0 ) { |
|
22 | + if (!$use_taxes && (float) $invoice->get_tax() > 0) { |
|
23 | 23 | $use_taxes = true; |
24 | 24 | } |
25 | - $item_types = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post ); |
|
25 | + $item_types = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post); |
|
26 | 26 | $is_recurring = $invoice->is_recurring(); |
27 | 27 | $post_type_object = get_post_type_object($invoice->post_type); |
28 | 28 | $type_title = $post_type_object->labels->singular_name; |
29 | 29 | |
30 | 30 | $cols = 5; |
31 | - if ( $item_quantities ) { |
|
31 | + if ($item_quantities) { |
|
32 | 32 | $cols++; |
33 | 33 | } |
34 | - if ( $use_taxes ) { |
|
34 | + if ($use_taxes) { |
|
35 | 35 | $cols++; |
36 | 36 | } |
37 | 37 | $class = ''; |
38 | - if ( $invoice->is_paid() ) { |
|
38 | + if ($invoice->is_paid()) { |
|
39 | 39 | $class .= ' wpinv-paid'; |
40 | 40 | } |
41 | - if ( $invoice->is_refunded() ) { |
|
41 | + if ($invoice->is_refunded()) { |
|
42 | 42 | $class .= ' wpinv-refunded'; |
43 | 43 | } |
44 | - if ( $is_recurring ) { |
|
44 | + if ($is_recurring) { |
|
45 | 45 | $class .= ' wpi-recurring'; |
46 | 46 | } |
47 | 47 | ?> |
@@ -49,21 +49,21 @@ discard block |
||
49 | 49 | <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0"> |
50 | 50 | <thead> |
51 | 51 | <tr> |
52 | - <th class="id"><?php _e( 'ID', 'invoicing' );?></th> |
|
53 | - <th class="title"><?php _e( 'Item', 'invoicing' );?></th> |
|
54 | - <th class="price"><?php _e( 'Price', 'invoicing' );?></th> |
|
55 | - <?php if ( $item_quantities ) { ?> |
|
56 | - <th class="qty"><?php _e( 'Qty', 'invoicing' );?></th> |
|
52 | + <th class="id"><?php _e('ID', 'invoicing'); ?></th> |
|
53 | + <th class="title"><?php _e('Item', 'invoicing'); ?></th> |
|
54 | + <th class="price"><?php _e('Price', 'invoicing'); ?></th> |
|
55 | + <?php if ($item_quantities) { ?> |
|
56 | + <th class="qty"><?php _e('Qty', 'invoicing'); ?></th> |
|
57 | 57 | <?php } ?> |
58 | - <th class="total"><?php _e( 'Total', 'invoicing' );?></th> |
|
59 | - <?php if ( $use_taxes ) { ?> |
|
60 | - <th class="tax"><?php _e( 'Tax (%)', 'invoicing' );?></th> |
|
58 | + <th class="total"><?php _e('Total', 'invoicing'); ?></th> |
|
59 | + <?php if ($use_taxes) { ?> |
|
60 | + <th class="tax"><?php _e('Tax (%)', 'invoicing'); ?></th> |
|
61 | 61 | <?php } ?> |
62 | 62 | <th class="action"></th> |
63 | 63 | </tr> |
64 | 64 | </thead> |
65 | 65 | <tbody class="wpinv-line-items"> |
66 | - <?php echo wpinv_admin_get_line_items( $invoice ); ?> |
|
66 | + <?php echo wpinv_admin_get_line_items($invoice); ?> |
|
67 | 67 | </tbody> |
68 | 68 | <tfoot class="wpinv-totals"> |
69 | 69 | <tr> |
@@ -74,45 +74,45 @@ discard block |
||
74 | 74 | <td class="id"> |
75 | 75 | </td> |
76 | 76 | <td class="title"> |
77 | - <input type="text" class="regular-text" placeholder="<?php _e( 'Item Name', 'invoicing' ); ?>" value="" name="_wpinv_quick[name]"> |
|
78 | - <?php if ( $wpinv_euvat->allow_vat_rules() ) { ?> |
|
77 | + <input type="text" class="regular-text" placeholder="<?php _e('Item Name', 'invoicing'); ?>" value="" name="_wpinv_quick[name]"> |
|
78 | + <?php if ($wpinv_euvat->allow_vat_rules()) { ?> |
|
79 | 79 | <div class="wp-clearfix"> |
80 | 80 | <label class="wpi-vat-rule"> |
81 | - <span class="title"><?php _e( 'VAT rule type', 'invoicing' );?></span> |
|
81 | + <span class="title"><?php _e('VAT rule type', 'invoicing'); ?></span> |
|
82 | 82 | <span class="input-text-wrap"> |
83 | - <?php echo wpinv_html_select( array( |
|
83 | + <?php echo wpinv_html_select(array( |
|
84 | 84 | 'options' => $wpinv_euvat->get_rules(), |
85 | 85 | 'name' => '_wpinv_quick[vat_rule]', |
86 | 86 | 'id' => '_wpinv_quick_vat_rule', |
87 | 87 | 'show_option_all' => false, |
88 | 88 | 'show_option_none' => false, |
89 | 89 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-rule wpi_select2', |
90 | - ) ); ?> |
|
90 | + )); ?> |
|
91 | 91 | </span> |
92 | 92 | </label> |
93 | 93 | </div> |
94 | - <?php } if ( $wpinv_euvat->allow_vat_classes() ) { ?> |
|
94 | + <?php } if ($wpinv_euvat->allow_vat_classes()) { ?> |
|
95 | 95 | <div class="wp-clearfix"> |
96 | 96 | <label class="wpi-vat-class"> |
97 | - <span class="title"><?php _e( 'VAT class', 'invoicing' );?></span> |
|
97 | + <span class="title"><?php _e('VAT class', 'invoicing'); ?></span> |
|
98 | 98 | <span class="input-text-wrap"> |
99 | - <?php echo wpinv_html_select( array( |
|
99 | + <?php echo wpinv_html_select(array( |
|
100 | 100 | 'options' => $wpinv_euvat->get_all_classes(), |
101 | 101 | 'name' => '_wpinv_quick[vat_class]', |
102 | 102 | 'id' => '_wpinv_quick_vat_class', |
103 | 103 | 'show_option_all' => false, |
104 | 104 | 'show_option_none' => false, |
105 | 105 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-class wpi_select2', |
106 | - ) ); ?> |
|
106 | + )); ?> |
|
107 | 107 | </span> |
108 | 108 | </label> |
109 | 109 | </div> |
110 | 110 | <?php } ?> |
111 | 111 | <div class="wp-clearfix"> |
112 | 112 | <label class="wpi-item-type"> |
113 | - <span class="title"><?php _e( 'Item type', 'invoicing' );?></span> |
|
113 | + <span class="title"><?php _e('Item type', 'invoicing'); ?></span> |
|
114 | 114 | <span class="input-text-wrap"> |
115 | - <?php echo wpinv_html_select( array( |
|
115 | + <?php echo wpinv_html_select(array( |
|
116 | 116 | 'options' => $item_types, |
117 | 117 | 'name' => '_wpinv_quick[type]', |
118 | 118 | 'id' => '_wpinv_quick_type', |
@@ -120,37 +120,37 @@ discard block |
||
120 | 120 | 'show_option_all' => false, |
121 | 121 | 'show_option_none' => false, |
122 | 122 | 'class' => 'gdmbx2-text-medium wpinv-quick-type wpi_select2', |
123 | - ) ); ?> |
|
123 | + )); ?> |
|
124 | 124 | </span> |
125 | 125 | </label> |
126 | 126 | </div> |
127 | 127 | |
128 | 128 | <div class="wp-clearfix"> |
129 | 129 | <?php |
130 | - echo wpinv_html_textarea( array( |
|
130 | + echo wpinv_html_textarea(array( |
|
131 | 131 | 'name' => '_wpinv_quick[excerpt]', |
132 | 132 | 'id' => '_wpinv_quick_excerpt', |
133 | 133 | 'value' => '', |
134 | 134 | 'class' => 'large-text', |
135 | - 'label' => __( 'Item description', 'invoicing' ), |
|
136 | - ) ); |
|
135 | + 'label' => __('Item description', 'invoicing'), |
|
136 | + )); |
|
137 | 137 | ?> |
138 | 138 | </div> |
139 | 139 | |
140 | 140 | <div class="wp-clearfix"> |
141 | 141 | <label class="wpi-item-actions"> |
142 | 142 | <span class="input-text-wrap"> |
143 | - <input type="button" value="<?php esc_attr_e( 'Add', 'invoicing' ); ?>" class="button button-primary" id="wpinv-save-item"><input type="button" value="Cancel" class="button button-secondary" id="wpinv-cancel-item"> |
|
143 | + <input type="button" value="<?php esc_attr_e('Add', 'invoicing'); ?>" class="button button-primary" id="wpinv-save-item"><input type="button" value="Cancel" class="button button-secondary" id="wpinv-cancel-item"> |
|
144 | 144 | </span> |
145 | 145 | </label> |
146 | 146 | </div> |
147 | 147 | </td> |
148 | 148 | <td class="price"><input type="text" placeholder="0.00" class="wpi-field-price wpi-price" name="_wpinv_quick[price]" /></td> |
149 | - <?php if ( $item_quantities ) { ?> |
|
149 | + <?php if ($item_quantities) { ?> |
|
150 | 150 | <td class="qty"><input type="number" class="small-text" step="1" min="1" value="1" name="_wpinv_quick[qty]" /></td> |
151 | 151 | <?php } ?> |
152 | 152 | <td class="total"></td> |
153 | - <?php if ( $use_taxes ) { ?> |
|
153 | + <?php if ($use_taxes) { ?> |
|
154 | 154 | <td class="tax"></td> |
155 | 155 | <?php } ?> |
156 | 156 | <td class="action"></td> |
@@ -163,29 +163,29 @@ discard block |
||
163 | 163 | <td colspan="<?php echo $cols; ?>"></td> |
164 | 164 | </tr> |
165 | 165 | <tr class="totals"> |
166 | - <td colspan="<?php echo ( $cols - 4 ); ?>"></td> |
|
166 | + <td colspan="<?php echo ($cols - 4); ?>"></td> |
|
167 | 167 | <td colspan="4"> |
168 | 168 | <table cellspacing="0" cellpadding="0"> |
169 | 169 | <tr class="subtotal"> |
170 | - <td class="name"><?php _e( 'Sub Total:', 'invoicing' );?></td> |
|
171 | - <td class="total"><?php echo $subtotal;?></td> |
|
170 | + <td class="name"><?php _e('Sub Total:', 'invoicing'); ?></td> |
|
171 | + <td class="total"><?php echo $subtotal; ?></td> |
|
172 | 172 | <td class="action"></td> |
173 | 173 | </tr> |
174 | 174 | <tr class="discount"> |
175 | - <td class="name"><?php wpinv_get_discount_label( wpinv_discount_code( $invoice->ID ) ); ?>:</td> |
|
176 | - <td class="total"><?php echo wpinv_discount( $invoice->ID, true, true ); ?></td> |
|
175 | + <td class="name"><?php wpinv_get_discount_label(wpinv_discount_code($invoice->ID)); ?>:</td> |
|
176 | + <td class="total"><?php echo wpinv_discount($invoice->ID, true, true); ?></td> |
|
177 | 177 | <td class="action"></td> |
178 | 178 | </tr> |
179 | - <?php if ( $use_taxes ) { ?> |
|
179 | + <?php if ($use_taxes) { ?> |
|
180 | 180 | <tr class="tax"> |
181 | - <td class="name"><?php _e( 'Tax:', 'invoicing' );?></td> |
|
182 | - <td class="total"><?php echo $tax;?></td> |
|
181 | + <td class="name"><?php _e('Tax:', 'invoicing'); ?></td> |
|
182 | + <td class="total"><?php echo $tax; ?></td> |
|
183 | 183 | <td class="action"></td> |
184 | 184 | </tr> |
185 | 185 | <?php } ?> |
186 | 186 | <tr class="total"> |
187 | - <td class="name"><?php echo apply_filters( 'wpinv_invoice_items_total_label', __( 'Invoice Total:', 'invoicing' ), $invoice );?></td> |
|
188 | - <td class="total"><?php echo $total;?></td> |
|
187 | + <td class="name"><?php echo apply_filters('wpinv_invoice_items_total_label', __('Invoice Total:', 'invoicing'), $invoice); ?></td> |
|
188 | + <td class="total"><?php echo $total; ?></td> |
|
189 | 189 | <td class="action"></td> |
190 | 190 | </tr> |
191 | 191 | </table> |
@@ -196,90 +196,90 @@ discard block |
||
196 | 196 | <div class="wpinv-actions"> |
197 | 197 | <?php ob_start(); ?> |
198 | 198 | <?php |
199 | - if ( !$invoice->is_paid() && !$invoice->is_refunded() ) { |
|
200 | - if ( !$invoice->is_recurring() ) { |
|
201 | - echo wpinv_item_dropdown( array( |
|
199 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
200 | + if (!$invoice->is_recurring()) { |
|
201 | + echo wpinv_item_dropdown(array( |
|
202 | 202 | 'name' => 'wpinv_invoice_item', |
203 | 203 | 'id' => 'wpinv_invoice_item', |
204 | 204 | 'show_recurring' => true, |
205 | 205 | 'class' => 'wpi_select2', |
206 | - ) ); |
|
206 | + )); |
|
207 | 207 | ?> |
208 | - <input type="button" value="<?php echo sprintf(esc_attr__( 'Add item to %s', 'invoicing'), $type_title); ?>" class="button button-primary" id="wpinv-add-item"><input type="button" value="<?php esc_attr_e( 'Create new item', 'invoicing' );?>" class="button button-primary" id="wpinv-new-item"><?php } ?><input type="button" value="<?php esc_attr_e( 'Recalculate Totals', 'invoicing' );?>" class="button button-primary wpinv-flr" id="wpinv-recalc-totals"> |
|
208 | + <input type="button" value="<?php echo sprintf(esc_attr__('Add item to %s', 'invoicing'), $type_title); ?>" class="button button-primary" id="wpinv-add-item"><input type="button" value="<?php esc_attr_e('Create new item', 'invoicing'); ?>" class="button button-primary" id="wpinv-new-item"><?php } ?><input type="button" value="<?php esc_attr_e('Recalculate Totals', 'invoicing'); ?>" class="button button-primary wpinv-flr" id="wpinv-recalc-totals"> |
|
209 | 209 | <?php } ?> |
210 | - <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?> |
|
211 | - <?php $item_actions = ob_get_clean(); echo apply_filters( 'wpinv_invoice_items_actions_content', $item_actions, $invoice, $post ); ?> |
|
210 | + <?php do_action('wpinv_invoice_items_actions', $invoice); ?> |
|
211 | + <?php $item_actions = ob_get_clean(); echo apply_filters('wpinv_invoice_items_actions_content', $item_actions, $invoice, $post); ?> |
|
212 | 212 | </div> |
213 | 213 | </div> |
214 | 214 | <?php |
215 | 215 | } |
216 | 216 | |
217 | - public static function prices( $post ) { |
|
217 | + public static function prices($post) { |
|
218 | 218 | $symbol = wpinv_currency_symbol(); |
219 | 219 | $position = wpinv_currency_position(); |
220 | - $item = new WPInv_Item( $post->ID ); |
|
220 | + $item = new WPInv_Item($post->ID); |
|
221 | 221 | |
222 | 222 | $price = $item->get_price(); |
223 | 223 | $is_dynamic_pricing = $item->get_is_dynamic_pricing(); |
224 | 224 | $minimum_price = $item->get_minimum_price(); |
225 | 225 | $is_recurring = $item->is_recurring(); |
226 | 226 | $period = $item->get_recurring_period(); |
227 | - $interval = absint( $item->get_recurring_interval() ); |
|
228 | - $times = absint( $item->get_recurring_limit() ); |
|
227 | + $interval = absint($item->get_recurring_interval()); |
|
228 | + $times = absint($item->get_recurring_limit()); |
|
229 | 229 | $free_trial = $item->has_free_trial(); |
230 | 230 | $trial_interval = $item->get_trial_interval(); |
231 | 231 | $trial_period = $item->get_trial_period(); |
232 | 232 | |
233 | 233 | $intervals = array(); |
234 | - for ( $i = 1; $i <= 90; $i++ ) { |
|
234 | + for ($i = 1; $i <= 90; $i++) { |
|
235 | 235 | $intervals[$i] = $i; |
236 | 236 | } |
237 | 237 | |
238 | - $interval = $interval > 0 ? $interval : 1; |
|
238 | + $interval = $interval > 0 ? $interval : 1; |
|
239 | 239 | |
240 | 240 | $class = $is_recurring ? 'wpinv-recurring-y' : 'wpinv-recurring-n'; |
241 | 241 | |
242 | 242 | $minimum_price_style = 'margin-left: 24px;'; |
243 | - if(! $is_dynamic_pricing ) { |
|
243 | + if (!$is_dynamic_pricing) { |
|
244 | 244 | $minimum_price_style .= 'display: none;'; |
245 | 245 | } |
246 | 246 | |
247 | 247 | ?> |
248 | - <p class="wpinv-row-prices"><?php echo ( $position != 'right' ? $symbol . ' ' : '' );?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" value="<?php echo $price;?>" id="wpinv_item_price" name="wpinv_item_price" class="medium-text wpi-field-price wpi-price" <?php disabled( $item->is_editable(), false ); ?> /><?php echo ( $position == 'right' ? ' ' . $symbol : '' );?><input type="hidden" name="wpinv_vat_meta_box_nonce" value="<?php echo wp_create_nonce( 'wpinv_item_meta_box_save' ) ;?>" /> |
|
249 | - <?php do_action( 'wpinv_prices_metabox_price', $item ); ?> |
|
248 | + <p class="wpinv-row-prices"><?php echo ($position != 'right' ? $symbol . ' ' : ''); ?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" value="<?php echo $price; ?>" id="wpinv_item_price" name="wpinv_item_price" class="medium-text wpi-field-price wpi-price" <?php disabled($item->is_editable(), false); ?> /><?php echo ($position == 'right' ? ' ' . $symbol : ''); ?><input type="hidden" name="wpinv_vat_meta_box_nonce" value="<?php echo wp_create_nonce('wpinv_item_meta_box_save'); ?>" /> |
|
249 | + <?php do_action('wpinv_prices_metabox_price', $item); ?> |
|
250 | 250 | </p> |
251 | 251 | |
252 | - <?php if( $item->supports_dynamic_pricing() ) { ?> |
|
252 | + <?php if ($item->supports_dynamic_pricing()) { ?> |
|
253 | 253 | |
254 | 254 | <p class="wpinv-row-name-your-price"> |
255 | 255 | <label> |
256 | - <input type="checkbox" name="wpinv_name_your_price" id="wpinv_name_your_price" value="1" <?php checked( 1, $is_dynamic_pricing ); ?> /> |
|
257 | - <?php echo apply_filters( 'wpinv_name_your_price_toggle_text', __( 'User can set a custom price', 'invoicing' ) ); ?> |
|
256 | + <input type="checkbox" name="wpinv_name_your_price" id="wpinv_name_your_price" value="1" <?php checked(1, $is_dynamic_pricing); ?> /> |
|
257 | + <?php echo apply_filters('wpinv_name_your_price_toggle_text', __('User can set a custom price', 'invoicing')); ?> |
|
258 | 258 | </label> |
259 | - <?php do_action( 'wpinv_prices_metabox_name_your_price_field', $item ); ?> |
|
259 | + <?php do_action('wpinv_prices_metabox_name_your_price_field', $item); ?> |
|
260 | 260 | </p> |
261 | 261 | |
262 | 262 | <p class="wpinv-row-minimum-price" style="<?php echo $minimum_price_style; ?>"> |
263 | 263 | <label> |
264 | - <?php _e( 'Minimum Price', 'invoicing' ); ?> |
|
265 | - <?php echo ( $position != 'right' ? $symbol . ' ' : '' );?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" value="<?php echo $minimum_price;?>" id="wpinv_minimum_price" name="wpinv_minimum_price" class="medium-text wpi-field-price" <?php disabled( $item->is_editable(), false ); ?> /><?php echo ( $position == 'right' ? ' ' . $symbol : '' );?> |
|
264 | + <?php _e('Minimum Price', 'invoicing'); ?> |
|
265 | + <?php echo ($position != 'right' ? $symbol . ' ' : ''); ?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" value="<?php echo $minimum_price; ?>" id="wpinv_minimum_price" name="wpinv_minimum_price" class="medium-text wpi-field-price" <?php disabled($item->is_editable(), false); ?> /><?php echo ($position == 'right' ? ' ' . $symbol : ''); ?> |
|
266 | 266 | </label> |
267 | 267 | |
268 | - <?php do_action( 'wpinv_prices_metabox_minimum_price_field', $item ); ?> |
|
268 | + <?php do_action('wpinv_prices_metabox_minimum_price_field', $item); ?> |
|
269 | 269 | </p> |
270 | 270 | |
271 | 271 | <?php } ?> |
272 | 272 | |
273 | 273 | <p class="wpinv-row-is-recurring"> |
274 | 274 | <label for="wpinv_is_recurring"> |
275 | - <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked( 1, $is_recurring ); ?> /> |
|
276 | - <?php echo apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Is Recurring Item?', 'invoicing' ) ); ?> |
|
275 | + <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked(1, $is_recurring); ?> /> |
|
276 | + <?php echo apply_filters('wpinv_is_recurring_toggle_text', __('Is Recurring Item?', 'invoicing')); ?> |
|
277 | 277 | </label> |
278 | - <?php do_action( 'wpinv_prices_metabox_is_recurring_field', $item ); ?> |
|
278 | + <?php do_action('wpinv_prices_metabox_is_recurring_field', $item); ?> |
|
279 | 279 | </p> |
280 | - <p class="wpinv-row-recurring-fields <?php echo $class;?>"> |
|
281 | - <label class="wpinv-period" for="wpinv_recurring_period"><?php _e( 'Recurring', 'invoicing' );?> <select class="wpinv-select wpi_select2" id="wpinv_recurring_period" name="wpinv_recurring_period"><option value="D" data-text="<?php esc_attr_e( 'day(s)', 'invoicing' ); ?>" <?php selected( 'D', $period );?>><?php _e( 'Daily', 'invoicing' ); ?></option><option value="W" data-text="<?php esc_attr_e( 'week(s)', 'invoicing' ); ?>" <?php selected( 'W', $period );?>><?php _e( 'Weekly', 'invoicing' ); ?></option><option value="M" data-text="<?php esc_attr_e( 'month(s)', 'invoicing' ); ?>" <?php selected( 'M', $period );?>><?php _e( 'Monthly', 'invoicing' ); ?></option><option value="Y" data-text="<?php esc_attr_e( 'year(s)', 'invoicing' ); ?>" <?php selected( 'Y', $period );?>><?php _e( 'Yearly', 'invoicing' ); ?></option></select></label> |
|
282 | - <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e( 'at every', 'invoicing' );?> <?php echo wpinv_html_select( array( |
|
280 | + <p class="wpinv-row-recurring-fields <?php echo $class; ?>"> |
|
281 | + <label class="wpinv-period" for="wpinv_recurring_period"><?php _e('Recurring', 'invoicing'); ?> <select class="wpinv-select wpi_select2" id="wpinv_recurring_period" name="wpinv_recurring_period"><option value="D" data-text="<?php esc_attr_e('day(s)', 'invoicing'); ?>" <?php selected('D', $period); ?>><?php _e('Daily', 'invoicing'); ?></option><option value="W" data-text="<?php esc_attr_e('week(s)', 'invoicing'); ?>" <?php selected('W', $period); ?>><?php _e('Weekly', 'invoicing'); ?></option><option value="M" data-text="<?php esc_attr_e('month(s)', 'invoicing'); ?>" <?php selected('M', $period); ?>><?php _e('Monthly', 'invoicing'); ?></option><option value="Y" data-text="<?php esc_attr_e('year(s)', 'invoicing'); ?>" <?php selected('Y', $period); ?>><?php _e('Yearly', 'invoicing'); ?></option></select></label> |
|
282 | + <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e('at every', 'invoicing'); ?> <?php echo wpinv_html_select(array( |
|
283 | 283 | 'options' => $intervals, |
284 | 284 | 'name' => 'wpinv_recurring_interval', |
285 | 285 | 'id' => 'wpinv_recurring_interval', |
@@ -287,30 +287,30 @@ discard block |
||
287 | 287 | 'show_option_all' => false, |
288 | 288 | 'show_option_none' => false, |
289 | 289 | 'class' => 'wpi_select2', |
290 | - ) ); ?> <span id="wpinv_interval_text"><?php _e( 'day(s)', 'invoicing' );?></span></label> |
|
291 | - <label class="wpinv-times" for="wpinv_recurring_limit"> <?php _e( 'for', 'invoicing' );?> <input class="small-text" type="number" value="<?php echo $times;?>" size="4" id="wpinv_recurring_limit" name="wpinv_recurring_limit" step="1" min="0"> <?php _e( 'time(s) <i>(select 0 for recurring forever until cancelled</i>)', 'invoicing' );?></label> |
|
290 | + )); ?> <span id="wpinv_interval_text"><?php _e('day(s)', 'invoicing'); ?></span></label> |
|
291 | + <label class="wpinv-times" for="wpinv_recurring_limit"> <?php _e('for', 'invoicing'); ?> <input class="small-text" type="number" value="<?php echo $times; ?>" size="4" id="wpinv_recurring_limit" name="wpinv_recurring_limit" step="1" min="0"> <?php _e('time(s) <i>(select 0 for recurring forever until cancelled</i>)', 'invoicing'); ?></label> |
|
292 | 292 | <span class="clear wpi-trial-clr"></span> |
293 | 293 | <label class="wpinv-free-trial" for="wpinv_free_trial"> |
294 | - <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked( true, (bool)$free_trial ); ?> /> |
|
295 | - <?php echo __( 'Offer free trial for', 'invoicing' ); ?> |
|
294 | + <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked(true, (bool) $free_trial); ?> /> |
|
295 | + <?php echo __('Offer free trial for', 'invoicing'); ?> |
|
296 | 296 | </label> |
297 | 297 | <label class="wpinv-trial-interval" for="wpinv_trial_interval"> |
298 | - <input class="small-text" type="number" value="<?php echo $trial_interval;?>" size="4" id="wpinv_trial_interval" name="wpinv_trial_interval" step="1" min="1"> <select class="wpinv-select wpi_select2" id="wpinv_trial_period" name="wpinv_trial_period"><option value="D" <?php selected( 'D', $trial_period );?>><?php _e( 'day(s)', 'invoicing' ); ?></option><option value="W" <?php selected( 'W', $trial_period );?>><?php _e( 'week(s)', 'invoicing' ); ?></option><option value="M" <?php selected( 'M', $trial_period );?>><?php _e( 'month(s)', 'invoicing' ); ?></option><option value="Y" <?php selected( 'Y', $trial_period );?>><?php _e( 'year(s)', 'invoicing' ); ?></option></select> |
|
298 | + <input class="small-text" type="number" value="<?php echo $trial_interval; ?>" size="4" id="wpinv_trial_interval" name="wpinv_trial_interval" step="1" min="1"> <select class="wpinv-select wpi_select2" id="wpinv_trial_period" name="wpinv_trial_period"><option value="D" <?php selected('D', $trial_period); ?>><?php _e('day(s)', 'invoicing'); ?></option><option value="W" <?php selected('W', $trial_period); ?>><?php _e('week(s)', 'invoicing'); ?></option><option value="M" <?php selected('M', $trial_period); ?>><?php _e('month(s)', 'invoicing'); ?></option><option value="Y" <?php selected('Y', $trial_period); ?>><?php _e('year(s)', 'invoicing'); ?></option></select> |
|
299 | 299 | </label> |
300 | - <?php do_action( 'wpinv_prices_metabox_recurring_fields', $item ); ?> |
|
300 | + <?php do_action('wpinv_prices_metabox_recurring_fields', $item); ?> |
|
301 | 301 | </p> |
302 | - <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type( $post->ID ); ?>" /> |
|
303 | - <?php do_action( 'wpinv_item_price_field', $post->ID ); ?> |
|
302 | + <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type($post->ID); ?>" /> |
|
303 | + <?php do_action('wpinv_item_price_field', $post->ID); ?> |
|
304 | 304 | <?php |
305 | 305 | } |
306 | 306 | |
307 | - public static function vat_rules( $post ) { |
|
307 | + public static function vat_rules($post) { |
|
308 | 308 | global $wpinv_euvat; |
309 | 309 | |
310 | - $rule_type = $wpinv_euvat->get_item_rule( $post->ID ); |
|
310 | + $rule_type = $wpinv_euvat->get_item_rule($post->ID); |
|
311 | 311 | ?> |
312 | - <p><label for="wpinv_vat_rules"><strong><?php _e( 'Select how VAT rules will be applied:', 'invoicing' );?></strong></label> |
|
313 | - <?php echo wpinv_html_select( array( |
|
312 | + <p><label for="wpinv_vat_rules"><strong><?php _e('Select how VAT rules will be applied:', 'invoicing'); ?></strong></label> |
|
313 | + <?php echo wpinv_html_select(array( |
|
314 | 314 | 'options' => $wpinv_euvat->get_rules(), |
315 | 315 | 'name' => 'wpinv_vat_rules', |
316 | 316 | 'id' => 'wpinv_vat_rules', |
@@ -318,20 +318,20 @@ discard block |
||
318 | 318 | 'show_option_all' => false, |
319 | 319 | 'show_option_none' => false, |
320 | 320 | 'class' => 'gdmbx2-text-medium wpinv-vat-rules wpi_select2', |
321 | - ) ); ?> |
|
321 | + )); ?> |
|
322 | 322 | </p> |
323 | - <p class="wpi-m0"><?php _e( 'When you select physical product rules, only consumers and businesses in your country will be charged VAT. The VAT rate used will be the rate in your country.', 'invoicing' ); ?></p> |
|
324 | - <p class="wpi-m0"><?php _e( 'If you select Digital product rules, VAT will be charged at the rate that applies in the country of the consumer. Only businesses in your country will be charged VAT.', 'invoicing' ); ?></p> |
|
325 | - <p class="wpi-m0"><?php _e( 'Select "Tax-Free" if you do not want to charge VAT for this item.', 'invoicing' ); ?></p> |
|
323 | + <p class="wpi-m0"><?php _e('When you select physical product rules, only consumers and businesses in your country will be charged VAT. The VAT rate used will be the rate in your country.', 'invoicing'); ?></p> |
|
324 | + <p class="wpi-m0"><?php _e('If you select Digital product rules, VAT will be charged at the rate that applies in the country of the consumer. Only businesses in your country will be charged VAT.', 'invoicing'); ?></p> |
|
325 | + <p class="wpi-m0"><?php _e('Select "Tax-Free" if you do not want to charge VAT for this item.', 'invoicing'); ?></p> |
|
326 | 326 | <?php |
327 | 327 | } |
328 | 328 | |
329 | - public static function vat_classes( $post ) { |
|
329 | + public static function vat_classes($post) { |
|
330 | 330 | global $wpinv_euvat; |
331 | 331 | |
332 | - $vat_class = $wpinv_euvat->get_item_class( $post->ID ); |
|
332 | + $vat_class = $wpinv_euvat->get_item_class($post->ID); |
|
333 | 333 | ?> |
334 | - <p><?php echo wpinv_html_select( array( |
|
334 | + <p><?php echo wpinv_html_select(array( |
|
335 | 335 | 'options' => $wpinv_euvat->get_all_classes(), |
336 | 336 | 'name' => 'wpinv_vat_class', |
337 | 337 | 'id' => 'wpinv_vat_class', |
@@ -339,18 +339,18 @@ discard block |
||
339 | 339 | 'show_option_all' => false, |
340 | 340 | 'show_option_none' => false, |
341 | 341 | 'class' => 'gdmbx2-text-medium wpinv-vat-class wpi_select2', |
342 | - ) ); ?> |
|
342 | + )); ?> |
|
343 | 343 | </p> |
344 | - <p class="wpi-m0"><?php _e( 'Select the VAT rate class to use for this invoice item.', 'invoicing' ); ?></p> |
|
344 | + <p class="wpi-m0"><?php _e('Select the VAT rate class to use for this invoice item.', 'invoicing'); ?></p> |
|
345 | 345 | <?php |
346 | 346 | } |
347 | 347 | |
348 | - public static function item_info( $post ) { |
|
349 | - $item_type = wpinv_get_item_type( $post->ID ); |
|
350 | - do_action( 'wpinv_item_info_metabox_before', $post ); |
|
348 | + public static function item_info($post) { |
|
349 | + $item_type = wpinv_get_item_type($post->ID); |
|
350 | + do_action('wpinv_item_info_metabox_before', $post); |
|
351 | 351 | ?> |
352 | - <p><label for="wpinv_item_type"><strong><?php _e( 'Type:', 'invoicing' );?></strong></label> |
|
353 | - <?php echo wpinv_html_select( array( |
|
352 | + <p><label for="wpinv_item_type"><strong><?php _e('Type:', 'invoicing'); ?></strong></label> |
|
353 | + <?php echo wpinv_html_select(array( |
|
354 | 354 | 'options' => wpinv_get_item_types(), |
355 | 355 | 'name' => 'wpinv_item_type', |
356 | 356 | 'id' => 'wpinv_item_type', |
@@ -358,135 +358,135 @@ discard block |
||
358 | 358 | 'show_option_all' => false, |
359 | 359 | 'show_option_none' => false, |
360 | 360 | 'class' => 'gdmbx2-text-medium wpinv-item-type', |
361 | - ) ); ?> |
|
361 | + )); ?> |
|
362 | 362 | </p> |
363 | - <p class="wpi-m0"><?php _e( 'Select item type.', 'invoicing' );?><br><?php _e( '<b>Standard:</b> Standard item type', 'invoicing' );?><br><?php _e( '<b>Fee:</b> Like Registration Fee, Sign up Fee etc.', 'invoicing' );?></p> |
|
363 | + <p class="wpi-m0"><?php _e('Select item type.', 'invoicing'); ?><br><?php _e('<b>Standard:</b> Standard item type', 'invoicing'); ?><br><?php _e('<b>Fee:</b> Like Registration Fee, Sign up Fee etc.', 'invoicing'); ?></p> |
|
364 | 364 | <?php |
365 | - do_action( 'wpinv_item_info_metabox_after', $post ); |
|
365 | + do_action('wpinv_item_info_metabox_after', $post); |
|
366 | 366 | } |
367 | 367 | |
368 | - public static function meta_values( $post ) { |
|
369 | - $meta_keys = apply_filters( 'wpinv_show_meta_values_for_keys', array( |
|
368 | + public static function meta_values($post) { |
|
369 | + $meta_keys = apply_filters('wpinv_show_meta_values_for_keys', array( |
|
370 | 370 | 'type', |
371 | 371 | 'custom_id' |
372 | - ) ); |
|
372 | + )); |
|
373 | 373 | |
374 | - if ( empty( $meta_keys ) ) { |
|
374 | + if (empty($meta_keys)) { |
|
375 | 375 | return; |
376 | 376 | } |
377 | 377 | |
378 | - do_action( 'wpinv_meta_values_metabox_before', $post ); |
|
378 | + do_action('wpinv_meta_values_metabox_before', $post); |
|
379 | 379 | |
380 | - foreach ( $meta_keys as $meta_key ) { |
|
380 | + foreach ($meta_keys as $meta_key) { |
|
381 | 381 | ?> |
382 | - <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta( $post->ID, '_wpinv_' . $meta_key, true ); ?></label></p> |
|
382 | + <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta($post->ID, '_wpinv_' . $meta_key, true); ?></label></p> |
|
383 | 383 | <?php |
384 | 384 | } |
385 | 385 | |
386 | - do_action( 'wpinv_meta_values_metabox_after', $post ); |
|
386 | + do_action('wpinv_meta_values_metabox_after', $post); |
|
387 | 387 | } |
388 | 388 | |
389 | - public static function save( $post_id, $data, $post ) { |
|
390 | - $invoice = new WPInv_Invoice( $post_id ); |
|
389 | + public static function save($post_id, $data, $post) { |
|
390 | + $invoice = new WPInv_Invoice($post_id); |
|
391 | 391 | |
392 | 392 | // Billing |
393 | - $first_name = sanitize_text_field( $data['wpinv_first_name'] ); |
|
394 | - $last_name = sanitize_text_field( $data['wpinv_last_name'] ); |
|
395 | - $company = sanitize_text_field( $data['wpinv_company'] ); |
|
396 | - $vat_number = sanitize_text_field( $data['wpinv_vat_number'] ); |
|
397 | - $phone = sanitize_text_field( $data['wpinv_phone'] ); |
|
398 | - $address = sanitize_text_field( $data['wpinv_address'] ); |
|
399 | - $city = sanitize_text_field( $data['wpinv_city'] ); |
|
400 | - $zip = sanitize_text_field( $data['wpinv_zip'] ); |
|
401 | - $country = sanitize_text_field( $data['wpinv_country'] ); |
|
402 | - $state = sanitize_text_field( $data['wpinv_state'] ); |
|
393 | + $first_name = sanitize_text_field($data['wpinv_first_name']); |
|
394 | + $last_name = sanitize_text_field($data['wpinv_last_name']); |
|
395 | + $company = sanitize_text_field($data['wpinv_company']); |
|
396 | + $vat_number = sanitize_text_field($data['wpinv_vat_number']); |
|
397 | + $phone = sanitize_text_field($data['wpinv_phone']); |
|
398 | + $address = sanitize_text_field($data['wpinv_address']); |
|
399 | + $city = sanitize_text_field($data['wpinv_city']); |
|
400 | + $zip = sanitize_text_field($data['wpinv_zip']); |
|
401 | + $country = sanitize_text_field($data['wpinv_country']); |
|
402 | + $state = sanitize_text_field($data['wpinv_state']); |
|
403 | 403 | |
404 | 404 | // Details |
405 | - $status = sanitize_text_field( $data['wpinv_status'] ); |
|
406 | - $old_status = !empty( $data['original_post_status'] ) ? sanitize_text_field( $data['original_post_status'] ) : $status; |
|
407 | - $number = sanitize_text_field( $data['wpinv_number'] ); |
|
408 | - $due_date = isset( $data['wpinv_due_date'] ) ? sanitize_text_field( $data['wpinv_due_date'] ) : ''; |
|
405 | + $status = sanitize_text_field($data['wpinv_status']); |
|
406 | + $old_status = !empty($data['original_post_status']) ? sanitize_text_field($data['original_post_status']) : $status; |
|
407 | + $number = sanitize_text_field($data['wpinv_number']); |
|
408 | + $due_date = isset($data['wpinv_due_date']) ? sanitize_text_field($data['wpinv_due_date']) : ''; |
|
409 | 409 | //$discounts = sanitize_text_field( $data['wpinv_discounts'] ); |
410 | 410 | //$discount = sanitize_text_field( $data['wpinv_discount'] ); |
411 | 411 | |
412 | 412 | $disable_taxes = 0; |
413 | 413 | |
414 | - if ( ! empty( $data['disable_taxes'] ) ) { |
|
414 | + if (!empty($data['disable_taxes'])) { |
|
415 | 415 | $disable_taxes = 1; |
416 | 416 | } |
417 | 417 | |
418 | - $ip = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip(); |
|
419 | - |
|
420 | - $invoice->set( 'due_date', $due_date ); |
|
421 | - $invoice->set( 'first_name', $first_name ); |
|
422 | - $invoice->set( 'last_name', $last_name ); |
|
423 | - $invoice->set( 'company', $company ); |
|
424 | - $invoice->set( 'vat_number', $vat_number ); |
|
425 | - $invoice->set( 'phone', $phone ); |
|
426 | - $invoice->set( 'address', $address ); |
|
427 | - $invoice->set( 'city', $city ); |
|
428 | - $invoice->set( 'zip', $zip ); |
|
429 | - $invoice->set( 'country', $country ); |
|
430 | - $invoice->set( 'state', $state ); |
|
431 | - $invoice->set( 'status', $status ); |
|
432 | - $invoice->set( 'set', $status ); |
|
418 | + $ip = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip(); |
|
419 | + |
|
420 | + $invoice->set('due_date', $due_date); |
|
421 | + $invoice->set('first_name', $first_name); |
|
422 | + $invoice->set('last_name', $last_name); |
|
423 | + $invoice->set('company', $company); |
|
424 | + $invoice->set('vat_number', $vat_number); |
|
425 | + $invoice->set('phone', $phone); |
|
426 | + $invoice->set('address', $address); |
|
427 | + $invoice->set('city', $city); |
|
428 | + $invoice->set('zip', $zip); |
|
429 | + $invoice->set('country', $country); |
|
430 | + $invoice->set('state', $state); |
|
431 | + $invoice->set('status', $status); |
|
432 | + $invoice->set('set', $status); |
|
433 | 433 | //$invoice->set( 'number', $number ); |
434 | 434 | //$invoice->set( 'discounts', $discounts ); |
435 | 435 | //$invoice->set( 'discount', $discount ); |
436 | - $invoice->set( 'disable_taxes', $disable_taxes ); |
|
437 | - $invoice->set( 'ip', $ip ); |
|
436 | + $invoice->set('disable_taxes', $disable_taxes); |
|
437 | + $invoice->set('ip', $ip); |
|
438 | 438 | $invoice->old_status = $_POST['original_post_status']; |
439 | 439 | |
440 | 440 | $currency = $invoice->get_currency(); |
441 | - if ( ! empty( sanitize_text_field( $data['wpinv_currency'] ) ) ) { |
|
442 | - $currency = sanitize_text_field( $data['wpinv_currency'] ); |
|
441 | + if (!empty(sanitize_text_field($data['wpinv_currency']))) { |
|
442 | + $currency = sanitize_text_field($data['wpinv_currency']); |
|
443 | 443 | } |
444 | 444 | |
445 | - if ( empty( $currency ) ) { |
|
445 | + if (empty($currency)) { |
|
446 | 446 | $currency = wpinv_get_currency(); |
447 | 447 | } |
448 | 448 | |
449 | - if ( ! $invoice->is_paid() ) { |
|
449 | + if (!$invoice->is_paid()) { |
|
450 | 450 | $invoice->currency = $currency; |
451 | 451 | } |
452 | 452 | |
453 | - if ( !empty( $data['wpinv_gateway'] ) ) { |
|
454 | - $invoice->set( 'gateway', sanitize_text_field( $data['wpinv_gateway'] ) ); |
|
453 | + if (!empty($data['wpinv_gateway'])) { |
|
454 | + $invoice->set('gateway', sanitize_text_field($data['wpinv_gateway'])); |
|
455 | 455 | } |
456 | 456 | $saved = $invoice->save(); |
457 | 457 | |
458 | 458 | // Check for payment notes |
459 | - if ( !empty( $data['invoice_note'] ) ) { |
|
460 | - $note = wp_kses( $data['invoice_note'], array() ); |
|
461 | - $note_type = sanitize_text_field( $data['invoice_note_type'] ); |
|
459 | + if (!empty($data['invoice_note'])) { |
|
460 | + $note = wp_kses($data['invoice_note'], array()); |
|
461 | + $note_type = sanitize_text_field($data['invoice_note_type']); |
|
462 | 462 | $is_customer_note = $note_type == 'customer' ? 1 : 0; |
463 | 463 | |
464 | - wpinv_insert_payment_note( $invoice->ID, $note, $is_customer_note ); |
|
464 | + wpinv_insert_payment_note($invoice->ID, $note, $is_customer_note); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | // Update user address if empty. |
468 | - if ( $saved && !empty( $invoice ) ) { |
|
469 | - if ( $user_id = $invoice->get_user_id() ) { |
|
470 | - $user_address = wpinv_get_user_address( $user_id, false ); |
|
468 | + if ($saved && !empty($invoice)) { |
|
469 | + if ($user_id = $invoice->get_user_id()) { |
|
470 | + $user_address = wpinv_get_user_address($user_id, false); |
|
471 | 471 | |
472 | 472 | if (empty($user_address['first_name'])) { |
473 | - update_user_meta( $user_id, '_wpinv_first_name', $first_name ); |
|
474 | - update_user_meta( $user_id, '_wpinv_last_name', $last_name ); |
|
473 | + update_user_meta($user_id, '_wpinv_first_name', $first_name); |
|
474 | + update_user_meta($user_id, '_wpinv_last_name', $last_name); |
|
475 | 475 | } else if (empty($user_address['last_name']) && $user_address['first_name'] == $first_name) { |
476 | - update_user_meta( $user_id, '_wpinv_last_name', $last_name ); |
|
476 | + update_user_meta($user_id, '_wpinv_last_name', $last_name); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | if (empty($user_address['address']) || empty($user_address['city']) || empty($user_address['state']) || empty($user_address['country'])) { |
480 | - update_user_meta( $user_id, '_wpinv_address', $address ); |
|
481 | - update_user_meta( $user_id, '_wpinv_city', $city ); |
|
482 | - update_user_meta( $user_id, '_wpinv_state', $state ); |
|
483 | - update_user_meta( $user_id, '_wpinv_country', $country ); |
|
484 | - update_user_meta( $user_id, '_wpinv_zip', $zip ); |
|
485 | - update_user_meta( $user_id, '_wpinv_phone', $phone ); |
|
480 | + update_user_meta($user_id, '_wpinv_address', $address); |
|
481 | + update_user_meta($user_id, '_wpinv_city', $city); |
|
482 | + update_user_meta($user_id, '_wpinv_state', $state); |
|
483 | + update_user_meta($user_id, '_wpinv_country', $country); |
|
484 | + update_user_meta($user_id, '_wpinv_zip', $zip); |
|
485 | + update_user_meta($user_id, '_wpinv_phone', $phone); |
|
486 | 486 | } |
487 | 487 | } |
488 | 488 | |
489 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
489 | + do_action('wpinv_invoice_metabox_saved', $invoice); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | return $saved; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @version 1.0.19 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | return array( |
14 | 14 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @version 1.0.19 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | return array( |
14 | 14 | |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | 'placeholder' => '[email protected]', |
18 | 18 | 'value' => '', |
19 | - 'label' => __( 'Billing Email', 'invoicing' ), |
|
19 | + 'label' => __('Billing Email', 'invoicing'), |
|
20 | 20 | 'description' => '', |
21 | 21 | 'required' => true, |
22 | 22 | 'id' => 'mmdwqzpox', |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | |
42 | 42 | 'value' =>'', |
43 | 43 | 'class' => 'btn-primary', |
44 | - 'label' => __( 'Pay Now »', 'invoicing' ), |
|
45 | - 'description' => __( 'By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ), |
|
44 | + 'label' => __('Pay Now »', 'invoicing'), |
|
45 | + 'description' => __('By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'), |
|
46 | 46 | 'id' => 'rtqljyy', |
47 | 47 | 'name' => 'rtqljyy', |
48 | 48 | 'type' => 'pay_button', |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | 'orderby' => 'title', |
23 | 23 | 'order' => 'ASC', |
24 | 24 | 'posts_per_page' => -1, |
25 | - 'post_status' => array( 'publish' ), |
|
25 | + 'post_status' => array('publish'), |
|
26 | 26 | ) |
27 | 27 | ); |
28 | 28 | |
29 | 29 | $options = array( |
30 | - '' => __('Select a Form','invoicing') |
|
30 | + '' => __('Select a Form', 'invoicing') |
|
31 | 31 | ); |
32 | 32 | |
33 | - foreach( $forms as $form ) { |
|
34 | - $options[ $form->ID ] = $form->post_title; |
|
33 | + foreach ($forms as $form) { |
|
34 | + $options[$form->ID] = $form->post_title; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $options = array( |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | 'block-keywords'=> "['invoicing','buy', 'buy item', 'pay', 'payment form']", |
42 | 42 | 'class_name' => __CLASS__, |
43 | 43 | 'base_id' => 'wpinv_payment_form', |
44 | - 'name' => __('Invoicing > Payment Form','invoicing'), |
|
44 | + 'name' => __('Invoicing > Payment Form', 'invoicing'), |
|
45 | 45 | 'widget_ops' => array( |
46 | 46 | 'classname' => 'wpinv-payment-form-class bsui', |
47 | - 'description' => esc_html__('Displays a payment form.','invoicing'), |
|
47 | + 'description' => esc_html__('Displays a payment form.', 'invoicing'), |
|
48 | 48 | ), |
49 | 49 | 'arguments' => array( |
50 | 50 | 'form' => array( |
51 | - 'title' => __( 'Payment Form', 'invoicing' ), |
|
52 | - 'desc' => __( 'Select your payment form.', 'invoicing' ), |
|
51 | + 'title' => __('Payment Form', 'invoicing'), |
|
52 | + 'desc' => __('Select your payment form.', 'invoicing'), |
|
53 | 53 | 'type' => 'select', |
54 | 54 | 'options' => $options, |
55 | 55 | 'desc_tip' => true, |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ); |
62 | 62 | |
63 | 63 | |
64 | - parent::__construct( $options ); |
|
64 | + parent::__construct($options); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -73,43 +73,43 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
76 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
77 | 77 | global $invoicing; |
78 | 78 | |
79 | 79 | // Do we have a payment form? |
80 | - if ( empty( $args['form'] ) ) { |
|
80 | + if (empty($args['form'])) { |
|
81 | 81 | return aui()->alert( |
82 | 82 | array( |
83 | 83 | 'type' => 'warning', |
84 | - 'content' => __( 'No payment form selected', 'invoicing' ), |
|
84 | + 'content' => __('No payment form selected', 'invoicing'), |
|
85 | 85 | ) |
86 | 86 | ); |
87 | 87 | |
88 | 88 | } |
89 | 89 | |
90 | 90 | // If yes, ensure that it is published. |
91 | - if ( 'publish' != get_post_status( $args['form'] ) ) { |
|
91 | + if ('publish' != get_post_status($args['form'])) { |
|
92 | 92 | return aui()->alert( |
93 | 93 | array( |
94 | 94 | 'type' => 'warning', |
95 | - 'content' => __( 'This payment form is no longer active', 'invoicing' ), |
|
95 | + 'content' => __('This payment form is no longer active', 'invoicing'), |
|
96 | 96 | ) |
97 | 97 | ); |
98 | 98 | } |
99 | 99 | |
100 | 100 | // Get the form elements and items. |
101 | - $elements = $invoicing->form_elements->get_form_elements( $args['form'] ); |
|
102 | - $items = $invoicing->form_elements->get_form_items( $args['form'] ); |
|
101 | + $elements = $invoicing->form_elements->get_form_elements($args['form']); |
|
102 | + $items = $invoicing->form_elements->get_form_items($args['form']); |
|
103 | 103 | |
104 | 104 | ob_start(); |
105 | 105 | echo "<form class='wpinv_payment_form'>"; |
106 | 106 | echo "<input type='hidden' name='form_id' value='{$args['form']}'/>"; |
107 | - wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' ); |
|
108 | - wp_nonce_field( 'vat_validation', '_wpi_nonce' ); |
|
107 | + wp_nonce_field('wpinv_payment_form', 'wpinv_payment_form'); |
|
108 | + wp_nonce_field('vat_validation', '_wpi_nonce'); |
|
109 | 109 | |
110 | - foreach ( $elements as $element ) { |
|
111 | - do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] ); |
|
112 | - do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] ); |
|
110 | + foreach ($elements as $element) { |
|
111 | + do_action('wpinv_frontend_render_payment_form_element', $element, $items, $args['form']); |
|
112 | + do_action("wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form']); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | echo "<div class='wpinv_payment_form_errors alert alert-danger d-none'></div>"; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | $content = ob_get_clean(); |
119 | 119 | |
120 | - return str_replace( 'sr-only', '', $content ); |
|
120 | + return str_replace('sr-only', '', $content); |
|
121 | 121 | |
122 | 122 | } |
123 | 123 |
@@ -16,23 +16,23 @@ discard block |
||
16 | 16 | */ |
17 | 17 | public function __construct() { |
18 | 18 | |
19 | - $forms = get_posts( |
|
20 | - array( |
|
21 | - 'post_type' => 'wpi_payment_form', |
|
22 | - 'orderby' => 'title', |
|
23 | - 'order' => 'ASC', |
|
24 | - 'posts_per_page' => -1, |
|
25 | - 'post_status' => array( 'publish' ), |
|
26 | - ) |
|
27 | - ); |
|
28 | - |
|
29 | - $options = array( |
|
30 | - '' => __('Select a Form','invoicing') |
|
31 | - ); |
|
32 | - |
|
33 | - foreach( $forms as $form ) { |
|
34 | - $options[ $form->ID ] = $form->post_title; |
|
35 | - } |
|
19 | + $forms = get_posts( |
|
20 | + array( |
|
21 | + 'post_type' => 'wpi_payment_form', |
|
22 | + 'orderby' => 'title', |
|
23 | + 'order' => 'ASC', |
|
24 | + 'posts_per_page' => -1, |
|
25 | + 'post_status' => array( 'publish' ), |
|
26 | + ) |
|
27 | + ); |
|
28 | + |
|
29 | + $options = array( |
|
30 | + '' => __('Select a Form','invoicing') |
|
31 | + ); |
|
32 | + |
|
33 | + foreach( $forms as $form ) { |
|
34 | + $options[ $form->ID ] = $form->post_title; |
|
35 | + } |
|
36 | 36 | |
37 | 37 | $options = array( |
38 | 38 | 'textdomain' => 'invoicing', |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | 'form' => array( |
51 | 51 | 'title' => __( 'Payment Form', 'invoicing' ), |
52 | 52 | 'desc' => __( 'Select your payment form.', 'invoicing' ), |
53 | - 'type' => 'select', |
|
54 | - 'options' => $options, |
|
53 | + 'type' => 'select', |
|
54 | + 'options' => $options, |
|
55 | 55 | 'desc_tip' => true, |
56 | 56 | 'default' => '', |
57 | 57 | 'advanced' => false |
@@ -64,60 +64,60 @@ discard block |
||
64 | 64 | parent::__construct( $options ); |
65 | 65 | } |
66 | 66 | |
67 | - /** |
|
68 | - * The Super block output function. |
|
69 | - * |
|
70 | - * @param array $args |
|
71 | - * @param array $widget_args |
|
72 | - * @param string $content |
|
73 | - * |
|
74 | - * @return string |
|
75 | - */ |
|
67 | + /** |
|
68 | + * The Super block output function. |
|
69 | + * |
|
70 | + * @param array $args |
|
71 | + * @param array $widget_args |
|
72 | + * @param string $content |
|
73 | + * |
|
74 | + * @return string |
|
75 | + */ |
|
76 | 76 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
77 | - global $invoicing; |
|
78 | - |
|
79 | - // Do we have a payment form? |
|
80 | - if ( empty( $args['form'] ) ) { |
|
81 | - return aui()->alert( |
|
82 | - array( |
|
83 | - 'type' => 'warning', |
|
84 | - 'content' => __( 'No payment form selected', 'invoicing' ), |
|
85 | - ) |
|
86 | - ); |
|
87 | - |
|
88 | - } |
|
89 | - |
|
90 | - // If yes, ensure that it is published. |
|
91 | - if ( 'publish' != get_post_status( $args['form'] ) ) { |
|
92 | - return aui()->alert( |
|
93 | - array( |
|
94 | - 'type' => 'warning', |
|
95 | - 'content' => __( 'This payment form is no longer active', 'invoicing' ), |
|
96 | - ) |
|
97 | - ); |
|
98 | - } |
|
99 | - |
|
100 | - // Get the form elements and items. |
|
101 | - $elements = $invoicing->form_elements->get_form_elements( $args['form'] ); |
|
102 | - $items = $invoicing->form_elements->get_form_items( $args['form'] ); |
|
103 | - |
|
104 | - ob_start(); |
|
105 | - echo "<form class='wpinv_payment_form'>"; |
|
106 | - echo "<input type='hidden' name='form_id' value='{$args['form']}'/>"; |
|
107 | - wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' ); |
|
108 | - wp_nonce_field( 'vat_validation', '_wpi_nonce' ); |
|
109 | - |
|
110 | - foreach ( $elements as $element ) { |
|
111 | - do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] ); |
|
112 | - do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] ); |
|
113 | - } |
|
114 | - |
|
115 | - echo "<div class='wpinv_payment_form_errors alert alert-danger d-none'></div>"; |
|
116 | - echo '</form>'; |
|
117 | - |
|
118 | - $content = ob_get_clean(); |
|
119 | - |
|
120 | - return str_replace( 'sr-only', '', $content ); |
|
77 | + global $invoicing; |
|
78 | + |
|
79 | + // Do we have a payment form? |
|
80 | + if ( empty( $args['form'] ) ) { |
|
81 | + return aui()->alert( |
|
82 | + array( |
|
83 | + 'type' => 'warning', |
|
84 | + 'content' => __( 'No payment form selected', 'invoicing' ), |
|
85 | + ) |
|
86 | + ); |
|
87 | + |
|
88 | + } |
|
89 | + |
|
90 | + // If yes, ensure that it is published. |
|
91 | + if ( 'publish' != get_post_status( $args['form'] ) ) { |
|
92 | + return aui()->alert( |
|
93 | + array( |
|
94 | + 'type' => 'warning', |
|
95 | + 'content' => __( 'This payment form is no longer active', 'invoicing' ), |
|
96 | + ) |
|
97 | + ); |
|
98 | + } |
|
99 | + |
|
100 | + // Get the form elements and items. |
|
101 | + $elements = $invoicing->form_elements->get_form_elements( $args['form'] ); |
|
102 | + $items = $invoicing->form_elements->get_form_items( $args['form'] ); |
|
103 | + |
|
104 | + ob_start(); |
|
105 | + echo "<form class='wpinv_payment_form'>"; |
|
106 | + echo "<input type='hidden' name='form_id' value='{$args['form']}'/>"; |
|
107 | + wp_nonce_field( 'wpinv_payment_form', 'wpinv_payment_form' ); |
|
108 | + wp_nonce_field( 'vat_validation', '_wpi_nonce' ); |
|
109 | + |
|
110 | + foreach ( $elements as $element ) { |
|
111 | + do_action( 'wpinv_frontend_render_payment_form_element', $element, $items, $args['form'] ); |
|
112 | + do_action( "wpinv_frontend_render_payment_form_{$element['type']}", $element, $items, $args['form'] ); |
|
113 | + } |
|
114 | + |
|
115 | + echo "<div class='wpinv_payment_form_errors alert alert-danger d-none'></div>"; |
|
116 | + echo '</form>'; |
|
117 | + |
|
118 | + $content = ob_get_clean(); |
|
119 | + |
|
120 | + return str_replace( 'sr-only', '', $content ); |
|
121 | 121 | |
122 | 122 | } |
123 | 123 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -13,19 +13,19 @@ discard block |
||
13 | 13 | |
14 | 14 | public function __construct() { |
15 | 15 | |
16 | - foreach( $this->get_elements() as $element ) { |
|
16 | + foreach ($this->get_elements() as $element) { |
|
17 | 17 | $element = $element['type']; |
18 | 18 | |
19 | - if ( method_exists( $this, "render_{$element}_template" ) ) { |
|
20 | - add_action( 'wpinv_payment_form_render_element_template', array( $this, "render_{$element}_template" ), 10, 2 ); |
|
19 | + if (method_exists($this, "render_{$element}_template")) { |
|
20 | + add_action('wpinv_payment_form_render_element_template', array($this, "render_{$element}_template"), 10, 2); |
|
21 | 21 | } |
22 | 22 | |
23 | - if ( method_exists( $this, "edit_{$element}_template" ) ) { |
|
24 | - add_action( 'wpinv_payment_form_edit_element_template', array( $this, "edit_{$element}_template" ), 10, 2 ); |
|
23 | + if (method_exists($this, "edit_{$element}_template")) { |
|
24 | + add_action('wpinv_payment_form_edit_element_template', array($this, "edit_{$element}_template"), 10, 2); |
|
25 | 25 | } |
26 | 26 | |
27 | - if ( method_exists( $this, "frontend_render_{$element}_template" ) ) { |
|
28 | - add_action( "wpinv_frontend_render_payment_form_$element", array( $this, "frontend_render_{$element}_template" ), 10, 3 ); |
|
27 | + if (method_exists($this, "frontend_render_{$element}_template")) { |
|
28 | + add_action("wpinv_frontend_render_payment_form_$element", array($this, "frontend_render_{$element}_template"), 10, 3); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function get_elements() { |
39 | 39 | |
40 | - if ( ! empty( $this->elements ) ) { |
|
40 | + if (!empty($this->elements)) { |
|
41 | 41 | return $this->elements; |
42 | 42 | } |
43 | 43 | |
@@ -45,28 +45,28 @@ discard block |
||
45 | 45 | |
46 | 46 | array( |
47 | 47 | 'type' => 'heading', |
48 | - 'name' => __( 'Heading', 'invoicing' ), |
|
48 | + 'name' => __('Heading', 'invoicing'), |
|
49 | 49 | 'defaults' => array( |
50 | 50 | 'level' => 'h2', |
51 | - 'text' => __( 'Heading', 'invoicing' ), |
|
51 | + 'text' => __('Heading', 'invoicing'), |
|
52 | 52 | ) |
53 | 53 | ), |
54 | 54 | |
55 | 55 | array( |
56 | 56 | 'type' => 'paragraph', |
57 | - 'name' => __( 'Paragraph', 'invoicing' ), |
|
57 | + 'name' => __('Paragraph', 'invoicing'), |
|
58 | 58 | 'defaults' => array( |
59 | - 'text' => __( 'Paragraph text', 'invoicing' ), |
|
59 | + 'text' => __('Paragraph text', 'invoicing'), |
|
60 | 60 | ) |
61 | 61 | ), |
62 | 62 | |
63 | 63 | array( |
64 | 64 | 'type' => 'alert', |
65 | - 'name' => __( 'Alert', 'invoicing' ), |
|
65 | + 'name' => __('Alert', 'invoicing'), |
|
66 | 66 | 'defaults' => array( |
67 | 67 | 'value' => '', |
68 | 68 | 'class' => 'alert-warning', |
69 | - 'text' => __( 'Alert', 'invoicing' ), |
|
69 | + 'text' => __('Alert', 'invoicing'), |
|
70 | 70 | 'dismissible' => false, |
71 | 71 | ) |
72 | 72 | ), |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | |
83 | 83 | array( |
84 | 84 | 'type' => 'text', |
85 | - 'name' => __( 'Text Input', 'invoicing' ), |
|
85 | + 'name' => __('Text Input', 'invoicing'), |
|
86 | 86 | 'defaults' => array( |
87 | - 'placeholder' => __( 'Enter some text', 'invoicing' ), |
|
87 | + 'placeholder' => __('Enter some text', 'invoicing'), |
|
88 | 88 | 'value' => '', |
89 | - 'label' => __( 'Field Label', 'invoicing' ), |
|
89 | + 'label' => __('Field Label', 'invoicing'), |
|
90 | 90 | 'description' => '', |
91 | 91 | 'required' => false, |
92 | 92 | ) |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | |
95 | 95 | array( |
96 | 96 | 'type' => 'textarea', |
97 | - 'name' => __( 'Textarea', 'invoicing' ), |
|
97 | + 'name' => __('Textarea', 'invoicing'), |
|
98 | 98 | 'defaults' => array( |
99 | - 'placeholder' => __( 'Enter your text hear', 'invoicing' ), |
|
99 | + 'placeholder' => __('Enter your text hear', 'invoicing'), |
|
100 | 100 | 'value' => '', |
101 | - 'label' => __( 'Textarea Label', 'invoicing' ), |
|
101 | + 'label' => __('Textarea Label', 'invoicing'), |
|
102 | 102 | 'description' => '', |
103 | 103 | 'required' => false, |
104 | 104 | ) |
@@ -106,27 +106,27 @@ discard block |
||
106 | 106 | |
107 | 107 | array( |
108 | 108 | 'type' => 'select', |
109 | - 'name' => __( 'Dropdown', 'invoicing' ), |
|
109 | + 'name' => __('Dropdown', 'invoicing'), |
|
110 | 110 | 'defaults' => array( |
111 | - 'placeholder' => __( 'Select a value', 'invoicing' ), |
|
111 | + 'placeholder' => __('Select a value', 'invoicing'), |
|
112 | 112 | 'value' => '', |
113 | - 'label' => __( 'Dropdown Label', 'invoicing' ), |
|
113 | + 'label' => __('Dropdown Label', 'invoicing'), |
|
114 | 114 | 'description' => '', |
115 | 115 | 'required' => false, |
116 | 116 | 'options' => array( |
117 | - esc_attr__( 'Option One', 'invoicing' ), |
|
118 | - esc_attr__( 'Option Two', 'invoicing' ), |
|
119 | - esc_attr__( 'Option Three', 'invoicing' ) |
|
117 | + esc_attr__('Option One', 'invoicing'), |
|
118 | + esc_attr__('Option Two', 'invoicing'), |
|
119 | + esc_attr__('Option Three', 'invoicing') |
|
120 | 120 | ), |
121 | 121 | ) |
122 | 122 | ), |
123 | 123 | |
124 | 124 | array( |
125 | 125 | 'type' => 'checkbox', |
126 | - 'name' => __( 'Checkbox', 'invoicing' ), |
|
126 | + 'name' => __('Checkbox', 'invoicing'), |
|
127 | 127 | 'defaults' => array( |
128 | 128 | 'value' => '', |
129 | - 'label' => __( 'Checkbox Label', 'invoicing' ), |
|
129 | + 'label' => __('Checkbox Label', 'invoicing'), |
|
130 | 130 | 'description' => '', |
131 | 131 | 'required' => false, |
132 | 132 | ) |
@@ -134,24 +134,24 @@ discard block |
||
134 | 134 | |
135 | 135 | array( |
136 | 136 | 'type' => 'radio', |
137 | - 'name' => __( 'Multiple Choice', 'invoicing' ), |
|
137 | + 'name' => __('Multiple Choice', 'invoicing'), |
|
138 | 138 | 'defaults' => array( |
139 | - 'label' => __( 'Select one choice', 'invoicing' ), |
|
139 | + 'label' => __('Select one choice', 'invoicing'), |
|
140 | 140 | 'options' => array( |
141 | - esc_attr__( 'Choice One', 'invoicing' ), |
|
142 | - esc_attr__( 'Choice Two', 'invoicing' ), |
|
143 | - esc_attr__( 'Choice Three', 'invoicing' ) |
|
141 | + esc_attr__('Choice One', 'invoicing'), |
|
142 | + esc_attr__('Choice Two', 'invoicing'), |
|
143 | + esc_attr__('Choice Three', 'invoicing') |
|
144 | 144 | ), |
145 | 145 | ) |
146 | 146 | ), |
147 | 147 | |
148 | 148 | array( |
149 | 149 | 'type' => 'date', |
150 | - 'name' => __( 'Date', 'invoicing' ), |
|
150 | + 'name' => __('Date', 'invoicing'), |
|
151 | 151 | 'defaults' => array( |
152 | 152 | 'placeholder' => '', |
153 | 153 | 'value' => '', |
154 | - 'label' => __( 'Date', 'invoicing' ), |
|
154 | + 'label' => __('Date', 'invoicing'), |
|
155 | 155 | 'description' => '', |
156 | 156 | 'required' => false, |
157 | 157 | ) |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | |
160 | 160 | array( |
161 | 161 | 'type' => 'time', |
162 | - 'name' => __( 'Time', 'invoicing' ), |
|
162 | + 'name' => __('Time', 'invoicing'), |
|
163 | 163 | 'defaults' => array( |
164 | 164 | 'placeholder' => '', |
165 | 165 | 'value' => '', |
166 | - 'label' => __( 'Time', 'invoicing' ), |
|
166 | + 'label' => __('Time', 'invoicing'), |
|
167 | 167 | 'description' => '', |
168 | 168 | 'required' => false, |
169 | 169 | ) |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | |
172 | 172 | array( |
173 | 173 | 'type' => 'number', |
174 | - 'name' => __( 'Number', 'invoicing' ), |
|
174 | + 'name' => __('Number', 'invoicing'), |
|
175 | 175 | 'defaults' => array( |
176 | 176 | 'placeholder' => '', |
177 | 177 | 'value' => '', |
178 | - 'label' => __( 'Number', 'invoicing' ), |
|
178 | + 'label' => __('Number', 'invoicing'), |
|
179 | 179 | 'description' => '', |
180 | 180 | 'required' => false, |
181 | 181 | ) |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | |
184 | 184 | array( |
185 | 185 | 'type' => 'website', |
186 | - 'name' => __( 'Website', 'invoicing' ), |
|
186 | + 'name' => __('Website', 'invoicing'), |
|
187 | 187 | 'defaults' => array( |
188 | 188 | 'placeholder' => 'http://example.com', |
189 | 189 | 'value' => '', |
190 | - 'label' => __( 'Website', 'invoicing' ), |
|
190 | + 'label' => __('Website', 'invoicing'), |
|
191 | 191 | 'description' => '', |
192 | 192 | 'required' => false, |
193 | 193 | ) |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | |
196 | 196 | array( |
197 | 197 | 'type' => 'email', |
198 | - 'name' => __( 'Email', 'invoicing' ), |
|
198 | + 'name' => __('Email', 'invoicing'), |
|
199 | 199 | 'defaults' => array( |
200 | 200 | 'placeholder' => '[email protected]', |
201 | 201 | 'value' => '', |
202 | - 'label' => __( 'Email Address', 'invoicing' ), |
|
202 | + 'label' => __('Email Address', 'invoicing'), |
|
203 | 203 | 'description' => '', |
204 | 204 | 'required' => false, |
205 | 205 | ) |
@@ -207,14 +207,14 @@ discard block |
||
207 | 207 | |
208 | 208 | array( |
209 | 209 | 'type' => 'address', |
210 | - 'name' => __( 'Address', 'invoicing' ), |
|
210 | + 'name' => __('Address', 'invoicing'), |
|
211 | 211 | 'defaults' => array( |
212 | 212 | |
213 | 213 | 'fields' => array( |
214 | 214 | array( |
215 | 215 | 'placeholder' => 'Jon', |
216 | 216 | 'value' => '', |
217 | - 'label' => __( 'First Name', 'invoicing' ), |
|
217 | + 'label' => __('First Name', 'invoicing'), |
|
218 | 218 | 'description' => '', |
219 | 219 | 'required' => false, |
220 | 220 | 'visible' => true, |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | array( |
225 | 225 | 'placeholder' => 'Snow', |
226 | 226 | 'value' => '', |
227 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
227 | + 'label' => __('Last Name', 'invoicing'), |
|
228 | 228 | 'description' => '', |
229 | 229 | 'required' => false, |
230 | 230 | 'visible' => true, |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | array( |
235 | 235 | 'placeholder' => '', |
236 | 236 | 'value' => '', |
237 | - 'label' => __( 'Address', 'invoicing' ), |
|
237 | + 'label' => __('Address', 'invoicing'), |
|
238 | 238 | 'description' => '', |
239 | 239 | 'required' => false, |
240 | 240 | 'visible' => true, |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | array( |
245 | 245 | 'placeholder' => '', |
246 | 246 | 'value' => '', |
247 | - 'label' => __( 'City', 'invoicing' ), |
|
247 | + 'label' => __('City', 'invoicing'), |
|
248 | 248 | 'description' => '', |
249 | 249 | 'required' => false, |
250 | 250 | 'visible' => true, |
@@ -252,9 +252,9 @@ discard block |
||
252 | 252 | ), |
253 | 253 | |
254 | 254 | array( |
255 | - 'placeholder' => __( 'Select your country' ), |
|
255 | + 'placeholder' => __('Select your country'), |
|
256 | 256 | 'value' => '', |
257 | - 'label' => __( 'Country', 'invoicing' ), |
|
257 | + 'label' => __('Country', 'invoicing'), |
|
258 | 258 | 'description' => '', |
259 | 259 | 'required' => false, |
260 | 260 | 'visible' => true, |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | ), |
263 | 263 | |
264 | 264 | array( |
265 | - 'placeholder' => __( 'Choose a state', 'invoicing' ), |
|
265 | + 'placeholder' => __('Choose a state', 'invoicing'), |
|
266 | 266 | 'value' => '', |
267 | - 'label' => __( 'State / Province', 'invoicing' ), |
|
267 | + 'label' => __('State / Province', 'invoicing'), |
|
268 | 268 | 'description' => '', |
269 | 269 | 'required' => false, |
270 | 270 | 'visible' => true, |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | array( |
275 | 275 | 'placeholder' => '', |
276 | 276 | 'value' => '', |
277 | - 'label' => __( 'ZIP / Postcode', 'invoicing' ), |
|
277 | + 'label' => __('ZIP / Postcode', 'invoicing'), |
|
278 | 278 | 'description' => '', |
279 | 279 | 'required' => false, |
280 | 280 | 'visible' => true, |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | array( |
285 | 285 | 'placeholder' => '', |
286 | 286 | 'value' => '', |
287 | - 'label' => __( 'Phone', 'invoicing' ), |
|
287 | + 'label' => __('Phone', 'invoicing'), |
|
288 | 288 | 'description' => '', |
289 | 289 | 'required' => false, |
290 | 290 | 'visible' => true, |
@@ -296,11 +296,11 @@ discard block |
||
296 | 296 | |
297 | 297 | array( |
298 | 298 | 'type' => 'billing_email', |
299 | - 'name' => __( 'Billing Email', 'invoicing' ), |
|
299 | + 'name' => __('Billing Email', 'invoicing'), |
|
300 | 300 | 'defaults' => array( |
301 | 301 | 'placeholder' => '[email protected]', |
302 | 302 | 'value' => '', |
303 | - 'label' => __( 'Billing Email', 'invoicing' ), |
|
303 | + 'label' => __('Billing Email', 'invoicing'), |
|
304 | 304 | 'description' => '', |
305 | 305 | 'premade' => true, |
306 | 306 | ) |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | |
320 | 320 | array( |
321 | 321 | 'type' => 'items', |
322 | - 'name' => __( 'Items', 'invoicing' ), |
|
322 | + 'name' => __('Items', 'invoicing'), |
|
323 | 323 | 'defaults' => array( |
324 | 324 | 'value' => '', |
325 | 325 | 'items_type' => 'total', |
@@ -330,25 +330,25 @@ discard block |
||
330 | 330 | |
331 | 331 | array( |
332 | 332 | 'type' => 'pay_button', |
333 | - 'name' => __( 'Payment Button', 'invoicing' ), |
|
333 | + 'name' => __('Payment Button', 'invoicing'), |
|
334 | 334 | 'defaults' => array( |
335 | 335 | 'value' => '', |
336 | 336 | 'class' => 'btn-primary', |
337 | - 'label' => __( 'Pay Now »', 'invoicing' ), |
|
338 | - 'description' => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ), |
|
337 | + 'label' => __('Pay Now »', 'invoicing'), |
|
338 | + 'description' => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'), |
|
339 | 339 | 'premade' => true, |
340 | 340 | ) |
341 | 341 | ) |
342 | 342 | ); |
343 | 343 | |
344 | - $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements ); |
|
344 | + $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements); |
|
345 | 345 | return $this->elements; |
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
349 | 349 | * Returns the restrict markup. |
350 | 350 | */ |
351 | - public function get_restrict_markup( $field, $field_type ) { |
|
351 | + public function get_restrict_markup($field, $field_type) { |
|
352 | 352 | $restrict = "$field.type=='$field_type'"; |
353 | 353 | return "v-if=\"$restrict\""; |
354 | 354 | } |
@@ -356,15 +356,15 @@ discard block |
||
356 | 356 | /** |
357 | 357 | * Renders the title element template. |
358 | 358 | */ |
359 | - public function render_heading_template( $field ) { |
|
360 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
359 | + public function render_heading_template($field) { |
|
360 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
361 | 361 | echo "<component :is='$field.level' $restrict v-html='$field.text'></component>"; |
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
365 | 365 | * Renders the title element on the frontend. |
366 | 366 | */ |
367 | - public function frontend_render_heading_template( $field ) { |
|
367 | + public function frontend_render_heading_template($field) { |
|
368 | 368 | $tag = $field['level']; |
369 | 369 | echo "<$tag>{$field['text']}</$tag>"; |
370 | 370 | } |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | /** |
373 | 373 | * Renders the edit title element template. |
374 | 374 | */ |
375 | - public function edit_heading_template( $field ) { |
|
376 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
377 | - $label = __( 'Heading', 'invoicing' ); |
|
378 | - $label2 = __( 'Select Heading Level', 'invoicing' ); |
|
375 | + public function edit_heading_template($field) { |
|
376 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
377 | + $label = __('Heading', 'invoicing'); |
|
378 | + $label2 = __('Select Heading Level', 'invoicing'); |
|
379 | 379 | $id = $field . '.id + "_edit"'; |
380 | 380 | $id2 = $field . '.id + "_edit2"'; |
381 | 381 | |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | /** |
408 | 408 | * Renders a paragraph element template. |
409 | 409 | */ |
410 | - public function render_paragraph_template( $field ) { |
|
411 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
410 | + public function render_paragraph_template($field) { |
|
411 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
412 | 412 | $label = "$field.text"; |
413 | 413 | echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>"; |
414 | 414 | } |
@@ -416,16 +416,16 @@ discard block |
||
416 | 416 | /** |
417 | 417 | * Renders the paragraph element on the frontend. |
418 | 418 | */ |
419 | - public function frontend_render_paragraph_template( $field ) { |
|
419 | + public function frontend_render_paragraph_template($field) { |
|
420 | 420 | echo "<p>{$field['text']}</p>"; |
421 | 421 | } |
422 | 422 | |
423 | 423 | /** |
424 | 424 | * Renders the edit paragraph element template. |
425 | 425 | */ |
426 | - public function edit_paragraph_template( $field ) { |
|
427 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
428 | - $label = __( 'Enter your text', 'invoicing' ); |
|
426 | + public function edit_paragraph_template($field) { |
|
427 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
428 | + $label = __('Enter your text', 'invoicing'); |
|
429 | 429 | $id = $field . '.id + "_edit"'; |
430 | 430 | echo " |
431 | 431 | <div $restrict> |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | /** |
442 | 442 | * Renders the text element template. |
443 | 443 | */ |
444 | - public function render_text_template( $field ) { |
|
445 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
444 | + public function render_text_template($field) { |
|
445 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
446 | 446 | $label = "$field.label"; |
447 | 447 | echo " |
448 | 448 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -457,23 +457,23 @@ discard block |
||
457 | 457 | /** |
458 | 458 | * Renders the text element on the frontend. |
459 | 459 | */ |
460 | - public function frontend_render_text_template( $field ) { |
|
460 | + public function frontend_render_text_template($field) { |
|
461 | 461 | |
462 | 462 | echo "<div class='form-group'>"; |
463 | 463 | |
464 | 464 | echo aui()->input( |
465 | 465 | array( |
466 | - 'name' => esc_attr( $field['id'] ), |
|
467 | - 'id' => esc_attr( $field['id'] ), |
|
468 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
466 | + 'name' => esc_attr($field['id']), |
|
467 | + 'id' => esc_attr($field['id']), |
|
468 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
469 | 469 | 'required' => (bool) $field['required'], |
470 | - 'label' => wp_kses_post( $field['label'] ), |
|
470 | + 'label' => wp_kses_post($field['label']), |
|
471 | 471 | 'no_wrap' => true, |
472 | 472 | ) |
473 | 473 | ); |
474 | 474 | |
475 | - if ( ! empty( $field['description'] ) ) { |
|
476 | - $description = wp_kses_post( $field['description'] ); |
|
475 | + if (!empty($field['description'])) { |
|
476 | + $description = wp_kses_post($field['description']); |
|
477 | 477 | echo "<small class='form-text text-muted'>$description</small>"; |
478 | 478 | } |
479 | 479 | |
@@ -484,16 +484,16 @@ discard block |
||
484 | 484 | /** |
485 | 485 | * Renders the edit text element template. |
486 | 486 | */ |
487 | - public function edit_text_template( $field ) { |
|
488 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
489 | - $label = __( 'Field Label', 'invoicing' ); |
|
487 | + public function edit_text_template($field) { |
|
488 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
489 | + $label = __('Field Label', 'invoicing'); |
|
490 | 490 | $id = $field . '.id + "_edit"'; |
491 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
491 | + $label2 = __('Placeholder text', 'invoicing'); |
|
492 | 492 | $id2 = $field . '.id + "_edit2"'; |
493 | - $label3 = __( 'Help text', 'invoicing' ); |
|
494 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
493 | + $label3 = __('Help text', 'invoicing'); |
|
494 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
495 | 495 | $id3 = $field . '.id + "_edit3"'; |
496 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
496 | + $label5 = __('Is this field required?', 'invoicing'); |
|
497 | 497 | $id4 = $field . '.id + "_edit4"'; |
498 | 498 | echo " |
499 | 499 | <div $restrict> |
@@ -521,8 +521,8 @@ discard block |
||
521 | 521 | /** |
522 | 522 | * Renders the textarea element template. |
523 | 523 | */ |
524 | - public function render_textarea_template( $field ) { |
|
525 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
524 | + public function render_textarea_template($field) { |
|
525 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
526 | 526 | $label = "$field.label"; |
527 | 527 | echo " |
528 | 528 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -537,24 +537,24 @@ discard block |
||
537 | 537 | /** |
538 | 538 | * Renders the textarea element on the frontend. |
539 | 539 | */ |
540 | - public function frontend_render_textarea_template( $field ) { |
|
540 | + public function frontend_render_textarea_template($field) { |
|
541 | 541 | |
542 | 542 | echo "<div class='form-group'>"; |
543 | 543 | |
544 | 544 | echo aui()->textarea( |
545 | 545 | array( |
546 | - 'name' => esc_attr( $field['id'] ), |
|
547 | - 'id' => esc_attr( $field['id'] ), |
|
548 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
546 | + 'name' => esc_attr($field['id']), |
|
547 | + 'id' => esc_attr($field['id']), |
|
548 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
549 | 549 | 'required' => (bool) $field['required'], |
550 | - 'label' => wp_kses_post( $field['label'] ), |
|
550 | + 'label' => wp_kses_post($field['label']), |
|
551 | 551 | 'no_wrap' => true, |
552 | 552 | 'rows' => 3, |
553 | 553 | ) |
554 | 554 | ); |
555 | 555 | |
556 | - if ( ! empty( $field['description'] ) ) { |
|
557 | - $description = wp_kses_post( $field['description'] ); |
|
556 | + if (!empty($field['description'])) { |
|
557 | + $description = wp_kses_post($field['description']); |
|
558 | 558 | echo "<small class='form-text text-muted'>$description</small>"; |
559 | 559 | } |
560 | 560 | |
@@ -565,16 +565,16 @@ discard block |
||
565 | 565 | /** |
566 | 566 | * Renders the edit textarea element template. |
567 | 567 | */ |
568 | - public function edit_textarea_template( $field ) { |
|
569 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
570 | - $label = __( 'Field Label', 'invoicing' ); |
|
568 | + public function edit_textarea_template($field) { |
|
569 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
570 | + $label = __('Field Label', 'invoicing'); |
|
571 | 571 | $id = $field . '.id + "_edit"'; |
572 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
572 | + $label2 = __('Placeholder text', 'invoicing'); |
|
573 | 573 | $id2 = $field . '.id + "_edit2"'; |
574 | - $label3 = __( 'Help text', 'invoicing' ); |
|
575 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
574 | + $label3 = __('Help text', 'invoicing'); |
|
575 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
576 | 576 | $id3 = $field . '.id + "_edit3"'; |
577 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
577 | + $label5 = __('Is this field required?', 'invoicing'); |
|
578 | 578 | $id4 = $field . '.id + "_edit4"'; |
579 | 579 | echo " |
580 | 580 | <div $restrict> |
@@ -602,8 +602,8 @@ discard block |
||
602 | 602 | /** |
603 | 603 | * Renders the select element template. |
604 | 604 | */ |
605 | - public function render_select_template( $field ) { |
|
606 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
605 | + public function render_select_template($field) { |
|
606 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
607 | 607 | $label = "$field.label"; |
608 | 608 | $placeholder = "$field.placeholder"; |
609 | 609 | $id = $field . '.id'; |
@@ -623,24 +623,24 @@ discard block |
||
623 | 623 | /** |
624 | 624 | * Renders the select element on the frontend. |
625 | 625 | */ |
626 | - public function frontend_render_select_template( $field ) { |
|
626 | + public function frontend_render_select_template($field) { |
|
627 | 627 | |
628 | 628 | echo "<div class='form-group'>"; |
629 | 629 | |
630 | 630 | echo aui()->select( |
631 | 631 | array( |
632 | - 'name' => esc_attr( $field['id'] ), |
|
633 | - 'id' => esc_attr( $field['id'] ), |
|
634 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
632 | + 'name' => esc_attr($field['id']), |
|
633 | + 'id' => esc_attr($field['id']), |
|
634 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
635 | 635 | 'required' => (bool) $field['required'], |
636 | - 'label' => wp_kses_post( $field['label'] ), |
|
636 | + 'label' => wp_kses_post($field['label']), |
|
637 | 637 | 'no_wrap' => true, |
638 | - 'options' => array_combine( $field['options'], $field['options'] ), |
|
638 | + 'options' => array_combine($field['options'], $field['options']), |
|
639 | 639 | ) |
640 | 640 | ); |
641 | 641 | |
642 | - if ( ! empty( $field['description'] ) ) { |
|
643 | - $description = wp_kses_post( $field['description'] ); |
|
642 | + if (!empty($field['description'])) { |
|
643 | + $description = wp_kses_post($field['description']); |
|
644 | 644 | echo "<small class='form-text text-muted'>$description</small>"; |
645 | 645 | } |
646 | 646 | |
@@ -651,18 +651,18 @@ discard block |
||
651 | 651 | /** |
652 | 652 | * Renders the edit select element template. |
653 | 653 | */ |
654 | - public function edit_select_template( $field ) { |
|
655 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
656 | - $label = __( 'Field Label', 'invoicing' ); |
|
654 | + public function edit_select_template($field) { |
|
655 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
656 | + $label = __('Field Label', 'invoicing'); |
|
657 | 657 | $id = $field . '.id + "_edit"'; |
658 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
658 | + $label2 = __('Placeholder text', 'invoicing'); |
|
659 | 659 | $id2 = $field . '.id + "_edit2"'; |
660 | - $label3 = __( 'Help text', 'invoicing' ); |
|
661 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
660 | + $label3 = __('Help text', 'invoicing'); |
|
661 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
662 | 662 | $id3 = $field . '.id + "_edit3"'; |
663 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
663 | + $label5 = __('Is this field required?', 'invoicing'); |
|
664 | 664 | $id4 = $field . '.id + "_edit4"'; |
665 | - $label6 = __( 'Available Options', 'invoicing' ); |
|
665 | + $label6 = __('Available Options', 'invoicing'); |
|
666 | 666 | echo " |
667 | 667 | <div $restrict> |
668 | 668 | <div class='form-group'> |
@@ -700,8 +700,8 @@ discard block |
||
700 | 700 | /** |
701 | 701 | * Renders the checkbox element template. |
702 | 702 | */ |
703 | - public function render_checkbox_template( $field ) { |
|
704 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
703 | + public function render_checkbox_template($field) { |
|
704 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
705 | 705 | $label = "$field.label"; |
706 | 706 | echo " |
707 | 707 | <div class='form-check' $restrict> |
@@ -716,24 +716,24 @@ discard block |
||
716 | 716 | /** |
717 | 717 | * Renders the checkbox element on the frontend. |
718 | 718 | */ |
719 | - public function frontend_render_checkbox_template( $field ) { |
|
719 | + public function frontend_render_checkbox_template($field) { |
|
720 | 720 | |
721 | 721 | echo "<div class='form-group'>"; |
722 | 722 | |
723 | 723 | echo aui()->input( |
724 | 724 | array( |
725 | - 'name' => esc_attr( $field['id'] ), |
|
726 | - 'id' => esc_attr( $field['id'] ), |
|
725 | + 'name' => esc_attr($field['id']), |
|
726 | + 'id' => esc_attr($field['id']), |
|
727 | 727 | 'required' => (bool) $field['required'], |
728 | - 'label' => wp_kses_post( $field['label'] ), |
|
728 | + 'label' => wp_kses_post($field['label']), |
|
729 | 729 | 'no_wrap' => true, |
730 | - 'value' => esc_attr__( 'Yes', 'invoicing' ), |
|
730 | + 'value' => esc_attr__('Yes', 'invoicing'), |
|
731 | 731 | 'type' => 'checkbox', |
732 | 732 | ) |
733 | 733 | ); |
734 | 734 | |
735 | - if ( ! empty( $field['description'] ) ) { |
|
736 | - $description = wp_kses_post( $field['description'] ); |
|
735 | + if (!empty($field['description'])) { |
|
736 | + $description = wp_kses_post($field['description']); |
|
737 | 737 | echo "<small class='form-text text-muted'>$description</small>"; |
738 | 738 | } |
739 | 739 | |
@@ -744,14 +744,14 @@ discard block |
||
744 | 744 | /** |
745 | 745 | * Renders the edit checkbox element template. |
746 | 746 | */ |
747 | - public function edit_checkbox_template( $field ) { |
|
748 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
749 | - $label = __( 'Field Label', 'invoicing' ); |
|
747 | + public function edit_checkbox_template($field) { |
|
748 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
749 | + $label = __('Field Label', 'invoicing'); |
|
750 | 750 | $id = $field . '.id + "_edit"'; |
751 | - $label2 = __( 'Help text', 'invoicing' ); |
|
752 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
751 | + $label2 = __('Help text', 'invoicing'); |
|
752 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
753 | 753 | $id2 = $field . '.id + "_edit2"'; |
754 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
754 | + $label4 = __('Is this field required?', 'invoicing'); |
|
755 | 755 | $id3 = $field . '.id + "_edit3"'; |
756 | 756 | echo " |
757 | 757 | <div $restrict> |
@@ -775,8 +775,8 @@ discard block |
||
775 | 775 | /** |
776 | 776 | * Renders the radio element template. |
777 | 777 | */ |
778 | - public function render_radio_template( $field ) { |
|
779 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
778 | + public function render_radio_template($field) { |
|
779 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
780 | 780 | $label = "$field.label"; |
781 | 781 | $id = $field . '.id'; |
782 | 782 | echo " |
@@ -795,20 +795,20 @@ discard block |
||
795 | 795 | /** |
796 | 796 | * Renders the radio element on the frontend. |
797 | 797 | */ |
798 | - public function frontend_render_radio_template( $field ) { |
|
798 | + public function frontend_render_radio_template($field) { |
|
799 | 799 | |
800 | 800 | echo "<div class='form-group'>"; |
801 | 801 | |
802 | - if ( ! empty( $field['label'] ) ) { |
|
803 | - $label = wp_kses_post( $field['label'] ); |
|
802 | + if (!empty($field['label'])) { |
|
803 | + $label = wp_kses_post($field['label']); |
|
804 | 804 | echo "<legend class='col-form-label'>$label</legend>"; |
805 | 805 | } |
806 | 806 | |
807 | - foreach( $field['options'] as $index => $option ) { |
|
807 | + foreach ($field['options'] as $index => $option) { |
|
808 | 808 | $id = $field['id'] . $index; |
809 | 809 | $name = $field['id']; |
810 | - $value = esc_attr( $option ); |
|
811 | - $label = wp_kses_post( $option ); |
|
810 | + $value = esc_attr($option); |
|
811 | + $label = wp_kses_post($option); |
|
812 | 812 | |
813 | 813 | echo " |
814 | 814 | <div class='form-check'> |
@@ -818,8 +818,8 @@ discard block |
||
818 | 818 | "; |
819 | 819 | } |
820 | 820 | |
821 | - if ( ! empty( $field['description'] ) ) { |
|
822 | - $description = wp_kses_post( $field['description'] ); |
|
821 | + if (!empty($field['description'])) { |
|
822 | + $description = wp_kses_post($field['description']); |
|
823 | 823 | echo "<small class='form-text text-muted'>$description</small>"; |
824 | 824 | } |
825 | 825 | |
@@ -830,16 +830,16 @@ discard block |
||
830 | 830 | /** |
831 | 831 | * Renders the edit radio element template. |
832 | 832 | */ |
833 | - public function edit_radio_template( $field ) { |
|
834 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
835 | - $label = __( 'Field Label', 'invoicing' ); |
|
833 | + public function edit_radio_template($field) { |
|
834 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
835 | + $label = __('Field Label', 'invoicing'); |
|
836 | 836 | $id = $field . '.id + "_edit"'; |
837 | - $label2 = __( 'Help text', 'invoicing' ); |
|
838 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
837 | + $label2 = __('Help text', 'invoicing'); |
|
838 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
839 | 839 | $id2 = $field . '.id + "_edit3"'; |
840 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
840 | + $label4 = __('Is this field required?', 'invoicing'); |
|
841 | 841 | $id3 = $field . '.id + "_edit4"'; |
842 | - $label5 = __( 'Available Options', 'invoicing' ); |
|
842 | + $label5 = __('Available Options', 'invoicing'); |
|
843 | 843 | echo " |
844 | 844 | <div $restrict> |
845 | 845 | <div class='form-group'> |
@@ -873,8 +873,8 @@ discard block |
||
873 | 873 | /** |
874 | 874 | * Renders the address element template. |
875 | 875 | */ |
876 | - public function render_address_template( $field ) { |
|
877 | - $restrict = $this->get_restrict_markup( $field, 'address' ); |
|
876 | + public function render_address_template($field) { |
|
877 | + $restrict = $this->get_restrict_markup($field, 'address'); |
|
878 | 878 | |
879 | 879 | echo " |
880 | 880 | <div class='wpinv-address-wrapper' $restrict> |
@@ -896,55 +896,55 @@ discard block |
||
896 | 896 | /** |
897 | 897 | * Renders the address element on the frontend. |
898 | 898 | */ |
899 | - public function frontend_render_address_template( $field ) { |
|
899 | + public function frontend_render_address_template($field) { |
|
900 | 900 | |
901 | 901 | echo "<div class='wpinv-address-fields'>"; |
902 | 902 | |
903 | - foreach( $field['fields'] as $address_field ) { |
|
903 | + foreach ($field['fields'] as $address_field) { |
|
904 | 904 | |
905 | - if ( empty( $address_field['visible'] ) ) { |
|
905 | + if (empty($address_field['visible'])) { |
|
906 | 906 | continue; |
907 | 907 | } |
908 | 908 | |
909 | - $class = esc_attr( $address_field['name'] ); |
|
909 | + $class = esc_attr($address_field['name']); |
|
910 | 910 | echo "<div class='form-group $class'>"; |
911 | 911 | |
912 | 912 | $label = $address_field['label']; |
913 | 913 | |
914 | - if ( ! empty( $address_field['required'] ) ) { |
|
914 | + if (!empty($address_field['required'])) { |
|
915 | 915 | $label .= "<span class='text-danger'> *</span>"; |
916 | 916 | } |
917 | 917 | |
918 | - if ( 'wpinv_country' == $address_field['name'] ) { |
|
918 | + if ('wpinv_country' == $address_field['name']) { |
|
919 | 919 | |
920 | - echo aui()->select( array( |
|
920 | + echo aui()->select(array( |
|
921 | 921 | 'options' => wpinv_get_country_list(), |
922 | - 'name' => esc_attr( $address_field['name'] ), |
|
923 | - 'id' => esc_attr( $address_field['name'] ), |
|
922 | + 'name' => esc_attr($address_field['name']), |
|
923 | + 'id' => esc_attr($address_field['name']), |
|
924 | 924 | 'value' => wpinv_get_default_country(), |
925 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
925 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
926 | 926 | 'required' => (bool) $address_field['required'], |
927 | 927 | 'no_wrap' => true, |
928 | - 'label' => wp_kses_post( $label ), |
|
928 | + 'label' => wp_kses_post($label), |
|
929 | 929 | 'select2' => false, |
930 | 930 | )); |
931 | 931 | |
932 | - } else if ( 'wpinv_state' == $address_field['name'] ) { |
|
932 | + } else if ('wpinv_state' == $address_field['name']) { |
|
933 | 933 | |
934 | - $states = wpinv_get_country_states( wpinv_get_default_country() ); |
|
934 | + $states = wpinv_get_country_states(wpinv_get_default_country()); |
|
935 | 935 | $state = wpinv_get_default_state(); |
936 | 936 | |
937 | - if ( ! empty( $states ) ) { |
|
937 | + if (!empty($states)) { |
|
938 | 938 | |
939 | - echo aui()->select( array( |
|
939 | + echo aui()->select(array( |
|
940 | 940 | 'options' => $states, |
941 | - 'name' => esc_attr( $address_field['name'] ), |
|
942 | - 'id' => esc_attr( $address_field['name'] ), |
|
941 | + 'name' => esc_attr($address_field['name']), |
|
942 | + 'id' => esc_attr($address_field['name']), |
|
943 | 943 | 'value' => $state, |
944 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
944 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
945 | 945 | 'required' => (bool) $address_field['required'], |
946 | 946 | 'no_wrap' => true, |
947 | - 'label' => wp_kses_post( $label ), |
|
947 | + 'label' => wp_kses_post($label), |
|
948 | 948 | 'select2' => false, |
949 | 949 | )); |
950 | 950 | |
@@ -952,10 +952,10 @@ discard block |
||
952 | 952 | |
953 | 953 | echo aui()->input( |
954 | 954 | array( |
955 | - 'name' => esc_attr( $address_field['name'] ), |
|
956 | - 'id' => esc_attr( $address_field['name'] ), |
|
955 | + 'name' => esc_attr($address_field['name']), |
|
956 | + 'id' => esc_attr($address_field['name']), |
|
957 | 957 | 'required' => (bool) $address_field['required'], |
958 | - 'label' => wp_kses_post( $label ), |
|
958 | + 'label' => wp_kses_post($label), |
|
959 | 959 | 'no_wrap' => true, |
960 | 960 | 'type' => 'text', |
961 | 961 | ) |
@@ -967,12 +967,12 @@ discard block |
||
967 | 967 | |
968 | 968 | echo aui()->input( |
969 | 969 | array( |
970 | - 'name' => esc_attr( $address_field['name'] ), |
|
971 | - 'id' => esc_attr( $address_field['name'] ), |
|
970 | + 'name' => esc_attr($address_field['name']), |
|
971 | + 'id' => esc_attr($address_field['name']), |
|
972 | 972 | 'required' => (bool) $address_field['required'], |
973 | - 'label' => wp_kses_post( $label ), |
|
973 | + 'label' => wp_kses_post($label), |
|
974 | 974 | 'no_wrap' => true, |
975 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
975 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
976 | 976 | 'type' => 'text', |
977 | 977 | ) |
978 | 978 | ); |
@@ -980,8 +980,8 @@ discard block |
||
980 | 980 | } |
981 | 981 | |
982 | 982 | |
983 | - if ( ! empty( $address_field['description'] ) ) { |
|
984 | - $description = wp_kses_post( $address_field['description'] ); |
|
983 | + if (!empty($address_field['description'])) { |
|
984 | + $description = wp_kses_post($address_field['description']); |
|
985 | 985 | echo "<small class='form-text text-muted'>$description</small>"; |
986 | 986 | } |
987 | 987 | |
@@ -996,13 +996,13 @@ discard block |
||
996 | 996 | /** |
997 | 997 | * Renders the edit address element template. |
998 | 998 | */ |
999 | - public function edit_address_template( $field ) { |
|
1000 | - $restrict = $this->get_restrict_markup( $field, 'address' ); |
|
1001 | - $label = __( 'Field Label', 'invoicing' ); |
|
1002 | - $label2 = __( 'Placeholder', 'invoicing' ); |
|
1003 | - $label3 = __( 'Description', 'invoicing' ); |
|
1004 | - $label4 = __( 'Is required', 'invoicing' ); |
|
1005 | - $label5 = __( 'Is visible', 'invoicing' ); |
|
999 | + public function edit_address_template($field) { |
|
1000 | + $restrict = $this->get_restrict_markup($field, 'address'); |
|
1001 | + $label = __('Field Label', 'invoicing'); |
|
1002 | + $label2 = __('Placeholder', 'invoicing'); |
|
1003 | + $label3 = __('Description', 'invoicing'); |
|
1004 | + $label4 = __('Is required', 'invoicing'); |
|
1005 | + $label5 = __('Is visible', 'invoicing'); |
|
1006 | 1006 | $id = $field . '.id + "_edit_label"'; |
1007 | 1007 | $id2 = $field . '.id + "_edit_placeholder"'; |
1008 | 1008 | $id3 = $field . '.id + "_edit_description"'; |
@@ -1070,8 +1070,8 @@ discard block |
||
1070 | 1070 | /** |
1071 | 1071 | * Renders the email element template. |
1072 | 1072 | */ |
1073 | - public function render_email_template( $field ) { |
|
1074 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
1073 | + public function render_email_template($field) { |
|
1074 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
1075 | 1075 | $label = "$field.label"; |
1076 | 1076 | echo " |
1077 | 1077 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1086,8 +1086,8 @@ discard block |
||
1086 | 1086 | /** |
1087 | 1087 | * Renders the billing_email element template. |
1088 | 1088 | */ |
1089 | - public function render_billing_email_template( $field ) { |
|
1090 | - $restrict = $this->get_restrict_markup( $field, 'billing_email' ); |
|
1089 | + public function render_billing_email_template($field) { |
|
1090 | + $restrict = $this->get_restrict_markup($field, 'billing_email'); |
|
1091 | 1091 | $label = "$field.label"; |
1092 | 1092 | echo " |
1093 | 1093 | <div $restrict> |
@@ -1101,24 +1101,24 @@ discard block |
||
1101 | 1101 | /** |
1102 | 1102 | * Renders the email element on the frontend. |
1103 | 1103 | */ |
1104 | - public function frontend_render_email_template( $field ) { |
|
1104 | + public function frontend_render_email_template($field) { |
|
1105 | 1105 | |
1106 | 1106 | echo "<div class='form-group'>"; |
1107 | 1107 | |
1108 | 1108 | echo aui()->input( |
1109 | 1109 | array( |
1110 | - 'name' => esc_attr( $field['id'] ), |
|
1111 | - 'id' => esc_attr( $field['id'] ), |
|
1110 | + 'name' => esc_attr($field['id']), |
|
1111 | + 'id' => esc_attr($field['id']), |
|
1112 | 1112 | 'required' => (bool) $field['required'], |
1113 | - 'label' => wp_kses_post( $field['label'] ), |
|
1113 | + 'label' => wp_kses_post($field['label']), |
|
1114 | 1114 | 'no_wrap' => true, |
1115 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1115 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1116 | 1116 | 'type' => 'email', |
1117 | 1117 | ) |
1118 | 1118 | ); |
1119 | 1119 | |
1120 | - if ( ! empty( $field['description'] ) ) { |
|
1121 | - $description = wp_kses_post( $field['description'] ); |
|
1120 | + if (!empty($field['description'])) { |
|
1121 | + $description = wp_kses_post($field['description']); |
|
1122 | 1122 | echo "<small class='form-text text-muted'>$description</small>"; |
1123 | 1123 | } |
1124 | 1124 | |
@@ -1129,30 +1129,30 @@ discard block |
||
1129 | 1129 | /** |
1130 | 1130 | * Renders the billing email element on the frontend. |
1131 | 1131 | */ |
1132 | - public function frontend_render_billing_email_template( $field ) { |
|
1132 | + public function frontend_render_billing_email_template($field) { |
|
1133 | 1133 | |
1134 | 1134 | echo "<div class='form-group'>"; |
1135 | 1135 | $value = ''; |
1136 | 1136 | |
1137 | - if ( is_user_logged_in() ) { |
|
1137 | + if (is_user_logged_in()) { |
|
1138 | 1138 | $user = wp_get_current_user(); |
1139 | - $value = sanitize_email( $user->user_email ); |
|
1139 | + $value = sanitize_email($user->user_email); |
|
1140 | 1140 | } |
1141 | 1141 | echo aui()->input( |
1142 | 1142 | array( |
1143 | 1143 | 'name' => 'billing_email', |
1144 | 1144 | 'value' => $value, |
1145 | - 'id' => esc_attr( $field['id'] ), |
|
1145 | + 'id' => esc_attr($field['id']), |
|
1146 | 1146 | 'required' => true, |
1147 | - 'label' => wp_kses_post( $field['label'] ), |
|
1147 | + 'label' => wp_kses_post($field['label']), |
|
1148 | 1148 | 'no_wrap' => true, |
1149 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1149 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1150 | 1150 | 'type' => 'email', |
1151 | 1151 | ) |
1152 | 1152 | ); |
1153 | 1153 | |
1154 | - if ( ! empty( $field['description'] ) ) { |
|
1155 | - $description = wp_kses_post( $field['description'] ); |
|
1154 | + if (!empty($field['description'])) { |
|
1155 | + $description = wp_kses_post($field['description']); |
|
1156 | 1156 | echo "<small class='form-text text-muted'>$description</small>"; |
1157 | 1157 | } |
1158 | 1158 | |
@@ -1163,16 +1163,16 @@ discard block |
||
1163 | 1163 | /** |
1164 | 1164 | * Renders the edit email element template. |
1165 | 1165 | */ |
1166 | - public function edit_email_template( $field ) { |
|
1167 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
1168 | - $label = __( 'Field Label', 'invoicing' ); |
|
1166 | + public function edit_email_template($field) { |
|
1167 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
1168 | + $label = __('Field Label', 'invoicing'); |
|
1169 | 1169 | $id = $field . '.id + "_edit"'; |
1170 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1170 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1171 | 1171 | $id2 = $field . '.id + "_edit2"'; |
1172 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1173 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1172 | + $label3 = __('Help text', 'invoicing'); |
|
1173 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1174 | 1174 | $id3 = $field . '.id + "_edit3"'; |
1175 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1175 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1176 | 1176 | $id4 = $field . '.id + "_edit4"'; |
1177 | 1177 | echo " |
1178 | 1178 | <div $restrict> |
@@ -1200,16 +1200,16 @@ discard block |
||
1200 | 1200 | /** |
1201 | 1201 | * Renders the edit billing_email element template. |
1202 | 1202 | */ |
1203 | - public function edit_billing_email_template( $field ) { |
|
1204 | - $restrict = $this->get_restrict_markup( $field, 'billing_email' ); |
|
1205 | - $label = __( 'Field Label', 'invoicing' ); |
|
1203 | + public function edit_billing_email_template($field) { |
|
1204 | + $restrict = $this->get_restrict_markup($field, 'billing_email'); |
|
1205 | + $label = __('Field Label', 'invoicing'); |
|
1206 | 1206 | $id = $field . '.id + "_edit"'; |
1207 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1207 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1208 | 1208 | $id2 = $field . '.id + "_edit2"'; |
1209 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1210 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1209 | + $label3 = __('Help text', 'invoicing'); |
|
1210 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1211 | 1211 | $id3 = $field . '.id + "_edit3"'; |
1212 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1212 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1213 | 1213 | $id4 = $field . '.id + "_edit4"'; |
1214 | 1214 | echo " |
1215 | 1215 | <div $restrict> |
@@ -1233,8 +1233,8 @@ discard block |
||
1233 | 1233 | /** |
1234 | 1234 | * Renders the website element template. |
1235 | 1235 | */ |
1236 | - public function render_website_template( $field ) { |
|
1237 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
1236 | + public function render_website_template($field) { |
|
1237 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
1238 | 1238 | $label = "$field.label"; |
1239 | 1239 | echo " |
1240 | 1240 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1249,24 +1249,24 @@ discard block |
||
1249 | 1249 | /** |
1250 | 1250 | * Renders the website element on the frontend. |
1251 | 1251 | */ |
1252 | - public function frontend_render_website_template( $field ) { |
|
1252 | + public function frontend_render_website_template($field) { |
|
1253 | 1253 | |
1254 | 1254 | echo "<div class='form-group'>"; |
1255 | 1255 | |
1256 | 1256 | echo aui()->input( |
1257 | 1257 | array( |
1258 | - 'name' => esc_attr( $field['id'] ), |
|
1259 | - 'id' => esc_attr( $field['id'] ), |
|
1258 | + 'name' => esc_attr($field['id']), |
|
1259 | + 'id' => esc_attr($field['id']), |
|
1260 | 1260 | 'required' => (bool) $field['required'], |
1261 | - 'label' => wp_kses_post( $field['label'] ), |
|
1261 | + 'label' => wp_kses_post($field['label']), |
|
1262 | 1262 | 'no_wrap' => true, |
1263 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1263 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1264 | 1264 | 'type' => 'url', |
1265 | 1265 | ) |
1266 | 1266 | ); |
1267 | 1267 | |
1268 | - if ( ! empty( $field['description'] ) ) { |
|
1269 | - $description = wp_kses_post( $field['description'] ); |
|
1268 | + if (!empty($field['description'])) { |
|
1269 | + $description = wp_kses_post($field['description']); |
|
1270 | 1270 | echo "<small class='form-text text-muted'>$description</small>"; |
1271 | 1271 | } |
1272 | 1272 | |
@@ -1277,16 +1277,16 @@ discard block |
||
1277 | 1277 | /** |
1278 | 1278 | * Renders the edit website element template. |
1279 | 1279 | */ |
1280 | - public function edit_website_template( $field ) { |
|
1281 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
1282 | - $label = __( 'Field Label', 'invoicing' ); |
|
1280 | + public function edit_website_template($field) { |
|
1281 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
1282 | + $label = __('Field Label', 'invoicing'); |
|
1283 | 1283 | $id = $field . '.id + "_edit"'; |
1284 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1284 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1285 | 1285 | $id2 = $field . '.id + "_edit2"'; |
1286 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1287 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1286 | + $label3 = __('Help text', 'invoicing'); |
|
1287 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1288 | 1288 | $id3 = $field . '.id + "_edit3"'; |
1289 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1289 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1290 | 1290 | $id4 = $field . '.id + "_edit4"'; |
1291 | 1291 | echo " |
1292 | 1292 | <div $restrict> |
@@ -1314,8 +1314,8 @@ discard block |
||
1314 | 1314 | /** |
1315 | 1315 | * Renders the date element template. |
1316 | 1316 | */ |
1317 | - public function render_date_template( $field ) { |
|
1318 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
1317 | + public function render_date_template($field) { |
|
1318 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
1319 | 1319 | $label = "$field.label"; |
1320 | 1320 | echo " |
1321 | 1321 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1330,24 +1330,24 @@ discard block |
||
1330 | 1330 | /** |
1331 | 1331 | * Renders the date element on the frontend. |
1332 | 1332 | */ |
1333 | - public function frontend_render_date_template( $field ) { |
|
1333 | + public function frontend_render_date_template($field) { |
|
1334 | 1334 | |
1335 | 1335 | echo "<div class='form-group'>"; |
1336 | 1336 | |
1337 | 1337 | echo aui()->input( |
1338 | 1338 | array( |
1339 | - 'name' => esc_attr( $field['id'] ), |
|
1340 | - 'id' => esc_attr( $field['id'] ), |
|
1339 | + 'name' => esc_attr($field['id']), |
|
1340 | + 'id' => esc_attr($field['id']), |
|
1341 | 1341 | 'required' => (bool) $field['required'], |
1342 | - 'label' => wp_kses_post( $field['label'] ), |
|
1343 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1342 | + 'label' => wp_kses_post($field['label']), |
|
1343 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1344 | 1344 | 'no_wrap' => true, |
1345 | 1345 | 'type' => 'date', |
1346 | 1346 | ) |
1347 | 1347 | ); |
1348 | 1348 | |
1349 | - if ( ! empty( $field['description'] ) ) { |
|
1350 | - $description = wp_kses_post( $field['description'] ); |
|
1349 | + if (!empty($field['description'])) { |
|
1350 | + $description = wp_kses_post($field['description']); |
|
1351 | 1351 | echo "<small class='form-text text-muted'>$description</small>"; |
1352 | 1352 | } |
1353 | 1353 | |
@@ -1358,16 +1358,16 @@ discard block |
||
1358 | 1358 | /** |
1359 | 1359 | * Renders the edit date element template. |
1360 | 1360 | */ |
1361 | - public function edit_date_template( $field ) { |
|
1362 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
1363 | - $label = __( 'Field Label', 'invoicing' ); |
|
1361 | + public function edit_date_template($field) { |
|
1362 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
1363 | + $label = __('Field Label', 'invoicing'); |
|
1364 | 1364 | $id = $field . '.id + "_edit"'; |
1365 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1365 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1366 | 1366 | $id2 = $field . '.id + "_edit2"'; |
1367 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1368 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1367 | + $label3 = __('Help text', 'invoicing'); |
|
1368 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1369 | 1369 | $id3 = $field . '.id + "_edit3"'; |
1370 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1370 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1371 | 1371 | $id4 = $field . '.id + "_edit4"'; |
1372 | 1372 | echo " |
1373 | 1373 | <div $restrict> |
@@ -1395,8 +1395,8 @@ discard block |
||
1395 | 1395 | /** |
1396 | 1396 | * Renders the time element template. |
1397 | 1397 | */ |
1398 | - public function render_time_template( $field ) { |
|
1399 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
1398 | + public function render_time_template($field) { |
|
1399 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
1400 | 1400 | $label = "$field.label"; |
1401 | 1401 | echo " |
1402 | 1402 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1411,24 +1411,24 @@ discard block |
||
1411 | 1411 | /** |
1412 | 1412 | * Renders the time element on the frontend. |
1413 | 1413 | */ |
1414 | - public function frontend_render_time_template( $field ) { |
|
1414 | + public function frontend_render_time_template($field) { |
|
1415 | 1415 | |
1416 | 1416 | echo "<div class='form-group'>"; |
1417 | 1417 | |
1418 | 1418 | echo aui()->input( |
1419 | 1419 | array( |
1420 | - 'name' => esc_attr( $field['id'] ), |
|
1421 | - 'id' => esc_attr( $field['id'] ), |
|
1420 | + 'name' => esc_attr($field['id']), |
|
1421 | + 'id' => esc_attr($field['id']), |
|
1422 | 1422 | 'required' => (bool) $field['required'], |
1423 | - 'label' => wp_kses_post( $field['label'] ), |
|
1423 | + 'label' => wp_kses_post($field['label']), |
|
1424 | 1424 | 'no_wrap' => true, |
1425 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1425 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1426 | 1426 | 'type' => 'time', |
1427 | 1427 | ) |
1428 | 1428 | ); |
1429 | 1429 | |
1430 | - if ( ! empty( $field['description'] ) ) { |
|
1431 | - $description = wp_kses_post( $field['description'] ); |
|
1430 | + if (!empty($field['description'])) { |
|
1431 | + $description = wp_kses_post($field['description']); |
|
1432 | 1432 | echo "<small class='form-text text-muted'>$description</small>"; |
1433 | 1433 | } |
1434 | 1434 | |
@@ -1439,16 +1439,16 @@ discard block |
||
1439 | 1439 | /** |
1440 | 1440 | * Renders the edit time element template. |
1441 | 1441 | */ |
1442 | - public function edit_time_template( $field ) { |
|
1443 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
1444 | - $label = __( 'Field Label', 'invoicing' ); |
|
1442 | + public function edit_time_template($field) { |
|
1443 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
1444 | + $label = __('Field Label', 'invoicing'); |
|
1445 | 1445 | $id = $field . '.id + "_edit"'; |
1446 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1446 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1447 | 1447 | $id2 = $field . '.id + "_edit2"'; |
1448 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1449 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1448 | + $label3 = __('Help text', 'invoicing'); |
|
1449 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1450 | 1450 | $id3 = $field . '.id + "_edit3"'; |
1451 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1451 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1452 | 1452 | $id4 = $field . '.id + "_edit4"'; |
1453 | 1453 | echo " |
1454 | 1454 | <div $restrict> |
@@ -1476,8 +1476,8 @@ discard block |
||
1476 | 1476 | /** |
1477 | 1477 | * Renders the number element template. |
1478 | 1478 | */ |
1479 | - public function render_number_template( $field ) { |
|
1480 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
1479 | + public function render_number_template($field) { |
|
1480 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
1481 | 1481 | $label = "$field.label"; |
1482 | 1482 | echo " |
1483 | 1483 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1492,24 +1492,24 @@ discard block |
||
1492 | 1492 | /** |
1493 | 1493 | * Renders the number element on the frontend. |
1494 | 1494 | */ |
1495 | - public function frontend_render_number_template( $field ) { |
|
1495 | + public function frontend_render_number_template($field) { |
|
1496 | 1496 | |
1497 | 1497 | echo "<div class='form-group'>"; |
1498 | 1498 | |
1499 | 1499 | echo aui()->input( |
1500 | 1500 | array( |
1501 | - 'name' => esc_attr( $field['id'] ), |
|
1502 | - 'id' => esc_attr( $field['id'] ), |
|
1501 | + 'name' => esc_attr($field['id']), |
|
1502 | + 'id' => esc_attr($field['id']), |
|
1503 | 1503 | 'required' => (bool) $field['required'], |
1504 | - 'label' => wp_kses_post( $field['label'] ), |
|
1505 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
1504 | + 'label' => wp_kses_post($field['label']), |
|
1505 | + 'placeholder' => esc_attr($field['placeholder']), |
|
1506 | 1506 | 'no_wrap' => true, |
1507 | 1507 | 'type' => 'number', |
1508 | 1508 | ) |
1509 | 1509 | ); |
1510 | 1510 | |
1511 | - if ( ! empty( $field['description'] ) ) { |
|
1512 | - $description = wp_kses_post( $field['description'] ); |
|
1511 | + if (!empty($field['description'])) { |
|
1512 | + $description = wp_kses_post($field['description']); |
|
1513 | 1513 | echo "<small class='form-text text-muted'>$description</small>"; |
1514 | 1514 | } |
1515 | 1515 | |
@@ -1520,16 +1520,16 @@ discard block |
||
1520 | 1520 | /** |
1521 | 1521 | * Renders the edit number element template. |
1522 | 1522 | */ |
1523 | - public function edit_number_template( $field ) { |
|
1524 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
1525 | - $label = __( 'Field Label', 'invoicing' ); |
|
1523 | + public function edit_number_template($field) { |
|
1524 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
1525 | + $label = __('Field Label', 'invoicing'); |
|
1526 | 1526 | $id = $field . '.id + "_edit"'; |
1527 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
1527 | + $label2 = __('Placeholder text', 'invoicing'); |
|
1528 | 1528 | $id2 = $field . '.id + "_edit2"'; |
1529 | - $label3 = __( 'Help text', 'invoicing' ); |
|
1530 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1529 | + $label3 = __('Help text', 'invoicing'); |
|
1530 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1531 | 1531 | $id3 = $field . '.id + "_edit3"'; |
1532 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
1532 | + $label5 = __('Is this field required?', 'invoicing'); |
|
1533 | 1533 | $id4 = $field . '.id + "_edit4"'; |
1534 | 1534 | echo " |
1535 | 1535 | <div $restrict> |
@@ -1557,23 +1557,23 @@ discard block |
||
1557 | 1557 | /** |
1558 | 1558 | * Renders the separator element template. |
1559 | 1559 | */ |
1560 | - public function render_separator_template( $field ) { |
|
1561 | - $restrict = $this->get_restrict_markup( $field, 'separator' ); |
|
1560 | + public function render_separator_template($field) { |
|
1561 | + $restrict = $this->get_restrict_markup($field, 'separator'); |
|
1562 | 1562 | echo "<hr class='featurette-divider mt-0 mb-2' $restrict>"; |
1563 | 1563 | } |
1564 | 1564 | |
1565 | 1565 | /** |
1566 | 1566 | * Renders the separator element on the frontend. |
1567 | 1567 | */ |
1568 | - public function frontend_render_separator_template( $field ) { |
|
1568 | + public function frontend_render_separator_template($field) { |
|
1569 | 1569 | echo '<hr class="featurette-divider mt-0 mb-2" />'; |
1570 | 1570 | } |
1571 | 1571 | |
1572 | 1572 | /** |
1573 | 1573 | * Renders the pay button element template. |
1574 | 1574 | */ |
1575 | - public function render_pay_button_template( $field ) { |
|
1576 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
1575 | + public function render_pay_button_template($field) { |
|
1576 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
1577 | 1577 | $label = "$field.label"; |
1578 | 1578 | echo " |
1579 | 1579 | <div $restrict> |
@@ -1586,28 +1586,28 @@ discard block |
||
1586 | 1586 | /** |
1587 | 1587 | * Renders the pay_button element on the frontend. |
1588 | 1588 | */ |
1589 | - public function frontend_render_pay_button_template( $field ) { |
|
1589 | + public function frontend_render_pay_button_template($field) { |
|
1590 | 1590 | |
1591 | 1591 | echo "<div class='mt-4 mb-4'>"; |
1592 | - do_action( 'wpinv_payment_mode_select' ); |
|
1592 | + do_action('wpinv_payment_mode_select'); |
|
1593 | 1593 | echo "</div>"; |
1594 | 1594 | |
1595 | 1595 | echo "<div class='form-group'>"; |
1596 | 1596 | |
1597 | - $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class( $field['class'] ); |
|
1597 | + $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class($field['class']); |
|
1598 | 1598 | echo aui()->input( |
1599 | 1599 | array( |
1600 | - 'name' => esc_attr( $field['id'] ), |
|
1601 | - 'id' => esc_attr( $field['id'] ), |
|
1602 | - 'value' => esc_attr( $field['label'] ), |
|
1600 | + 'name' => esc_attr($field['id']), |
|
1601 | + 'id' => esc_attr($field['id']), |
|
1602 | + 'value' => esc_attr($field['label']), |
|
1603 | 1603 | 'no_wrap' => true, |
1604 | 1604 | 'type' => 'submit', |
1605 | 1605 | 'class' => $class, |
1606 | 1606 | ) |
1607 | 1607 | ); |
1608 | 1608 | |
1609 | - if ( ! empty( $field['description'] ) ) { |
|
1610 | - $description = wp_kses_post( $field['description'] ); |
|
1609 | + if (!empty($field['description'])) { |
|
1610 | + $description = wp_kses_post($field['description']); |
|
1611 | 1611 | echo "<small class='form-text text-muted'>$description</small>"; |
1612 | 1612 | } |
1613 | 1613 | |
@@ -1618,14 +1618,14 @@ discard block |
||
1618 | 1618 | /** |
1619 | 1619 | * Renders the pay button element template. |
1620 | 1620 | */ |
1621 | - public function edit_pay_button_template( $field ) { |
|
1622 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
1623 | - $label = __( 'Button Text', 'invoicing' ); |
|
1621 | + public function edit_pay_button_template($field) { |
|
1622 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
1623 | + $label = __('Button Text', 'invoicing'); |
|
1624 | 1624 | $id = $field . '.id + "_edit"'; |
1625 | - $label2 = __( 'Help text', 'invoicing' ); |
|
1626 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1625 | + $label2 = __('Help text', 'invoicing'); |
|
1626 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1627 | 1627 | $id2 = $field . '.id + "_edit2"'; |
1628 | - $label4 = esc_attr__( 'Button Type', 'invoicing' ); |
|
1628 | + $label4 = esc_attr__('Button Type', 'invoicing'); |
|
1629 | 1629 | $id3 = $field . '.id + "_edit3"'; |
1630 | 1630 | echo " |
1631 | 1631 | <div $restrict> |
@@ -1641,15 +1641,15 @@ discard block |
||
1641 | 1641 | <label :for='$id3'>$label4</label> |
1642 | 1642 | |
1643 | 1643 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
1644 | - <option value='btn-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
1645 | - <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
1646 | - <option value='btn-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
1647 | - <option value='btn-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
1648 | - <option value='btn-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
1649 | - <option value='btn-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
1650 | - <option value='btn-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
1651 | - <option value='btn-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
1652 | - <option value='btn-link'>" . __( 'Link', 'invoicing' ) ."</option> |
|
1644 | + <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option> |
|
1645 | + <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
1646 | + <option value='btn-success'>" . __('Success', 'invoicing') . "</option> |
|
1647 | + <option value='btn-danger'>" . __('Danger', 'invoicing') . "</option> |
|
1648 | + <option value='btn-warning'>" . __('Warning', 'invoicing') . "</option> |
|
1649 | + <option value='btn-info'>" . __('Info', 'invoicing') . "</option> |
|
1650 | + <option value='btn-light'>" . __('Light', 'invoicing') . "</option> |
|
1651 | + <option value='btn-dark'>" . __('Dark', 'invoicing') . "</option> |
|
1652 | + <option value='btn-link'>" . __('Link', 'invoicing') . "</option> |
|
1653 | 1653 | </select> |
1654 | 1654 | </div> |
1655 | 1655 | </div> |
@@ -1660,8 +1660,8 @@ discard block |
||
1660 | 1660 | /** |
1661 | 1661 | * Renders the alert element template. |
1662 | 1662 | */ |
1663 | - public function render_alert_template( $field ) { |
|
1664 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
1663 | + public function render_alert_template($field) { |
|
1664 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
1665 | 1665 | $text = "$field.text"; |
1666 | 1666 | echo " |
1667 | 1667 | <div $restrict class='alert' :class='$field.class' role='alert'> |
@@ -1676,15 +1676,15 @@ discard block |
||
1676 | 1676 | /** |
1677 | 1677 | * Renders the alert element on the frontend. |
1678 | 1678 | */ |
1679 | - public function frontend_render_alert_template( $field ) { |
|
1679 | + public function frontend_render_alert_template($field) { |
|
1680 | 1680 | |
1681 | 1681 | echo "<div class='form-group'>"; |
1682 | 1682 | |
1683 | 1683 | echo aui()->alert( |
1684 | 1684 | array( |
1685 | - 'content' => wp_kses_post( $field['text'] ), |
|
1685 | + 'content' => wp_kses_post($field['text']), |
|
1686 | 1686 | 'dismissible' => $field['dismissible'], |
1687 | - 'type' => str_replace( 'alert-', '', $field['class'] ), |
|
1687 | + 'type' => str_replace('alert-', '', $field['class']), |
|
1688 | 1688 | ) |
1689 | 1689 | ); |
1690 | 1690 | |
@@ -1695,14 +1695,14 @@ discard block |
||
1695 | 1695 | /** |
1696 | 1696 | * Renders the alert element template. |
1697 | 1697 | */ |
1698 | - public function edit_alert_template( $field ) { |
|
1699 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
1700 | - $label = __( 'Alert Text', 'invoicing' ); |
|
1701 | - $label2 = esc_attr__( 'Enter your alert text here', 'invoicing' ); |
|
1698 | + public function edit_alert_template($field) { |
|
1699 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
1700 | + $label = __('Alert Text', 'invoicing'); |
|
1701 | + $label2 = esc_attr__('Enter your alert text here', 'invoicing'); |
|
1702 | 1702 | $id = $field . '.id + "_edit"'; |
1703 | - $label3 = __( 'Is Dismissible?', 'invoicing' ); |
|
1703 | + $label3 = __('Is Dismissible?', 'invoicing'); |
|
1704 | 1704 | $id2 = $field . '.id + "_edit2"'; |
1705 | - $label4 = esc_attr__( 'Alert Type', 'invoicing' ); |
|
1705 | + $label4 = esc_attr__('Alert Type', 'invoicing'); |
|
1706 | 1706 | $id3 = $field . '.id + "_edit3"'; |
1707 | 1707 | echo " |
1708 | 1708 | <div $restrict> |
@@ -1718,14 +1718,14 @@ discard block |
||
1718 | 1718 | <label :for='$id3'>$label4</label> |
1719 | 1719 | |
1720 | 1720 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
1721 | - <option value='alert-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
1722 | - <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
1723 | - <option value='alert-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
1724 | - <option value='alert-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
1725 | - <option value='alert-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
1726 | - <option value='alert-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
1727 | - <option value='alert-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
1728 | - <option value='alert-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
1721 | + <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option> |
|
1722 | + <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
1723 | + <option value='alert-success'>" . __('Success', 'invoicing') . "</option> |
|
1724 | + <option value='alert-danger'>" . __('Danger', 'invoicing') . "</option> |
|
1725 | + <option value='alert-warning'>" . __('Warning', 'invoicing') . "</option> |
|
1726 | + <option value='alert-info'>" . __('Info', 'invoicing') . "</option> |
|
1727 | + <option value='alert-light'>" . __('Light', 'invoicing') . "</option> |
|
1728 | + <option value='alert-dark'>" . __('Dark', 'invoicing') . "</option> |
|
1729 | 1729 | </select> |
1730 | 1730 | </div> |
1731 | 1731 | </div> |
@@ -1736,8 +1736,8 @@ discard block |
||
1736 | 1736 | /** |
1737 | 1737 | * Renders the discount element template. |
1738 | 1738 | */ |
1739 | - public function render_discount_template( $field ) { |
|
1740 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
1739 | + public function render_discount_template($field) { |
|
1740 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
1741 | 1741 | ?> |
1742 | 1742 | |
1743 | 1743 | <div <?php echo $restrict; ?> class="discount_field border rounded p-3"> |
@@ -1754,13 +1754,13 @@ discard block |
||
1754 | 1754 | /** |
1755 | 1755 | * Renders the discount element on the frontend. |
1756 | 1756 | */ |
1757 | - public function frontend_render_discount_template( $field ) { |
|
1757 | + public function frontend_render_discount_template($field) { |
|
1758 | 1758 | |
1759 | - $placeholder = esc_attr( $field['input_label'] ); |
|
1760 | - $label = sanitize_text_field( $field['button_label'] ); |
|
1759 | + $placeholder = esc_attr($field['input_label']); |
|
1760 | + $label = sanitize_text_field($field['button_label']); |
|
1761 | 1761 | $description = ''; |
1762 | 1762 | |
1763 | - if ( ! empty( $field['description'] ) ) { |
|
1763 | + if (!empty($field['description'])) { |
|
1764 | 1764 | $description = "<small class='form-text text-muted'>{$field['description']}</small>"; |
1765 | 1765 | } |
1766 | 1766 | ?> |
@@ -1781,12 +1781,12 @@ discard block |
||
1781 | 1781 | /** |
1782 | 1782 | * Renders the discount element template. |
1783 | 1783 | */ |
1784 | - public function edit_discount_template( $field ) { |
|
1785 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
1786 | - $label = __( 'Discount Input Placeholder', 'invoicing' ); |
|
1787 | - $label2 = __( 'Help Text', 'invoicing' ); |
|
1788 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
1789 | - $label4 = __( 'Button Text', 'invoicing' ); |
|
1784 | + public function edit_discount_template($field) { |
|
1785 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
1786 | + $label = __('Discount Input Placeholder', 'invoicing'); |
|
1787 | + $label2 = __('Help Text', 'invoicing'); |
|
1788 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
1789 | + $label4 = __('Button Text', 'invoicing'); |
|
1790 | 1790 | $id = $field . '.id + "_edit"'; |
1791 | 1791 | $id2 = $field . '.id + "_edit2"'; |
1792 | 1792 | $id3 = $field . '.id + "_edit3"'; |
@@ -1815,21 +1815,21 @@ discard block |
||
1815 | 1815 | /** |
1816 | 1816 | * Renders the items element template. |
1817 | 1817 | */ |
1818 | - public function render_items_template( $field ) { |
|
1819 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
1820 | - $label = __( 'Item totals will appear here. Click to set items.', 'invoicing' ); |
|
1818 | + public function render_items_template($field) { |
|
1819 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
1820 | + $label = __('Item totals will appear here. Click to set items.', 'invoicing'); |
|
1821 | 1821 | echo "<div $restrict class='item_totals p-4 bg-warning text-center'>$label</div>"; |
1822 | 1822 | } |
1823 | 1823 | |
1824 | 1824 | /** |
1825 | 1825 | * Renders the items element on the frontend. |
1826 | 1826 | */ |
1827 | - public function frontend_render_items_template( $field, $items ) { |
|
1827 | + public function frontend_render_items_template($field, $items) { |
|
1828 | 1828 | |
1829 | 1829 | echo "<div class='form-group item_totals'>"; |
1830 | 1830 | |
1831 | - $id = esc_attr( $field['id'] ); |
|
1832 | - if ( 'total' == $field[ 'items_type' ] ) { |
|
1831 | + $id = esc_attr($field['id']); |
|
1832 | + if ('total' == $field['items_type']) { |
|
1833 | 1833 | $total = 0; |
1834 | 1834 | $tax = 0; |
1835 | 1835 | $sub_total = 0; |
@@ -1838,16 +1838,16 @@ discard block |
||
1838 | 1838 | <div class="border item_totals_type_total"> |
1839 | 1839 | |
1840 | 1840 | <?php |
1841 | - foreach( $items as $item ) { |
|
1841 | + foreach ($items as $item) { |
|
1842 | 1842 | |
1843 | - $amount = floatval( $item['price'] ); |
|
1843 | + $amount = floatval($item['price']); |
|
1844 | 1844 | |
1845 | - if ( wpinv_use_taxes() ) { |
|
1845 | + if (wpinv_use_taxes()) { |
|
1846 | 1846 | |
1847 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
1847 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
1848 | 1848 | |
1849 | - if ( wpinv_prices_include_tax() ) { |
|
1850 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
1849 | + if (wpinv_prices_include_tax()) { |
|
1850 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
1851 | 1851 | $item_tax = $amount - $pre_tax; |
1852 | 1852 | } else { |
1853 | 1853 | $pre_tax = $amount; |
@@ -1859,27 +1859,27 @@ discard block |
||
1859 | 1859 | $total = $sub_total + $tax; |
1860 | 1860 | |
1861 | 1861 | } else { |
1862 | - $total = $total + $amount; |
|
1862 | + $total = $total + $amount; |
|
1863 | 1863 | } |
1864 | 1864 | |
1865 | 1865 | $class = 'col-8'; |
1866 | 1866 | $class2 = ''; |
1867 | 1867 | |
1868 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
1868 | + if (!empty($item['allow_quantities'])) { |
|
1869 | 1869 | $class = 'col-6 pt-2'; |
1870 | 1870 | $class2 = 'pt-2'; |
1871 | 1871 | } |
1872 | 1872 | |
1873 | - if ( ! empty( $item['custom_price'] ) ) { |
|
1873 | + if (!empty($item['custom_price'])) { |
|
1874 | 1874 | $class .= ' pt-2'; |
1875 | 1875 | } |
1876 | 1876 | |
1877 | 1877 | ?> |
1878 | 1878 | <div class="item_totals_item"> |
1879 | 1879 | <div class='row pl-2 pr-2 pt-2'> |
1880 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
1880 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
1881 | 1881 | |
1882 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
1882 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
1883 | 1883 | |
1884 | 1884 | <div class='col-2'> |
1885 | 1885 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -1887,11 +1887,11 @@ discard block |
||
1887 | 1887 | |
1888 | 1888 | <?php } else { ?> |
1889 | 1889 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
1890 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
1890 | + <?php } if (empty($item['custom_price'])) { ?> |
|
1891 | 1891 | |
1892 | 1892 | <div class='col-4 <?php echo $class2; ?>'> |
1893 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
1894 | - <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
1893 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
1894 | + <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
1895 | 1895 | </div> |
1896 | 1896 | |
1897 | 1897 | <?php } else {?> |
@@ -1899,15 +1899,15 @@ discard block |
||
1899 | 1899 | <div class='col-4'> |
1900 | 1900 | <div class='input-group'> |
1901 | 1901 | |
1902 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
1902 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
1903 | 1903 | <div class='input-group-prepend'> |
1904 | 1904 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
1905 | 1905 | </div> |
1906 | 1906 | <?php } ?> |
1907 | 1907 | |
1908 | - <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
1908 | + <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
1909 | 1909 | |
1910 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
1910 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
1911 | 1911 | <div class='input-group-append'> |
1912 | 1912 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
1913 | 1913 | </div> |
@@ -1918,28 +1918,28 @@ discard block |
||
1918 | 1918 | <?php } ?> |
1919 | 1919 | |
1920 | 1920 | </div> |
1921 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
1922 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
1921 | + <?php if (!empty($item['description'])) { ?> |
|
1922 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
1923 | 1923 | <?php } ?> |
1924 | 1924 | </div> |
1925 | 1925 | <?php } ?> |
1926 | 1926 | |
1927 | 1927 | <div class='mt-4 border-top item_totals_total p-2'> |
1928 | 1928 | |
1929 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
1929 | + <?php if (wpinv_use_taxes()) { ?> |
|
1930 | 1930 | <div class='row'> |
1931 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
1932 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
1931 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
1932 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
1933 | 1933 | </div> |
1934 | 1934 | <div class='row'> |
1935 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
1936 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
1935 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
1936 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
1937 | 1937 | </div> |
1938 | 1938 | <?php } ?> |
1939 | 1939 | |
1940 | 1940 | <div class='row'> |
1941 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
1942 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
1941 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
1942 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
1943 | 1943 | </div> |
1944 | 1944 | |
1945 | 1945 | </div> |
@@ -1947,22 +1947,22 @@ discard block |
||
1947 | 1947 | </div> |
1948 | 1948 | <?php } ?> |
1949 | 1949 | |
1950 | - <?php if ( 'radio' == $field[ 'items_type' ] ) { ?> |
|
1950 | + <?php if ('radio' == $field['items_type']) { ?> |
|
1951 | 1951 | <div class="item_totals_type_radio"> |
1952 | 1952 | |
1953 | 1953 | <?php |
1954 | - foreach( $items as $index => $item ) { |
|
1954 | + foreach ($items as $index => $item) { |
|
1955 | 1955 | |
1956 | - if ( ! empty( $item['required'] ) ) { |
|
1956 | + if (!empty($item['required'])) { |
|
1957 | 1957 | continue; |
1958 | 1958 | } |
1959 | 1959 | ?> |
1960 | 1960 | <div class="form-check"> |
1961 | - <input class='form-check-input wpinv-items-selector' <?php checked( ! isset( $selected_radio_item ) ); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'> |
|
1962 | - <label class='form-check-label' for='<?php echo $id . $index; ?>'><?php echo sanitize_text_field( $item['title'] ); ?> <strong><?php echo wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); ?></strong></label> |
|
1961 | + <input class='form-check-input wpinv-items-selector' <?php checked(!isset($selected_radio_item)); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'> |
|
1962 | + <label class='form-check-label' for='<?php echo $id . $index; ?>'><?php echo sanitize_text_field($item['title']); ?> <strong><?php echo wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); ?></strong></label> |
|
1963 | 1963 | </div> |
1964 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
1965 | - <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
1964 | + <?php if (!empty($item['description'])) { ?> |
|
1965 | + <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
1966 | 1966 | <?php } ?> |
1967 | 1967 | <?php } ?> |
1968 | 1968 | |
@@ -1974,32 +1974,32 @@ discard block |
||
1974 | 1974 | $tax = 0; |
1975 | 1975 | $sub_total = 0; |
1976 | 1976 | |
1977 | - foreach ( $items as $item ) { |
|
1977 | + foreach ($items as $item) { |
|
1978 | 1978 | |
1979 | 1979 | $class = 'col-8'; |
1980 | 1980 | $class2 = ''; |
1981 | 1981 | |
1982 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
1982 | + if (!empty($item['allow_quantities'])) { |
|
1983 | 1983 | $class = 'col-6 pt-2'; |
1984 | 1984 | $class2 = 'pt-2'; |
1985 | 1985 | } |
1986 | 1986 | |
1987 | - if ( ! empty( $item['custom_price'] ) ) { |
|
1987 | + if (!empty($item['custom_price'])) { |
|
1988 | 1988 | $class .= ' pt-2'; |
1989 | 1989 | } |
1990 | 1990 | |
1991 | 1991 | $class3 = 'd-none'; |
1992 | 1992 | $name = ''; |
1993 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_radio_item ) ) { |
|
1993 | + if (!empty($item['required']) || !isset($totals_selected_radio_item)) { |
|
1994 | 1994 | |
1995 | - $amount = floatval( $item['price'] ); |
|
1995 | + $amount = floatval($item['price']); |
|
1996 | 1996 | |
1997 | - if ( wpinv_use_taxes() ) { |
|
1997 | + if (wpinv_use_taxes()) { |
|
1998 | 1998 | |
1999 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
1999 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
2000 | 2000 | |
2001 | - if ( wpinv_prices_include_tax() ) { |
|
2002 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
2001 | + if (wpinv_prices_include_tax()) { |
|
2002 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
2003 | 2003 | $item_tax = $amount - $pre_tax; |
2004 | 2004 | } else { |
2005 | 2005 | $pre_tax = $amount; |
@@ -2011,13 +2011,13 @@ discard block |
||
2011 | 2011 | $total = $sub_total + $tax; |
2012 | 2012 | |
2013 | 2013 | } else { |
2014 | - $total = $total + $amount; |
|
2014 | + $total = $total + $amount; |
|
2015 | 2015 | } |
2016 | 2016 | |
2017 | 2017 | $class3 = ''; |
2018 | 2018 | $name = "wpinv-items[{$item['id']}]"; |
2019 | 2019 | |
2020 | - if ( empty( $item['required'] ) ) { |
|
2020 | + if (empty($item['required'])) { |
|
2021 | 2021 | $totals_selected_radio_item = 1; |
2022 | 2022 | } |
2023 | 2023 | |
@@ -2029,9 +2029,9 @@ discard block |
||
2029 | 2029 | |
2030 | 2030 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2031 | 2031 | <div class='row pl-2 pr-2 pt-2'> |
2032 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2032 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2033 | 2033 | |
2034 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2034 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2035 | 2035 | |
2036 | 2036 | <div class='col-2'> |
2037 | 2037 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2039,11 +2039,11 @@ discard block |
||
2039 | 2039 | |
2040 | 2040 | <?php } else { ?> |
2041 | 2041 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2042 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2042 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2043 | 2043 | |
2044 | 2044 | <div class='col-4 <?php echo $class2; ?>'> |
2045 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2046 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2045 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2046 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2047 | 2047 | </div> |
2048 | 2048 | |
2049 | 2049 | <?php } else {?> |
@@ -2051,15 +2051,15 @@ discard block |
||
2051 | 2051 | <div class='col-4'> |
2052 | 2052 | <div class='input-group'> |
2053 | 2053 | |
2054 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2054 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2055 | 2055 | <div class='input-group-prepend'> |
2056 | 2056 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2057 | 2057 | </div> |
2058 | 2058 | <?php } ?> |
2059 | 2059 | |
2060 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
2060 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
2061 | 2061 | |
2062 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2062 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2063 | 2063 | <div class='input-group-append'> |
2064 | 2064 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2065 | 2065 | </div> |
@@ -2070,27 +2070,27 @@ discard block |
||
2070 | 2070 | <?php } ?> |
2071 | 2071 | |
2072 | 2072 | </div> |
2073 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2074 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2073 | + <?php if (!empty($item['description'])) { ?> |
|
2074 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2075 | 2075 | <?php } ?> |
2076 | 2076 | </div> |
2077 | 2077 | <?php } ?> |
2078 | 2078 | |
2079 | 2079 | <div class='mt-4 border-top item_totals_total p-2'> |
2080 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
2080 | + <?php if (wpinv_use_taxes()) { ?> |
|
2081 | 2081 | <div class='row'> |
2082 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
2083 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
2082 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
2083 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
2084 | 2084 | </div> |
2085 | 2085 | <div class='row'> |
2086 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
2087 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
2086 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
2087 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
2088 | 2088 | </div> |
2089 | 2089 | <?php } ?> |
2090 | 2090 | |
2091 | 2091 | <div class='row'> |
2092 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2093 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
2092 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2093 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
2094 | 2094 | </div> |
2095 | 2095 | </div> |
2096 | 2096 | |
@@ -2098,22 +2098,22 @@ discard block |
||
2098 | 2098 | </div> |
2099 | 2099 | <?php } ?> |
2100 | 2100 | |
2101 | - <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?> |
|
2101 | + <?php if ('checkbox' == $field['items_type']) { ?> |
|
2102 | 2102 | |
2103 | 2103 | <div class="item_totals_type_checkbox"> |
2104 | 2104 | |
2105 | 2105 | <?php |
2106 | - foreach ( $items as $index => $item ) { |
|
2106 | + foreach ($items as $index => $item) { |
|
2107 | 2107 | |
2108 | - if ( ! empty( $item['required'] ) ) { |
|
2108 | + if (!empty($item['required'])) { |
|
2109 | 2109 | continue; |
2110 | 2110 | } |
2111 | 2111 | |
2112 | - $title = sanitize_text_field( $item['title'] ); |
|
2113 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
2114 | - $item_id = esc_attr( $id . "_$index" ); |
|
2115 | - $value = esc_attr( $item['id'] ); |
|
2116 | - $checked = checked( ! isset( $selected_checkbox_item ), true, false ); |
|
2112 | + $title = sanitize_text_field($item['title']); |
|
2113 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
2114 | + $item_id = esc_attr($id . "_$index"); |
|
2115 | + $value = esc_attr($item['id']); |
|
2116 | + $checked = checked(!isset($selected_checkbox_item), true, false); |
|
2117 | 2117 | $selected_checkbox_item = 1; |
2118 | 2118 | |
2119 | 2119 | echo " |
@@ -2122,7 +2122,7 @@ discard block |
||
2122 | 2122 | <label for='$item_id' class='custom-control-label'>$title ($price)</label> |
2123 | 2123 | </div>"; |
2124 | 2124 | |
2125 | - if ( ! empty( $item['description'] ) ) { |
|
2125 | + if (!empty($item['description'])) { |
|
2126 | 2126 | echo "<small class='form-text text-muted'>{$item['description']}</small>"; |
2127 | 2127 | } |
2128 | 2128 | } |
@@ -2136,31 +2136,31 @@ discard block |
||
2136 | 2136 | $tax = 0; |
2137 | 2137 | $sub_total = 0; |
2138 | 2138 | |
2139 | - foreach ( $items as $item ) { |
|
2139 | + foreach ($items as $item) { |
|
2140 | 2140 | |
2141 | 2141 | $class = 'col-8'; |
2142 | 2142 | $class2 = ''; |
2143 | 2143 | |
2144 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
2144 | + if (!empty($item['allow_quantities'])) { |
|
2145 | 2145 | $class = 'col-6 pt-2'; |
2146 | 2146 | $class2 = 'pt-2'; |
2147 | 2147 | } |
2148 | 2148 | |
2149 | - if ( ! empty( $item['custom_price'] ) ) { |
|
2149 | + if (!empty($item['custom_price'])) { |
|
2150 | 2150 | $class .= ' pt-2'; |
2151 | 2151 | } |
2152 | 2152 | |
2153 | 2153 | $class3 = 'd-none'; |
2154 | - $name = ''; |
|
2155 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_checkbox_item ) ) { |
|
2154 | + $name = ''; |
|
2155 | + if (!empty($item['required']) || !isset($totals_selected_checkbox_item)) { |
|
2156 | 2156 | |
2157 | - $amount = floatval( $item['price'] ); |
|
2158 | - if ( wpinv_use_taxes() ) { |
|
2157 | + $amount = floatval($item['price']); |
|
2158 | + if (wpinv_use_taxes()) { |
|
2159 | 2159 | |
2160 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
2160 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
2161 | 2161 | |
2162 | - if ( wpinv_prices_include_tax() ) { |
|
2163 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
2162 | + if (wpinv_prices_include_tax()) { |
|
2163 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
2164 | 2164 | $item_tax = $amount - $pre_tax; |
2165 | 2165 | } else { |
2166 | 2166 | $pre_tax = $amount; |
@@ -2172,13 +2172,13 @@ discard block |
||
2172 | 2172 | $total = $sub_total + $tax; |
2173 | 2173 | |
2174 | 2174 | } else { |
2175 | - $total = $total + $amount; |
|
2175 | + $total = $total + $amount; |
|
2176 | 2176 | } |
2177 | 2177 | |
2178 | 2178 | $class3 = ''; |
2179 | - $name = "wpinv-items[{$item['id']}]"; |
|
2179 | + $name = "wpinv-items[{$item['id']}]"; |
|
2180 | 2180 | |
2181 | - if ( empty( $item['required'] ) ) { |
|
2181 | + if (empty($item['required'])) { |
|
2182 | 2182 | $totals_selected_checkbox_item = 1; |
2183 | 2183 | } |
2184 | 2184 | |
@@ -2190,9 +2190,9 @@ discard block |
||
2190 | 2190 | |
2191 | 2191 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2192 | 2192 | <div class='row pl-2 pr-2 pt-2'> |
2193 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2193 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2194 | 2194 | |
2195 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2195 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2196 | 2196 | |
2197 | 2197 | <div class='col-2'> |
2198 | 2198 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2200,11 +2200,11 @@ discard block |
||
2200 | 2200 | |
2201 | 2201 | <?php } else { ?> |
2202 | 2202 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2203 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2203 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2204 | 2204 | |
2205 | 2205 | <div class='col-4 <?php echo $class2; ?>'> |
2206 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2207 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2206 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2207 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2208 | 2208 | </div> |
2209 | 2209 | |
2210 | 2210 | <?php } else {?> |
@@ -2212,15 +2212,15 @@ discard block |
||
2212 | 2212 | <div class='col-4'> |
2213 | 2213 | <div class='input-group'> |
2214 | 2214 | |
2215 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2215 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2216 | 2216 | <div class='input-group-prepend'> |
2217 | 2217 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2218 | 2218 | </div> |
2219 | 2219 | <?php } ?> |
2220 | 2220 | |
2221 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
2221 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
2222 | 2222 | |
2223 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2223 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2224 | 2224 | <div class='input-group-append'> |
2225 | 2225 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2226 | 2226 | </div> |
@@ -2231,35 +2231,35 @@ discard block |
||
2231 | 2231 | <?php } ?> |
2232 | 2232 | |
2233 | 2233 | </div> |
2234 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2235 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2234 | + <?php if (!empty($item['description'])) { ?> |
|
2235 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2236 | 2236 | <?php } ?> |
2237 | 2237 | </div> |
2238 | 2238 | <?php } ?> |
2239 | 2239 | |
2240 | 2240 | <div class='mt-4 border-top item_totals_total p-2'> |
2241 | 2241 | |
2242 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
2242 | + <?php if (wpinv_use_taxes()) { ?> |
|
2243 | 2243 | <div class='row'> |
2244 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
2245 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
2244 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
2245 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
2246 | 2246 | </div> |
2247 | 2247 | <div class='row'> |
2248 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
2249 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
2248 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
2249 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
2250 | 2250 | </div> |
2251 | 2251 | <?php } ?> |
2252 | 2252 | |
2253 | 2253 | <div class='row'> |
2254 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2255 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
2254 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2255 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
2256 | 2256 | </div> |
2257 | 2257 | </div> |
2258 | 2258 | </div> |
2259 | 2259 | </div> |
2260 | 2260 | <?php } ?> |
2261 | 2261 | |
2262 | - <?php if ( 'select' == $field[ 'items_type' ] ) { ?> |
|
2262 | + <?php if ('select' == $field['items_type']) { ?> |
|
2263 | 2263 | |
2264 | 2264 | <div class="item_totals_type_select"> |
2265 | 2265 | |
@@ -2267,17 +2267,17 @@ discard block |
||
2267 | 2267 | |
2268 | 2268 | $options = array(); |
2269 | 2269 | $selected = ''; |
2270 | - foreach ( $items as $index => $item ) { |
|
2270 | + foreach ($items as $index => $item) { |
|
2271 | 2271 | |
2272 | - if ( ! empty( $item['required'] ) ) { |
|
2272 | + if (!empty($item['required'])) { |
|
2273 | 2273 | continue; |
2274 | 2274 | } |
2275 | 2275 | |
2276 | - $title = sanitize_text_field( $item['title'] ); |
|
2277 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
2278 | - $options[ $item['id'] ] = "$title ($price)"; |
|
2276 | + $title = sanitize_text_field($item['title']); |
|
2277 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
2278 | + $options[$item['id']] = "$title ($price)"; |
|
2279 | 2279 | |
2280 | - if ( ! isset( $selected_item ) ) { |
|
2280 | + if (!isset($selected_item)) { |
|
2281 | 2281 | $selected = $item['id']; |
2282 | 2282 | $selected_item = 1; |
2283 | 2283 | } |
@@ -2288,7 +2288,7 @@ discard block |
||
2288 | 2288 | array( |
2289 | 2289 | 'name' => 'payment-form-items', |
2290 | 2290 | 'id' => $id, |
2291 | - 'placeholder' => __( 'Select an item', 'invoicing' ), |
|
2291 | + 'placeholder' => __('Select an item', 'invoicing'), |
|
2292 | 2292 | 'no_wrap' => true, |
2293 | 2293 | 'options' => $options, |
2294 | 2294 | 'class' => 'wpi_select2 wpinv-items-select-selector', |
@@ -2305,31 +2305,31 @@ discard block |
||
2305 | 2305 | $tax = 0; |
2306 | 2306 | $sub_total = 0; |
2307 | 2307 | |
2308 | - foreach ( $items as $item ) { |
|
2308 | + foreach ($items as $item) { |
|
2309 | 2309 | |
2310 | 2310 | $class = 'col-8'; |
2311 | 2311 | $class2 = ''; |
2312 | 2312 | |
2313 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
2313 | + if (!empty($item['allow_quantities'])) { |
|
2314 | 2314 | $class = 'col-6 pt-2'; |
2315 | 2315 | $class2 = 'pt-2'; |
2316 | 2316 | } |
2317 | 2317 | |
2318 | - if ( ! empty( $item['custom_price'] ) ) { |
|
2318 | + if (!empty($item['custom_price'])) { |
|
2319 | 2319 | $class .= ' pt-2'; |
2320 | 2320 | } |
2321 | 2321 | |
2322 | 2322 | $class3 = 'd-none'; |
2323 | - $name = ''; |
|
2324 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) { |
|
2323 | + $name = ''; |
|
2324 | + if (!empty($item['required']) || !isset($totals_selected_select_item)) { |
|
2325 | 2325 | |
2326 | - $amount = floatval( $item['price'] ); |
|
2327 | - if ( wpinv_use_taxes() ) { |
|
2326 | + $amount = floatval($item['price']); |
|
2327 | + if (wpinv_use_taxes()) { |
|
2328 | 2328 | |
2329 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
2329 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
2330 | 2330 | |
2331 | - if ( wpinv_prices_include_tax() ) { |
|
2332 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
2331 | + if (wpinv_prices_include_tax()) { |
|
2332 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
2333 | 2333 | $item_tax = $amount - $pre_tax; |
2334 | 2334 | } else { |
2335 | 2335 | $pre_tax = $amount; |
@@ -2341,13 +2341,13 @@ discard block |
||
2341 | 2341 | $total = $sub_total + $tax; |
2342 | 2342 | |
2343 | 2343 | } else { |
2344 | - $total = $total + $amount; |
|
2344 | + $total = $total + $amount; |
|
2345 | 2345 | } |
2346 | 2346 | |
2347 | 2347 | $class3 = ''; |
2348 | - $name = "wpinv-items[{$item['id']}]"; |
|
2348 | + $name = "wpinv-items[{$item['id']}]"; |
|
2349 | 2349 | |
2350 | - if ( empty( $item['required'] ) ) { |
|
2350 | + if (empty($item['required'])) { |
|
2351 | 2351 | $totals_selected_select_item = 1; |
2352 | 2352 | } |
2353 | 2353 | |
@@ -2359,9 +2359,9 @@ discard block |
||
2359 | 2359 | |
2360 | 2360 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2361 | 2361 | <div class='row pl-2 pr-2 pt-2'> |
2362 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2362 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2363 | 2363 | |
2364 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2364 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2365 | 2365 | |
2366 | 2366 | <div class='col-2'> |
2367 | 2367 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2369,11 +2369,11 @@ discard block |
||
2369 | 2369 | |
2370 | 2370 | <?php } else { ?> |
2371 | 2371 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2372 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2372 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2373 | 2373 | |
2374 | 2374 | <div class='col-4 <?php echo $class2; ?>'> |
2375 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2376 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2375 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2376 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2377 | 2377 | </div> |
2378 | 2378 | |
2379 | 2379 | <?php } else {?> |
@@ -2381,15 +2381,15 @@ discard block |
||
2381 | 2381 | <div class='col-4'> |
2382 | 2382 | <div class='input-group'> |
2383 | 2383 | |
2384 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2384 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2385 | 2385 | <div class='input-group-prepend'> |
2386 | 2386 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2387 | 2387 | </div> |
2388 | 2388 | <?php } ?> |
2389 | 2389 | |
2390 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
2390 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
2391 | 2391 | |
2392 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2392 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2393 | 2393 | <div class='input-group-append'> |
2394 | 2394 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2395 | 2395 | </div> |
@@ -2400,34 +2400,34 @@ discard block |
||
2400 | 2400 | <?php } ?> |
2401 | 2401 | |
2402 | 2402 | </div> |
2403 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2404 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2403 | + <?php if (!empty($item['description'])) { ?> |
|
2404 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2405 | 2405 | <?php } ?> |
2406 | 2406 | </div> |
2407 | 2407 | <?php } ?> |
2408 | 2408 | |
2409 | 2409 | <div class='mt-4 border-top item_totals_total p-2'> |
2410 | 2410 | |
2411 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
2411 | + <?php if (wpinv_use_taxes()) { ?> |
|
2412 | 2412 | <div class='row'> |
2413 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
2414 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
2413 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
2414 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
2415 | 2415 | </div> |
2416 | 2416 | <div class='row'> |
2417 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
2418 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
2417 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
2418 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
2419 | 2419 | </div> |
2420 | 2420 | <?php } ?> |
2421 | 2421 | <div class='row'> |
2422 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2423 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
2422 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2423 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
2424 | 2424 | </div> |
2425 | 2425 | </div> |
2426 | 2426 | |
2427 | 2427 | </div> |
2428 | 2428 | <?php } ?> |
2429 | 2429 | |
2430 | - <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?> |
|
2430 | + <?php if ('multi_select' == $field['items_type']) { ?> |
|
2431 | 2431 | |
2432 | 2432 | <div class="item_totals_type_multi_select"> |
2433 | 2433 | |
@@ -2436,18 +2436,18 @@ discard block |
||
2436 | 2436 | $options = array(); |
2437 | 2437 | $selected = array(); |
2438 | 2438 | |
2439 | - foreach ( $items as $index => $item ) { |
|
2439 | + foreach ($items as $index => $item) { |
|
2440 | 2440 | |
2441 | - if ( ! empty( $item['required'] ) ) { |
|
2441 | + if (!empty($item['required'])) { |
|
2442 | 2442 | continue; |
2443 | 2443 | } |
2444 | 2444 | |
2445 | - $title = sanitize_text_field( $item['title'] ); |
|
2446 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
2447 | - $options[ $item['id'] ] = "$title ($price)"; |
|
2445 | + $title = sanitize_text_field($item['title']); |
|
2446 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
2447 | + $options[$item['id']] = "$title ($price)"; |
|
2448 | 2448 | |
2449 | - if ( ! isset( $selected_item ) ) { |
|
2450 | - $selected = array( $item['id'] ); |
|
2449 | + if (!isset($selected_item)) { |
|
2450 | + $selected = array($item['id']); |
|
2451 | 2451 | $selected_item = 1; |
2452 | 2452 | } |
2453 | 2453 | |
@@ -2474,31 +2474,31 @@ discard block |
||
2474 | 2474 | $tax = 0; |
2475 | 2475 | $sub_total = 0; |
2476 | 2476 | |
2477 | - foreach ( $items as $item ) { |
|
2477 | + foreach ($items as $item) { |
|
2478 | 2478 | |
2479 | 2479 | $class = 'col-8'; |
2480 | 2480 | $class2 = ''; |
2481 | 2481 | |
2482 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
2482 | + if (!empty($item['allow_quantities'])) { |
|
2483 | 2483 | $class = 'col-6 pt-2'; |
2484 | 2484 | $class2 = 'pt-2'; |
2485 | 2485 | } |
2486 | 2486 | |
2487 | - if ( ! empty( $item['custom_price'] ) ) { |
|
2487 | + if (!empty($item['custom_price'])) { |
|
2488 | 2488 | $class .= ' pt-2'; |
2489 | 2489 | } |
2490 | 2490 | |
2491 | 2491 | $class3 = 'd-none'; |
2492 | - $name = ''; |
|
2493 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) { |
|
2492 | + $name = ''; |
|
2493 | + if (!empty($item['required']) || !isset($totals_selected_select_item)) { |
|
2494 | 2494 | |
2495 | - $amount = floatval( $item['price'] ); |
|
2496 | - if ( wpinv_use_taxes() ) { |
|
2495 | + $amount = floatval($item['price']); |
|
2496 | + if (wpinv_use_taxes()) { |
|
2497 | 2497 | |
2498 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
2498 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
2499 | 2499 | |
2500 | - if ( wpinv_prices_include_tax() ) { |
|
2501 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
2500 | + if (wpinv_prices_include_tax()) { |
|
2501 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
2502 | 2502 | $item_tax = $amount - $pre_tax; |
2503 | 2503 | } else { |
2504 | 2504 | $pre_tax = $amount; |
@@ -2510,13 +2510,13 @@ discard block |
||
2510 | 2510 | $total = $sub_total + $tax; |
2511 | 2511 | |
2512 | 2512 | } else { |
2513 | - $total = $total + $amount; |
|
2513 | + $total = $total + $amount; |
|
2514 | 2514 | } |
2515 | 2515 | |
2516 | 2516 | $class3 = ''; |
2517 | - $name = "wpinv-items[{$item['id']}]"; |
|
2517 | + $name = "wpinv-items[{$item['id']}]"; |
|
2518 | 2518 | |
2519 | - if ( empty( $item['required'] ) ) { |
|
2519 | + if (empty($item['required'])) { |
|
2520 | 2520 | $totals_selected_select_item = 1; |
2521 | 2521 | } |
2522 | 2522 | |
@@ -2528,9 +2528,9 @@ discard block |
||
2528 | 2528 | |
2529 | 2529 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
2530 | 2530 | <div class='row pl-2 pr-2 pt-2'> |
2531 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
2531 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
2532 | 2532 | |
2533 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
2533 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
2534 | 2534 | |
2535 | 2535 | <div class='col-2'> |
2536 | 2536 | <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required> |
@@ -2538,11 +2538,11 @@ discard block |
||
2538 | 2538 | |
2539 | 2539 | <?php } else { ?> |
2540 | 2540 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
2541 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
2541 | + <?php } if (empty($item['custom_price'])) { ?> |
|
2542 | 2542 | |
2543 | 2543 | <div class='col-4 <?php echo $class2; ?>'> |
2544 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
2545 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
2544 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
2545 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
2546 | 2546 | </div> |
2547 | 2547 | |
2548 | 2548 | <?php } else {?> |
@@ -2550,15 +2550,15 @@ discard block |
||
2550 | 2550 | <div class='col-4'> |
2551 | 2551 | <div class='input-group'> |
2552 | 2552 | |
2553 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
2553 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
2554 | 2554 | <div class='input-group-prepend'> |
2555 | 2555 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2556 | 2556 | </div> |
2557 | 2557 | <?php } ?> |
2558 | 2558 | |
2559 | - <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'> |
|
2559 | + <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'> |
|
2560 | 2560 | |
2561 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
2561 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
2562 | 2562 | <div class='input-group-append'> |
2563 | 2563 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
2564 | 2564 | </div> |
@@ -2569,35 +2569,35 @@ discard block |
||
2569 | 2569 | <?php } ?> |
2570 | 2570 | |
2571 | 2571 | </div> |
2572 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
2573 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
2572 | + <?php if (!empty($item['description'])) { ?> |
|
2573 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
2574 | 2574 | <?php } ?> |
2575 | 2575 | </div> |
2576 | 2576 | <?php } ?> |
2577 | 2577 | |
2578 | 2578 | <div class='mt-4 border-top item_totals_total p-2'> |
2579 | 2579 | |
2580 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
2580 | + <?php if (wpinv_use_taxes()) { ?> |
|
2581 | 2581 | <div class='row'> |
2582 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
2583 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
2582 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
2583 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
2584 | 2584 | </div> |
2585 | 2585 | <div class='row'> |
2586 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
2587 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
2586 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
2587 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
2588 | 2588 | </div> |
2589 | 2589 | <?php } ?> |
2590 | 2590 | |
2591 | 2591 | <div class='row'> |
2592 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
2593 | - <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div> |
|
2592 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
2593 | + <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div> |
|
2594 | 2594 | </div> |
2595 | 2595 | </div> |
2596 | 2596 | |
2597 | 2597 | </div> |
2598 | 2598 | <?php } ?> |
2599 | - <?php if ( ! empty( $field[ 'description' ] ) ) { ?> |
|
2600 | - <small class='form-text text-muted'><?php echo wp_kses_post( $field[ 'description' ] ); ?></small> |
|
2599 | + <?php if (!empty($field['description'])) { ?> |
|
2600 | + <small class='form-text text-muted'><?php echo wp_kses_post($field['description']); ?></small> |
|
2601 | 2601 | <?php } ?> |
2602 | 2602 | </div> |
2603 | 2603 | <?php |
@@ -2606,20 +2606,20 @@ discard block |
||
2606 | 2606 | /** |
2607 | 2607 | * Renders the items element template. |
2608 | 2608 | */ |
2609 | - public function edit_items_template( $field ) { |
|
2610 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
2611 | - $label = __( 'Let customers...', 'invoicing' ); |
|
2612 | - $label2 = __( 'Available Items', 'invoicing' ); |
|
2613 | - $label3 = esc_attr__( 'Add some help text for this element', 'invoicing' ); |
|
2609 | + public function edit_items_template($field) { |
|
2610 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
2611 | + $label = __('Let customers...', 'invoicing'); |
|
2612 | + $label2 = __('Available Items', 'invoicing'); |
|
2613 | + $label3 = esc_attr__('Add some help text for this element', 'invoicing'); |
|
2614 | 2614 | $id = $field . '.id + "_edit"'; |
2615 | 2615 | $id2 = $field . '.id + "_edit2"'; |
2616 | 2616 | $id3 = $field . '.id + "_edit3"'; |
2617 | 2617 | $id4 = $field . '.id + "_edit4"'; |
2618 | - $label4 = esc_attr__( 'This will be shown to the customer as the recommended price', 'invoicing' ); |
|
2619 | - $label5 = esc_attr__( 'Allow users to pay what they want', 'invoicing' ); |
|
2620 | - $label6 = esc_attr__( 'Enter the minimum price that a user can pay', 'invoicing' ); |
|
2621 | - $label7 = esc_attr__( 'Allow users to buy several quantities', 'invoicing' ); |
|
2622 | - $label8 = esc_attr__( 'This item is required', 'invoicing' ); |
|
2618 | + $label4 = esc_attr__('This will be shown to the customer as the recommended price', 'invoicing'); |
|
2619 | + $label5 = esc_attr__('Allow users to pay what they want', 'invoicing'); |
|
2620 | + $label6 = esc_attr__('Enter the minimum price that a user can pay', 'invoicing'); |
|
2621 | + $label7 = esc_attr__('Allow users to buy several quantities', 'invoicing'); |
|
2622 | + $label8 = esc_attr__('This item is required', 'invoicing'); |
|
2623 | 2623 | echo "<div $restrict> |
2624 | 2624 | |
2625 | 2625 | <label>$label2</label> |
@@ -2689,7 +2689,7 @@ discard block |
||
2689 | 2689 | <div class='form-group mt-2'> |
2690 | 2690 | |
2691 | 2691 | <select class='form-control custom-select' v-model='selected_item' @change='addSelectedItem'> |
2692 | - <option value=''>" . __( 'Add an existing item to the form', 'invoicing' ) ."</option> |
|
2692 | + <option value=''>" . __('Add an existing item to the form', 'invoicing') . "</option> |
|
2693 | 2693 | <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option> |
2694 | 2694 | </select> |
2695 | 2695 | |
@@ -2704,11 +2704,11 @@ discard block |
||
2704 | 2704 | <label :for='$id2'>$label</label> |
2705 | 2705 | |
2706 | 2706 | <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'> |
2707 | - <option value='total'>" . __( 'Buy all items on the list', 'invoicing' ) ."</option> |
|
2708 | - <option value='radio'>" . __( 'Select a single item from the list', 'invoicing' ) ."</option> |
|
2709 | - <option value='checkbox'>" . __( 'Select one or more items on the list', 'invoicing' ) ."</option> |
|
2710 | - <option value='select'>" . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option> |
|
2711 | - <option value='multi_select'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option> |
|
2707 | + <option value='total'>" . __('Buy all items on the list', 'invoicing') . "</option> |
|
2708 | + <option value='radio'>" . __('Select a single item from the list', 'invoicing') . "</option> |
|
2709 | + <option value='checkbox'>" . __('Select one or more items on the list', 'invoicing') . "</option> |
|
2710 | + <option value='select'>" . __('Select a single item from a dropdown', 'invoicing') . "</option> |
|
2711 | + <option value='multi_select'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option> |
|
2712 | 2712 | </select> |
2713 | 2713 | |
2714 | 2714 | </div> |
@@ -2733,7 +2733,7 @@ discard block |
||
2733 | 2733 | 'orderby' => 'title', |
2734 | 2734 | 'order' => 'ASC', |
2735 | 2735 | 'posts_per_page' => -1, |
2736 | - 'post_status' => array( 'publish' ), |
|
2736 | + 'post_status' => array('publish'), |
|
2737 | 2737 | 'meta_query' => array( |
2738 | 2738 | array( |
2739 | 2739 | 'key' => '_wpinv_type', |
@@ -2743,24 +2743,24 @@ discard block |
||
2743 | 2743 | ) |
2744 | 2744 | ); |
2745 | 2745 | |
2746 | - $items = get_posts( apply_filters( 'wpinv_payment_form_item_dropdown_query_args', $item_args ) ); |
|
2746 | + $items = get_posts(apply_filters('wpinv_payment_form_item_dropdown_query_args', $item_args)); |
|
2747 | 2747 | |
2748 | - if ( empty( $items ) ) { |
|
2748 | + if (empty($items)) { |
|
2749 | 2749 | return array(); |
2750 | 2750 | } |
2751 | 2751 | |
2752 | - $options = array(); |
|
2753 | - foreach ( $items as $item ) { |
|
2754 | - $title = esc_html( $item->post_title ); |
|
2755 | - $title .= wpinv_get_item_suffix( $item->ID, false ); |
|
2756 | - $id = absint( $item->ID ); |
|
2757 | - $price = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) ); |
|
2758 | - $recurring = (bool) get_post_meta( $id, '_wpinv_is_recurring', true ); |
|
2752 | + $options = array(); |
|
2753 | + foreach ($items as $item) { |
|
2754 | + $title = esc_html($item->post_title); |
|
2755 | + $title .= wpinv_get_item_suffix($item->ID, false); |
|
2756 | + $id = absint($item->ID); |
|
2757 | + $price = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true)); |
|
2758 | + $recurring = (bool) get_post_meta($id, '_wpinv_is_recurring', true); |
|
2759 | 2759 | $description = $item->post_excerpt; |
2760 | - $custom_price = (bool) get_post_meta( $id, '_wpinv_dynamic_pricing', true ); |
|
2761 | - $minimum_price = (float) get_post_meta( $id, '_minimum_price', true ); |
|
2760 | + $custom_price = (bool) get_post_meta($id, '_wpinv_dynamic_pricing', true); |
|
2761 | + $minimum_price = (float) get_post_meta($id, '_minimum_price', true); |
|
2762 | 2762 | $allow_quantities = false; |
2763 | - $options[] = compact( 'title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities' ); |
|
2763 | + $options[] = compact('title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities'); |
|
2764 | 2764 | |
2765 | 2765 | } |
2766 | 2766 | return $options; |
@@ -2770,47 +2770,47 @@ discard block |
||
2770 | 2770 | /** |
2771 | 2771 | * Returns an array of items for the currently being edited form. |
2772 | 2772 | */ |
2773 | - public function get_form_items( $id = false ) { |
|
2773 | + public function get_form_items($id = false) { |
|
2774 | 2774 | |
2775 | - if ( empty( $id ) ) { |
|
2776 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
2775 | + if (empty($id)) { |
|
2776 | + return wpinv_get_data('sample-payment-form-items'); |
|
2777 | 2777 | } |
2778 | 2778 | |
2779 | - $form_elements = get_post_meta( $id, 'wpinv_form_items', true ); |
|
2779 | + $form_elements = get_post_meta($id, 'wpinv_form_items', true); |
|
2780 | 2780 | |
2781 | - if ( is_array( $form_elements ) ) { |
|
2781 | + if (is_array($form_elements)) { |
|
2782 | 2782 | return $form_elements; |
2783 | 2783 | } |
2784 | 2784 | |
2785 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
2785 | + return wpinv_get_data('sample-payment-form-items'); |
|
2786 | 2786 | |
2787 | 2787 | } |
2788 | 2788 | |
2789 | 2789 | /** |
2790 | 2790 | * Returns an array of elements for the currently being edited form. |
2791 | 2791 | */ |
2792 | - public function get_form_elements( $id = false ) { |
|
2792 | + public function get_form_elements($id = false) { |
|
2793 | 2793 | |
2794 | - if ( empty( $id ) ) { |
|
2795 | - return wpinv_get_data( 'sample-payment-form' ); |
|
2794 | + if (empty($id)) { |
|
2795 | + return wpinv_get_data('sample-payment-form'); |
|
2796 | 2796 | } |
2797 | 2797 | |
2798 | - $form_elements = get_post_meta( $id, 'wpinv_form_elements', true ); |
|
2798 | + $form_elements = get_post_meta($id, 'wpinv_form_elements', true); |
|
2799 | 2799 | |
2800 | - if ( is_array( $form_elements ) ) { |
|
2800 | + if (is_array($form_elements)) { |
|
2801 | 2801 | return $form_elements; |
2802 | 2802 | } |
2803 | 2803 | |
2804 | - return wpinv_get_data( 'sample-payment-form' ); |
|
2804 | + return wpinv_get_data('sample-payment-form'); |
|
2805 | 2805 | } |
2806 | 2806 | |
2807 | 2807 | /** |
2808 | 2808 | * Sends a redrect response to payment details. |
2809 | 2809 | * |
2810 | 2810 | */ |
2811 | - public function send_redirect_response( $url ) { |
|
2812 | - $url = urlencode( $url ); |
|
2813 | - wp_send_json_success( $url ); |
|
2811 | + public function send_redirect_response($url) { |
|
2812 | + $url = urlencode($url); |
|
2813 | + wp_send_json_success($url); |
|
2814 | 2814 | } |
2815 | 2815 | |
2816 | 2816 | /** |
@@ -2821,12 +2821,12 @@ discard block |
||
2821 | 2821 | |
2822 | 2822 | $errors = wpinv_get_errors(); |
2823 | 2823 | |
2824 | - if ( ! empty( $errors ) ) { |
|
2824 | + if (!empty($errors)) { |
|
2825 | 2825 | wpinv_print_errors(); |
2826 | 2826 | exit; |
2827 | 2827 | } |
2828 | 2828 | |
2829 | - wp_send_json_error( __( 'An error occured while processing your payment. Please try again.', 'invoicing' ) ); |
|
2829 | + wp_send_json_error(__('An error occured while processing your payment. Please try again.', 'invoicing')); |
|
2830 | 2830 | exit; |
2831 | 2831 | |
2832 | 2832 | } |