@@ -1,7 +1,7 @@ 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_Payment_Form { |
@@ -11,23 +11,23 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | * @param WP_Post $post |
| 13 | 13 | */ |
| 14 | - public static function output_details( $post ) { |
|
| 15 | - $details = get_post_meta( $post->ID, 'payment_form_data', true ); |
|
| 14 | + public static function output_details($post) { |
|
| 15 | + $details = get_post_meta($post->ID, 'payment_form_data', true); |
|
| 16 | 16 | |
| 17 | - if ( ! is_array( $details ) ) { |
|
| 17 | + if (!is_array($details)) { |
|
| 18 | 18 | return; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | echo '<div class="gdmbx2-wrap form-table"> <div class="gdmbx2-metabox gdmbx-field-list">'; |
| 22 | 22 | |
| 23 | - foreach ( $details as $key => $value ) { |
|
| 24 | - $key = sanitize_text_field( $key ); |
|
| 23 | + foreach ($details as $key => $value) { |
|
| 24 | + $key = sanitize_text_field($key); |
|
| 25 | 25 | |
| 26 | - if ( is_array( $value ) ) { |
|
| 27 | - $value = implode( ',', $value ); |
|
| 26 | + if (is_array($value)) { |
|
| 27 | + $value = implode(',', $value); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - $value = esc_html( $value ); |
|
| 30 | + $value = esc_html($value); |
|
| 31 | 31 | |
| 32 | 32 | echo "<div class='gdmbx-row gdmbx-type-select'>"; |
| 33 | 33 | echo "<div class='gdmbx-th'><label>$key:</label></div>"; |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @param WP_Post $post |
| 45 | 45 | */ |
| 46 | - public static function output_shortcode( $post ) { |
|
| 46 | + public static function output_shortcode($post) { |
|
| 47 | 47 | |
| 48 | - if ( ! is_numeric( $post ) ) { |
|
| 48 | + if (!is_numeric($post)) { |
|
| 49 | 49 | $post = $post->ID; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @param WP_Post $post |
| 59 | 59 | */ |
| 60 | - public static function output ( $post ) { |
|
| 61 | - $success_page = get_post_meta( $post->ID, 'wpinv_success_page', true ); |
|
| 62 | - $success_page = empty( $success_page ) ? wpinv_get_success_page_uri() : $success_page |
|
| 60 | + public static function output($post) { |
|
| 61 | + $success_page = get_post_meta($post->ID, 'wpinv_success_page', true); |
|
| 62 | + $success_page = empty($success_page) ? wpinv_get_success_page_uri() : $success_page |
|
| 63 | 63 | ?> |
| 64 | 64 | |
| 65 | 65 | <div id="wpinv-form-builder" style="display: flex; flex-flow: wrap;"> |
@@ -67,20 +67,20 @@ discard block |
||
| 67 | 67 | <div class="wpinv-form-builder-left bsui" style="flex: 0 0 320px;"> |
| 68 | 68 | <ul class="wpinv-form-builder-tabs nav nav-tabs"> |
| 69 | 69 | <li class='nav-item' v-if="active_tab!='new_item'"> |
| 70 | - <a @click.prevent="active_tab='new_item'" class="nav-link p-3" :class="{ 'active': active_tab=='new_item' }" href="#"><?php _e( 'Add new element', 'invoicing' ); ?></a> |
|
| 70 | + <a @click.prevent="active_tab='new_item'" class="nav-link p-3" :class="{ 'active': active_tab=='new_item' }" href="#"><?php _e('Add new element', 'invoicing'); ?></a> |
|
| 71 | 71 | </li> |
| 72 | 72 | <li class='nav-item' v-if='false'> |
| 73 | - <a @click.prevent="active_tab='edit_item'" class="nav-link p-3" :class="{ 'active': active_tab=='edit_item' }" href="#"><?php _e( 'Edit element', 'invoicing' ); ?></a> |
|
| 73 | + <a @click.prevent="active_tab='edit_item'" class="nav-link p-3" :class="{ 'active': active_tab=='edit_item' }" href="#"><?php _e('Edit element', 'invoicing'); ?></a> |
|
| 74 | 74 | </li> |
| 75 | 75 | <li class='nav-item' v-if='false'> |
| 76 | - <a @click.prevent="active_tab='settings'" class="nav-link p-3" :class="{ 'active': active_tab=='settings' }" href="#"><?php _e( 'Settings', 'invoicing' ); ?></a> |
|
| 76 | + <a @click.prevent="active_tab='settings'" class="nav-link p-3" :class="{ 'active': active_tab=='settings' }" href="#"><?php _e('Settings', 'invoicing'); ?></a> |
|
| 77 | 77 | </li> |
| 78 | 78 | </ul> |
| 79 | 79 | |
| 80 | 80 | <div class="wpinv-form-builder-tab-content bsui" style="margin-top: 16px;"> |
| 81 | 81 | <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='new_item'"> |
| 82 | 82 | <div class="wpinv-form-builder-add-field-types"> |
| 83 | - <small class='form-text text-muted'><?php _e( 'Add an element by dragging it to the payment form.', 'invoicing' ); ?></small> |
|
| 83 | + <small class='form-text text-muted'><?php _e('Add an element by dragging it to the payment form.', 'invoicing'); ?></small> |
|
| 84 | 84 | <draggable class="section mt-2" style="display: flex; flex-flow: wrap; justify-content: space-between;" v-model="elements" :group="{ name: 'fields', pull: 'clone', put: false }" :sort="false" :clone="addDraggedField" tag="ul" filter=".wpinv-undraggable"> |
| 85 | 85 | <li v-for="element in elements" class= "wpinv-payment-form-left-fields-field" @click.prevent="addField(element)" :class="{ 'd-none': element.defaults.premade }"> |
| 86 | 86 | <button class="button btn"> |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | <div class="wpinv-form-builder-tab-pane bsui" v-if="active_tab=='edit_item'" style="font-size: 16px;"> |
| 97 | 97 | <div class="wpinv-form-builder-edit-field-wrapper"> |
| 98 | - <?php do_action( 'wpinv_payment_form_edit_element_template', 'active_form_element', $post ); ?> |
|
| 98 | + <?php do_action('wpinv_payment_form_edit_element_template', 'active_form_element', $post); ?> |
|
| 99 | 99 | <div> |
| 100 | - <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php _e( 'Delete Field', 'invoicing' ); ?></button> |
|
| 100 | + <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php _e('Delete Field', 'invoicing'); ?></button> |
|
| 101 | 101 | </div> |
| 102 | 102 | </div> |
| 103 | 103 | </div> |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | <div class="wpinv-form-builder-settings-wrapper"> |
| 107 | 107 | |
| 108 | 108 | <div class='form-group'> |
| 109 | - <label for="wpi-success-page"><?php _e( 'Success Page', 'invoicing' ); ?></label> |
|
| 110 | - <input placeholder="https://" id='wpi-success-page' value="<?php echo esc_url( $success_page ); ?>" class='form-control' type='text'> |
|
| 111 | - <small class='form-text text-muted'><?php _e( 'Where should we redirect users after successfuly completing their payment?', 'invoicing' ); ?></small> |
|
| 109 | + <label for="wpi-success-page"><?php _e('Success Page', 'invoicing'); ?></label> |
|
| 110 | + <input placeholder="https://" id='wpi-success-page' value="<?php echo esc_url($success_page); ?>" class='form-control' type='text'> |
|
| 111 | + <small class='form-text text-muted'><?php _e('Where should we redirect users after successfuly completing their payment?', 'invoicing'); ?></small> |
|
| 112 | 112 | </div> |
| 113 | 113 | |
| 114 | 114 | </div> |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | <div class="wpinv-form-builder-right" style="flex: 1; padding-top: 40px;border-left: 1px solid #ddd;padding-left: 20px;min-height: 520px;margin-left: 10px;"> |
| 121 | 121 | |
| 122 | - <small class='form-text text-muted' v-if='form_elements.length'><?php _e( 'Click on any element to edit or delete it.', 'invoicing' ); ?></small> |
|
| 123 | - <p class='form-text text-muted' v-if='! form_elements.length'><?php _e( 'This form is empty. Add new elements by dragging them from the right.', 'invoicing' ); ?></p> |
|
| 122 | + <small class='form-text text-muted' v-if='form_elements.length'><?php _e('Click on any element to edit or delete it.', 'invoicing'); ?></small> |
|
| 123 | + <p class='form-text text-muted' v-if='! form_elements.length'><?php _e('This form is empty. Add new elements by dragging them from the right.', 'invoicing'); ?></p> |
|
| 124 | 124 | |
| 125 | 125 | <draggable class="section bsui" v-model="form_elements" @add="highlightLastDroppedField" group="fields" tag="div" style="min-height: 100%; font-size: 16px;"> |
| 126 | 126 | <div v-for="form_element in form_elements" class="wpinv-form-builder-element-preview" :class="{ active: active_form_element==form_element && active_tab=='edit_item' }" @click="active_tab = 'edit_item'; active_form_element = form_element"> |
| 127 | - <?php do_action( 'wpinv_payment_form_render_element_template', 'form_element', $post ); ?> |
|
| 127 | + <?php do_action('wpinv_payment_form_render_element_template', 'form_element', $post); ?> |
|
| 128 | 128 | </div> |
| 129 | 129 | </draggable> |
| 130 | 130 | </div> |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | <textarea style="display:none;" name="wpinv_form_items" v-model="itemString"></textarea> |
| 134 | 134 | </div> |
| 135 | 135 | |
| 136 | - <?php wp_nonce_field( 'wpinv_save_payment_form', 'wpinv_save_payment_form' ) ;?> |
|
| 136 | + <?php wp_nonce_field('wpinv_save_payment_form', 'wpinv_save_payment_form'); ?> |
|
| 137 | 137 | |
| 138 | 138 | <?php |
| 139 | 139 | } |
@@ -141,86 +141,86 @@ discard block |
||
| 141 | 141 | /** |
| 142 | 142 | * Saves our payment forms. |
| 143 | 143 | */ |
| 144 | - public static function save( $post_id, $post ) { |
|
| 144 | + public static function save($post_id, $post) { |
|
| 145 | 145 | |
| 146 | - remove_action( 'save_post', 'WPInv_Meta_Box_Payment_Form::save' ); |
|
| 146 | + remove_action('save_post', 'WPInv_Meta_Box_Payment_Form::save'); |
|
| 147 | 147 | |
| 148 | 148 | // $post_id and $post are required. |
| 149 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
| 149 | + if (empty($post_id) || empty($post)) { |
|
| 150 | 150 | return; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // Ensure that this user can edit the post. |
| 154 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 154 | + if (!current_user_can('edit_post', $post_id)) { |
|
| 155 | 155 | return; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Dont' save meta boxes for revisions or autosaves |
| 159 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
| 159 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
| 160 | 160 | return; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | // Do not save for ajax requests. |
| 164 | - if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) { |
|
| 164 | + if ((defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) { |
|
| 165 | 165 | return; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // Confirm the security nonce. |
| 169 | - if ( empty( $_POST['wpinv_save_payment_form'] ) || ! wp_verify_nonce( $_POST['wpinv_save_payment_form'], 'wpinv_save_payment_form' ) ) { |
|
| 169 | + if (empty($_POST['wpinv_save_payment_form']) || !wp_verify_nonce($_POST['wpinv_save_payment_form'], 'wpinv_save_payment_form')) { |
|
| 170 | 170 | return; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | // Save form items. |
| 174 | - $form_items = json_decode( wp_unslash( $_POST['wpinv_form_items'] ), true ); |
|
| 174 | + $form_items = json_decode(wp_unslash($_POST['wpinv_form_items']), true); |
|
| 175 | 175 | |
| 176 | - if ( empty( $form_items ) ) { |
|
| 176 | + if (empty($form_items)) { |
|
| 177 | 177 | $form_items = array(); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - update_post_meta( $post_id, 'wpinv_form_items', self::maybe_save_items( $form_items ) ); |
|
| 180 | + update_post_meta($post_id, 'wpinv_form_items', self::maybe_save_items($form_items)); |
|
| 181 | 181 | |
| 182 | 182 | // Save form elements. |
| 183 | - $wpinv_form_elements = json_decode( wp_unslash( $_POST['wpinv_form_elements'] ), true ); |
|
| 184 | - if ( empty( $wpinv_form_elements ) ) { |
|
| 183 | + $wpinv_form_elements = json_decode(wp_unslash($_POST['wpinv_form_elements']), true); |
|
| 184 | + if (empty($wpinv_form_elements)) { |
|
| 185 | 185 | $wpinv_form_elements = array(); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - update_post_meta( $post_id, 'wpinv_form_elements', $wpinv_form_elements ); |
|
| 188 | + update_post_meta($post_id, 'wpinv_form_elements', $wpinv_form_elements); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | 192 | * Saves unsaved form items. |
| 193 | 193 | */ |
| 194 | - public static function maybe_save_items( $items ) { |
|
| 194 | + public static function maybe_save_items($items) { |
|
| 195 | 195 | |
| 196 | 196 | $saved = array(); |
| 197 | 197 | |
| 198 | - foreach( $items as $item ) { |
|
| 198 | + foreach ($items as $item) { |
|
| 199 | 199 | |
| 200 | - if ( is_numeric( $item['id'] ) ) { |
|
| 200 | + if (is_numeric($item['id'])) { |
|
| 201 | 201 | $saved[] = $item; |
| 202 | 202 | continue; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | $data = array( |
| 206 | - 'post_title' => sanitize_text_field( $item['title'] ), |
|
| 207 | - 'post_excerpt' => wp_kses_post( $item['description'] ), |
|
| 206 | + 'post_title' => sanitize_text_field($item['title']), |
|
| 207 | + 'post_excerpt' => wp_kses_post($item['description']), |
|
| 208 | 208 | 'post_status' => 'publish', |
| 209 | 209 | 'meta' => array( |
| 210 | - 'type' => empty( $item['type'] ) ? 'custom' : $item['type'] , |
|
| 211 | - 'price' => wpinv_sanitize_amount( $item['price'] ), |
|
| 212 | - 'vat_rule' => empty( $item['rule'] ) ? 'digital' : $item['rule'], |
|
| 213 | - 'vat_class' => empty( $item['class'] ) ? '_standard' : $item['class'], |
|
| 210 | + 'type' => empty($item['type']) ? 'custom' : $item['type'], |
|
| 211 | + 'price' => wpinv_sanitize_amount($item['price']), |
|
| 212 | + 'vat_rule' => empty($item['rule']) ? 'digital' : $item['rule'], |
|
| 213 | + 'vat_class' => empty($item['class']) ? '_standard' : $item['class'], |
|
| 214 | 214 | ) |
| 215 | 215 | ); |
| 216 | 216 | |
| 217 | - $new_item = new WPInv_Item(); |
|
| 218 | - $new_item->create( $data ); |
|
| 217 | + $new_item = new WPInv_Item(); |
|
| 218 | + $new_item->create($data); |
|
| 219 | 219 | |
| 220 | - if ( ! empty( $new_item ) ) { |
|
| 220 | + if (!empty($new_item)) { |
|
| 221 | 221 | $item['id'] = $new_item->ID; |
| 222 | - unset( $item['new'] ); |
|
| 223 | - unset( $item['type'] ); |
|
| 222 | + unset($item['new']); |
|
| 223 | + unset($item['type']); |
|
| 224 | 224 | $saved[] = $item; |
| 225 | 225 | } |
| 226 | 226 | |
@@ -232,5 +232,5 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | -add_action( 'save_post_wpi_payment_form', 'WPInv_Meta_Box_Payment_Form::save', 10, 2 ); |
|
| 235 | +add_action('save_post_wpi_payment_form', 'WPInv_Meta_Box_Payment_Form::save', 10, 2); |
|
| 236 | 236 | |
@@ -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); |
@@ -37,39 +37,39 @@ discard block |
||
| 37 | 37 | <div class="gdmbx2-metabox gdmbx-field-list" id="gdmbx2-metabox-wpinv_details"> |
| 38 | 38 | |
| 39 | 39 | <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-date-created table-layout"> |
| 40 | - <div class="gdmbx-th"><label for="wpinv_date_created"><?php _e( 'Date Created:', 'invoicing' );?></label></div> |
|
| 40 | + <div class="gdmbx-th"><label for="wpinv_date_created"><?php _e('Date Created:', 'invoicing'); ?></label></div> |
|
| 41 | 41 | <div class="gdmbx-td"> |
| 42 | - <input type="datetime-local" value="<?php echo esc_attr( date( 'Y-m-d\TH:i:s', $datetime_created ) );?>" id="wpinv_date_created" name="date_created" class="regular-text"> |
|
| 42 | + <input type="datetime-local" value="<?php echo esc_attr(date('Y-m-d\TH:i:s', $datetime_created)); ?>" id="wpinv_date_created" name="date_created" class="regular-text"> |
|
| 43 | 43 | </div> |
| 44 | 44 | </div> |
| 45 | 45 | |
| 46 | - <?php if ( $invoice->post_type == 'wpi_invoice' && wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->has_status( array( 'auto-draft', 'draft' ) ) ) ) { ?> |
|
| 46 | + <?php if ($invoice->post_type == 'wpi_invoice' && wpinv_get_option('overdue_active') && ($invoice->needs_payment() || $invoice->has_status(array('auto-draft', 'draft')))) { ?> |
|
| 47 | 47 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-overdue"> |
| 48 | - <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e( 'Due Date:', 'invoicing' );?></label></div> |
|
| 48 | + <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e('Due Date:', 'invoicing'); ?></label></div> |
|
| 49 | 49 | <div class="gdmbx-td"> |
| 50 | - <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"> |
|
| 51 | - <p class="wpi-meta-row wpi-meta-desc"><?php _e( 'Leave blank to disable sending auto reminder for this invoice.', 'invoicing' );?></p> |
|
| 50 | + <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"> |
|
| 51 | + <p class="wpi-meta-row wpi-meta-desc"><?php _e('Leave blank to disable sending auto reminder for this invoice.', 'invoicing'); ?></p> |
|
| 52 | 52 | </div> |
| 53 | 53 | </div> |
| 54 | 54 | <?php } ?> |
| 55 | - <?php do_action( 'wpinv_meta_box_details_after_due_date', $post_id ); ?> |
|
| 56 | - <?php if ( $date_completed && $date_completed != 'n/a' ) { ?> |
|
| 55 | + <?php do_action('wpinv_meta_box_details_after_due_date', $post_id); ?> |
|
| 56 | + <?php if ($date_completed && $date_completed != 'n/a') { ?> |
|
| 57 | 57 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-completed"> |
| 58 | - <div class="gdmbx-th"><label><?php _e( 'Payment Date:', 'invoicing' );?></label></div> |
|
| 59 | - <div class="gdmbx-td"><?php echo $date_completed;?></div> |
|
| 58 | + <div class="gdmbx-th"><label><?php _e('Payment Date:', 'invoicing'); ?></label></div> |
|
| 59 | + <div class="gdmbx-td"><?php echo $date_completed; ?></div> |
|
| 60 | 60 | </div> |
| 61 | 61 | <?php } ?> |
| 62 | - <?php $is_viewed = wpinv_is_invoice_viewed( $post_id ); ?> |
|
| 62 | + <?php $is_viewed = wpinv_is_invoice_viewed($post_id); ?> |
|
| 63 | 63 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-customer-viewed"> |
| 64 | - <div class="gdmbx-th"><label><?php _e( 'Viewed by Customer:', 'invoicing' );?></label></div> |
|
| 65 | - <div class="gdmbx-td"><?php ( 1 == $is_viewed ) ? _e( 'Yes', 'invoicing' ) : _e( 'No', 'invoicing' ); ?></div> |
|
| 64 | + <div class="gdmbx-th"><label><?php _e('Viewed by Customer:', 'invoicing'); ?></label></div> |
|
| 65 | + <div class="gdmbx-td"><?php (1 == $is_viewed) ? _e('Yes', 'invoicing') : _e('No', 'invoicing'); ?></div> |
|
| 66 | 66 | </div> |
| 67 | 67 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-status"> |
| 68 | 68 | <div class="gdmbx-th"><label for="wpinv_status"><?php echo $title['status']; ?></label></div> |
| 69 | 69 | <div class="gdmbx-td"> |
| 70 | 70 | <select required="required" id="wpinv_status" name="wpinv_status" class="gdmbx2_select wpi_select2"> |
| 71 | - <?php foreach ( $statuses as $value => $label ) { ?> |
|
| 72 | - <option value="<?php echo $value;?>" <?php selected( $status, $value );?>><?php echo $label;?></option> |
|
| 71 | + <?php foreach ($statuses as $value => $label) { ?> |
|
| 72 | + <option value="<?php echo $value; ?>" <?php selected($status, $value); ?>><?php echo $label; ?></option> |
|
| 73 | 73 | <?php } ?> |
| 74 | 74 | </select> |
| 75 | 75 | </div> |
@@ -78,129 +78,129 @@ discard block |
||
| 78 | 78 | <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-number table-layout"> |
| 79 | 79 | <div class="gdmbx-th"><label for="wpinv_number"><?php echo $title['number']; ?></label></div> |
| 80 | 80 | <div class="gdmbx-td"> |
| 81 | - <input type="text" value="<?php echo esc_attr( $invoice_number );?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly> |
|
| 81 | + <input type="text" value="<?php echo esc_attr($invoice_number); ?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly> |
|
| 82 | 82 | </div> |
| 83 | 83 | </div> |
| 84 | - <?php do_action( 'wpinv_meta_box_details_inner', $post_id ); |
|
| 84 | + <?php do_action('wpinv_meta_box_details_inner', $post_id); |
|
| 85 | 85 | $disable_discount = apply_filters('wpinv_disable_apply_discount', false, $invoice, $post_id); |
| 86 | 86 | ?> |
| 87 | 87 | |
| 88 | - <?php if ( $wpinv_euvat->allow_vat_rules() && ! ( $invoice->is_paid() || $invoice->is_refunded() ) ) { ?> |
|
| 88 | + <?php if ($wpinv_euvat->allow_vat_rules() && !($invoice->is_paid() || $invoice->is_refunded())) { ?> |
|
| 89 | 89 | <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-taxable"> |
| 90 | 90 | <div class="gdmbx-th"> |
| 91 | 91 | <label for="wpinv_taxable"> |
| 92 | - <input type="checkbox" name="disable_taxes" value="1" <?php checked( $taxable, false ); ?> id="wpinv_taxable"> |
|
| 93 | - <?php _e( 'Disable taxes', 'invoicing' ); ?> |
|
| 92 | + <input type="checkbox" name="disable_taxes" value="1" <?php checked($taxable, false); ?> id="wpinv_taxable"> |
|
| 93 | + <?php _e('Disable taxes', 'invoicing'); ?> |
|
| 94 | 94 | </label> |
| 95 | 95 | </div> |
| 96 | 96 | </div> |
| 97 | 97 | <?php } ?> |
| 98 | 98 | |
| 99 | - <?php if ( !( $is_paid = ( $invoice->is_paid() || $invoice->is_refunded() ) ) && !$disable_discount || $discount_code ) { ?> |
|
| 99 | + <?php if (!($is_paid = ($invoice->is_paid() || $invoice->is_refunded())) && !$disable_discount || $discount_code) { ?> |
|
| 100 | 100 | <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-discount-code table-layout"> |
| 101 | - <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e( 'Discount Code:', 'invoicing' );?></label></div> |
|
| 101 | + <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e('Discount Code:', 'invoicing'); ?></label></div> |
|
| 102 | 102 | <div class="gdmbx-td"> |
| 103 | - <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 } ?> |
|
| 103 | + <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 } ?> |
|
| 104 | 104 | </div> |
| 105 | 105 | </div> |
| 106 | 106 | <?php } ?> |
| 107 | 107 | </div> |
| 108 | 108 | </div> |
| 109 | 109 | <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-save-send table-layout"> |
| 110 | - <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> |
|
| 110 | + <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> |
|
| 111 | 111 | <select id="wpi_save_send" name="wpi_save_send" class="wpi_select2"> |
| 112 | - <option value="1"><?php _e( 'Yes', 'invoicing' ); ?></option> |
|
| 113 | - <option value="" selected="selected"><?php _e( 'No', 'invoicing' ); ?></option> |
|
| 112 | + <option value="1"><?php _e('Yes', 'invoicing'); ?></option> |
|
| 113 | + <option value="" selected="selected"><?php _e('No', 'invoicing'); ?></option> |
|
| 114 | 114 | </select> |
| 115 | 115 | </p> |
| 116 | 116 | <p class="wpi-meta-row wpi-send-info"><?php echo $mail_notice; ?></p> |
| 117 | 117 | </div> |
| 118 | -<?php wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ;?> |
|
| 118 | +<?php wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); ?> |
|
| 119 | 119 | <?php |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public static function resend_invoice( $post ) { |
|
| 122 | + public static function resend_invoice($post) { |
|
| 123 | 123 | global $wpi_mb_invoice; |
| 124 | 124 | |
| 125 | - if ( empty( $wpi_mb_invoice ) ) { |
|
| 125 | + if (empty($wpi_mb_invoice)) { |
|
| 126 | 126 | return; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | $text = array( |
| 130 | - 'message' => esc_attr__( 'This will send a copy of the invoice to the customer’s email address.', 'invoicing' ), |
|
| 131 | - 'button_text' => __( 'Resend Invoice', 'invoicing' ), |
|
| 130 | + 'message' => esc_attr__('This will send a copy of the invoice to the customer’s email address.', 'invoicing'), |
|
| 131 | + 'button_text' => __('Resend Invoice', 'invoicing'), |
|
| 132 | 132 | ); |
| 133 | 133 | |
| 134 | 134 | $text = apply_filters('wpinv_resend_invoice_metabox_text', $text); |
| 135 | - do_action( 'wpinv_metabox_resend_invoice_before', $wpi_mb_invoice ); |
|
| 135 | + do_action('wpinv_metabox_resend_invoice_before', $wpi_mb_invoice); |
|
| 136 | 136 | |
| 137 | - if ( $email = $wpi_mb_invoice->get_email() ) { |
|
| 137 | + if ($email = $wpi_mb_invoice->get_email()) { |
|
| 138 | 138 | $email_actions = array(); |
| 139 | - $email_actions['email_url'] = remove_query_arg( 'wpinv-message', add_query_arg( array( 'wpi_action' => 'send_invoice', 'invoice_id' => $post->ID ) ) ); |
|
| 140 | - $email_actions['reminder_url'] = add_query_arg( array( 'wpi_action' => 'send_reminder', 'invoice_id' => $post->ID ) ); |
|
| 139 | + $email_actions['email_url'] = remove_query_arg('wpinv-message', add_query_arg(array('wpi_action' => 'send_invoice', 'invoice_id' => $post->ID))); |
|
| 140 | + $email_actions['reminder_url'] = add_query_arg(array('wpi_action' => 'send_reminder', 'invoice_id' => $post->ID)); |
|
| 141 | 141 | |
| 142 | - $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions ); |
|
| 142 | + $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions); |
|
| 143 | 143 | ?> |
| 144 | 144 | <p class="wpi-meta-row wpi-resend-info"><?php echo $text['message']; ?></p> |
| 145 | - <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> |
|
| 146 | - <?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() ) ) { ?> |
|
| 147 | - <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> |
|
| 145 | + <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> |
|
| 146 | + <?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())) { ?> |
|
| 147 | + <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> |
|
| 148 | 148 | <?php } ?> |
| 149 | 149 | <?php |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - do_action( 'wpinv_metabox_resend_invoice_after', $wpi_mb_invoice ); |
|
| 152 | + do_action('wpinv_metabox_resend_invoice_after', $wpi_mb_invoice); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - public static function subscriptions( $post ) { |
|
| 156 | - $invoice = wpinv_get_invoice( $post->ID ); |
|
| 155 | + public static function subscriptions($post) { |
|
| 156 | + $invoice = wpinv_get_invoice($post->ID); |
|
| 157 | 157 | |
| 158 | - if ( ! empty( $invoice ) && $invoice->is_recurring() && $invoice->is_parent() ) { |
|
| 159 | - $subscription = wpinv_get_subscription( $invoice ); |
|
| 158 | + if (!empty($invoice) && $invoice->is_recurring() && $invoice->is_parent()) { |
|
| 159 | + $subscription = wpinv_get_subscription($invoice); |
|
| 160 | 160 | |
| 161 | - if ( empty( $subscription ) ) { |
|
| 161 | + if (empty($subscription)) { |
|
| 162 | 162 | ?> |
| 163 | - <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> |
|
| 163 | + <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> |
|
| 164 | 164 | <?php |
| 165 | 165 | return; |
| 166 | 166 | } |
| 167 | - $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency( $subscription->period, $subscription->frequency ); |
|
| 168 | - $billing = wpinv_price(wpinv_format_amount( $subscription->recurring_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) ) . ' / ' . $frequency; |
|
| 169 | - $initial = wpinv_price(wpinv_format_amount( $subscription->initial_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) ); |
|
| 167 | + $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency($subscription->period, $subscription->frequency); |
|
| 168 | + $billing = wpinv_price(wpinv_format_amount($subscription->recurring_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id)) . ' / ' . $frequency; |
|
| 169 | + $initial = wpinv_price(wpinv_format_amount($subscription->initial_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id)); |
|
| 170 | 170 | $payments = $subscription->get_child_payments(); |
| 171 | 171 | ?> |
| 172 | 172 | <p class="wpi-meta-row wpi-sub-label <?php echo 'status-' . $subscription->status; ?>"><?php _e('Recurring Payment', 'invoicing'); ?></p> |
| 173 | - <?php if ( ! empty( $subscription ) && ! empty( $subscription->id ) ) { ?> |
|
| 173 | + <?php if (!empty($subscription) && !empty($subscription->id)) { ?> |
|
| 174 | 174 | <p class="wpi-meta-row wpi-sub-id"> |
| 175 | - <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> |
|
| 175 | + <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> |
|
| 176 | 176 | <?php } ?> |
| 177 | 177 | <p class="wpi-meta-row wpi-bill-cycle"> |
| 178 | - <label><?php _e( 'Billing Cycle:', 'invoicing'); ?> </label><?php printf( _x( '%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing' ), $initial, $billing ); ?> |
|
| 178 | + <label><?php _e('Billing Cycle:', 'invoicing'); ?> </label><?php printf(_x('%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing'), $initial, $billing); ?> |
|
| 179 | 179 | </p> |
| 180 | 180 | <p class="wpi-meta-row wpi-billed-times"> |
| 181 | - <label><?php _e( 'Times Billed:', 'invoicing' ); ?> </label><?php echo $subscription->get_times_billed() . ' / ' . ( ( $subscription->bill_times == 0 ) ? 'Until Cancelled' : $subscription->bill_times ); ?> |
|
| 181 | + <label><?php _e('Times Billed:', 'invoicing'); ?> </label><?php echo $subscription->get_times_billed() . ' / ' . (($subscription->bill_times == 0) ? 'Until Cancelled' : $subscription->bill_times); ?> |
|
| 182 | 182 | </p> |
| 183 | 183 | <p class="wpi-meta-row wpi-start-date"> |
| 184 | - <label><?php _e( 'Start Date:', 'invoicing' ); ?> </label><?php echo date_i18n( get_option( 'date_format' ), strtotime( $subscription->created, current_time( 'timestamp' ) ) ); ?> |
|
| 184 | + <label><?php _e('Start Date:', 'invoicing'); ?> </label><?php echo date_i18n(get_option('date_format'), strtotime($subscription->created, current_time('timestamp'))); ?> |
|
| 185 | 185 | </p> |
| 186 | 186 | <p class="wpi-meta-row wpi-end-date"> |
| 187 | - <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' ) ) ); ?> |
|
| 187 | + <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'))); ?> |
|
| 188 | 188 | </p> |
| 189 | - <?php if ( $subscription->status ) { ?> |
|
| 189 | + <?php if ($subscription->status) { ?> |
|
| 190 | 190 | <p class="wpi-meta-row wpi-sub-status"> |
| 191 | - <label><?php _e( 'Subscription Status:', 'invoicing'); ?> </label><?php echo $subscription->get_status_label(); ?> |
|
| 191 | + <label><?php _e('Subscription Status:', 'invoicing'); ?> </label><?php echo $subscription->get_status_label(); ?> |
|
| 192 | 192 | </p> |
| 193 | 193 | <?php } ?> |
| 194 | - <?php if ( !empty( $payments ) ) { ?> |
|
| 195 | - <p><strong><?php _e( 'Renewal Payments:', 'invoicing' ); ?></strong></p> |
|
| 194 | + <?php if (!empty($payments)) { ?> |
|
| 195 | + <p><strong><?php _e('Renewal Payments:', 'invoicing'); ?></strong></p> |
|
| 196 | 196 | <ul id="wpi-sub-payments"> |
| 197 | - <?php foreach ( $payments as $payment ) { |
|
| 197 | + <?php foreach ($payments as $payment) { |
|
| 198 | 198 | $invoice_id = $payment->ID; |
| 199 | 199 | ?> |
| 200 | 200 | <li> |
| 201 | - <a href="<?php echo esc_url( get_edit_post_link( $invoice_id ) ); ?>"><?php echo wpinv_get_invoice_number( $invoice_id ); ?></a> – |
|
| 202 | - <span><?php echo wpinv_get_invoice_date( $invoice_id ); ?> – </span> |
|
| 203 | - <span><?php echo wpinv_payment_total( $invoice_id, true ); ?></span> |
|
| 201 | + <a href="<?php echo esc_url(get_edit_post_link($invoice_id)); ?>"><?php echo wpinv_get_invoice_number($invoice_id); ?></a> – |
|
| 202 | + <span><?php echo wpinv_get_invoice_date($invoice_id); ?> – </span> |
|
| 203 | + <span><?php echo wpinv_payment_total($invoice_id, true); ?></span> |
|
| 204 | 204 | </li> |
| 205 | 205 | <?php } ?> |
| 206 | 206 | </ul> |
@@ -208,50 +208,50 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - public static function renewals( $post ) { |
|
| 212 | - $invoice = wpinv_get_invoice( $post->ID ); |
|
| 211 | + public static function renewals($post) { |
|
| 212 | + $invoice = wpinv_get_invoice($post->ID); |
|
| 213 | 213 | |
| 214 | - if ( wpinv_is_subscription_payment( $invoice ) ) { |
|
| 215 | - $parent_url = get_edit_post_link( $invoice->parent_invoice ); |
|
| 216 | - $parent_id = wpinv_get_invoice_number( $invoice->parent_invoice ); |
|
| 217 | - $subscription = wpinv_get_subscription( $invoice ); |
|
| 214 | + if (wpinv_is_subscription_payment($invoice)) { |
|
| 215 | + $parent_url = get_edit_post_link($invoice->parent_invoice); |
|
| 216 | + $parent_id = wpinv_get_invoice_number($invoice->parent_invoice); |
|
| 217 | + $subscription = wpinv_get_subscription($invoice); |
|
| 218 | 218 | ?> |
| 219 | - <?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 } ?> |
|
| 220 | - <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> |
|
| 219 | + <?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 } ?> |
|
| 220 | + <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> |
|
| 221 | 221 | <?php |
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - public static function payment_meta( $post ) { |
|
| 225 | + public static function payment_meta($post) { |
|
| 226 | 226 | global $wpi_mb_invoice; |
| 227 | 227 | |
| 228 | - $set_dateway = empty( $wpi_mb_invoice->gateway ) ? true : false; |
|
| 229 | - if ( !$set_dateway && !$wpi_mb_invoice->get_meta( '_wpinv_checkout', true ) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded() ) { |
|
| 228 | + $set_dateway = empty($wpi_mb_invoice->gateway) ? true : false; |
|
| 229 | + if (!$set_dateway && !$wpi_mb_invoice->get_meta('_wpinv_checkout', true) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded()) { |
|
| 230 | 230 | $set_dateway = true; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | ?> |
| 234 | 234 | <p class="wpi-meta-row"> |
| 235 | - <?php if ( $set_dateway ) { $gateways = wpinv_get_enabled_payment_gateways( true ); ?> |
|
| 236 | - <label for="wpinv_gateway"><?php _e( 'Gateway:', 'invoicing' ) ; ?></label> |
|
| 235 | + <?php if ($set_dateway) { $gateways = wpinv_get_enabled_payment_gateways(true); ?> |
|
| 236 | + <label for="wpinv_gateway"><?php _e('Gateway:', 'invoicing'); ?></label> |
|
| 237 | 237 | <select required="required" id="wpinv_gateway" class="wpi_select2" name="wpinv_gateway"> |
| 238 | - <?php foreach ( $gateways as $name => $gateway ) { |
|
| 239 | - if ( $wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription( $name ) ) { |
|
| 238 | + <?php foreach ($gateways as $name => $gateway) { |
|
| 239 | + if ($wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription($name)) { |
|
| 240 | 240 | continue; |
| 241 | 241 | } |
| 242 | 242 | ?> |
| 243 | - <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> |
|
| 243 | + <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> |
|
| 244 | 244 | <?php } ?> |
| 245 | 245 | </select> |
| 246 | 246 | <?php } else { |
| 247 | - echo wp_sprintf( __( '<label>Gateway:</label> %s', 'invoicing' ), wpinv_get_gateway_admin_label( $wpi_mb_invoice->gateway ) ); |
|
| 247 | + echo wp_sprintf(__('<label>Gateway:</label> %s', 'invoicing'), wpinv_get_gateway_admin_label($wpi_mb_invoice->gateway)); |
|
| 248 | 248 | } ?> |
| 249 | 249 | </p> |
| 250 | - <?php if ( $key = $wpi_mb_invoice->get_key() ) { ?> |
|
| 251 | - <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Key:</label> %s', 'invoicing' ), $key ); ?></p> |
|
| 250 | + <?php if ($key = $wpi_mb_invoice->get_key()) { ?> |
|
| 251 | + <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Key:</label> %s', 'invoicing'), $key); ?></p> |
|
| 252 | 252 | <?php } ?> |
| 253 | - <?php if ( $wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded() ) { ?> |
|
| 254 | - <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Transaction ID:</label> %s', 'invoicing' ), wpinv_payment_link_transaction_id( $wpi_mb_invoice ) ); ?></p> |
|
| 253 | + <?php if ($wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded()) { ?> |
|
| 254 | + <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Transaction ID:</label> %s', 'invoicing'), wpinv_payment_link_transaction_id($wpi_mb_invoice)); ?></p> |
|
| 255 | 255 | <?php } ?> |
| 256 | 256 | <?php |
| 257 | 257 | } |
@@ -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,23 +134,23 @@ 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 | 'value' => '', |
| 153 | - 'label' => __( 'Date', 'invoicing' ), |
|
| 153 | + 'label' => __('Date', 'invoicing'), |
|
| 154 | 154 | 'description' => '', |
| 155 | 155 | 'required' => false, |
| 156 | 156 | ) |
@@ -158,10 +158,10 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | array( |
| 160 | 160 | 'type' => 'time', |
| 161 | - 'name' => __( 'Time', 'invoicing' ), |
|
| 161 | + 'name' => __('Time', 'invoicing'), |
|
| 162 | 162 | 'defaults' => array( |
| 163 | 163 | 'value' => '', |
| 164 | - 'label' => __( 'Time', 'invoicing' ), |
|
| 164 | + 'label' => __('Time', 'invoicing'), |
|
| 165 | 165 | 'description' => '', |
| 166 | 166 | 'required' => false, |
| 167 | 167 | ) |
@@ -169,11 +169,11 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | array( |
| 171 | 171 | 'type' => 'number', |
| 172 | - 'name' => __( 'Number', 'invoicing' ), |
|
| 172 | + 'name' => __('Number', 'invoicing'), |
|
| 173 | 173 | 'defaults' => array( |
| 174 | 174 | 'placeholder' => '', |
| 175 | 175 | 'value' => '', |
| 176 | - 'label' => __( 'Number', 'invoicing' ), |
|
| 176 | + 'label' => __('Number', 'invoicing'), |
|
| 177 | 177 | 'description' => '', |
| 178 | 178 | 'required' => false, |
| 179 | 179 | ) |
@@ -181,11 +181,11 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | array( |
| 183 | 183 | 'type' => 'website', |
| 184 | - 'name' => __( 'Website', 'invoicing' ), |
|
| 184 | + 'name' => __('Website', 'invoicing'), |
|
| 185 | 185 | 'defaults' => array( |
| 186 | 186 | 'placeholder' => 'http://example.com', |
| 187 | 187 | 'value' => '', |
| 188 | - 'label' => __( 'Website', 'invoicing' ), |
|
| 188 | + 'label' => __('Website', 'invoicing'), |
|
| 189 | 189 | 'description' => '', |
| 190 | 190 | 'required' => false, |
| 191 | 191 | ) |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | array( |
| 195 | 195 | 'type' => 'email', |
| 196 | - 'name' => __( 'Email', 'invoicing' ), |
|
| 196 | + 'name' => __('Email', 'invoicing'), |
|
| 197 | 197 | 'defaults' => array( |
| 198 | 198 | 'placeholder' => '[email protected]', |
| 199 | 199 | 'value' => '', |
| 200 | - 'label' => __( 'Email Address', 'invoicing' ), |
|
| 200 | + 'label' => __('Email Address', 'invoicing'), |
|
| 201 | 201 | 'description' => '', |
| 202 | 202 | 'required' => false, |
| 203 | 203 | ) |
@@ -205,14 +205,14 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | array( |
| 207 | 207 | 'type' => 'address', |
| 208 | - 'name' => __( 'Address', 'invoicing' ), |
|
| 208 | + 'name' => __('Address', 'invoicing'), |
|
| 209 | 209 | 'defaults' => array( |
| 210 | 210 | |
| 211 | 211 | 'fields' => array( |
| 212 | 212 | array( |
| 213 | 213 | 'placeholder' => 'Jon', |
| 214 | 214 | 'value' => '', |
| 215 | - 'label' => __( 'First Name', 'invoicing' ), |
|
| 215 | + 'label' => __('First Name', 'invoicing'), |
|
| 216 | 216 | 'description' => '', |
| 217 | 217 | 'required' => false, |
| 218 | 218 | 'visible' => true, |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | array( |
| 223 | 223 | 'placeholder' => 'Snow', |
| 224 | 224 | 'value' => '', |
| 225 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
| 225 | + 'label' => __('Last Name', 'invoicing'), |
|
| 226 | 226 | 'description' => '', |
| 227 | 227 | 'required' => false, |
| 228 | 228 | 'visible' => true, |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | array( |
| 233 | 233 | 'placeholder' => '', |
| 234 | 234 | 'value' => '', |
| 235 | - 'label' => __( 'Address', 'invoicing' ), |
|
| 235 | + 'label' => __('Address', 'invoicing'), |
|
| 236 | 236 | 'description' => '', |
| 237 | 237 | 'required' => false, |
| 238 | 238 | 'visible' => true, |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | array( |
| 243 | 243 | 'placeholder' => '', |
| 244 | 244 | 'value' => '', |
| 245 | - 'label' => __( 'City', 'invoicing' ), |
|
| 245 | + 'label' => __('City', 'invoicing'), |
|
| 246 | 246 | 'description' => '', |
| 247 | 247 | 'required' => false, |
| 248 | 248 | 'visible' => true, |
@@ -250,9 +250,9 @@ discard block |
||
| 250 | 250 | ), |
| 251 | 251 | |
| 252 | 252 | array( |
| 253 | - 'placeholder' => __( 'Select your country' ), |
|
| 253 | + 'placeholder' => __('Select your country'), |
|
| 254 | 254 | 'value' => '', |
| 255 | - 'label' => __( 'Country', 'invoicing' ), |
|
| 255 | + 'label' => __('Country', 'invoicing'), |
|
| 256 | 256 | 'description' => '', |
| 257 | 257 | 'required' => false, |
| 258 | 258 | 'visible' => true, |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | ), |
| 261 | 261 | |
| 262 | 262 | array( |
| 263 | - 'placeholder' => __( 'Choose a state', 'invoicing' ), |
|
| 263 | + 'placeholder' => __('Choose a state', 'invoicing'), |
|
| 264 | 264 | 'value' => '', |
| 265 | - 'label' => __( 'State / Province', 'invoicing' ), |
|
| 265 | + 'label' => __('State / Province', 'invoicing'), |
|
| 266 | 266 | 'description' => '', |
| 267 | 267 | 'required' => false, |
| 268 | 268 | 'visible' => true, |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | array( |
| 273 | 273 | 'placeholder' => '', |
| 274 | 274 | 'value' => '', |
| 275 | - 'label' => __( 'ZIP / Postcode', 'invoicing' ), |
|
| 275 | + 'label' => __('ZIP / Postcode', 'invoicing'), |
|
| 276 | 276 | 'description' => '', |
| 277 | 277 | 'required' => false, |
| 278 | 278 | 'visible' => true, |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | array( |
| 283 | 283 | 'placeholder' => '', |
| 284 | 284 | 'value' => '', |
| 285 | - 'label' => __( 'Phone', 'invoicing' ), |
|
| 285 | + 'label' => __('Phone', 'invoicing'), |
|
| 286 | 286 | 'description' => '', |
| 287 | 287 | 'required' => false, |
| 288 | 288 | 'visible' => true, |
@@ -294,11 +294,11 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | array( |
| 296 | 296 | 'type' => 'billing_email', |
| 297 | - 'name' => __( 'Billing Email', 'invoicing' ), |
|
| 297 | + 'name' => __('Billing Email', 'invoicing'), |
|
| 298 | 298 | 'defaults' => array( |
| 299 | 299 | 'placeholder' => '[email protected]', |
| 300 | 300 | 'value' => '', |
| 301 | - 'label' => __( 'Billing Email', 'invoicing' ), |
|
| 301 | + 'label' => __('Billing Email', 'invoicing'), |
|
| 302 | 302 | 'description' => '', |
| 303 | 303 | 'premade' => true, |
| 304 | 304 | ) |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | array( |
| 319 | 319 | 'type' => 'items', |
| 320 | - 'name' => __( 'Items', 'invoicing' ), |
|
| 320 | + 'name' => __('Items', 'invoicing'), |
|
| 321 | 321 | 'defaults' => array( |
| 322 | 322 | 'value' => '', |
| 323 | 323 | 'items_type' => 'total', |
@@ -328,25 +328,25 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | array( |
| 330 | 330 | 'type' => 'pay_button', |
| 331 | - 'name' => __( 'Payment Button', 'invoicing' ), |
|
| 331 | + 'name' => __('Payment Button', 'invoicing'), |
|
| 332 | 332 | 'defaults' => array( |
| 333 | 333 | 'value' => '', |
| 334 | 334 | 'class' => 'btn-primary', |
| 335 | - 'label' => __( 'Pay Now »', 'invoicing' ), |
|
| 336 | - 'description' => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ), |
|
| 335 | + 'label' => __('Pay Now »', 'invoicing'), |
|
| 336 | + 'description' => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'), |
|
| 337 | 337 | 'premade' => true, |
| 338 | 338 | ) |
| 339 | 339 | ) |
| 340 | 340 | ); |
| 341 | 341 | |
| 342 | - $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements ); |
|
| 342 | + $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements); |
|
| 343 | 343 | return $this->elements; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | /** |
| 347 | 347 | * Returns the restrict markup. |
| 348 | 348 | */ |
| 349 | - public function get_restrict_markup( $field, $field_type ) { |
|
| 349 | + public function get_restrict_markup($field, $field_type) { |
|
| 350 | 350 | $restrict = "$field.type=='$field_type'"; |
| 351 | 351 | return "v-if=\"$restrict\""; |
| 352 | 352 | } |
@@ -354,15 +354,15 @@ discard block |
||
| 354 | 354 | /** |
| 355 | 355 | * Renders the title element template. |
| 356 | 356 | */ |
| 357 | - public function render_heading_template( $field ) { |
|
| 358 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
| 357 | + public function render_heading_template($field) { |
|
| 358 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
| 359 | 359 | echo "<component :is='$field.level' $restrict v-html='$field.text'></component>"; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /** |
| 363 | 363 | * Renders the title element on the frontend. |
| 364 | 364 | */ |
| 365 | - public function frontend_render_heading_template( $field ) { |
|
| 365 | + public function frontend_render_heading_template($field) { |
|
| 366 | 366 | $tag = $field['level']; |
| 367 | 367 | echo "<$tag>{$field['text']}</$tag>"; |
| 368 | 368 | } |
@@ -370,10 +370,10 @@ discard block |
||
| 370 | 370 | /** |
| 371 | 371 | * Renders the edit title element template. |
| 372 | 372 | */ |
| 373 | - public function edit_heading_template( $field ) { |
|
| 374 | - $restrict = $this->get_restrict_markup( $field, 'heading' ); |
|
| 375 | - $label = __( 'Heading', 'invoicing' ); |
|
| 376 | - $label2 = __( 'Select Heading Level', 'invoicing' ); |
|
| 373 | + public function edit_heading_template($field) { |
|
| 374 | + $restrict = $this->get_restrict_markup($field, 'heading'); |
|
| 375 | + $label = __('Heading', 'invoicing'); |
|
| 376 | + $label2 = __('Select Heading Level', 'invoicing'); |
|
| 377 | 377 | $id = $field . '.id + "_edit"'; |
| 378 | 378 | $id2 = $field . '.id + "_edit2"'; |
| 379 | 379 | |
@@ -405,8 +405,8 @@ discard block |
||
| 405 | 405 | /** |
| 406 | 406 | * Renders a paragraph element template. |
| 407 | 407 | */ |
| 408 | - public function render_paragraph_template( $field ) { |
|
| 409 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
| 408 | + public function render_paragraph_template($field) { |
|
| 409 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
| 410 | 410 | $label = "$field.text"; |
| 411 | 411 | echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>"; |
| 412 | 412 | } |
@@ -414,16 +414,16 @@ discard block |
||
| 414 | 414 | /** |
| 415 | 415 | * Renders the paragraph element on the frontend. |
| 416 | 416 | */ |
| 417 | - public function frontend_render_paragraph_template( $field ) { |
|
| 417 | + public function frontend_render_paragraph_template($field) { |
|
| 418 | 418 | echo "<p>{$field['text']}</p>"; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | /** |
| 422 | 422 | * Renders the edit paragraph element template. |
| 423 | 423 | */ |
| 424 | - public function edit_paragraph_template( $field ) { |
|
| 425 | - $restrict = $this->get_restrict_markup( $field, 'paragraph' ); |
|
| 426 | - $label = __( 'Enter your text', 'invoicing' ); |
|
| 424 | + public function edit_paragraph_template($field) { |
|
| 425 | + $restrict = $this->get_restrict_markup($field, 'paragraph'); |
|
| 426 | + $label = __('Enter your text', 'invoicing'); |
|
| 427 | 427 | $id = $field . '.id + "_edit"'; |
| 428 | 428 | echo " |
| 429 | 429 | <div $restrict> |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | /** |
| 440 | 440 | * Renders the text element template. |
| 441 | 441 | */ |
| 442 | - public function render_text_template( $field ) { |
|
| 443 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
| 442 | + public function render_text_template($field) { |
|
| 443 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
| 444 | 444 | $label = "$field.label"; |
| 445 | 445 | echo " |
| 446 | 446 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -455,23 +455,23 @@ discard block |
||
| 455 | 455 | /** |
| 456 | 456 | * Renders the text element on the frontend. |
| 457 | 457 | */ |
| 458 | - public function frontend_render_text_template( $field ) { |
|
| 458 | + public function frontend_render_text_template($field) { |
|
| 459 | 459 | |
| 460 | 460 | echo "<div class='form-group'>"; |
| 461 | 461 | |
| 462 | 462 | echo aui()->input( |
| 463 | 463 | array( |
| 464 | - 'name' => esc_attr( $field['id'] ), |
|
| 465 | - 'id' => esc_attr( $field['id'] ), |
|
| 466 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
| 464 | + 'name' => esc_attr($field['id']), |
|
| 465 | + 'id' => esc_attr($field['id']), |
|
| 466 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
| 467 | 467 | 'required' => (bool) $field['required'], |
| 468 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 468 | + 'label' => wp_kses_post($field['label']), |
|
| 469 | 469 | 'no_wrap' => true, |
| 470 | 470 | ) |
| 471 | 471 | ); |
| 472 | 472 | |
| 473 | - if ( ! empty( $field['description'] ) ) { |
|
| 474 | - $description = wp_kses_post( $field['description'] ); |
|
| 473 | + if (!empty($field['description'])) { |
|
| 474 | + $description = wp_kses_post($field['description']); |
|
| 475 | 475 | echo "<small class='form-text text-muted'>$description</small>"; |
| 476 | 476 | } |
| 477 | 477 | |
@@ -482,16 +482,16 @@ discard block |
||
| 482 | 482 | /** |
| 483 | 483 | * Renders the edit text element template. |
| 484 | 484 | */ |
| 485 | - public function edit_text_template( $field ) { |
|
| 486 | - $restrict = $this->get_restrict_markup( $field, 'text' ); |
|
| 487 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 485 | + public function edit_text_template($field) { |
|
| 486 | + $restrict = $this->get_restrict_markup($field, 'text'); |
|
| 487 | + $label = __('Field Label', 'invoicing'); |
|
| 488 | 488 | $id = $field . '.id + "_edit"'; |
| 489 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 489 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 490 | 490 | $id2 = $field . '.id + "_edit2"'; |
| 491 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 492 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 491 | + $label3 = __('Help text', 'invoicing'); |
|
| 492 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 493 | 493 | $id3 = $field . '.id + "_edit3"'; |
| 494 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 494 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 495 | 495 | $id4 = $field . '.id + "_edit4"'; |
| 496 | 496 | echo " |
| 497 | 497 | <div $restrict> |
@@ -519,8 +519,8 @@ discard block |
||
| 519 | 519 | /** |
| 520 | 520 | * Renders the textarea element template. |
| 521 | 521 | */ |
| 522 | - public function render_textarea_template( $field ) { |
|
| 523 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
| 522 | + public function render_textarea_template($field) { |
|
| 523 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
| 524 | 524 | $label = "$field.label"; |
| 525 | 525 | echo " |
| 526 | 526 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -535,24 +535,24 @@ discard block |
||
| 535 | 535 | /** |
| 536 | 536 | * Renders the textarea element on the frontend. |
| 537 | 537 | */ |
| 538 | - public function frontend_render_textarea_template( $field ) { |
|
| 538 | + public function frontend_render_textarea_template($field) { |
|
| 539 | 539 | |
| 540 | 540 | echo "<div class='form-group'>"; |
| 541 | 541 | |
| 542 | 542 | echo aui()->textarea( |
| 543 | 543 | array( |
| 544 | - 'name' => esc_attr( $field['id'] ), |
|
| 545 | - 'id' => esc_attr( $field['id'] ), |
|
| 546 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
| 544 | + 'name' => esc_attr($field['id']), |
|
| 545 | + 'id' => esc_attr($field['id']), |
|
| 546 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
| 547 | 547 | 'required' => (bool) $field['required'], |
| 548 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 548 | + 'label' => wp_kses_post($field['label']), |
|
| 549 | 549 | 'no_wrap' => true, |
| 550 | 550 | 'rows' => 3, |
| 551 | 551 | ) |
| 552 | 552 | ); |
| 553 | 553 | |
| 554 | - if ( ! empty( $field['description'] ) ) { |
|
| 555 | - $description = wp_kses_post( $field['description'] ); |
|
| 554 | + if (!empty($field['description'])) { |
|
| 555 | + $description = wp_kses_post($field['description']); |
|
| 556 | 556 | echo "<small class='form-text text-muted'>$description</small>"; |
| 557 | 557 | } |
| 558 | 558 | |
@@ -563,16 +563,16 @@ discard block |
||
| 563 | 563 | /** |
| 564 | 564 | * Renders the edit textarea element template. |
| 565 | 565 | */ |
| 566 | - public function edit_textarea_template( $field ) { |
|
| 567 | - $restrict = $this->get_restrict_markup( $field, 'textarea' ); |
|
| 568 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 566 | + public function edit_textarea_template($field) { |
|
| 567 | + $restrict = $this->get_restrict_markup($field, 'textarea'); |
|
| 568 | + $label = __('Field Label', 'invoicing'); |
|
| 569 | 569 | $id = $field . '.id + "_edit"'; |
| 570 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 570 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 571 | 571 | $id2 = $field . '.id + "_edit2"'; |
| 572 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 573 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 572 | + $label3 = __('Help text', 'invoicing'); |
|
| 573 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 574 | 574 | $id3 = $field . '.id + "_edit3"'; |
| 575 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 575 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 576 | 576 | $id4 = $field . '.id + "_edit4"'; |
| 577 | 577 | echo " |
| 578 | 578 | <div $restrict> |
@@ -600,8 +600,8 @@ discard block |
||
| 600 | 600 | /** |
| 601 | 601 | * Renders the select element template. |
| 602 | 602 | */ |
| 603 | - public function render_select_template( $field ) { |
|
| 604 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
| 603 | + public function render_select_template($field) { |
|
| 604 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
| 605 | 605 | $label = "$field.label"; |
| 606 | 606 | $placeholder = "$field.placeholder"; |
| 607 | 607 | $id = $field . '.id'; |
@@ -621,24 +621,24 @@ discard block |
||
| 621 | 621 | /** |
| 622 | 622 | * Renders the select element on the frontend. |
| 623 | 623 | */ |
| 624 | - public function frontend_render_select_template( $field ) { |
|
| 624 | + public function frontend_render_select_template($field) { |
|
| 625 | 625 | |
| 626 | 626 | echo "<div class='form-group'>"; |
| 627 | 627 | |
| 628 | 628 | echo aui()->select( |
| 629 | 629 | array( |
| 630 | - 'name' => esc_attr( $field['id'] ), |
|
| 631 | - 'id' => esc_attr( $field['id'] ), |
|
| 632 | - 'placeholder'=> esc_attr( $field['placeholder'] ), |
|
| 630 | + 'name' => esc_attr($field['id']), |
|
| 631 | + 'id' => esc_attr($field['id']), |
|
| 632 | + 'placeholder'=> esc_attr($field['placeholder']), |
|
| 633 | 633 | 'required' => (bool) $field['required'], |
| 634 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 634 | + 'label' => wp_kses_post($field['label']), |
|
| 635 | 635 | 'no_wrap' => true, |
| 636 | - 'options' => array_combine( $field['options'], $field['options'] ), |
|
| 636 | + 'options' => array_combine($field['options'], $field['options']), |
|
| 637 | 637 | ) |
| 638 | 638 | ); |
| 639 | 639 | |
| 640 | - if ( ! empty( $field['description'] ) ) { |
|
| 641 | - $description = wp_kses_post( $field['description'] ); |
|
| 640 | + if (!empty($field['description'])) { |
|
| 641 | + $description = wp_kses_post($field['description']); |
|
| 642 | 642 | echo "<small class='form-text text-muted'>$description</small>"; |
| 643 | 643 | } |
| 644 | 644 | |
@@ -649,18 +649,18 @@ discard block |
||
| 649 | 649 | /** |
| 650 | 650 | * Renders the edit select element template. |
| 651 | 651 | */ |
| 652 | - public function edit_select_template( $field ) { |
|
| 653 | - $restrict = $this->get_restrict_markup( $field, 'select' ); |
|
| 654 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 652 | + public function edit_select_template($field) { |
|
| 653 | + $restrict = $this->get_restrict_markup($field, 'select'); |
|
| 654 | + $label = __('Field Label', 'invoicing'); |
|
| 655 | 655 | $id = $field . '.id + "_edit"'; |
| 656 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 656 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 657 | 657 | $id2 = $field . '.id + "_edit2"'; |
| 658 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 659 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 658 | + $label3 = __('Help text', 'invoicing'); |
|
| 659 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 660 | 660 | $id3 = $field . '.id + "_edit3"'; |
| 661 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 661 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 662 | 662 | $id4 = $field . '.id + "_edit4"'; |
| 663 | - $label6 = __( 'Available Options', 'invoicing' ); |
|
| 663 | + $label6 = __('Available Options', 'invoicing'); |
|
| 664 | 664 | echo " |
| 665 | 665 | <div $restrict> |
| 666 | 666 | <div class='form-group'> |
@@ -698,8 +698,8 @@ discard block |
||
| 698 | 698 | /** |
| 699 | 699 | * Renders the checkbox element template. |
| 700 | 700 | */ |
| 701 | - public function render_checkbox_template( $field ) { |
|
| 702 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
| 701 | + public function render_checkbox_template($field) { |
|
| 702 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
| 703 | 703 | $label = "$field.label"; |
| 704 | 704 | echo " |
| 705 | 705 | <div class='form-check' $restrict> |
@@ -714,24 +714,24 @@ discard block |
||
| 714 | 714 | /** |
| 715 | 715 | * Renders the checkbox element on the frontend. |
| 716 | 716 | */ |
| 717 | - public function frontend_render_checkbox_template( $field ) { |
|
| 717 | + public function frontend_render_checkbox_template($field) { |
|
| 718 | 718 | |
| 719 | 719 | echo "<div class='form-group'>"; |
| 720 | 720 | |
| 721 | 721 | echo aui()->input( |
| 722 | 722 | array( |
| 723 | - 'name' => esc_attr( $field['id'] ), |
|
| 724 | - 'id' => esc_attr( $field['id'] ), |
|
| 723 | + 'name' => esc_attr($field['id']), |
|
| 724 | + 'id' => esc_attr($field['id']), |
|
| 725 | 725 | 'required' => (bool) $field['required'], |
| 726 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 726 | + 'label' => wp_kses_post($field['label']), |
|
| 727 | 727 | 'no_wrap' => true, |
| 728 | - 'value' => esc_attr__( 'Yes', 'invoicing' ), |
|
| 728 | + 'value' => esc_attr__('Yes', 'invoicing'), |
|
| 729 | 729 | 'type' => 'checkbox', |
| 730 | 730 | ) |
| 731 | 731 | ); |
| 732 | 732 | |
| 733 | - if ( ! empty( $field['description'] ) ) { |
|
| 734 | - $description = wp_kses_post( $field['description'] ); |
|
| 733 | + if (!empty($field['description'])) { |
|
| 734 | + $description = wp_kses_post($field['description']); |
|
| 735 | 735 | echo "<small class='form-text text-muted'>$description</small>"; |
| 736 | 736 | } |
| 737 | 737 | |
@@ -742,14 +742,14 @@ discard block |
||
| 742 | 742 | /** |
| 743 | 743 | * Renders the edit checkbox element template. |
| 744 | 744 | */ |
| 745 | - public function edit_checkbox_template( $field ) { |
|
| 746 | - $restrict = $this->get_restrict_markup( $field, 'checkbox' ); |
|
| 747 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 745 | + public function edit_checkbox_template($field) { |
|
| 746 | + $restrict = $this->get_restrict_markup($field, 'checkbox'); |
|
| 747 | + $label = __('Field Label', 'invoicing'); |
|
| 748 | 748 | $id = $field . '.id + "_edit"'; |
| 749 | - $label2 = __( 'Help text', 'invoicing' ); |
|
| 750 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 749 | + $label2 = __('Help text', 'invoicing'); |
|
| 750 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 751 | 751 | $id2 = $field . '.id + "_edit2"'; |
| 752 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
| 752 | + $label4 = __('Is this field required?', 'invoicing'); |
|
| 753 | 753 | $id3 = $field . '.id + "_edit3"'; |
| 754 | 754 | echo " |
| 755 | 755 | <div $restrict> |
@@ -773,8 +773,8 @@ discard block |
||
| 773 | 773 | /** |
| 774 | 774 | * Renders the radio element template. |
| 775 | 775 | */ |
| 776 | - public function render_radio_template( $field ) { |
|
| 777 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
| 776 | + public function render_radio_template($field) { |
|
| 777 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
| 778 | 778 | $label = "$field.label"; |
| 779 | 779 | $id = $field . '.id'; |
| 780 | 780 | echo " |
@@ -793,20 +793,20 @@ discard block |
||
| 793 | 793 | /** |
| 794 | 794 | * Renders the radio element on the frontend. |
| 795 | 795 | */ |
| 796 | - public function frontend_render_radio_template( $field ) { |
|
| 796 | + public function frontend_render_radio_template($field) { |
|
| 797 | 797 | |
| 798 | 798 | echo "<div class='form-group'>"; |
| 799 | 799 | |
| 800 | - if ( ! empty( $field['label'] ) ) { |
|
| 801 | - $label = wp_kses_post( $field['label'] ); |
|
| 800 | + if (!empty($field['label'])) { |
|
| 801 | + $label = wp_kses_post($field['label']); |
|
| 802 | 802 | echo "<legend class='col-form-label'>$label</legend>"; |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | - foreach( $field['options'] as $index => $option ) { |
|
| 805 | + foreach ($field['options'] as $index => $option) { |
|
| 806 | 806 | $id = $field['id'] . $index; |
| 807 | 807 | $name = $field['id']; |
| 808 | - $value = esc_attr( $option ); |
|
| 809 | - $label = wp_kses_post( $option ); |
|
| 808 | + $value = esc_attr($option); |
|
| 809 | + $label = wp_kses_post($option); |
|
| 810 | 810 | |
| 811 | 811 | echo " |
| 812 | 812 | <div class='form-check'> |
@@ -816,8 +816,8 @@ discard block |
||
| 816 | 816 | "; |
| 817 | 817 | } |
| 818 | 818 | |
| 819 | - if ( ! empty( $field['description'] ) ) { |
|
| 820 | - $description = wp_kses_post( $field['description'] ); |
|
| 819 | + if (!empty($field['description'])) { |
|
| 820 | + $description = wp_kses_post($field['description']); |
|
| 821 | 821 | echo "<small class='form-text text-muted'>$description</small>"; |
| 822 | 822 | } |
| 823 | 823 | |
@@ -828,16 +828,16 @@ discard block |
||
| 828 | 828 | /** |
| 829 | 829 | * Renders the edit radio element template. |
| 830 | 830 | */ |
| 831 | - public function edit_radio_template( $field ) { |
|
| 832 | - $restrict = $this->get_restrict_markup( $field, 'radio' ); |
|
| 833 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 831 | + public function edit_radio_template($field) { |
|
| 832 | + $restrict = $this->get_restrict_markup($field, 'radio'); |
|
| 833 | + $label = __('Field Label', 'invoicing'); |
|
| 834 | 834 | $id = $field . '.id + "_edit"'; |
| 835 | - $label2 = __( 'Help text', 'invoicing' ); |
|
| 836 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 835 | + $label2 = __('Help text', 'invoicing'); |
|
| 836 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 837 | 837 | $id2 = $field . '.id + "_edit3"'; |
| 838 | - $label4 = __( 'Is this field required?', 'invoicing' ); |
|
| 838 | + $label4 = __('Is this field required?', 'invoicing'); |
|
| 839 | 839 | $id3 = $field . '.id + "_edit4"'; |
| 840 | - $label5 = __( 'Available Options', 'invoicing' ); |
|
| 840 | + $label5 = __('Available Options', 'invoicing'); |
|
| 841 | 841 | echo " |
| 842 | 842 | <div $restrict> |
| 843 | 843 | <div class='form-group'> |
@@ -871,8 +871,8 @@ discard block |
||
| 871 | 871 | /** |
| 872 | 872 | * Renders the address element template. |
| 873 | 873 | */ |
| 874 | - public function render_address_template( $field ) { |
|
| 875 | - $restrict = $this->get_restrict_markup( $field, 'address' ); |
|
| 874 | + public function render_address_template($field) { |
|
| 875 | + $restrict = $this->get_restrict_markup($field, 'address'); |
|
| 876 | 876 | |
| 877 | 877 | echo " |
| 878 | 878 | <div class='wpinv-address-wrapper' $restrict> |
@@ -894,55 +894,55 @@ discard block |
||
| 894 | 894 | /** |
| 895 | 895 | * Renders the address element on the frontend. |
| 896 | 896 | */ |
| 897 | - public function frontend_render_address_template( $field ) { |
|
| 897 | + public function frontend_render_address_template($field) { |
|
| 898 | 898 | |
| 899 | 899 | echo "<div class='wpinv-address-fields'>"; |
| 900 | 900 | |
| 901 | - foreach( $field['fields'] as $address_field ) { |
|
| 901 | + foreach ($field['fields'] as $address_field) { |
|
| 902 | 902 | |
| 903 | - if ( empty( $address_field['visible'] ) ) { |
|
| 903 | + if (empty($address_field['visible'])) { |
|
| 904 | 904 | continue; |
| 905 | 905 | } |
| 906 | 906 | |
| 907 | - $class = esc_attr( $address_field['name'] ); |
|
| 907 | + $class = esc_attr($address_field['name']); |
|
| 908 | 908 | echo "<div class='form-group $class'>"; |
| 909 | 909 | |
| 910 | 910 | $label = $address_field['label']; |
| 911 | 911 | |
| 912 | - if ( ! empty( $address_field['required'] ) ) { |
|
| 912 | + if (!empty($address_field['required'])) { |
|
| 913 | 913 | $label .= "<span class='text-danger'> *</span>"; |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | - if ( 'wpinv_country' == $address_field['name'] ) { |
|
| 916 | + if ('wpinv_country' == $address_field['name']) { |
|
| 917 | 917 | |
| 918 | - echo aui()->select( array( |
|
| 918 | + echo aui()->select(array( |
|
| 919 | 919 | 'options' => wpinv_get_country_list(), |
| 920 | - 'name' => esc_attr( $address_field['name'] ), |
|
| 921 | - 'id' => esc_attr( $address_field['name'] ), |
|
| 920 | + 'name' => esc_attr($address_field['name']), |
|
| 921 | + 'id' => esc_attr($address_field['name']), |
|
| 922 | 922 | 'value' => wpinv_get_default_country(), |
| 923 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
| 923 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
| 924 | 924 | 'required' => (bool) $address_field['required'], |
| 925 | 925 | 'no_wrap' => true, |
| 926 | - 'label' => wp_kses_post( $label ), |
|
| 926 | + 'label' => wp_kses_post($label), |
|
| 927 | 927 | 'select2' => false, |
| 928 | 928 | )); |
| 929 | 929 | |
| 930 | - } else if ( 'wpinv_state' == $address_field['name'] ) { |
|
| 930 | + } else if ('wpinv_state' == $address_field['name']) { |
|
| 931 | 931 | |
| 932 | - $states = wpinv_get_country_states( wpinv_get_default_country() ); |
|
| 932 | + $states = wpinv_get_country_states(wpinv_get_default_country()); |
|
| 933 | 933 | $state = wpinv_get_default_state(); |
| 934 | 934 | |
| 935 | - if ( ! empty( $states ) ) { |
|
| 935 | + if (!empty($states)) { |
|
| 936 | 936 | |
| 937 | - echo aui()->select( array( |
|
| 937 | + echo aui()->select(array( |
|
| 938 | 938 | 'options' => $states, |
| 939 | - 'name' => esc_attr( $address_field['name'] ), |
|
| 940 | - 'id' => esc_attr( $address_field['name'] ), |
|
| 939 | + 'name' => esc_attr($address_field['name']), |
|
| 940 | + 'id' => esc_attr($address_field['name']), |
|
| 941 | 941 | 'value' => $state, |
| 942 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
| 942 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
| 943 | 943 | 'required' => (bool) $address_field['required'], |
| 944 | 944 | 'no_wrap' => true, |
| 945 | - 'label' => wp_kses_post( $label ), |
|
| 945 | + 'label' => wp_kses_post($label), |
|
| 946 | 946 | 'select2' => false, |
| 947 | 947 | )); |
| 948 | 948 | |
@@ -950,10 +950,10 @@ discard block |
||
| 950 | 950 | |
| 951 | 951 | echo aui()->input( |
| 952 | 952 | array( |
| 953 | - 'name' => esc_attr( $address_field['name'] ), |
|
| 954 | - 'id' => esc_attr( $address_field['name'] ), |
|
| 953 | + 'name' => esc_attr($address_field['name']), |
|
| 954 | + 'id' => esc_attr($address_field['name']), |
|
| 955 | 955 | 'required' => (bool) $address_field['required'], |
| 956 | - 'label' => wp_kses_post( $label ), |
|
| 956 | + 'label' => wp_kses_post($label), |
|
| 957 | 957 | 'no_wrap' => true, |
| 958 | 958 | 'type' => 'text', |
| 959 | 959 | ) |
@@ -965,12 +965,12 @@ discard block |
||
| 965 | 965 | |
| 966 | 966 | echo aui()->input( |
| 967 | 967 | array( |
| 968 | - 'name' => esc_attr( $address_field['name'] ), |
|
| 969 | - 'id' => esc_attr( $address_field['name'] ), |
|
| 968 | + 'name' => esc_attr($address_field['name']), |
|
| 969 | + 'id' => esc_attr($address_field['name']), |
|
| 970 | 970 | 'required' => (bool) $address_field['required'], |
| 971 | - 'label' => wp_kses_post( $label ), |
|
| 971 | + 'label' => wp_kses_post($label), |
|
| 972 | 972 | 'no_wrap' => true, |
| 973 | - 'placeholder' => esc_attr( $address_field['placeholder'] ), |
|
| 973 | + 'placeholder' => esc_attr($address_field['placeholder']), |
|
| 974 | 974 | 'type' => 'text', |
| 975 | 975 | ) |
| 976 | 976 | ); |
@@ -978,8 +978,8 @@ discard block |
||
| 978 | 978 | } |
| 979 | 979 | |
| 980 | 980 | |
| 981 | - if ( ! empty( $address_field['description'] ) ) { |
|
| 982 | - $description = wp_kses_post( $address_field['description'] ); |
|
| 981 | + if (!empty($address_field['description'])) { |
|
| 982 | + $description = wp_kses_post($address_field['description']); |
|
| 983 | 983 | echo "<small class='form-text text-muted'>$description</small>"; |
| 984 | 984 | } |
| 985 | 985 | |
@@ -994,13 +994,13 @@ discard block |
||
| 994 | 994 | /** |
| 995 | 995 | * Renders the edit address element template. |
| 996 | 996 | */ |
| 997 | - public function edit_address_template( $field ) { |
|
| 998 | - $restrict = $this->get_restrict_markup( $field, 'address' ); |
|
| 999 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1000 | - $label2 = __( 'Placeholder', 'invoicing' ); |
|
| 1001 | - $label3 = __( 'Description', 'invoicing' ); |
|
| 1002 | - $label4 = __( 'Is required', 'invoicing' ); |
|
| 1003 | - $label5 = __( 'Is visible', 'invoicing' ); |
|
| 997 | + public function edit_address_template($field) { |
|
| 998 | + $restrict = $this->get_restrict_markup($field, 'address'); |
|
| 999 | + $label = __('Field Label', 'invoicing'); |
|
| 1000 | + $label2 = __('Placeholder', 'invoicing'); |
|
| 1001 | + $label3 = __('Description', 'invoicing'); |
|
| 1002 | + $label4 = __('Is required', 'invoicing'); |
|
| 1003 | + $label5 = __('Is visible', 'invoicing'); |
|
| 1004 | 1004 | $id = $field . '.id + "_edit_label"'; |
| 1005 | 1005 | $id2 = $field . '.id + "_edit_placeholder"'; |
| 1006 | 1006 | $id3 = $field . '.id + "_edit_description"'; |
@@ -1068,8 +1068,8 @@ discard block |
||
| 1068 | 1068 | /** |
| 1069 | 1069 | * Renders the email element template. |
| 1070 | 1070 | */ |
| 1071 | - public function render_email_template( $field ) { |
|
| 1072 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
| 1071 | + public function render_email_template($field) { |
|
| 1072 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
| 1073 | 1073 | $label = "$field.label"; |
| 1074 | 1074 | echo " |
| 1075 | 1075 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1084,8 +1084,8 @@ discard block |
||
| 1084 | 1084 | /** |
| 1085 | 1085 | * Renders the billing_email element template. |
| 1086 | 1086 | */ |
| 1087 | - public function render_billing_email_template( $field ) { |
|
| 1088 | - $restrict = $this->get_restrict_markup( $field, 'billing_email' ); |
|
| 1087 | + public function render_billing_email_template($field) { |
|
| 1088 | + $restrict = $this->get_restrict_markup($field, 'billing_email'); |
|
| 1089 | 1089 | $label = "$field.label"; |
| 1090 | 1090 | echo " |
| 1091 | 1091 | <div $restrict> |
@@ -1099,24 +1099,24 @@ discard block |
||
| 1099 | 1099 | /** |
| 1100 | 1100 | * Renders the email element on the frontend. |
| 1101 | 1101 | */ |
| 1102 | - public function frontend_render_email_template( $field ) { |
|
| 1102 | + public function frontend_render_email_template($field) { |
|
| 1103 | 1103 | |
| 1104 | 1104 | echo "<div class='form-group'>"; |
| 1105 | 1105 | |
| 1106 | 1106 | echo aui()->input( |
| 1107 | 1107 | array( |
| 1108 | - 'name' => esc_attr( $field['id'] ), |
|
| 1109 | - 'id' => esc_attr( $field['id'] ), |
|
| 1108 | + 'name' => esc_attr($field['id']), |
|
| 1109 | + 'id' => esc_attr($field['id']), |
|
| 1110 | 1110 | 'required' => (bool) $field['required'], |
| 1111 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 1111 | + 'label' => wp_kses_post($field['label']), |
|
| 1112 | 1112 | 'no_wrap' => true, |
| 1113 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
| 1113 | + 'placeholder' => esc_attr($field['placeholder']), |
|
| 1114 | 1114 | 'type' => 'email', |
| 1115 | 1115 | ) |
| 1116 | 1116 | ); |
| 1117 | 1117 | |
| 1118 | - if ( ! empty( $field['description'] ) ) { |
|
| 1119 | - $description = wp_kses_post( $field['description'] ); |
|
| 1118 | + if (!empty($field['description'])) { |
|
| 1119 | + $description = wp_kses_post($field['description']); |
|
| 1120 | 1120 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1121 | 1121 | } |
| 1122 | 1122 | |
@@ -1127,30 +1127,30 @@ discard block |
||
| 1127 | 1127 | /** |
| 1128 | 1128 | * Renders the billing email element on the frontend. |
| 1129 | 1129 | */ |
| 1130 | - public function frontend_render_billing_email_template( $field ) { |
|
| 1130 | + public function frontend_render_billing_email_template($field) { |
|
| 1131 | 1131 | |
| 1132 | 1132 | echo "<div class='form-group'>"; |
| 1133 | 1133 | $value = ''; |
| 1134 | 1134 | |
| 1135 | - if ( is_user_logged_in() ) { |
|
| 1135 | + if (is_user_logged_in()) { |
|
| 1136 | 1136 | $user = wp_get_current_user(); |
| 1137 | - $value = sanitize_email( $user->user_email ); |
|
| 1137 | + $value = sanitize_email($user->user_email); |
|
| 1138 | 1138 | } |
| 1139 | 1139 | echo aui()->input( |
| 1140 | 1140 | array( |
| 1141 | 1141 | 'name' => 'billing_email', |
| 1142 | 1142 | 'value' => $value, |
| 1143 | - 'id' => esc_attr( $field['id'] ), |
|
| 1143 | + 'id' => esc_attr($field['id']), |
|
| 1144 | 1144 | 'required' => true, |
| 1145 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 1145 | + 'label' => wp_kses_post($field['label']), |
|
| 1146 | 1146 | 'no_wrap' => true, |
| 1147 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
| 1147 | + 'placeholder' => esc_attr($field['placeholder']), |
|
| 1148 | 1148 | 'type' => 'email', |
| 1149 | 1149 | ) |
| 1150 | 1150 | ); |
| 1151 | 1151 | |
| 1152 | - if ( ! empty( $field['description'] ) ) { |
|
| 1153 | - $description = wp_kses_post( $field['description'] ); |
|
| 1152 | + if (!empty($field['description'])) { |
|
| 1153 | + $description = wp_kses_post($field['description']); |
|
| 1154 | 1154 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1155 | 1155 | } |
| 1156 | 1156 | |
@@ -1161,16 +1161,16 @@ discard block |
||
| 1161 | 1161 | /** |
| 1162 | 1162 | * Renders the edit email element template. |
| 1163 | 1163 | */ |
| 1164 | - public function edit_email_template( $field ) { |
|
| 1165 | - $restrict = $this->get_restrict_markup( $field, 'email' ); |
|
| 1166 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1164 | + public function edit_email_template($field) { |
|
| 1165 | + $restrict = $this->get_restrict_markup($field, 'email'); |
|
| 1166 | + $label = __('Field Label', 'invoicing'); |
|
| 1167 | 1167 | $id = $field . '.id + "_edit"'; |
| 1168 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 1168 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 1169 | 1169 | $id2 = $field . '.id + "_edit2"'; |
| 1170 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 1171 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1170 | + $label3 = __('Help text', 'invoicing'); |
|
| 1171 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1172 | 1172 | $id3 = $field . '.id + "_edit3"'; |
| 1173 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 1173 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 1174 | 1174 | $id4 = $field . '.id + "_edit4"'; |
| 1175 | 1175 | echo " |
| 1176 | 1176 | <div $restrict> |
@@ -1198,16 +1198,16 @@ discard block |
||
| 1198 | 1198 | /** |
| 1199 | 1199 | * Renders the edit billing_email element template. |
| 1200 | 1200 | */ |
| 1201 | - public function edit_billing_email_template( $field ) { |
|
| 1202 | - $restrict = $this->get_restrict_markup( $field, 'billing_email' ); |
|
| 1203 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1201 | + public function edit_billing_email_template($field) { |
|
| 1202 | + $restrict = $this->get_restrict_markup($field, 'billing_email'); |
|
| 1203 | + $label = __('Field Label', 'invoicing'); |
|
| 1204 | 1204 | $id = $field . '.id + "_edit"'; |
| 1205 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 1205 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 1206 | 1206 | $id2 = $field . '.id + "_edit2"'; |
| 1207 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 1208 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1207 | + $label3 = __('Help text', 'invoicing'); |
|
| 1208 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1209 | 1209 | $id3 = $field . '.id + "_edit3"'; |
| 1210 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 1210 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 1211 | 1211 | $id4 = $field . '.id + "_edit4"'; |
| 1212 | 1212 | echo " |
| 1213 | 1213 | <div $restrict> |
@@ -1231,8 +1231,8 @@ discard block |
||
| 1231 | 1231 | /** |
| 1232 | 1232 | * Renders the website element template. |
| 1233 | 1233 | */ |
| 1234 | - public function render_website_template( $field ) { |
|
| 1235 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
| 1234 | + public function render_website_template($field) { |
|
| 1235 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
| 1236 | 1236 | $label = "$field.label"; |
| 1237 | 1237 | echo " |
| 1238 | 1238 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1247,24 +1247,24 @@ discard block |
||
| 1247 | 1247 | /** |
| 1248 | 1248 | * Renders the website element on the frontend. |
| 1249 | 1249 | */ |
| 1250 | - public function frontend_render_website_template( $field ) { |
|
| 1250 | + public function frontend_render_website_template($field) { |
|
| 1251 | 1251 | |
| 1252 | 1252 | echo "<div class='form-group'>"; |
| 1253 | 1253 | |
| 1254 | 1254 | echo aui()->input( |
| 1255 | 1255 | array( |
| 1256 | - 'name' => esc_attr( $field['id'] ), |
|
| 1257 | - 'id' => esc_attr( $field['id'] ), |
|
| 1256 | + 'name' => esc_attr($field['id']), |
|
| 1257 | + 'id' => esc_attr($field['id']), |
|
| 1258 | 1258 | 'required' => (bool) $field['required'], |
| 1259 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 1259 | + 'label' => wp_kses_post($field['label']), |
|
| 1260 | 1260 | 'no_wrap' => true, |
| 1261 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
| 1261 | + 'placeholder' => esc_attr($field['placeholder']), |
|
| 1262 | 1262 | 'type' => 'url', |
| 1263 | 1263 | ) |
| 1264 | 1264 | ); |
| 1265 | 1265 | |
| 1266 | - if ( ! empty( $field['description'] ) ) { |
|
| 1267 | - $description = wp_kses_post( $field['description'] ); |
|
| 1266 | + if (!empty($field['description'])) { |
|
| 1267 | + $description = wp_kses_post($field['description']); |
|
| 1268 | 1268 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1269 | 1269 | } |
| 1270 | 1270 | |
@@ -1275,16 +1275,16 @@ discard block |
||
| 1275 | 1275 | /** |
| 1276 | 1276 | * Renders the edit website element template. |
| 1277 | 1277 | */ |
| 1278 | - public function edit_website_template( $field ) { |
|
| 1279 | - $restrict = $this->get_restrict_markup( $field, 'website' ); |
|
| 1280 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1278 | + public function edit_website_template($field) { |
|
| 1279 | + $restrict = $this->get_restrict_markup($field, 'website'); |
|
| 1280 | + $label = __('Field Label', 'invoicing'); |
|
| 1281 | 1281 | $id = $field . '.id + "_edit"'; |
| 1282 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 1282 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 1283 | 1283 | $id2 = $field . '.id + "_edit2"'; |
| 1284 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 1285 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1284 | + $label3 = __('Help text', 'invoicing'); |
|
| 1285 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1286 | 1286 | $id3 = $field . '.id + "_edit3"'; |
| 1287 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 1287 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 1288 | 1288 | $id4 = $field . '.id + "_edit4"'; |
| 1289 | 1289 | echo " |
| 1290 | 1290 | <div $restrict> |
@@ -1312,8 +1312,8 @@ discard block |
||
| 1312 | 1312 | /** |
| 1313 | 1313 | * Renders the date element template. |
| 1314 | 1314 | */ |
| 1315 | - public function render_date_template( $field ) { |
|
| 1316 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
| 1315 | + public function render_date_template($field) { |
|
| 1316 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
| 1317 | 1317 | $label = "$field.label"; |
| 1318 | 1318 | echo " |
| 1319 | 1319 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1328,23 +1328,23 @@ discard block |
||
| 1328 | 1328 | /** |
| 1329 | 1329 | * Renders the date element on the frontend. |
| 1330 | 1330 | */ |
| 1331 | - public function frontend_render_date_template( $field ) { |
|
| 1331 | + public function frontend_render_date_template($field) { |
|
| 1332 | 1332 | |
| 1333 | 1333 | echo "<div class='form-group'>"; |
| 1334 | 1334 | |
| 1335 | 1335 | echo aui()->input( |
| 1336 | 1336 | array( |
| 1337 | - 'name' => esc_attr( $field['id'] ), |
|
| 1338 | - 'id' => esc_attr( $field['id'] ), |
|
| 1337 | + 'name' => esc_attr($field['id']), |
|
| 1338 | + 'id' => esc_attr($field['id']), |
|
| 1339 | 1339 | 'required' => (bool) $field['required'], |
| 1340 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 1340 | + 'label' => wp_kses_post($field['label']), |
|
| 1341 | 1341 | 'no_wrap' => true, |
| 1342 | 1342 | 'type' => 'date', |
| 1343 | 1343 | ) |
| 1344 | 1344 | ); |
| 1345 | 1345 | |
| 1346 | - if ( ! empty( $field['description'] ) ) { |
|
| 1347 | - $description = wp_kses_post( $field['description'] ); |
|
| 1346 | + if (!empty($field['description'])) { |
|
| 1347 | + $description = wp_kses_post($field['description']); |
|
| 1348 | 1348 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1349 | 1349 | } |
| 1350 | 1350 | |
@@ -1355,14 +1355,14 @@ discard block |
||
| 1355 | 1355 | /** |
| 1356 | 1356 | * Renders the edit date element template. |
| 1357 | 1357 | */ |
| 1358 | - public function edit_date_template( $field ) { |
|
| 1359 | - $restrict = $this->get_restrict_markup( $field, 'date' ); |
|
| 1360 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1358 | + public function edit_date_template($field) { |
|
| 1359 | + $restrict = $this->get_restrict_markup($field, 'date'); |
|
| 1360 | + $label = __('Field Label', 'invoicing'); |
|
| 1361 | 1361 | $id = $field . '.id + "_edit"'; |
| 1362 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 1363 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1362 | + $label3 = __('Help text', 'invoicing'); |
|
| 1363 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1364 | 1364 | $id3 = $field . '.id + "_edit3"'; |
| 1365 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 1365 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 1366 | 1366 | $id4 = $field . '.id + "_edit4"'; |
| 1367 | 1367 | echo " |
| 1368 | 1368 | <div $restrict> |
@@ -1386,8 +1386,8 @@ discard block |
||
| 1386 | 1386 | /** |
| 1387 | 1387 | * Renders the time element template. |
| 1388 | 1388 | */ |
| 1389 | - public function render_time_template( $field ) { |
|
| 1390 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
| 1389 | + public function render_time_template($field) { |
|
| 1390 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
| 1391 | 1391 | $label = "$field.label"; |
| 1392 | 1392 | echo " |
| 1393 | 1393 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1402,23 +1402,23 @@ discard block |
||
| 1402 | 1402 | /** |
| 1403 | 1403 | * Renders the time element on the frontend. |
| 1404 | 1404 | */ |
| 1405 | - public function frontend_render_time_template( $field ) { |
|
| 1405 | + public function frontend_render_time_template($field) { |
|
| 1406 | 1406 | |
| 1407 | 1407 | echo "<div class='form-group'>"; |
| 1408 | 1408 | |
| 1409 | 1409 | echo aui()->input( |
| 1410 | 1410 | array( |
| 1411 | - 'name' => esc_attr( $field['id'] ), |
|
| 1412 | - 'id' => esc_attr( $field['id'] ), |
|
| 1411 | + 'name' => esc_attr($field['id']), |
|
| 1412 | + 'id' => esc_attr($field['id']), |
|
| 1413 | 1413 | 'required' => (bool) $field['required'], |
| 1414 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 1414 | + 'label' => wp_kses_post($field['label']), |
|
| 1415 | 1415 | 'no_wrap' => true, |
| 1416 | 1416 | 'type' => 'time', |
| 1417 | 1417 | ) |
| 1418 | 1418 | ); |
| 1419 | 1419 | |
| 1420 | - if ( ! empty( $field['description'] ) ) { |
|
| 1421 | - $description = wp_kses_post( $field['description'] ); |
|
| 1420 | + if (!empty($field['description'])) { |
|
| 1421 | + $description = wp_kses_post($field['description']); |
|
| 1422 | 1422 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1423 | 1423 | } |
| 1424 | 1424 | |
@@ -1429,14 +1429,14 @@ discard block |
||
| 1429 | 1429 | /** |
| 1430 | 1430 | * Renders the edit time element template. |
| 1431 | 1431 | */ |
| 1432 | - public function edit_time_template( $field ) { |
|
| 1433 | - $restrict = $this->get_restrict_markup( $field, 'time' ); |
|
| 1434 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1432 | + public function edit_time_template($field) { |
|
| 1433 | + $restrict = $this->get_restrict_markup($field, 'time'); |
|
| 1434 | + $label = __('Field Label', 'invoicing'); |
|
| 1435 | 1435 | $id = $field . '.id + "_edit"'; |
| 1436 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 1437 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1436 | + $label3 = __('Help text', 'invoicing'); |
|
| 1437 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1438 | 1438 | $id3 = $field . '.id + "_edit3"'; |
| 1439 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 1439 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 1440 | 1440 | $id4 = $field . '.id + "_edit4"'; |
| 1441 | 1441 | echo " |
| 1442 | 1442 | <div $restrict> |
@@ -1460,8 +1460,8 @@ discard block |
||
| 1460 | 1460 | /** |
| 1461 | 1461 | * Renders the number element template. |
| 1462 | 1462 | */ |
| 1463 | - public function render_number_template( $field ) { |
|
| 1464 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
| 1463 | + public function render_number_template($field) { |
|
| 1464 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
| 1465 | 1465 | $label = "$field.label"; |
| 1466 | 1466 | echo " |
| 1467 | 1467 | <div $restrict class='wpinv-payment-form-field-preview'> |
@@ -1476,24 +1476,24 @@ discard block |
||
| 1476 | 1476 | /** |
| 1477 | 1477 | * Renders the number element on the frontend. |
| 1478 | 1478 | */ |
| 1479 | - public function frontend_render_number_template( $field ) { |
|
| 1479 | + public function frontend_render_number_template($field) { |
|
| 1480 | 1480 | |
| 1481 | 1481 | echo "<div class='form-group'>"; |
| 1482 | 1482 | |
| 1483 | 1483 | echo aui()->input( |
| 1484 | 1484 | array( |
| 1485 | - 'name' => esc_attr( $field['id'] ), |
|
| 1486 | - 'id' => esc_attr( $field['id'] ), |
|
| 1485 | + 'name' => esc_attr($field['id']), |
|
| 1486 | + 'id' => esc_attr($field['id']), |
|
| 1487 | 1487 | 'required' => (bool) $field['required'], |
| 1488 | - 'label' => wp_kses_post( $field['label'] ), |
|
| 1489 | - 'placeholder' => esc_attr( $field['placeholder'] ), |
|
| 1488 | + 'label' => wp_kses_post($field['label']), |
|
| 1489 | + 'placeholder' => esc_attr($field['placeholder']), |
|
| 1490 | 1490 | 'no_wrap' => true, |
| 1491 | 1491 | 'type' => 'number', |
| 1492 | 1492 | ) |
| 1493 | 1493 | ); |
| 1494 | 1494 | |
| 1495 | - if ( ! empty( $field['description'] ) ) { |
|
| 1496 | - $description = wp_kses_post( $field['description'] ); |
|
| 1495 | + if (!empty($field['description'])) { |
|
| 1496 | + $description = wp_kses_post($field['description']); |
|
| 1497 | 1497 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1498 | 1498 | } |
| 1499 | 1499 | |
@@ -1504,16 +1504,16 @@ discard block |
||
| 1504 | 1504 | /** |
| 1505 | 1505 | * Renders the edit number element template. |
| 1506 | 1506 | */ |
| 1507 | - public function edit_number_template( $field ) { |
|
| 1508 | - $restrict = $this->get_restrict_markup( $field, 'number' ); |
|
| 1509 | - $label = __( 'Field Label', 'invoicing' ); |
|
| 1507 | + public function edit_number_template($field) { |
|
| 1508 | + $restrict = $this->get_restrict_markup($field, 'number'); |
|
| 1509 | + $label = __('Field Label', 'invoicing'); |
|
| 1510 | 1510 | $id = $field . '.id + "_edit"'; |
| 1511 | - $label2 = __( 'Placeholder text', 'invoicing' ); |
|
| 1511 | + $label2 = __('Placeholder text', 'invoicing'); |
|
| 1512 | 1512 | $id2 = $field . '.id + "_edit2"'; |
| 1513 | - $label3 = __( 'Help text', 'invoicing' ); |
|
| 1514 | - $label4 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1513 | + $label3 = __('Help text', 'invoicing'); |
|
| 1514 | + $label4 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1515 | 1515 | $id3 = $field . '.id + "_edit3"'; |
| 1516 | - $label5 = __( 'Is this field required?', 'invoicing' ); |
|
| 1516 | + $label5 = __('Is this field required?', 'invoicing'); |
|
| 1517 | 1517 | $id4 = $field . '.id + "_edit4"'; |
| 1518 | 1518 | echo " |
| 1519 | 1519 | <div $restrict> |
@@ -1541,23 +1541,23 @@ discard block |
||
| 1541 | 1541 | /** |
| 1542 | 1542 | * Renders the separator element template. |
| 1543 | 1543 | */ |
| 1544 | - public function render_separator_template( $field ) { |
|
| 1545 | - $restrict = $this->get_restrict_markup( $field, 'separator' ); |
|
| 1544 | + public function render_separator_template($field) { |
|
| 1545 | + $restrict = $this->get_restrict_markup($field, 'separator'); |
|
| 1546 | 1546 | echo "<hr class='featurette-divider mt-0 mb-2' $restrict>"; |
| 1547 | 1547 | } |
| 1548 | 1548 | |
| 1549 | 1549 | /** |
| 1550 | 1550 | * Renders the separator element on the frontend. |
| 1551 | 1551 | */ |
| 1552 | - public function frontend_render_separator_template( $field ) { |
|
| 1552 | + public function frontend_render_separator_template($field) { |
|
| 1553 | 1553 | echo '<hr class="featurette-divider mt-0 mb-2" />'; |
| 1554 | 1554 | } |
| 1555 | 1555 | |
| 1556 | 1556 | /** |
| 1557 | 1557 | * Renders the pay button element template. |
| 1558 | 1558 | */ |
| 1559 | - public function render_pay_button_template( $field ) { |
|
| 1560 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
| 1559 | + public function render_pay_button_template($field) { |
|
| 1560 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
| 1561 | 1561 | $label = "$field.label"; |
| 1562 | 1562 | echo " |
| 1563 | 1563 | <div $restrict> |
@@ -1570,28 +1570,28 @@ discard block |
||
| 1570 | 1570 | /** |
| 1571 | 1571 | * Renders the pay_button element on the frontend. |
| 1572 | 1572 | */ |
| 1573 | - public function frontend_render_pay_button_template( $field ) { |
|
| 1573 | + public function frontend_render_pay_button_template($field) { |
|
| 1574 | 1574 | |
| 1575 | 1575 | echo "<div class='mt-4 mb-4'>"; |
| 1576 | - do_action( 'wpinv_payment_mode_select' ); |
|
| 1576 | + do_action('wpinv_payment_mode_select'); |
|
| 1577 | 1577 | echo "</div>"; |
| 1578 | 1578 | |
| 1579 | 1579 | echo "<div class='form-group'>"; |
| 1580 | 1580 | |
| 1581 | - $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class( $field['class'] ); |
|
| 1581 | + $class = 'wpinv-payment-form-submit btn btn-block submit-button ' . sanitize_html_class($field['class']); |
|
| 1582 | 1582 | echo aui()->input( |
| 1583 | 1583 | array( |
| 1584 | - 'name' => esc_attr( $field['id'] ), |
|
| 1585 | - 'id' => esc_attr( $field['id'] ), |
|
| 1586 | - 'value' => esc_attr( $field['label'] ), |
|
| 1584 | + 'name' => esc_attr($field['id']), |
|
| 1585 | + 'id' => esc_attr($field['id']), |
|
| 1586 | + 'value' => esc_attr($field['label']), |
|
| 1587 | 1587 | 'no_wrap' => true, |
| 1588 | 1588 | 'type' => 'submit', |
| 1589 | 1589 | 'class' => $class, |
| 1590 | 1590 | ) |
| 1591 | 1591 | ); |
| 1592 | 1592 | |
| 1593 | - if ( ! empty( $field['description'] ) ) { |
|
| 1594 | - $description = wp_kses_post( $field['description'] ); |
|
| 1593 | + if (!empty($field['description'])) { |
|
| 1594 | + $description = wp_kses_post($field['description']); |
|
| 1595 | 1595 | echo "<small class='form-text text-muted'>$description</small>"; |
| 1596 | 1596 | } |
| 1597 | 1597 | |
@@ -1602,14 +1602,14 @@ discard block |
||
| 1602 | 1602 | /** |
| 1603 | 1603 | * Renders the pay button element template. |
| 1604 | 1604 | */ |
| 1605 | - public function edit_pay_button_template( $field ) { |
|
| 1606 | - $restrict = $this->get_restrict_markup( $field, 'pay_button' ); |
|
| 1607 | - $label = __( 'Button Text', 'invoicing' ); |
|
| 1605 | + public function edit_pay_button_template($field) { |
|
| 1606 | + $restrict = $this->get_restrict_markup($field, 'pay_button'); |
|
| 1607 | + $label = __('Button Text', 'invoicing'); |
|
| 1608 | 1608 | $id = $field . '.id + "_edit"'; |
| 1609 | - $label2 = __( 'Help text', 'invoicing' ); |
|
| 1610 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1609 | + $label2 = __('Help text', 'invoicing'); |
|
| 1610 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1611 | 1611 | $id2 = $field . '.id + "_edit2"'; |
| 1612 | - $label4 = esc_attr__( 'Button Type', 'invoicing' ); |
|
| 1612 | + $label4 = esc_attr__('Button Type', 'invoicing'); |
|
| 1613 | 1613 | $id3 = $field . '.id + "_edit3"'; |
| 1614 | 1614 | echo " |
| 1615 | 1615 | <div $restrict> |
@@ -1625,15 +1625,15 @@ discard block |
||
| 1625 | 1625 | <label :for='$id3'>$label4</label> |
| 1626 | 1626 | |
| 1627 | 1627 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
| 1628 | - <option value='btn-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
| 1629 | - <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
| 1630 | - <option value='btn-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
| 1631 | - <option value='btn-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
| 1632 | - <option value='btn-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
| 1633 | - <option value='btn-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
| 1634 | - <option value='btn-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
| 1635 | - <option value='btn-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
| 1636 | - <option value='btn-link'>" . __( 'Link', 'invoicing' ) ."</option> |
|
| 1628 | + <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option> |
|
| 1629 | + <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
| 1630 | + <option value='btn-success'>" . __('Success', 'invoicing') . "</option> |
|
| 1631 | + <option value='btn-danger'>" . __('Danger', 'invoicing') . "</option> |
|
| 1632 | + <option value='btn-warning'>" . __('Warning', 'invoicing') . "</option> |
|
| 1633 | + <option value='btn-info'>" . __('Info', 'invoicing') . "</option> |
|
| 1634 | + <option value='btn-light'>" . __('Light', 'invoicing') . "</option> |
|
| 1635 | + <option value='btn-dark'>" . __('Dark', 'invoicing') . "</option> |
|
| 1636 | + <option value='btn-link'>" . __('Link', 'invoicing') . "</option> |
|
| 1637 | 1637 | </select> |
| 1638 | 1638 | </div> |
| 1639 | 1639 | </div> |
@@ -1644,8 +1644,8 @@ discard block |
||
| 1644 | 1644 | /** |
| 1645 | 1645 | * Renders the alert element template. |
| 1646 | 1646 | */ |
| 1647 | - public function render_alert_template( $field ) { |
|
| 1648 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
| 1647 | + public function render_alert_template($field) { |
|
| 1648 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
| 1649 | 1649 | $text = "$field.text"; |
| 1650 | 1650 | echo " |
| 1651 | 1651 | <div $restrict class='alert' :class='$field.class' role='alert'> |
@@ -1660,15 +1660,15 @@ discard block |
||
| 1660 | 1660 | /** |
| 1661 | 1661 | * Renders the alert element on the frontend. |
| 1662 | 1662 | */ |
| 1663 | - public function frontend_render_alert_template( $field ) { |
|
| 1663 | + public function frontend_render_alert_template($field) { |
|
| 1664 | 1664 | |
| 1665 | 1665 | echo "<div class='form-group'>"; |
| 1666 | 1666 | |
| 1667 | 1667 | echo aui()->alert( |
| 1668 | 1668 | array( |
| 1669 | - 'content' => wp_kses_post( $field['text'] ), |
|
| 1669 | + 'content' => wp_kses_post($field['text']), |
|
| 1670 | 1670 | 'dismissible' => $field['dismissible'], |
| 1671 | - 'type' => str_replace( 'alert-', '', $field['class'] ), |
|
| 1671 | + 'type' => str_replace('alert-', '', $field['class']), |
|
| 1672 | 1672 | ) |
| 1673 | 1673 | ); |
| 1674 | 1674 | |
@@ -1679,14 +1679,14 @@ discard block |
||
| 1679 | 1679 | /** |
| 1680 | 1680 | * Renders the alert element template. |
| 1681 | 1681 | */ |
| 1682 | - public function edit_alert_template( $field ) { |
|
| 1683 | - $restrict = $this->get_restrict_markup( $field, 'alert' ); |
|
| 1684 | - $label = __( 'Alert Text', 'invoicing' ); |
|
| 1685 | - $label2 = esc_attr__( 'Enter your alert text here', 'invoicing' ); |
|
| 1682 | + public function edit_alert_template($field) { |
|
| 1683 | + $restrict = $this->get_restrict_markup($field, 'alert'); |
|
| 1684 | + $label = __('Alert Text', 'invoicing'); |
|
| 1685 | + $label2 = esc_attr__('Enter your alert text here', 'invoicing'); |
|
| 1686 | 1686 | $id = $field . '.id + "_edit"'; |
| 1687 | - $label3 = __( 'Is Dismissible?', 'invoicing' ); |
|
| 1687 | + $label3 = __('Is Dismissible?', 'invoicing'); |
|
| 1688 | 1688 | $id2 = $field . '.id + "_edit2"'; |
| 1689 | - $label4 = esc_attr__( 'Alert Type', 'invoicing' ); |
|
| 1689 | + $label4 = esc_attr__('Alert Type', 'invoicing'); |
|
| 1690 | 1690 | $id3 = $field . '.id + "_edit3"'; |
| 1691 | 1691 | echo " |
| 1692 | 1692 | <div $restrict> |
@@ -1702,14 +1702,14 @@ discard block |
||
| 1702 | 1702 | <label :for='$id3'>$label4</label> |
| 1703 | 1703 | |
| 1704 | 1704 | <select class='form-control custom-select' :id='$id3' v-model='$field.class'> |
| 1705 | - <option value='alert-primary'>" . __( 'Primary', 'invoicing' ) ."</option> |
|
| 1706 | - <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option> |
|
| 1707 | - <option value='alert-success'>" . __( 'Success', 'invoicing' ) ."</option> |
|
| 1708 | - <option value='alert-danger'>" . __( 'Danger', 'invoicing' ) ."</option> |
|
| 1709 | - <option value='alert-warning'>" . __( 'Warning', 'invoicing' ) ."</option> |
|
| 1710 | - <option value='alert-info'>" . __( 'Info', 'invoicing' ) ."</option> |
|
| 1711 | - <option value='alert-light'>" . __( 'Light', 'invoicing' ) ."</option> |
|
| 1712 | - <option value='alert-dark'>" . __( 'Dark', 'invoicing' ) ."</option> |
|
| 1705 | + <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option> |
|
| 1706 | + <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option> |
|
| 1707 | + <option value='alert-success'>" . __('Success', 'invoicing') . "</option> |
|
| 1708 | + <option value='alert-danger'>" . __('Danger', 'invoicing') . "</option> |
|
| 1709 | + <option value='alert-warning'>" . __('Warning', 'invoicing') . "</option> |
|
| 1710 | + <option value='alert-info'>" . __('Info', 'invoicing') . "</option> |
|
| 1711 | + <option value='alert-light'>" . __('Light', 'invoicing') . "</option> |
|
| 1712 | + <option value='alert-dark'>" . __('Dark', 'invoicing') . "</option> |
|
| 1713 | 1713 | </select> |
| 1714 | 1714 | </div> |
| 1715 | 1715 | </div> |
@@ -1720,8 +1720,8 @@ discard block |
||
| 1720 | 1720 | /** |
| 1721 | 1721 | * Renders the discount element template. |
| 1722 | 1722 | */ |
| 1723 | - public function render_discount_template( $field ) { |
|
| 1724 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
| 1723 | + public function render_discount_template($field) { |
|
| 1724 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
| 1725 | 1725 | ?> |
| 1726 | 1726 | |
| 1727 | 1727 | <div <?php echo $restrict; ?> class="discount_field border rounded p-3"> |
@@ -1738,13 +1738,13 @@ discard block |
||
| 1738 | 1738 | /** |
| 1739 | 1739 | * Renders the discount element on the frontend. |
| 1740 | 1740 | */ |
| 1741 | - public function frontend_render_discount_template( $field ) { |
|
| 1741 | + public function frontend_render_discount_template($field) { |
|
| 1742 | 1742 | |
| 1743 | - $placeholder = esc_attr( $field['input_label'] ); |
|
| 1744 | - $label = sanitize_text_field( $field['button_label'] ); |
|
| 1743 | + $placeholder = esc_attr($field['input_label']); |
|
| 1744 | + $label = sanitize_text_field($field['button_label']); |
|
| 1745 | 1745 | $description = ''; |
| 1746 | 1746 | |
| 1747 | - if ( ! empty( $field['description'] ) ) { |
|
| 1747 | + if (!empty($field['description'])) { |
|
| 1748 | 1748 | $description = "<small class='form-text text-muted'>{$field['description']}</small>"; |
| 1749 | 1749 | } |
| 1750 | 1750 | ?> |
@@ -1765,12 +1765,12 @@ discard block |
||
| 1765 | 1765 | /** |
| 1766 | 1766 | * Renders the discount element template. |
| 1767 | 1767 | */ |
| 1768 | - public function edit_discount_template( $field ) { |
|
| 1769 | - $restrict = $this->get_restrict_markup( $field, 'discount' ); |
|
| 1770 | - $label = __( 'Discount Input Placeholder', 'invoicing' ); |
|
| 1771 | - $label2 = __( 'Help Text', 'invoicing' ); |
|
| 1772 | - $label3 = esc_attr__( 'Add some help text for this field', 'invoicing' ); |
|
| 1773 | - $label4 = __( 'Button Text', 'invoicing' ); |
|
| 1768 | + public function edit_discount_template($field) { |
|
| 1769 | + $restrict = $this->get_restrict_markup($field, 'discount'); |
|
| 1770 | + $label = __('Discount Input Placeholder', 'invoicing'); |
|
| 1771 | + $label2 = __('Help Text', 'invoicing'); |
|
| 1772 | + $label3 = esc_attr__('Add some help text for this field', 'invoicing'); |
|
| 1773 | + $label4 = __('Button Text', 'invoicing'); |
|
| 1774 | 1774 | $id = $field . '.id + "_edit"'; |
| 1775 | 1775 | $id2 = $field . '.id + "_edit2"'; |
| 1776 | 1776 | $id3 = $field . '.id + "_edit3"'; |
@@ -1799,11 +1799,11 @@ discard block |
||
| 1799 | 1799 | /** |
| 1800 | 1800 | * Renders the items element template. |
| 1801 | 1801 | */ |
| 1802 | - public function render_items_template( $field ) { |
|
| 1803 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
| 1804 | - $label = __( 'Item totals will appear here. Click to set items.', 'invoicing' ); |
|
| 1805 | - $label2 = __( 'Your form allows customers to buy several recurring items. This is not supported and will lead to unexpected behaviour.', 'invoicing' ); |
|
| 1806 | - $label2 .= ' ' . __( 'To prevent this, limit customers to selecting a single item.', 'invoicing' ); |
|
| 1802 | + public function render_items_template($field) { |
|
| 1803 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
| 1804 | + $label = __('Item totals will appear here. Click to set items.', 'invoicing'); |
|
| 1805 | + $label2 = __('Your form allows customers to buy several recurring items. This is not supported and will lead to unexpected behaviour.', 'invoicing'); |
|
| 1806 | + $label2 .= ' ' . __('To prevent this, limit customers to selecting a single item.', 'invoicing'); |
|
| 1807 | 1807 | echo " |
| 1808 | 1808 | <div $restrict class='item_totals text-center'> |
| 1809 | 1809 | <div v-if='canCheckoutSeveralSubscriptions($field)' class='p-4 bg-danger text-light'>$label2</div> |
@@ -1815,12 +1815,12 @@ discard block |
||
| 1815 | 1815 | /** |
| 1816 | 1816 | * Renders the items element on the frontend. |
| 1817 | 1817 | */ |
| 1818 | - public function frontend_render_items_template( $field, $items ) { |
|
| 1818 | + public function frontend_render_items_template($field, $items) { |
|
| 1819 | 1819 | |
| 1820 | 1820 | echo "<div class='form-group item_totals'>"; |
| 1821 | 1821 | |
| 1822 | - $id = esc_attr( $field['id'] ); |
|
| 1823 | - if ( 'total' == $field[ 'items_type' ] ) { |
|
| 1822 | + $id = esc_attr($field['id']); |
|
| 1823 | + if ('total' == $field['items_type']) { |
|
| 1824 | 1824 | $total = 0; |
| 1825 | 1825 | $tax = 0; |
| 1826 | 1826 | $sub_total = 0; |
@@ -1829,16 +1829,16 @@ discard block |
||
| 1829 | 1829 | <div class="border item_totals_type_total"> |
| 1830 | 1830 | |
| 1831 | 1831 | <?php |
| 1832 | - foreach( $items as $item ) { |
|
| 1832 | + foreach ($items as $item) { |
|
| 1833 | 1833 | |
| 1834 | - $amount = floatval( $item['price'] ); |
|
| 1834 | + $amount = floatval($item['price']); |
|
| 1835 | 1835 | |
| 1836 | - if ( wpinv_use_taxes() ) { |
|
| 1836 | + if (wpinv_use_taxes()) { |
|
| 1837 | 1837 | |
| 1838 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
| 1838 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
| 1839 | 1839 | |
| 1840 | - if ( wpinv_prices_include_tax() ) { |
|
| 1841 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
| 1840 | + if (wpinv_prices_include_tax()) { |
|
| 1841 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
| 1842 | 1842 | $item_tax = $amount - $pre_tax; |
| 1843 | 1843 | } else { |
| 1844 | 1844 | $pre_tax = $amount; |
@@ -1850,27 +1850,27 @@ discard block |
||
| 1850 | 1850 | $total = $sub_total + $tax; |
| 1851 | 1851 | |
| 1852 | 1852 | } else { |
| 1853 | - $total = $total + $amount; |
|
| 1853 | + $total = $total + $amount; |
|
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | 1856 | $class = 'col-8'; |
| 1857 | 1857 | $class2 = ''; |
| 1858 | 1858 | |
| 1859 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
| 1859 | + if (!empty($item['allow_quantities'])) { |
|
| 1860 | 1860 | $class = 'col-6 pt-2'; |
| 1861 | 1861 | $class2 = 'pt-2'; |
| 1862 | 1862 | } |
| 1863 | 1863 | |
| 1864 | - if ( ! empty( $item['custom_price'] ) ) { |
|
| 1864 | + if (!empty($item['custom_price'])) { |
|
| 1865 | 1865 | $class .= ' pt-2'; |
| 1866 | 1866 | } |
| 1867 | 1867 | |
| 1868 | 1868 | ?> |
| 1869 | 1869 | <div class="item_totals_item"> |
| 1870 | 1870 | <div class='row pl-2 pr-2 pt-2'> |
| 1871 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
| 1871 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
| 1872 | 1872 | |
| 1873 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
| 1873 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
| 1874 | 1874 | |
| 1875 | 1875 | <div class='col-2'> |
| 1876 | 1876 | <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> |
@@ -1878,11 +1878,11 @@ discard block |
||
| 1878 | 1878 | |
| 1879 | 1879 | <?php } else { ?> |
| 1880 | 1880 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
| 1881 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
| 1881 | + <?php } if (empty($item['custom_price'])) { ?> |
|
| 1882 | 1882 | |
| 1883 | 1883 | <div class='col-4 <?php echo $class2; ?>'> |
| 1884 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
| 1885 | - <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
| 1884 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
| 1885 | + <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
| 1886 | 1886 | </div> |
| 1887 | 1887 | |
| 1888 | 1888 | <?php } else {?> |
@@ -1890,15 +1890,15 @@ discard block |
||
| 1890 | 1890 | <div class='col-4'> |
| 1891 | 1891 | <div class='input-group'> |
| 1892 | 1892 | |
| 1893 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
| 1893 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
| 1894 | 1894 | <div class='input-group-prepend'> |
| 1895 | 1895 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 1896 | 1896 | </div> |
| 1897 | 1897 | <?php } ?> |
| 1898 | 1898 | |
| 1899 | - <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'] ); ?>'> |
|
| 1899 | + <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']); ?>'> |
|
| 1900 | 1900 | |
| 1901 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
| 1901 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
| 1902 | 1902 | <div class='input-group-append'> |
| 1903 | 1903 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 1904 | 1904 | </div> |
@@ -1909,28 +1909,28 @@ discard block |
||
| 1909 | 1909 | <?php } ?> |
| 1910 | 1910 | |
| 1911 | 1911 | </div> |
| 1912 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
| 1913 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
| 1912 | + <?php if (!empty($item['description'])) { ?> |
|
| 1913 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
| 1914 | 1914 | <?php } ?> |
| 1915 | 1915 | </div> |
| 1916 | 1916 | <?php } ?> |
| 1917 | 1917 | |
| 1918 | 1918 | <div class='mt-4 border-top item_totals_total p-2'> |
| 1919 | 1919 | |
| 1920 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
| 1920 | + <?php if (wpinv_use_taxes()) { ?> |
|
| 1921 | 1921 | <div class='row'> |
| 1922 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
| 1923 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
| 1922 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
| 1923 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
| 1924 | 1924 | </div> |
| 1925 | 1925 | <div class='row'> |
| 1926 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
| 1927 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
| 1926 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
| 1927 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
| 1928 | 1928 | </div> |
| 1929 | 1929 | <?php } ?> |
| 1930 | 1930 | |
| 1931 | 1931 | <div class='row'> |
| 1932 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
| 1933 | - <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> |
|
| 1932 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
| 1933 | + <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> |
|
| 1934 | 1934 | </div> |
| 1935 | 1935 | |
| 1936 | 1936 | </div> |
@@ -1938,22 +1938,22 @@ discard block |
||
| 1938 | 1938 | </div> |
| 1939 | 1939 | <?php } ?> |
| 1940 | 1940 | |
| 1941 | - <?php if ( 'radio' == $field[ 'items_type' ] ) { ?> |
|
| 1941 | + <?php if ('radio' == $field['items_type']) { ?> |
|
| 1942 | 1942 | <div class="item_totals_type_radio"> |
| 1943 | 1943 | |
| 1944 | 1944 | <?php |
| 1945 | - foreach( $items as $index => $item ) { |
|
| 1945 | + foreach ($items as $index => $item) { |
|
| 1946 | 1946 | |
| 1947 | - if ( ! empty( $item['required'] ) ) { |
|
| 1947 | + if (!empty($item['required'])) { |
|
| 1948 | 1948 | continue; |
| 1949 | 1949 | } |
| 1950 | 1950 | ?> |
| 1951 | 1951 | <div class="form-check"> |
| 1952 | - <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'> |
|
| 1953 | - <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> |
|
| 1952 | + <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'> |
|
| 1953 | + <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> |
|
| 1954 | 1954 | </div> |
| 1955 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
| 1956 | - <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
| 1955 | + <?php if (!empty($item['description'])) { ?> |
|
| 1956 | + <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
| 1957 | 1957 | <?php } ?> |
| 1958 | 1958 | <?php } ?> |
| 1959 | 1959 | |
@@ -1965,32 +1965,32 @@ discard block |
||
| 1965 | 1965 | $tax = 0; |
| 1966 | 1966 | $sub_total = 0; |
| 1967 | 1967 | |
| 1968 | - foreach ( $items as $item ) { |
|
| 1968 | + foreach ($items as $item) { |
|
| 1969 | 1969 | |
| 1970 | 1970 | $class = 'col-8'; |
| 1971 | 1971 | $class2 = ''; |
| 1972 | 1972 | |
| 1973 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
| 1973 | + if (!empty($item['allow_quantities'])) { |
|
| 1974 | 1974 | $class = 'col-6 pt-2'; |
| 1975 | 1975 | $class2 = 'pt-2'; |
| 1976 | 1976 | } |
| 1977 | 1977 | |
| 1978 | - if ( ! empty( $item['custom_price'] ) ) { |
|
| 1978 | + if (!empty($item['custom_price'])) { |
|
| 1979 | 1979 | $class .= ' pt-2'; |
| 1980 | 1980 | } |
| 1981 | 1981 | |
| 1982 | 1982 | $class3 = 'd-none'; |
| 1983 | 1983 | $name = ''; |
| 1984 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_radio_item ) ) { |
|
| 1984 | + if (!empty($item['required']) || !isset($totals_selected_radio_item)) { |
|
| 1985 | 1985 | |
| 1986 | - $amount = floatval( $item['price'] ); |
|
| 1986 | + $amount = floatval($item['price']); |
|
| 1987 | 1987 | |
| 1988 | - if ( wpinv_use_taxes() ) { |
|
| 1988 | + if (wpinv_use_taxes()) { |
|
| 1989 | 1989 | |
| 1990 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
| 1990 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
| 1991 | 1991 | |
| 1992 | - if ( wpinv_prices_include_tax() ) { |
|
| 1993 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
| 1992 | + if (wpinv_prices_include_tax()) { |
|
| 1993 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
| 1994 | 1994 | $item_tax = $amount - $pre_tax; |
| 1995 | 1995 | } else { |
| 1996 | 1996 | $pre_tax = $amount; |
@@ -2002,13 +2002,13 @@ discard block |
||
| 2002 | 2002 | $total = $sub_total + $tax; |
| 2003 | 2003 | |
| 2004 | 2004 | } else { |
| 2005 | - $total = $total + $amount; |
|
| 2005 | + $total = $total + $amount; |
|
| 2006 | 2006 | } |
| 2007 | 2007 | |
| 2008 | 2008 | $class3 = ''; |
| 2009 | 2009 | $name = "wpinv-items[{$item['id']}]"; |
| 2010 | 2010 | |
| 2011 | - if ( empty( $item['required'] ) ) { |
|
| 2011 | + if (empty($item['required'])) { |
|
| 2012 | 2012 | $totals_selected_radio_item = 1; |
| 2013 | 2013 | } |
| 2014 | 2014 | |
@@ -2020,9 +2020,9 @@ discard block |
||
| 2020 | 2020 | |
| 2021 | 2021 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
| 2022 | 2022 | <div class='row pl-2 pr-2 pt-2'> |
| 2023 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
| 2023 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
| 2024 | 2024 | |
| 2025 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
| 2025 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
| 2026 | 2026 | |
| 2027 | 2027 | <div class='col-2'> |
| 2028 | 2028 | <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> |
@@ -2030,11 +2030,11 @@ discard block |
||
| 2030 | 2030 | |
| 2031 | 2031 | <?php } else { ?> |
| 2032 | 2032 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
| 2033 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
| 2033 | + <?php } if (empty($item['custom_price'])) { ?> |
|
| 2034 | 2034 | |
| 2035 | 2035 | <div class='col-4 <?php echo $class2; ?>'> |
| 2036 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
| 2037 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
| 2036 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
| 2037 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
| 2038 | 2038 | </div> |
| 2039 | 2039 | |
| 2040 | 2040 | <?php } else {?> |
@@ -2042,15 +2042,15 @@ discard block |
||
| 2042 | 2042 | <div class='col-4'> |
| 2043 | 2043 | <div class='input-group'> |
| 2044 | 2044 | |
| 2045 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
| 2045 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
| 2046 | 2046 | <div class='input-group-prepend'> |
| 2047 | 2047 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2048 | 2048 | </div> |
| 2049 | 2049 | <?php } ?> |
| 2050 | 2050 | |
| 2051 | - <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'] ); ?>'> |
|
| 2051 | + <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']); ?>'> |
|
| 2052 | 2052 | |
| 2053 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
| 2053 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
| 2054 | 2054 | <div class='input-group-append'> |
| 2055 | 2055 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2056 | 2056 | </div> |
@@ -2061,27 +2061,27 @@ discard block |
||
| 2061 | 2061 | <?php } ?> |
| 2062 | 2062 | |
| 2063 | 2063 | </div> |
| 2064 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
| 2065 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
| 2064 | + <?php if (!empty($item['description'])) { ?> |
|
| 2065 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
| 2066 | 2066 | <?php } ?> |
| 2067 | 2067 | </div> |
| 2068 | 2068 | <?php } ?> |
| 2069 | 2069 | |
| 2070 | 2070 | <div class='mt-4 border-top item_totals_total p-2'> |
| 2071 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
| 2071 | + <?php if (wpinv_use_taxes()) { ?> |
|
| 2072 | 2072 | <div class='row'> |
| 2073 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
| 2074 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
| 2073 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
| 2074 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
| 2075 | 2075 | </div> |
| 2076 | 2076 | <div class='row'> |
| 2077 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
| 2078 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
| 2077 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
| 2078 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
| 2079 | 2079 | </div> |
| 2080 | 2080 | <?php } ?> |
| 2081 | 2081 | |
| 2082 | 2082 | <div class='row'> |
| 2083 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
| 2084 | - <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> |
|
| 2083 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
| 2084 | + <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> |
|
| 2085 | 2085 | </div> |
| 2086 | 2086 | </div> |
| 2087 | 2087 | |
@@ -2089,22 +2089,22 @@ discard block |
||
| 2089 | 2089 | </div> |
| 2090 | 2090 | <?php } ?> |
| 2091 | 2091 | |
| 2092 | - <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?> |
|
| 2092 | + <?php if ('checkbox' == $field['items_type']) { ?> |
|
| 2093 | 2093 | |
| 2094 | 2094 | <div class="item_totals_type_checkbox"> |
| 2095 | 2095 | |
| 2096 | 2096 | <?php |
| 2097 | - foreach ( $items as $index => $item ) { |
|
| 2097 | + foreach ($items as $index => $item) { |
|
| 2098 | 2098 | |
| 2099 | - if ( ! empty( $item['required'] ) ) { |
|
| 2099 | + if (!empty($item['required'])) { |
|
| 2100 | 2100 | continue; |
| 2101 | 2101 | } |
| 2102 | 2102 | |
| 2103 | - $title = sanitize_text_field( $item['title'] ); |
|
| 2104 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
| 2105 | - $item_id = esc_attr( $id . "_$index" ); |
|
| 2106 | - $value = esc_attr( $item['id'] ); |
|
| 2107 | - $checked = checked( ! isset( $selected_checkbox_item ), true, false ); |
|
| 2103 | + $title = sanitize_text_field($item['title']); |
|
| 2104 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
| 2105 | + $item_id = esc_attr($id . "_$index"); |
|
| 2106 | + $value = esc_attr($item['id']); |
|
| 2107 | + $checked = checked(!isset($selected_checkbox_item), true, false); |
|
| 2108 | 2108 | $selected_checkbox_item = 1; |
| 2109 | 2109 | |
| 2110 | 2110 | echo " |
@@ -2113,7 +2113,7 @@ discard block |
||
| 2113 | 2113 | <label for='$item_id' class='custom-control-label'>$title ($price)</label> |
| 2114 | 2114 | </div>"; |
| 2115 | 2115 | |
| 2116 | - if ( ! empty( $item['description'] ) ) { |
|
| 2116 | + if (!empty($item['description'])) { |
|
| 2117 | 2117 | echo "<small class='form-text text-muted'>{$item['description']}</small>"; |
| 2118 | 2118 | } |
| 2119 | 2119 | } |
@@ -2127,31 +2127,31 @@ discard block |
||
| 2127 | 2127 | $tax = 0; |
| 2128 | 2128 | $sub_total = 0; |
| 2129 | 2129 | |
| 2130 | - foreach ( $items as $item ) { |
|
| 2130 | + foreach ($items as $item) { |
|
| 2131 | 2131 | |
| 2132 | 2132 | $class = 'col-8'; |
| 2133 | 2133 | $class2 = ''; |
| 2134 | 2134 | |
| 2135 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
| 2135 | + if (!empty($item['allow_quantities'])) { |
|
| 2136 | 2136 | $class = 'col-6 pt-2'; |
| 2137 | 2137 | $class2 = 'pt-2'; |
| 2138 | 2138 | } |
| 2139 | 2139 | |
| 2140 | - if ( ! empty( $item['custom_price'] ) ) { |
|
| 2140 | + if (!empty($item['custom_price'])) { |
|
| 2141 | 2141 | $class .= ' pt-2'; |
| 2142 | 2142 | } |
| 2143 | 2143 | |
| 2144 | 2144 | $class3 = 'd-none'; |
| 2145 | - $name = ''; |
|
| 2146 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_checkbox_item ) ) { |
|
| 2145 | + $name = ''; |
|
| 2146 | + if (!empty($item['required']) || !isset($totals_selected_checkbox_item)) { |
|
| 2147 | 2147 | |
| 2148 | - $amount = floatval( $item['price'] ); |
|
| 2149 | - if ( wpinv_use_taxes() ) { |
|
| 2148 | + $amount = floatval($item['price']); |
|
| 2149 | + if (wpinv_use_taxes()) { |
|
| 2150 | 2150 | |
| 2151 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
| 2151 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
| 2152 | 2152 | |
| 2153 | - if ( wpinv_prices_include_tax() ) { |
|
| 2154 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
| 2153 | + if (wpinv_prices_include_tax()) { |
|
| 2154 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
| 2155 | 2155 | $item_tax = $amount - $pre_tax; |
| 2156 | 2156 | } else { |
| 2157 | 2157 | $pre_tax = $amount; |
@@ -2163,13 +2163,13 @@ discard block |
||
| 2163 | 2163 | $total = $sub_total + $tax; |
| 2164 | 2164 | |
| 2165 | 2165 | } else { |
| 2166 | - $total = $total + $amount; |
|
| 2166 | + $total = $total + $amount; |
|
| 2167 | 2167 | } |
| 2168 | 2168 | |
| 2169 | 2169 | $class3 = ''; |
| 2170 | - $name = "wpinv-items[{$item['id']}]"; |
|
| 2170 | + $name = "wpinv-items[{$item['id']}]"; |
|
| 2171 | 2171 | |
| 2172 | - if ( empty( $item['required'] ) ) { |
|
| 2172 | + if (empty($item['required'])) { |
|
| 2173 | 2173 | $totals_selected_checkbox_item = 1; |
| 2174 | 2174 | } |
| 2175 | 2175 | |
@@ -2181,9 +2181,9 @@ discard block |
||
| 2181 | 2181 | |
| 2182 | 2182 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
| 2183 | 2183 | <div class='row pl-2 pr-2 pt-2'> |
| 2184 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
| 2184 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
| 2185 | 2185 | |
| 2186 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
| 2186 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
| 2187 | 2187 | |
| 2188 | 2188 | <div class='col-2'> |
| 2189 | 2189 | <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> |
@@ -2191,11 +2191,11 @@ discard block |
||
| 2191 | 2191 | |
| 2192 | 2192 | <?php } else { ?> |
| 2193 | 2193 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
| 2194 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
| 2194 | + <?php } if (empty($item['custom_price'])) { ?> |
|
| 2195 | 2195 | |
| 2196 | 2196 | <div class='col-4 <?php echo $class2; ?>'> |
| 2197 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
| 2198 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
| 2197 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
| 2198 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
| 2199 | 2199 | </div> |
| 2200 | 2200 | |
| 2201 | 2201 | <?php } else {?> |
@@ -2203,15 +2203,15 @@ discard block |
||
| 2203 | 2203 | <div class='col-4'> |
| 2204 | 2204 | <div class='input-group'> |
| 2205 | 2205 | |
| 2206 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
| 2206 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
| 2207 | 2207 | <div class='input-group-prepend'> |
| 2208 | 2208 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2209 | 2209 | </div> |
| 2210 | 2210 | <?php } ?> |
| 2211 | 2211 | |
| 2212 | - <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'] ); ?>'> |
|
| 2212 | + <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']); ?>'> |
|
| 2213 | 2213 | |
| 2214 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
| 2214 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
| 2215 | 2215 | <div class='input-group-append'> |
| 2216 | 2216 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2217 | 2217 | </div> |
@@ -2222,35 +2222,35 @@ discard block |
||
| 2222 | 2222 | <?php } ?> |
| 2223 | 2223 | |
| 2224 | 2224 | </div> |
| 2225 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
| 2226 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
| 2225 | + <?php if (!empty($item['description'])) { ?> |
|
| 2226 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
| 2227 | 2227 | <?php } ?> |
| 2228 | 2228 | </div> |
| 2229 | 2229 | <?php } ?> |
| 2230 | 2230 | |
| 2231 | 2231 | <div class='mt-4 border-top item_totals_total p-2'> |
| 2232 | 2232 | |
| 2233 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
| 2233 | + <?php if (wpinv_use_taxes()) { ?> |
|
| 2234 | 2234 | <div class='row'> |
| 2235 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
| 2236 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
| 2235 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
| 2236 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
| 2237 | 2237 | </div> |
| 2238 | 2238 | <div class='row'> |
| 2239 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
| 2240 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
| 2239 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
| 2240 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
| 2241 | 2241 | </div> |
| 2242 | 2242 | <?php } ?> |
| 2243 | 2243 | |
| 2244 | 2244 | <div class='row'> |
| 2245 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
| 2246 | - <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> |
|
| 2245 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
| 2246 | + <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> |
|
| 2247 | 2247 | </div> |
| 2248 | 2248 | </div> |
| 2249 | 2249 | </div> |
| 2250 | 2250 | </div> |
| 2251 | 2251 | <?php } ?> |
| 2252 | 2252 | |
| 2253 | - <?php if ( 'select' == $field[ 'items_type' ] ) { ?> |
|
| 2253 | + <?php if ('select' == $field['items_type']) { ?> |
|
| 2254 | 2254 | |
| 2255 | 2255 | <div class="item_totals_type_select"> |
| 2256 | 2256 | |
@@ -2258,17 +2258,17 @@ discard block |
||
| 2258 | 2258 | |
| 2259 | 2259 | $options = array(); |
| 2260 | 2260 | $selected = ''; |
| 2261 | - foreach ( $items as $index => $item ) { |
|
| 2261 | + foreach ($items as $index => $item) { |
|
| 2262 | 2262 | |
| 2263 | - if ( ! empty( $item['required'] ) ) { |
|
| 2263 | + if (!empty($item['required'])) { |
|
| 2264 | 2264 | continue; |
| 2265 | 2265 | } |
| 2266 | 2266 | |
| 2267 | - $title = sanitize_text_field( $item['title'] ); |
|
| 2268 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
| 2269 | - $options[ $item['id'] ] = "$title ($price)"; |
|
| 2267 | + $title = sanitize_text_field($item['title']); |
|
| 2268 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
| 2269 | + $options[$item['id']] = "$title ($price)"; |
|
| 2270 | 2270 | |
| 2271 | - if ( ! isset( $selected_item ) ) { |
|
| 2271 | + if (!isset($selected_item)) { |
|
| 2272 | 2272 | $selected = $item['id']; |
| 2273 | 2273 | $selected_item = 1; |
| 2274 | 2274 | } |
@@ -2279,7 +2279,7 @@ discard block |
||
| 2279 | 2279 | array( |
| 2280 | 2280 | 'name' => 'payment-form-items', |
| 2281 | 2281 | 'id' => $id, |
| 2282 | - 'placeholder' => __( 'Select an item', 'invoicing' ), |
|
| 2282 | + 'placeholder' => __('Select an item', 'invoicing'), |
|
| 2283 | 2283 | 'no_wrap' => true, |
| 2284 | 2284 | 'options' => $options, |
| 2285 | 2285 | 'class' => 'wpi_select2 wpinv-items-select-selector', |
@@ -2296,31 +2296,31 @@ discard block |
||
| 2296 | 2296 | $tax = 0; |
| 2297 | 2297 | $sub_total = 0; |
| 2298 | 2298 | |
| 2299 | - foreach ( $items as $item ) { |
|
| 2299 | + foreach ($items as $item) { |
|
| 2300 | 2300 | |
| 2301 | 2301 | $class = 'col-8'; |
| 2302 | 2302 | $class2 = ''; |
| 2303 | 2303 | |
| 2304 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
| 2304 | + if (!empty($item['allow_quantities'])) { |
|
| 2305 | 2305 | $class = 'col-6 pt-2'; |
| 2306 | 2306 | $class2 = 'pt-2'; |
| 2307 | 2307 | } |
| 2308 | 2308 | |
| 2309 | - if ( ! empty( $item['custom_price'] ) ) { |
|
| 2309 | + if (!empty($item['custom_price'])) { |
|
| 2310 | 2310 | $class .= ' pt-2'; |
| 2311 | 2311 | } |
| 2312 | 2312 | |
| 2313 | 2313 | $class3 = 'd-none'; |
| 2314 | - $name = ''; |
|
| 2315 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) { |
|
| 2314 | + $name = ''; |
|
| 2315 | + if (!empty($item['required']) || !isset($totals_selected_select_item)) { |
|
| 2316 | 2316 | |
| 2317 | - $amount = floatval( $item['price'] ); |
|
| 2318 | - if ( wpinv_use_taxes() ) { |
|
| 2317 | + $amount = floatval($item['price']); |
|
| 2318 | + if (wpinv_use_taxes()) { |
|
| 2319 | 2319 | |
| 2320 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
| 2320 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
| 2321 | 2321 | |
| 2322 | - if ( wpinv_prices_include_tax() ) { |
|
| 2323 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
| 2322 | + if (wpinv_prices_include_tax()) { |
|
| 2323 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
| 2324 | 2324 | $item_tax = $amount - $pre_tax; |
| 2325 | 2325 | } else { |
| 2326 | 2326 | $pre_tax = $amount; |
@@ -2332,13 +2332,13 @@ discard block |
||
| 2332 | 2332 | $total = $sub_total + $tax; |
| 2333 | 2333 | |
| 2334 | 2334 | } else { |
| 2335 | - $total = $total + $amount; |
|
| 2335 | + $total = $total + $amount; |
|
| 2336 | 2336 | } |
| 2337 | 2337 | |
| 2338 | 2338 | $class3 = ''; |
| 2339 | - $name = "wpinv-items[{$item['id']}]"; |
|
| 2339 | + $name = "wpinv-items[{$item['id']}]"; |
|
| 2340 | 2340 | |
| 2341 | - if ( empty( $item['required'] ) ) { |
|
| 2341 | + if (empty($item['required'])) { |
|
| 2342 | 2342 | $totals_selected_select_item = 1; |
| 2343 | 2343 | } |
| 2344 | 2344 | |
@@ -2350,9 +2350,9 @@ discard block |
||
| 2350 | 2350 | |
| 2351 | 2351 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
| 2352 | 2352 | <div class='row pl-2 pr-2 pt-2'> |
| 2353 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
| 2353 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
| 2354 | 2354 | |
| 2355 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
| 2355 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
| 2356 | 2356 | |
| 2357 | 2357 | <div class='col-2'> |
| 2358 | 2358 | <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> |
@@ -2360,11 +2360,11 @@ discard block |
||
| 2360 | 2360 | |
| 2361 | 2361 | <?php } else { ?> |
| 2362 | 2362 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
| 2363 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
| 2363 | + <?php } if (empty($item['custom_price'])) { ?> |
|
| 2364 | 2364 | |
| 2365 | 2365 | <div class='col-4 <?php echo $class2; ?>'> |
| 2366 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
| 2367 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
| 2366 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
| 2367 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
| 2368 | 2368 | </div> |
| 2369 | 2369 | |
| 2370 | 2370 | <?php } else {?> |
@@ -2372,15 +2372,15 @@ discard block |
||
| 2372 | 2372 | <div class='col-4'> |
| 2373 | 2373 | <div class='input-group'> |
| 2374 | 2374 | |
| 2375 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
| 2375 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
| 2376 | 2376 | <div class='input-group-prepend'> |
| 2377 | 2377 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2378 | 2378 | </div> |
| 2379 | 2379 | <?php } ?> |
| 2380 | 2380 | |
| 2381 | - <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'] ); ?>'> |
|
| 2381 | + <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']); ?>'> |
|
| 2382 | 2382 | |
| 2383 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
| 2383 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
| 2384 | 2384 | <div class='input-group-append'> |
| 2385 | 2385 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2386 | 2386 | </div> |
@@ -2391,34 +2391,34 @@ discard block |
||
| 2391 | 2391 | <?php } ?> |
| 2392 | 2392 | |
| 2393 | 2393 | </div> |
| 2394 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
| 2395 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
| 2394 | + <?php if (!empty($item['description'])) { ?> |
|
| 2395 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
| 2396 | 2396 | <?php } ?> |
| 2397 | 2397 | </div> |
| 2398 | 2398 | <?php } ?> |
| 2399 | 2399 | |
| 2400 | 2400 | <div class='mt-4 border-top item_totals_total p-2'> |
| 2401 | 2401 | |
| 2402 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
| 2402 | + <?php if (wpinv_use_taxes()) { ?> |
|
| 2403 | 2403 | <div class='row'> |
| 2404 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
| 2405 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
| 2404 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
| 2405 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
| 2406 | 2406 | </div> |
| 2407 | 2407 | <div class='row'> |
| 2408 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
| 2409 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
| 2408 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
| 2409 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
| 2410 | 2410 | </div> |
| 2411 | 2411 | <?php } ?> |
| 2412 | 2412 | <div class='row'> |
| 2413 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
| 2414 | - <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> |
|
| 2413 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
| 2414 | + <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> |
|
| 2415 | 2415 | </div> |
| 2416 | 2416 | </div> |
| 2417 | 2417 | |
| 2418 | 2418 | </div> |
| 2419 | 2419 | <?php } ?> |
| 2420 | 2420 | |
| 2421 | - <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?> |
|
| 2421 | + <?php if ('multi_select' == $field['items_type']) { ?> |
|
| 2422 | 2422 | |
| 2423 | 2423 | <div class="item_totals_type_multi_select"> |
| 2424 | 2424 | |
@@ -2427,18 +2427,18 @@ discard block |
||
| 2427 | 2427 | $options = array(); |
| 2428 | 2428 | $selected = array(); |
| 2429 | 2429 | |
| 2430 | - foreach ( $items as $index => $item ) { |
|
| 2430 | + foreach ($items as $index => $item) { |
|
| 2431 | 2431 | |
| 2432 | - if ( ! empty( $item['required'] ) ) { |
|
| 2432 | + if (!empty($item['required'])) { |
|
| 2433 | 2433 | continue; |
| 2434 | 2434 | } |
| 2435 | 2435 | |
| 2436 | - $title = sanitize_text_field( $item['title'] ); |
|
| 2437 | - $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field( $item['price'] ) ) ); |
|
| 2438 | - $options[ $item['id'] ] = "$title ($price)"; |
|
| 2436 | + $title = sanitize_text_field($item['title']); |
|
| 2437 | + $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); |
|
| 2438 | + $options[$item['id']] = "$title ($price)"; |
|
| 2439 | 2439 | |
| 2440 | - if ( ! isset( $selected_item ) ) { |
|
| 2441 | - $selected = array( $item['id'] ); |
|
| 2440 | + if (!isset($selected_item)) { |
|
| 2441 | + $selected = array($item['id']); |
|
| 2442 | 2442 | $selected_item = 1; |
| 2443 | 2443 | } |
| 2444 | 2444 | |
@@ -2465,31 +2465,31 @@ discard block |
||
| 2465 | 2465 | $tax = 0; |
| 2466 | 2466 | $sub_total = 0; |
| 2467 | 2467 | |
| 2468 | - foreach ( $items as $item ) { |
|
| 2468 | + foreach ($items as $item) { |
|
| 2469 | 2469 | |
| 2470 | 2470 | $class = 'col-8'; |
| 2471 | 2471 | $class2 = ''; |
| 2472 | 2472 | |
| 2473 | - if ( ! empty( $item['allow_quantities'] ) ) { |
|
| 2473 | + if (!empty($item['allow_quantities'])) { |
|
| 2474 | 2474 | $class = 'col-6 pt-2'; |
| 2475 | 2475 | $class2 = 'pt-2'; |
| 2476 | 2476 | } |
| 2477 | 2477 | |
| 2478 | - if ( ! empty( $item['custom_price'] ) ) { |
|
| 2478 | + if (!empty($item['custom_price'])) { |
|
| 2479 | 2479 | $class .= ' pt-2'; |
| 2480 | 2480 | } |
| 2481 | 2481 | |
| 2482 | 2482 | $class3 = 'd-none'; |
| 2483 | - $name = ''; |
|
| 2484 | - if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) { |
|
| 2483 | + $name = ''; |
|
| 2484 | + if (!empty($item['required']) || !isset($totals_selected_select_item)) { |
|
| 2485 | 2485 | |
| 2486 | - $amount = floatval( $item['price'] ); |
|
| 2487 | - if ( wpinv_use_taxes() ) { |
|
| 2486 | + $amount = floatval($item['price']); |
|
| 2487 | + if (wpinv_use_taxes()) { |
|
| 2488 | 2488 | |
| 2489 | - $rate = wpinv_get_tax_rate( wpinv_get_default_country(), false, (int) $item['id'] ); |
|
| 2489 | + $rate = wpinv_get_tax_rate(wpinv_get_default_country(), false, (int) $item['id']); |
|
| 2490 | 2490 | |
| 2491 | - if ( wpinv_prices_include_tax() ) { |
|
| 2492 | - $pre_tax = ( $amount - $amount * $rate * 0.01 ); |
|
| 2491 | + if (wpinv_prices_include_tax()) { |
|
| 2492 | + $pre_tax = ($amount - $amount * $rate * 0.01); |
|
| 2493 | 2493 | $item_tax = $amount - $pre_tax; |
| 2494 | 2494 | } else { |
| 2495 | 2495 | $pre_tax = $amount; |
@@ -2501,13 +2501,13 @@ discard block |
||
| 2501 | 2501 | $total = $sub_total + $tax; |
| 2502 | 2502 | |
| 2503 | 2503 | } else { |
| 2504 | - $total = $total + $amount; |
|
| 2504 | + $total = $total + $amount; |
|
| 2505 | 2505 | } |
| 2506 | 2506 | |
| 2507 | 2507 | $class3 = ''; |
| 2508 | - $name = "wpinv-items[{$item['id']}]"; |
|
| 2508 | + $name = "wpinv-items[{$item['id']}]"; |
|
| 2509 | 2509 | |
| 2510 | - if ( empty( $item['required'] ) ) { |
|
| 2510 | + if (empty($item['required'])) { |
|
| 2511 | 2511 | $totals_selected_select_item = 1; |
| 2512 | 2512 | } |
| 2513 | 2513 | |
@@ -2519,9 +2519,9 @@ discard block |
||
| 2519 | 2519 | |
| 2520 | 2520 | <div class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>"> |
| 2521 | 2521 | <div class='row pl-2 pr-2 pt-2'> |
| 2522 | - <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div> |
|
| 2522 | + <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div> |
|
| 2523 | 2523 | |
| 2524 | - <?php if ( ! empty( $item['allow_quantities'] ) ) { ?> |
|
| 2524 | + <?php if (!empty($item['allow_quantities'])) { ?> |
|
| 2525 | 2525 | |
| 2526 | 2526 | <div class='col-2'> |
| 2527 | 2527 | <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> |
@@ -2529,11 +2529,11 @@ discard block |
||
| 2529 | 2529 | |
| 2530 | 2530 | <?php } else { ?> |
| 2531 | 2531 | <input type='hidden' class='wpinv-item-quantity-input' value='1'> |
| 2532 | - <?php } if ( empty( $item['custom_price'] ) ) { ?> |
|
| 2532 | + <?php } if (empty($item['custom_price'])) { ?> |
|
| 2533 | 2533 | |
| 2534 | 2534 | <div class='col-4 <?php echo $class2; ?>'> |
| 2535 | - <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?> |
|
| 2536 | - <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'> |
|
| 2535 | + <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?> |
|
| 2536 | + <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'> |
|
| 2537 | 2537 | </div> |
| 2538 | 2538 | |
| 2539 | 2539 | <?php } else {?> |
@@ -2541,15 +2541,15 @@ discard block |
||
| 2541 | 2541 | <div class='col-4'> |
| 2542 | 2542 | <div class='input-group'> |
| 2543 | 2543 | |
| 2544 | - <?php if ( 'left' == wpinv_currency_position() ) { ?> |
|
| 2544 | + <?php if ('left' == wpinv_currency_position()) { ?> |
|
| 2545 | 2545 | <div class='input-group-prepend'> |
| 2546 | 2546 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2547 | 2547 | </div> |
| 2548 | 2548 | <?php } ?> |
| 2549 | 2549 | |
| 2550 | - <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'] ); ?>'> |
|
| 2550 | + <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']); ?>'> |
|
| 2551 | 2551 | |
| 2552 | - <?php if ( 'left' != wpinv_currency_position() ) { ?> |
|
| 2552 | + <?php if ('left' != wpinv_currency_position()) { ?> |
|
| 2553 | 2553 | <div class='input-group-append'> |
| 2554 | 2554 | <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span> |
| 2555 | 2555 | </div> |
@@ -2560,35 +2560,35 @@ discard block |
||
| 2560 | 2560 | <?php } ?> |
| 2561 | 2561 | |
| 2562 | 2562 | </div> |
| 2563 | - <?php if ( ! empty( $item['description'] )) { ?> |
|
| 2564 | - <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small> |
|
| 2563 | + <?php if (!empty($item['description'])) { ?> |
|
| 2564 | + <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small> |
|
| 2565 | 2565 | <?php } ?> |
| 2566 | 2566 | </div> |
| 2567 | 2567 | <?php } ?> |
| 2568 | 2568 | |
| 2569 | 2569 | <div class='mt-4 border-top item_totals_total p-2'> |
| 2570 | 2570 | |
| 2571 | - <?php if ( wpinv_use_taxes() ) { ?> |
|
| 2571 | + <?php if (wpinv_use_taxes()) { ?> |
|
| 2572 | 2572 | <div class='row'> |
| 2573 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Sub Total', 'invoicing' ); ?></strong></div> |
|
| 2574 | - <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price( wpinv_format_amount( $sub_total ) ) ?></strong></div> |
|
| 2573 | + <div class='col-8'><strong class='mr-5'><?php _e('Sub Total', 'invoicing'); ?></strong></div> |
|
| 2574 | + <div class='col-4'><strong class='wpinv-items-sub-total'><?php echo wpinv_price(wpinv_format_amount($sub_total)) ?></strong></div> |
|
| 2575 | 2575 | </div> |
| 2576 | 2576 | <div class='row'> |
| 2577 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Tax', 'invoicing' ); ?></strong></div> |
|
| 2578 | - <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price( wpinv_format_amount( $tax ) ) ?></strong></div> |
|
| 2577 | + <div class='col-8'><strong class='mr-5'><?php _e('Tax', 'invoicing'); ?></strong></div> |
|
| 2578 | + <div class='col-4'><strong class='wpinv-items-tax' ><?php echo wpinv_price(wpinv_format_amount($tax)) ?></strong></div> |
|
| 2579 | 2579 | </div> |
| 2580 | 2580 | <?php } ?> |
| 2581 | 2581 | |
| 2582 | 2582 | <div class='row'> |
| 2583 | - <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div> |
|
| 2584 | - <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> |
|
| 2583 | + <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div> |
|
| 2584 | + <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> |
|
| 2585 | 2585 | </div> |
| 2586 | 2586 | </div> |
| 2587 | 2587 | |
| 2588 | 2588 | </div> |
| 2589 | 2589 | <?php } ?> |
| 2590 | - <?php if ( ! empty( $field[ 'description' ] ) ) { ?> |
|
| 2591 | - <small class='form-text text-muted'><?php echo wp_kses_post( $field[ 'description' ] ); ?></small> |
|
| 2590 | + <?php if (!empty($field['description'])) { ?> |
|
| 2591 | + <small class='form-text text-muted'><?php echo wp_kses_post($field['description']); ?></small> |
|
| 2592 | 2592 | <?php } ?> |
| 2593 | 2593 | </div> |
| 2594 | 2594 | <?php |
@@ -2597,57 +2597,57 @@ discard block |
||
| 2597 | 2597 | /** |
| 2598 | 2598 | * Renders the items element template. |
| 2599 | 2599 | */ |
| 2600 | - public function edit_items_template( $field ) { |
|
| 2600 | + public function edit_items_template($field) { |
|
| 2601 | 2601 | global $wpinv_euvat, $post; |
| 2602 | 2602 | |
| 2603 | - $restrict = $this->get_restrict_markup( $field, 'items' ); |
|
| 2604 | - $label = __( 'Let customers...', 'invoicing' ); |
|
| 2605 | - $label2 = __( 'Available Items', 'invoicing' ); |
|
| 2606 | - $label3 = esc_attr__( 'Add some help text for this element', 'invoicing' ); |
|
| 2603 | + $restrict = $this->get_restrict_markup($field, 'items'); |
|
| 2604 | + $label = __('Let customers...', 'invoicing'); |
|
| 2605 | + $label2 = __('Available Items', 'invoicing'); |
|
| 2606 | + $label3 = esc_attr__('Add some help text for this element', 'invoicing'); |
|
| 2607 | 2607 | $id = $field . '.id + "_edit"'; |
| 2608 | 2608 | $id2 = $field . '.id + "_edit2"'; |
| 2609 | 2609 | $id3 = $field . '.id + "_edit3"'; |
| 2610 | 2610 | $id4 = $field . '.id + "_edit4"'; |
| 2611 | - $label4 = esc_attr__( 'This will be shown to the customer as the recommended price', 'invoicing' ); |
|
| 2612 | - $label5 = esc_attr__( 'Allow users to pay what they want', 'invoicing' ); |
|
| 2613 | - $label6 = esc_attr__( 'Enter the minimum price that a user can pay', 'invoicing' ); |
|
| 2614 | - $label7 = esc_attr__( 'Allow users to buy several quantities', 'invoicing' ); |
|
| 2615 | - $label8 = esc_attr__( 'This item is required', 'invoicing' ); |
|
| 2611 | + $label4 = esc_attr__('This will be shown to the customer as the recommended price', 'invoicing'); |
|
| 2612 | + $label5 = esc_attr__('Allow users to pay what they want', 'invoicing'); |
|
| 2613 | + $label6 = esc_attr__('Enter the minimum price that a user can pay', 'invoicing'); |
|
| 2614 | + $label7 = esc_attr__('Allow users to buy several quantities', 'invoicing'); |
|
| 2615 | + $label8 = esc_attr__('This item is required', 'invoicing'); |
|
| 2616 | 2616 | |
| 2617 | 2617 | // Item types. |
| 2618 | - $item_types = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post ); |
|
| 2618 | + $item_types = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post); |
|
| 2619 | 2619 | $item_types_html = ''; |
| 2620 | 2620 | |
| 2621 | - foreach ( $item_types as $type => $label ) { |
|
| 2622 | - $type = esc_attr( $type ); |
|
| 2623 | - $label = esc_html( $label ); |
|
| 2621 | + foreach ($item_types as $type => $label) { |
|
| 2622 | + $type = esc_attr($type); |
|
| 2623 | + $label = esc_html($label); |
|
| 2624 | 2624 | $item_types_html .= "<option value='$type'>$label</type>"; |
| 2625 | 2625 | } |
| 2626 | 2626 | |
| 2627 | 2627 | // Taxes. |
| 2628 | 2628 | $taxes = ''; |
| 2629 | - if ( $wpinv_euvat->allow_vat_rules() ) { |
|
| 2629 | + if ($wpinv_euvat->allow_vat_rules()) { |
|
| 2630 | 2630 | $taxes .= "<div class='form-group'> <label :for='$id + item.id + \"rule\"'>"; |
| 2631 | - $taxes .= __( 'VAT rule type', 'invoicing' ); |
|
| 2631 | + $taxes .= __('VAT rule type', 'invoicing'); |
|
| 2632 | 2632 | $taxes .= "</label><select :id='$id + item.id + \"rule\"' class='form-control custom-select' v-model='item.rule'>"; |
| 2633 | 2633 | |
| 2634 | - foreach ( $wpinv_euvat->get_rules() as $type => $label ) { |
|
| 2635 | - $type = esc_attr( $type ); |
|
| 2636 | - $label = esc_html( $label ); |
|
| 2634 | + foreach ($wpinv_euvat->get_rules() as $type => $label) { |
|
| 2635 | + $type = esc_attr($type); |
|
| 2636 | + $label = esc_html($label); |
|
| 2637 | 2637 | $taxes .= "<option value='$type'>$label</type>"; |
| 2638 | 2638 | } |
| 2639 | 2639 | |
| 2640 | 2640 | $taxes .= '</select></div>'; |
| 2641 | 2641 | } |
| 2642 | 2642 | |
| 2643 | - if ( $wpinv_euvat->allow_vat_classes() ) { |
|
| 2643 | + if ($wpinv_euvat->allow_vat_classes()) { |
|
| 2644 | 2644 | $taxes .= "<div class='form-group'> <label :for='$id + item.id + \"class\"'>"; |
| 2645 | - $taxes .= __( 'VAT class', 'invoicing' ); |
|
| 2645 | + $taxes .= __('VAT class', 'invoicing'); |
|
| 2646 | 2646 | $taxes .= "</label><select :id='$id + item.id + \"class\"' class='form-control custom-select' v-model='item.class'>"; |
| 2647 | 2647 | |
| 2648 | - foreach ( $wpinv_euvat->get_all_classes() as $type => $label ) { |
|
| 2649 | - $type = esc_attr( $type ); |
|
| 2650 | - $label = esc_html( $label ); |
|
| 2648 | + foreach ($wpinv_euvat->get_all_classes() as $type => $label) { |
|
| 2649 | + $type = esc_attr($type); |
|
| 2650 | + $label = esc_html($label); |
|
| 2651 | 2651 | $taxes .= "<option value='$type'>$label</type>"; |
| 2652 | 2652 | } |
| 2653 | 2653 | |
@@ -2732,7 +2732,7 @@ discard block |
||
| 2732 | 2732 | <div class='form-group mt-2'> |
| 2733 | 2733 | |
| 2734 | 2734 | <select class='form-control custom-select' v-model='selected_item' @change='addSelectedItem'> |
| 2735 | - <option value=''>" . __( 'Add an existing item to the form', 'invoicing' ) ."</option> |
|
| 2735 | + <option value=''>" . __('Add an existing item to the form', 'invoicing') . "</option> |
|
| 2736 | 2736 | <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option> |
| 2737 | 2737 | </select> |
| 2738 | 2738 | |
@@ -2747,11 +2747,11 @@ discard block |
||
| 2747 | 2747 | <label :for='$id2'>$label</label> |
| 2748 | 2748 | |
| 2749 | 2749 | <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'> |
| 2750 | - <option value='total' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __( 'Buy all items on the list', 'invoicing' ) ."</option> |
|
| 2751 | - <option value='radio'>" . __( 'Select a single item from the list', 'invoicing' ) ."</option> |
|
| 2752 | - <option value='checkbox' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __( 'Select one or more items on the list', 'invoicing' ) ."</option> |
|
| 2753 | - <option value='select'>" . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option> |
|
| 2754 | - <option value='multi_select' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option> |
|
| 2750 | + <option value='total' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __('Buy all items on the list', 'invoicing') . "</option> |
|
| 2751 | + <option value='radio'>" . __('Select a single item from the list', 'invoicing') . "</option> |
|
| 2752 | + <option value='checkbox' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __('Select one or more items on the list', 'invoicing') . "</option> |
|
| 2753 | + <option value='select'>" . __('Select a single item from a dropdown', 'invoicing') . "</option> |
|
| 2754 | + <option value='multi_select' :disabled='canCheckoutSeveralSubscriptions($field)'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option> |
|
| 2755 | 2755 | </select> |
| 2756 | 2756 | |
| 2757 | 2757 | </div> |
@@ -2776,7 +2776,7 @@ discard block |
||
| 2776 | 2776 | 'orderby' => 'title', |
| 2777 | 2777 | 'order' => 'ASC', |
| 2778 | 2778 | 'posts_per_page' => -1, |
| 2779 | - 'post_status' => array( 'publish' ), |
|
| 2779 | + 'post_status' => array('publish'), |
|
| 2780 | 2780 | 'meta_query' => array( |
| 2781 | 2781 | array( |
| 2782 | 2782 | 'key' => '_wpinv_type', |
@@ -2786,24 +2786,24 @@ discard block |
||
| 2786 | 2786 | ) |
| 2787 | 2787 | ); |
| 2788 | 2788 | |
| 2789 | - $items = get_posts( apply_filters( 'wpinv_payment_form_item_dropdown_query_args', $item_args ) ); |
|
| 2789 | + $items = get_posts(apply_filters('wpinv_payment_form_item_dropdown_query_args', $item_args)); |
|
| 2790 | 2790 | |
| 2791 | - if ( empty( $items ) ) { |
|
| 2791 | + if (empty($items)) { |
|
| 2792 | 2792 | return array(); |
| 2793 | 2793 | } |
| 2794 | 2794 | |
| 2795 | - $options = array(); |
|
| 2796 | - foreach ( $items as $item ) { |
|
| 2797 | - $title = esc_html( $item->post_title ); |
|
| 2798 | - $title .= wpinv_get_item_suffix( $item->ID, false ); |
|
| 2799 | - $id = absint( $item->ID ); |
|
| 2800 | - $price = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) ); |
|
| 2801 | - $recurring = (bool) get_post_meta( $id, '_wpinv_is_recurring', true ); |
|
| 2795 | + $options = array(); |
|
| 2796 | + foreach ($items as $item) { |
|
| 2797 | + $title = esc_html($item->post_title); |
|
| 2798 | + $title .= wpinv_get_item_suffix($item->ID, false); |
|
| 2799 | + $id = absint($item->ID); |
|
| 2800 | + $price = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true)); |
|
| 2801 | + $recurring = (bool) get_post_meta($id, '_wpinv_is_recurring', true); |
|
| 2802 | 2802 | $description = $item->post_excerpt; |
| 2803 | - $custom_price = (bool) get_post_meta( $id, '_wpinv_dynamic_pricing', true ); |
|
| 2804 | - $minimum_price = (float) get_post_meta( $id, '_minimum_price', true ); |
|
| 2803 | + $custom_price = (bool) get_post_meta($id, '_wpinv_dynamic_pricing', true); |
|
| 2804 | + $minimum_price = (float) get_post_meta($id, '_minimum_price', true); |
|
| 2805 | 2805 | $allow_quantities = false; |
| 2806 | - $options[] = compact( 'title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities' ); |
|
| 2806 | + $options[] = compact('title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities'); |
|
| 2807 | 2807 | |
| 2808 | 2808 | } |
| 2809 | 2809 | return $options; |
@@ -2813,47 +2813,47 @@ discard block |
||
| 2813 | 2813 | /** |
| 2814 | 2814 | * Returns an array of items for the currently being edited form. |
| 2815 | 2815 | */ |
| 2816 | - public function get_form_items( $id = false ) { |
|
| 2816 | + public function get_form_items($id = false) { |
|
| 2817 | 2817 | |
| 2818 | - if ( empty( $id ) ) { |
|
| 2819 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
| 2818 | + if (empty($id)) { |
|
| 2819 | + return wpinv_get_data('sample-payment-form-items'); |
|
| 2820 | 2820 | } |
| 2821 | 2821 | |
| 2822 | - $form_elements = get_post_meta( $id, 'wpinv_form_items', true ); |
|
| 2822 | + $form_elements = get_post_meta($id, 'wpinv_form_items', true); |
|
| 2823 | 2823 | |
| 2824 | - if ( is_array( $form_elements ) ) { |
|
| 2824 | + if (is_array($form_elements)) { |
|
| 2825 | 2825 | return $form_elements; |
| 2826 | 2826 | } |
| 2827 | 2827 | |
| 2828 | - return wpinv_get_data( 'sample-payment-form-items' ); |
|
| 2828 | + return wpinv_get_data('sample-payment-form-items'); |
|
| 2829 | 2829 | |
| 2830 | 2830 | } |
| 2831 | 2831 | |
| 2832 | 2832 | /** |
| 2833 | 2833 | * Returns an array of elements for the currently being edited form. |
| 2834 | 2834 | */ |
| 2835 | - public function get_form_elements( $id = false ) { |
|
| 2835 | + public function get_form_elements($id = false) { |
|
| 2836 | 2836 | |
| 2837 | - if ( empty( $id ) ) { |
|
| 2838 | - return wpinv_get_data( 'sample-payment-form' ); |
|
| 2837 | + if (empty($id)) { |
|
| 2838 | + return wpinv_get_data('sample-payment-form'); |
|
| 2839 | 2839 | } |
| 2840 | 2840 | |
| 2841 | - $form_elements = get_post_meta( $id, 'wpinv_form_elements', true ); |
|
| 2841 | + $form_elements = get_post_meta($id, 'wpinv_form_elements', true); |
|
| 2842 | 2842 | |
| 2843 | - if ( is_array( $form_elements ) ) { |
|
| 2843 | + if (is_array($form_elements)) { |
|
| 2844 | 2844 | return $form_elements; |
| 2845 | 2845 | } |
| 2846 | 2846 | |
| 2847 | - return wpinv_get_data( 'sample-payment-form' ); |
|
| 2847 | + return wpinv_get_data('sample-payment-form'); |
|
| 2848 | 2848 | } |
| 2849 | 2849 | |
| 2850 | 2850 | /** |
| 2851 | 2851 | * Sends a redrect response to payment details. |
| 2852 | 2852 | * |
| 2853 | 2853 | */ |
| 2854 | - public function send_redirect_response( $url ) { |
|
| 2855 | - $url = urlencode( $url ); |
|
| 2856 | - wp_send_json_success( $url ); |
|
| 2854 | + public function send_redirect_response($url) { |
|
| 2855 | + $url = urlencode($url); |
|
| 2856 | + wp_send_json_success($url); |
|
| 2857 | 2857 | } |
| 2858 | 2858 | |
| 2859 | 2859 | /** |
@@ -2864,12 +2864,12 @@ discard block |
||
| 2864 | 2864 | |
| 2865 | 2865 | $errors = wpinv_get_errors(); |
| 2866 | 2866 | |
| 2867 | - if ( ! empty( $errors ) ) { |
|
| 2867 | + if (!empty($errors)) { |
|
| 2868 | 2868 | wpinv_print_errors(); |
| 2869 | 2869 | exit; |
| 2870 | 2870 | } |
| 2871 | 2871 | |
| 2872 | - wp_send_json_error( __( 'An error occured while processing your payment. Please try again.', 'invoicing' ) ); |
|
| 2872 | + wp_send_json_error(__('An error occured while processing your payment. Please try again.', 'invoicing')); |
|
| 2873 | 2873 | exit; |
| 2874 | 2874 | |
| 2875 | 2875 | } |