@@ -29,7 +29,7 @@ |
||
29 | 29 | add_meta_box( 'wpinv-items', __( 'Invoice Items', 'invoicing' ), 'WPInv_Meta_Box_Items::output', 'wpi_invoice', 'normal', 'high' ); |
30 | 30 | add_meta_box( 'wpinv-notes', __( 'Invoice Notes', 'invoicing' ), 'WPInv_Meta_Box_Notes::output', 'wpi_invoice', 'normal', 'high' ); |
31 | 31 | |
32 | - remove_meta_box('wpseo_meta', 'wpi_invoice', 'normal'); |
|
32 | + remove_meta_box('wpseo_meta', 'wpi_invoice', 'normal'); |
|
33 | 33 | } |
34 | 34 | add_action( 'add_meta_boxes', 'wpinv_add_meta_boxes', 30, 2 ); |
35 | 35 |
@@ -1,67 +1,67 @@ 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 | -function wpinv_add_meta_boxes( $post_type, $post ) { |
|
7 | +function wpinv_add_meta_boxes($post_type, $post) { |
|
8 | 8 | global $wpi_mb_invoice; |
9 | - if ( $post_type == 'wpi_invoice' && !empty( $post->ID ) ) { |
|
10 | - $wpi_mb_invoice = wpinv_get_invoice( $post->ID ); |
|
9 | + if ($post_type == 'wpi_invoice' && !empty($post->ID)) { |
|
10 | + $wpi_mb_invoice = wpinv_get_invoice($post->ID); |
|
11 | 11 | } |
12 | 12 | |
13 | - if ( !empty( $wpi_mb_invoice ) && !$wpi_mb_invoice->has_status( array( 'draft', 'auto-draft' ) ) ) { |
|
14 | - add_meta_box( 'wpinv-mb-resend-invoice', __( 'Resend Invoice', 'invoicing' ), 'WPInv_Meta_Box_Details::resend_invoice', 'wpi_invoice', 'side', 'high' ); |
|
13 | + if (!empty($wpi_mb_invoice) && !$wpi_mb_invoice->has_status(array('draft', 'auto-draft'))) { |
|
14 | + add_meta_box('wpinv-mb-resend-invoice', __('Resend Invoice', 'invoicing'), 'WPInv_Meta_Box_Details::resend_invoice', 'wpi_invoice', 'side', 'high'); |
|
15 | 15 | } |
16 | 16 | |
17 | - if ( !empty( $wpi_mb_invoice ) && $wpi_mb_invoice->is_recurring() && $wpi_mb_invoice->is_parent() ) { |
|
18 | - add_meta_box( 'wpinv-mb-subscriptions', __( 'Subscriptions', 'invoicing' ), 'WPInv_Meta_Box_Details::subscriptions', 'wpi_invoice', 'side', 'high' ); |
|
17 | + if (!empty($wpi_mb_invoice) && $wpi_mb_invoice->is_recurring() && $wpi_mb_invoice->is_parent()) { |
|
18 | + add_meta_box('wpinv-mb-subscriptions', __('Subscriptions', 'invoicing'), 'WPInv_Meta_Box_Details::subscriptions', 'wpi_invoice', 'side', 'high'); |
|
19 | 19 | } |
20 | 20 | |
21 | - if ( wpinv_is_subscription_payment( $wpi_mb_invoice ) ) { |
|
22 | - add_meta_box( 'wpinv-mb-renewals', __( 'Renewal Payment', 'invoicing' ), 'WPInv_Meta_Box_Details::renewals', 'wpi_invoice', 'side', 'high' ); |
|
21 | + if (wpinv_is_subscription_payment($wpi_mb_invoice)) { |
|
22 | + add_meta_box('wpinv-mb-renewals', __('Renewal Payment', 'invoicing'), 'WPInv_Meta_Box_Details::renewals', 'wpi_invoice', 'side', 'high'); |
|
23 | 23 | } |
24 | 24 | |
25 | - add_meta_box( 'wpinv-details', __( 'Invoice Details', 'invoicing' ), 'WPInv_Meta_Box_Details::output', 'wpi_invoice', 'side', 'default' ); |
|
26 | - add_meta_box( 'wpinv-payment-meta', __( 'Payment Meta', 'invoicing' ), 'WPInv_Meta_Box_Details::payment_meta', 'wpi_invoice', 'side', 'default' ); |
|
25 | + add_meta_box('wpinv-details', __('Invoice Details', 'invoicing'), 'WPInv_Meta_Box_Details::output', 'wpi_invoice', 'side', 'default'); |
|
26 | + add_meta_box('wpinv-payment-meta', __('Payment Meta', 'invoicing'), 'WPInv_Meta_Box_Details::payment_meta', 'wpi_invoice', 'side', 'default'); |
|
27 | 27 | |
28 | - add_meta_box( 'wpinv-address', __( 'Billing Details', 'invoicing' ), 'WPInv_Meta_Box_Billing_Details::output', 'wpi_invoice', 'normal', 'high' ); |
|
29 | - add_meta_box( 'wpinv-items', __( 'Invoice Items', 'invoicing' ), 'WPInv_Meta_Box_Items::output', 'wpi_invoice', 'normal', 'high' ); |
|
30 | - add_meta_box( 'wpinv-notes', __( 'Invoice Notes', 'invoicing' ), 'WPInv_Meta_Box_Notes::output', 'wpi_invoice', 'normal', 'high' ); |
|
28 | + add_meta_box('wpinv-address', __('Billing Details', 'invoicing'), 'WPInv_Meta_Box_Billing_Details::output', 'wpi_invoice', 'normal', 'high'); |
|
29 | + add_meta_box('wpinv-items', __('Invoice Items', 'invoicing'), 'WPInv_Meta_Box_Items::output', 'wpi_invoice', 'normal', 'high'); |
|
30 | + add_meta_box('wpinv-notes', __('Invoice Notes', 'invoicing'), 'WPInv_Meta_Box_Notes::output', 'wpi_invoice', 'normal', 'high'); |
|
31 | 31 | |
32 | 32 | remove_meta_box('wpseo_meta', 'wpi_invoice', 'normal'); |
33 | 33 | } |
34 | -add_action( 'add_meta_boxes', 'wpinv_add_meta_boxes', 30, 2 ); |
|
34 | +add_action('add_meta_boxes', 'wpinv_add_meta_boxes', 30, 2); |
|
35 | 35 | |
36 | -function wpinv_save_meta_boxes( $post_id, $post, $update = false ) { |
|
37 | - remove_action( 'save_post', __FUNCTION__ ); |
|
36 | +function wpinv_save_meta_boxes($post_id, $post, $update = false) { |
|
37 | + remove_action('save_post', __FUNCTION__); |
|
38 | 38 | |
39 | 39 | // $post_id and $post are required |
40 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
40 | + if (empty($post_id) || empty($post)) { |
|
41 | 41 | return; |
42 | 42 | } |
43 | 43 | |
44 | - if ( !current_user_can( 'edit_post', $post_id ) || empty( $post->post_type ) ) { |
|
44 | + if (!current_user_can('edit_post', $post_id) || empty($post->post_type)) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | |
48 | 48 | // Dont' save meta boxes for revisions or autosaves |
49 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
49 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
50 | 50 | return; |
51 | 51 | } |
52 | 52 | |
53 | - if ( $post->post_type == 'wpi_invoice' or $post->post_type == 'wpi_quote' ) { |
|
54 | - if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) { |
|
53 | + if ($post->post_type == 'wpi_invoice' or $post->post_type == 'wpi_quote') { |
|
54 | + if ((defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) { |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | - if ( isset( $_POST['wpinv_save_invoice'] ) && wp_verify_nonce( $_POST['wpinv_save_invoice'], 'wpinv_save_invoice' ) ) { |
|
59 | - WPInv_Meta_Box_Items::save( $post_id, $_POST, $post ); |
|
58 | + if (isset($_POST['wpinv_save_invoice']) && wp_verify_nonce($_POST['wpinv_save_invoice'], 'wpinv_save_invoice')) { |
|
59 | + WPInv_Meta_Box_Items::save($post_id, $_POST, $post); |
|
60 | 60 | } |
61 | - } else if ( $post->post_type == 'wpi_item' ) { |
|
61 | + } else if ($post->post_type == 'wpi_item') { |
|
62 | 62 | // verify nonce |
63 | - if ( isset( $_POST['wpinv_vat_meta_box_nonce'] ) && wp_verify_nonce( $_POST['wpinv_vat_meta_box_nonce'], 'wpinv_item_meta_box_save' ) ) { |
|
64 | - $fields = array(); |
|
63 | + if (isset($_POST['wpinv_vat_meta_box_nonce']) && wp_verify_nonce($_POST['wpinv_vat_meta_box_nonce'], 'wpinv_item_meta_box_save')) { |
|
64 | + $fields = array(); |
|
65 | 65 | $fields['_wpinv_price'] = 'wpinv_item_price'; |
66 | 66 | $fields['_wpinv_vat_class'] = 'wpinv_vat_class'; |
67 | 67 | $fields['_wpinv_vat_rule'] = 'wpinv_vat_rules'; |
@@ -76,96 +76,96 @@ discard block |
||
76 | 76 | $fields['_wpinv_dynamic_pricing'] = 'wpinv_name_your_price'; |
77 | 77 | $fields['_minimum_price'] = 'wpinv_minimum_price'; |
78 | 78 | |
79 | - if ( !isset( $_POST['wpinv_is_recurring'] ) ) { |
|
79 | + if (!isset($_POST['wpinv_is_recurring'])) { |
|
80 | 80 | $_POST['wpinv_is_recurring'] = 0; |
81 | 81 | } |
82 | 82 | |
83 | - if ( !isset( $_POST['wpinv_name_your_price'] ) ) { |
|
83 | + if (!isset($_POST['wpinv_name_your_price'])) { |
|
84 | 84 | $_POST['wpinv_name_your_price'] = 0; |
85 | 85 | } |
86 | 86 | |
87 | - if ( !isset( $_POST['wpinv_free_trial'] ) || empty( $_POST['wpinv_is_recurring'] ) ) { |
|
87 | + if (!isset($_POST['wpinv_free_trial']) || empty($_POST['wpinv_is_recurring'])) { |
|
88 | 88 | $_POST['wpinv_free_trial'] = 0; |
89 | 89 | } |
90 | 90 | |
91 | - foreach ( $fields as $field => $name ) { |
|
92 | - if ( isset( $_POST[ $name ] ) ) { |
|
93 | - $allowed = apply_filters( 'wpinv_item_allowed_save_meta_value', true, $field, $post_id ); |
|
91 | + foreach ($fields as $field => $name) { |
|
92 | + if (isset($_POST[$name])) { |
|
93 | + $allowed = apply_filters('wpinv_item_allowed_save_meta_value', true, $field, $post_id); |
|
94 | 94 | |
95 | - if ( !$allowed ) { |
|
95 | + if (!$allowed) { |
|
96 | 96 | continue; |
97 | 97 | } |
98 | 98 | |
99 | - if ( $field == '_wpinv_price' ) { |
|
100 | - $value = wpinv_sanitize_amount( $_POST[ $name ] ); |
|
99 | + if ($field == '_wpinv_price') { |
|
100 | + $value = wpinv_sanitize_amount($_POST[$name]); |
|
101 | 101 | } else { |
102 | - $value = is_string( $_POST[ $name ] ) ? sanitize_text_field( $_POST[ $name ] ) : $_POST[ $name ]; |
|
102 | + $value = is_string($_POST[$name]) ? sanitize_text_field($_POST[$name]) : $_POST[$name]; |
|
103 | 103 | } |
104 | 104 | |
105 | - $value = apply_filters( 'wpinv_item_metabox_save_' . $field, $value, $name ); |
|
106 | - update_post_meta( $post_id, $field, $value ); |
|
105 | + $value = apply_filters('wpinv_item_metabox_save_' . $field, $value, $name); |
|
106 | + update_post_meta($post_id, $field, $value); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | - if ( !get_post_meta( $post_id, '_wpinv_custom_id', true ) ) { |
|
111 | - update_post_meta( $post_id, '_wpinv_custom_id', $post_id ); |
|
110 | + if (!get_post_meta($post_id, '_wpinv_custom_id', true)) { |
|
111 | + update_post_meta($post_id, '_wpinv_custom_id', $post_id); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | } |
115 | 115 | } |
116 | -add_action( 'save_post', 'wpinv_save_meta_boxes', 10, 3 ); |
|
116 | +add_action('save_post', 'wpinv_save_meta_boxes', 10, 3); |
|
117 | 117 | |
118 | 118 | function wpinv_register_item_meta_boxes() { |
119 | 119 | global $wpinv_euvat; |
120 | 120 | |
121 | - add_meta_box( 'wpinv_field_prices', __( 'Item Price', 'invoicing' ), 'WPInv_Meta_Box_Items::prices', 'wpi_item', 'normal', 'high' ); |
|
121 | + add_meta_box('wpinv_field_prices', __('Item Price', 'invoicing'), 'WPInv_Meta_Box_Items::prices', 'wpi_item', 'normal', 'high'); |
|
122 | 122 | |
123 | - if ( $wpinv_euvat->allow_vat_rules() ) { |
|
124 | - add_meta_box( 'wpinv_field_vat_rules', __( 'VAT rules type to use', 'invoicing' ), 'WPInv_Meta_Box_Items::vat_rules', 'wpi_item', 'normal', 'high' ); |
|
123 | + if ($wpinv_euvat->allow_vat_rules()) { |
|
124 | + add_meta_box('wpinv_field_vat_rules', __('VAT rules type to use', 'invoicing'), 'WPInv_Meta_Box_Items::vat_rules', 'wpi_item', 'normal', 'high'); |
|
125 | 125 | } |
126 | 126 | |
127 | - if ( $wpinv_euvat->allow_vat_classes() ) { |
|
128 | - add_meta_box( 'wpinv_field_vat_classes', __( 'VAT rates class to use', 'invoicing' ), 'WPInv_Meta_Box_Items::vat_classes', 'wpi_item', 'normal', 'high' ); |
|
127 | + if ($wpinv_euvat->allow_vat_classes()) { |
|
128 | + add_meta_box('wpinv_field_vat_classes', __('VAT rates class to use', 'invoicing'), 'WPInv_Meta_Box_Items::vat_classes', 'wpi_item', 'normal', 'high'); |
|
129 | 129 | } |
130 | 130 | |
131 | - add_meta_box( 'wpinv_field_item_info', __( 'Item info', 'invoicing' ), 'WPInv_Meta_Box_Items::item_info', 'wpi_item', 'side', 'core' ); |
|
132 | - add_meta_box( 'wpinv_field_meta_values', __( 'Item Meta Values', 'invoicing' ), 'WPInv_Meta_Box_Items::meta_values', 'wpi_item', 'side', 'core' ); |
|
131 | + add_meta_box('wpinv_field_item_info', __('Item info', 'invoicing'), 'WPInv_Meta_Box_Items::item_info', 'wpi_item', 'side', 'core'); |
|
132 | + add_meta_box('wpinv_field_meta_values', __('Item Meta Values', 'invoicing'), 'WPInv_Meta_Box_Items::meta_values', 'wpi_item', 'side', 'core'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | function wpinv_register_discount_meta_boxes() { |
136 | - add_meta_box( 'wpinv_discount_fields', __( 'Discount Details', 'invoicing' ), 'wpinv_discount_metabox_details', 'wpi_discount', 'normal', 'high' ); |
|
136 | + add_meta_box('wpinv_discount_fields', __('Discount Details', 'invoicing'), 'wpinv_discount_metabox_details', 'wpi_discount', 'normal', 'high'); |
|
137 | 137 | } |
138 | 138 | |
139 | -function wpinv_discount_metabox_details( $post ) { |
|
139 | +function wpinv_discount_metabox_details($post) { |
|
140 | 140 | $discount_id = $post->ID; |
141 | - $discount = wpinv_get_discount( $discount_id ); |
|
141 | + $discount = wpinv_get_discount($discount_id); |
|
142 | 142 | |
143 | - $type = wpinv_get_discount_type( $discount_id ); |
|
144 | - $item_reqs = wpinv_get_discount_item_reqs( $discount_id ); |
|
145 | - $excluded_items = wpinv_get_discount_excluded_items( $discount_id ); |
|
146 | - $min_total = wpinv_get_discount_min_total( $discount_id ); |
|
147 | - $max_total = wpinv_get_discount_max_total( $discount_id ); |
|
148 | - $max_uses = wpinv_get_discount_max_uses( $discount_id ); |
|
149 | - $single_use = wpinv_discount_is_single_use( $discount_id ); |
|
150 | - $recurring = (bool)wpinv_discount_is_recurring( $discount_id ); |
|
151 | - $start_date = wpinv_get_discount_start_date( $discount_id ); |
|
152 | - $expiration_date = wpinv_get_discount_expiration( $discount_id ); |
|
143 | + $type = wpinv_get_discount_type($discount_id); |
|
144 | + $item_reqs = wpinv_get_discount_item_reqs($discount_id); |
|
145 | + $excluded_items = wpinv_get_discount_excluded_items($discount_id); |
|
146 | + $min_total = wpinv_get_discount_min_total($discount_id); |
|
147 | + $max_total = wpinv_get_discount_max_total($discount_id); |
|
148 | + $max_uses = wpinv_get_discount_max_uses($discount_id); |
|
149 | + $single_use = wpinv_discount_is_single_use($discount_id); |
|
150 | + $recurring = (bool)wpinv_discount_is_recurring($discount_id); |
|
151 | + $start_date = wpinv_get_discount_start_date($discount_id); |
|
152 | + $expiration_date = wpinv_get_discount_expiration($discount_id); |
|
153 | 153 | |
154 | - if ( ! empty( $start_date ) && strpos( $start_date, '0000' ) === false ) { |
|
155 | - $start_time = strtotime( $start_date ); |
|
156 | - $start_h = date_i18n( 'H', $start_time ); |
|
157 | - $start_m = date_i18n( 'i', $start_time ); |
|
158 | - $start_date = date_i18n( 'Y-m-d', $start_time ); |
|
154 | + if (!empty($start_date) && strpos($start_date, '0000') === false) { |
|
155 | + $start_time = strtotime($start_date); |
|
156 | + $start_h = date_i18n('H', $start_time); |
|
157 | + $start_m = date_i18n('i', $start_time); |
|
158 | + $start_date = date_i18n('Y-m-d', $start_time); |
|
159 | 159 | } else { |
160 | 160 | $start_h = '00'; |
161 | 161 | $start_m = '00'; |
162 | 162 | } |
163 | 163 | |
164 | - if ( ! empty( $expiration_date ) && strpos( $expiration_date, '0000' ) === false ) { |
|
165 | - $expiration_time = strtotime( $expiration_date ); |
|
166 | - $expiration_h = date_i18n( 'H', $expiration_time ); |
|
167 | - $expiration_m = date_i18n( 'i', $expiration_time ); |
|
168 | - $expiration_date = date_i18n( 'Y-m-d', $expiration_time ); |
|
164 | + if (!empty($expiration_date) && strpos($expiration_date, '0000') === false) { |
|
165 | + $expiration_time = strtotime($expiration_date); |
|
166 | + $expiration_h = date_i18n('H', $expiration_time); |
|
167 | + $expiration_m = date_i18n('i', $expiration_time); |
|
168 | + $expiration_date = date_i18n('Y-m-d', $expiration_time); |
|
169 | 169 | } else { |
170 | 170 | $expiration_h = '23'; |
171 | 171 | $expiration_m = '59'; |
@@ -175,207 +175,207 @@ discard block |
||
175 | 175 | $max_total = $max_total > 0 ? $max_total : ''; |
176 | 176 | $max_uses = $max_uses > 0 ? $max_uses : ''; |
177 | 177 | ?> |
178 | -<?php do_action( 'wpinv_discount_form_top', $post ); ?> |
|
179 | -<?php wp_nonce_field( 'wpinv_discount_metabox_nonce', 'wpinv_discount_metabox_nonce' ); ;?> |
|
178 | +<?php do_action('wpinv_discount_form_top', $post); ?> |
|
179 | +<?php wp_nonce_field('wpinv_discount_metabox_nonce', 'wpinv_discount_metabox_nonce'); ;?> |
|
180 | 180 | <table class="form-table wpi-form-table"> |
181 | 181 | <tbody> |
182 | - <?php do_action( 'wpinv_discount_form_first', $post ); ?> |
|
183 | - <?php do_action( 'wpinv_discount_form_before_code', $post ); ?> |
|
182 | + <?php do_action('wpinv_discount_form_first', $post); ?> |
|
183 | + <?php do_action('wpinv_discount_form_before_code', $post); ?> |
|
184 | 184 | <tr> |
185 | 185 | <th valign="top" scope="row"> |
186 | - <label for="wpinv_discount_code"><?php _e( 'Discount Code', 'invoicing' ); ?></label> |
|
186 | + <label for="wpinv_discount_code"><?php _e('Discount Code', 'invoicing'); ?></label> |
|
187 | 187 | </th> |
188 | 188 | <td> |
189 | - <input type="text" name="code" id="wpinv_discount_code" class="medium-text" value="<?php echo esc_attr( wpinv_get_discount_code( $discount_id ) ); ?>" required> |
|
190 | - <p class="description"><?php _e( 'Enter a code for this discount, such as 10OFF', 'invoicing' ); ?></p> |
|
189 | + <input type="text" name="code" id="wpinv_discount_code" class="medium-text" value="<?php echo esc_attr(wpinv_get_discount_code($discount_id)); ?>" required> |
|
190 | + <p class="description"><?php _e('Enter a code for this discount, such as 10OFF', 'invoicing'); ?></p> |
|
191 | 191 | </td> |
192 | 192 | </tr> |
193 | - <?php do_action( 'wpinv_discount_form_before_type', $post ); ?> |
|
193 | + <?php do_action('wpinv_discount_form_before_type', $post); ?> |
|
194 | 194 | <tr> |
195 | 195 | <th valign="top" scope="row"> |
196 | - <label for="wpinv_discount_type"><?php _e( 'Discount Type', 'invoicing' ); ?></label> |
|
196 | + <label for="wpinv_discount_type"><?php _e('Discount Type', 'invoicing'); ?></label> |
|
197 | 197 | </th> |
198 | 198 | <td> |
199 | 199 | <select id="wpinv_discount_type" name="type" class="medium-text wpi_select2"> |
200 | - <?php foreach ( wpinv_get_discount_types() as $value => $label ) { ?> |
|
201 | - <option value="<?php echo $value ;?>" <?php selected( $type, $value ); ?>><?php echo $label; ?></option> |
|
200 | + <?php foreach (wpinv_get_discount_types() as $value => $label) { ?> |
|
201 | + <option value="<?php echo $value; ?>" <?php selected($type, $value); ?>><?php echo $label; ?></option> |
|
202 | 202 | <?php } ?> |
203 | 203 | </select> |
204 | - <p class="description"><?php _e( 'The kind of discount to apply for this discount.', 'invoicing' ); ?></p> |
|
204 | + <p class="description"><?php _e('The kind of discount to apply for this discount.', 'invoicing'); ?></p> |
|
205 | 205 | </td> |
206 | 206 | </tr> |
207 | - <?php do_action( 'wpinv_discount_form_before_amount', $post ); ?> |
|
207 | + <?php do_action('wpinv_discount_form_before_amount', $post); ?> |
|
208 | 208 | <tr> |
209 | 209 | <th valign="top" scope="row"> |
210 | - <label for="wpinv_discount_amount"><?php _e( 'Amount', 'invoicing' ); ?></label> |
|
210 | + <label for="wpinv_discount_amount"><?php _e('Amount', 'invoicing'); ?></label> |
|
211 | 211 | </th> |
212 | 212 | <td> |
213 | - <input type="text" name="amount" id="wpinv_discount_amount" class="wpi-field-price wpi-price" value="<?php echo esc_attr( wpinv_get_discount_amount( $discount_id ) ); ?>" required> <font class="wpi-discount-p">%</font><font class="wpi-discount-f" style="display:none;"><?php echo wpinv_currency_symbol() ;?></font> |
|
214 | - <p style="display:none;" class="description"><?php _e( 'Enter the discount amount in USD', 'invoicing' ); ?></p> |
|
215 | - <p class="description"><?php _e( 'Enter the discount value. Ex: 10', 'invoicing' ); ?></p> |
|
213 | + <input type="text" name="amount" id="wpinv_discount_amount" class="wpi-field-price wpi-price" value="<?php echo esc_attr(wpinv_get_discount_amount($discount_id)); ?>" required> <font class="wpi-discount-p">%</font><font class="wpi-discount-f" style="display:none;"><?php echo wpinv_currency_symbol(); ?></font> |
|
214 | + <p style="display:none;" class="description"><?php _e('Enter the discount amount in USD', 'invoicing'); ?></p> |
|
215 | + <p class="description"><?php _e('Enter the discount value. Ex: 10', 'invoicing'); ?></p> |
|
216 | 216 | </td> |
217 | 217 | </tr> |
218 | - <?php do_action( 'wpinv_discount_form_before_items', $post ); ?> |
|
218 | + <?php do_action('wpinv_discount_form_before_items', $post); ?> |
|
219 | 219 | <tr> |
220 | 220 | <th valign="top" scope="row"> |
221 | - <label for="wpinv_discount_items"><?php _e( 'Items', 'invoicing' ); ?></label> |
|
221 | + <label for="wpinv_discount_items"><?php _e('Items', 'invoicing'); ?></label> |
|
222 | 222 | </th> |
223 | 223 | <td> |
224 | - <p><?php echo wpinv_item_dropdown( array( |
|
224 | + <p><?php echo wpinv_item_dropdown(array( |
|
225 | 225 | 'name' => 'items[]', |
226 | 226 | 'id' => 'items', |
227 | 227 | 'selected' => $item_reqs, |
228 | 228 | 'multiple' => true, |
229 | 229 | 'class' => 'medium-text wpi_select2', |
230 | - 'placeholder' => __( 'Select one or more Items', 'invoicing' ), |
|
230 | + 'placeholder' => __('Select one or more Items', 'invoicing'), |
|
231 | 231 | 'show_recurring' => true, |
232 | - ) ); ?> |
|
232 | + )); ?> |
|
233 | 233 | </p> |
234 | - <p class="description"><?php _e( 'Items which need to be in the cart to use this discount or, for "Item Discounts", which items are discounted. If left blank, this discount can be used on any item.', 'invoicing' ); ?></p> |
|
234 | + <p class="description"><?php _e('Items which need to be in the cart to use this discount or, for "Item Discounts", which items are discounted. If left blank, this discount can be used on any item.', 'invoicing'); ?></p> |
|
235 | 235 | </td> |
236 | 236 | </tr> |
237 | - <?php do_action( 'wpinv_discount_form_before_excluded_items', $post ); ?> |
|
237 | + <?php do_action('wpinv_discount_form_before_excluded_items', $post); ?> |
|
238 | 238 | <tr> |
239 | 239 | <th valign="top" scope="row"> |
240 | - <label for="wpinv_discount_excluded_items"><?php _e( 'Excluded Items', 'invoicing' ); ?></label> |
|
240 | + <label for="wpinv_discount_excluded_items"><?php _e('Excluded Items', 'invoicing'); ?></label> |
|
241 | 241 | </th> |
242 | 242 | <td> |
243 | - <p><?php echo wpinv_item_dropdown( array( |
|
243 | + <p><?php echo wpinv_item_dropdown(array( |
|
244 | 244 | 'name' => 'excluded_items[]', |
245 | 245 | 'id' => 'excluded_items', |
246 | 246 | 'selected' => $excluded_items, |
247 | 247 | 'multiple' => true, |
248 | 248 | 'class' => 'medium-text wpi_select2', |
249 | - 'placeholder' => __( 'Select one or more Items', 'invoicing' ), |
|
249 | + 'placeholder' => __('Select one or more Items', 'invoicing'), |
|
250 | 250 | 'show_recurring' => true, |
251 | - ) ); ?> |
|
251 | + )); ?> |
|
252 | 252 | </p> |
253 | - <p class="description"><?php _e( 'Items which are NOT allowed to use this discount.', 'invoicing' ); ?></p> |
|
253 | + <p class="description"><?php _e('Items which are NOT allowed to use this discount.', 'invoicing'); ?></p> |
|
254 | 254 | </td> |
255 | 255 | </tr> |
256 | - <?php do_action( 'wpinv_discount_form_before_start', $post ); ?> |
|
256 | + <?php do_action('wpinv_discount_form_before_start', $post); ?> |
|
257 | 257 | <tr> |
258 | 258 | <th valign="top" scope="row"> |
259 | - <label for="wpinv_discount_start"><?php _e( 'Start Date', 'invoicing' ); ?></label> |
|
259 | + <label for="wpinv_discount_start"><?php _e('Start Date', 'invoicing'); ?></label> |
|
260 | 260 | </th> |
261 | 261 | <td> |
262 | - <input type="text" class="w120 wpiDatepicker" id="wpinv_discount_start" data-dateFormat="yy-mm-dd" name="start" value="<?php echo esc_attr( $start_date ); ?>"> @ <select id="wpinv_discount_start_h" name="start_h"> |
|
263 | - <?php for ( $i = 0; $i <= 23; $i++ ) { $value = str_pad( $i, 2, '0', STR_PAD_LEFT ); ?> |
|
264 | - <option value="<?php echo $value;?>" <?php selected( $value, $start_h ); ?>><?php echo $value;?></option> |
|
262 | + <input type="text" class="w120 wpiDatepicker" id="wpinv_discount_start" data-dateFormat="yy-mm-dd" name="start" value="<?php echo esc_attr($start_date); ?>"> @ <select id="wpinv_discount_start_h" name="start_h"> |
|
263 | + <?php for ($i = 0; $i <= 23; $i++) { $value = str_pad($i, 2, '0', STR_PAD_LEFT); ?> |
|
264 | + <option value="<?php echo $value; ?>" <?php selected($value, $start_h); ?>><?php echo $value; ?></option> |
|
265 | 265 | <?php } ?> |
266 | 266 | </select> : <select id="wpinv_discount_start_m" name="start_m"> |
267 | - <?php for ( $i = 0; $i <= 59; $i++ ) { $value = str_pad( $i, 2, '0', STR_PAD_LEFT ); ?> |
|
268 | - <option value="<?php echo $value;?>" <?php selected( $value, $start_m ); ?>><?php echo $value;?></option> |
|
267 | + <?php for ($i = 0; $i <= 59; $i++) { $value = str_pad($i, 2, '0', STR_PAD_LEFT); ?> |
|
268 | + <option value="<?php echo $value; ?>" <?php selected($value, $start_m); ?>><?php echo $value; ?></option> |
|
269 | 269 | <?php } ?> |
270 | 270 | </select> |
271 | - <p class="description"><?php _e( 'Enter the start date for this discount code in the format of yyyy-mm-dd. For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing' ); ?></p> |
|
271 | + <p class="description"><?php _e('Enter the start date for this discount code in the format of yyyy-mm-dd. For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing'); ?></p> |
|
272 | 272 | </td> |
273 | 273 | </tr> |
274 | - <?php do_action( 'wpinv_discount_form_before_expiration', $post ); ?> |
|
274 | + <?php do_action('wpinv_discount_form_before_expiration', $post); ?> |
|
275 | 275 | <tr> |
276 | 276 | <th valign="top" scope="row"> |
277 | - <label for="wpinv_discount_expiration"><?php _e( 'Expiration Date', 'invoicing' ); ?></label> |
|
277 | + <label for="wpinv_discount_expiration"><?php _e('Expiration Date', 'invoicing'); ?></label> |
|
278 | 278 | </th> |
279 | 279 | <td> |
280 | - <input type="text" class="w120 wpiDatepicker" id="wpinv_discount_expiration" data-dateFormat="yy-mm-dd" name="expiration" value="<?php echo esc_attr( $expiration_date ); ?>"> @ <select id="wpinv_discount_expiration_h" name="expiration_h"> |
|
281 | - <?php for ( $i = 0; $i <= 23; $i++ ) { $value = str_pad( $i, 2, '0', STR_PAD_LEFT ); ?> |
|
282 | - <option value="<?php echo $value;?>" <?php selected( $value, $expiration_h ); ?>><?php echo $value;?></option> |
|
280 | + <input type="text" class="w120 wpiDatepicker" id="wpinv_discount_expiration" data-dateFormat="yy-mm-dd" name="expiration" value="<?php echo esc_attr($expiration_date); ?>"> @ <select id="wpinv_discount_expiration_h" name="expiration_h"> |
|
281 | + <?php for ($i = 0; $i <= 23; $i++) { $value = str_pad($i, 2, '0', STR_PAD_LEFT); ?> |
|
282 | + <option value="<?php echo $value; ?>" <?php selected($value, $expiration_h); ?>><?php echo $value; ?></option> |
|
283 | 283 | <?php } ?> |
284 | 284 | </select> : <select id="wpinv_discount_expiration_m" name="expiration_m"> |
285 | - <?php for ( $i = 0; $i <= 59; $i++ ) { $value = str_pad( $i, 2, '0', STR_PAD_LEFT ); ?> |
|
286 | - <option value="<?php echo $value;?>" <?php selected( $value, $expiration_m ); ?>><?php echo $value;?></option> |
|
285 | + <?php for ($i = 0; $i <= 59; $i++) { $value = str_pad($i, 2, '0', STR_PAD_LEFT); ?> |
|
286 | + <option value="<?php echo $value; ?>" <?php selected($value, $expiration_m); ?>><?php echo $value; ?></option> |
|
287 | 287 | <?php } ?> |
288 | 288 | </select> |
289 | - <p class="description"><?php _e( 'Enter the expiration date for this discount code in the format of yyyy-mm-dd. Leave blank for no expiration.', 'invoicing' ); ?></p> |
|
289 | + <p class="description"><?php _e('Enter the expiration date for this discount code in the format of yyyy-mm-dd. Leave blank for no expiration.', 'invoicing'); ?></p> |
|
290 | 290 | </td> |
291 | 291 | </tr> |
292 | - <?php do_action( 'wpinv_discount_form_before_min_total', $post ); ?> |
|
292 | + <?php do_action('wpinv_discount_form_before_min_total', $post); ?> |
|
293 | 293 | <tr> |
294 | 294 | <th valign="top" scope="row"> |
295 | - <label for="wpinv_discount_min_total"><?php _e( 'Minimum Amount', 'invoicing' ); ?></label> |
|
295 | + <label for="wpinv_discount_min_total"><?php _e('Minimum Amount', 'invoicing'); ?></label> |
|
296 | 296 | </th> |
297 | 297 | <td> |
298 | 298 | <input type="text" name="min_total" id="wpinv_discount_min_total" class="wpi-field-price wpi-price" value="<?php echo $min_total; ?>"> |
299 | - <p class="description"><?php _e( 'This allows you to set the minimum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing' ); ?></p> |
|
299 | + <p class="description"><?php _e('This allows you to set the minimum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing'); ?></p> |
|
300 | 300 | </td> |
301 | 301 | </tr> |
302 | - <?php do_action( 'wpinv_discount_form_before_max_total', $post ); ?> |
|
302 | + <?php do_action('wpinv_discount_form_before_max_total', $post); ?> |
|
303 | 303 | <tr> |
304 | 304 | <th valign="top" scope="row"> |
305 | - <label for="wpinv_discount_max_total"><?php _e( 'Maximum Amount', 'invoicing' ); ?></label> |
|
305 | + <label for="wpinv_discount_max_total"><?php _e('Maximum Amount', 'invoicing'); ?></label> |
|
306 | 306 | </th> |
307 | 307 | <td> |
308 | 308 | <input type="text" name="max_total" id="wpinv_discount_max_total" class="wpi-field-price wpi-price" value="<?php echo $max_total; ?>"> |
309 | - <p class="description"><?php _e( 'This allows you to set the maximum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing' ); ?></p> |
|
309 | + <p class="description"><?php _e('This allows you to set the maximum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing'); ?></p> |
|
310 | 310 | </td> |
311 | 311 | </tr> |
312 | - <?php do_action( 'wpinv_discount_form_before_recurring', $post ); ?> |
|
312 | + <?php do_action('wpinv_discount_form_before_recurring', $post); ?> |
|
313 | 313 | <tr> |
314 | 314 | <th valign="top" scope="row"> |
315 | - <label for="wpinv_discount_recurring"><?php _e( 'For recurring apply to', 'invoicing' ); ?></label> |
|
315 | + <label for="wpinv_discount_recurring"><?php _e('For recurring apply to', 'invoicing'); ?></label> |
|
316 | 316 | </th> |
317 | 317 | <td> |
318 | 318 | <select id="wpinv_discount_recurring" name="recurring" class="medium-text wpi_select2"> |
319 | - <option value="0" <?php selected( false, $recurring ); ?>><?php _e( 'All payments', 'invoicing' ); ?></option> |
|
320 | - <option value="1" <?php selected( true, $recurring ); ?>><?php _e( 'First payment only', 'invoicing' ); ?></option> |
|
319 | + <option value="0" <?php selected(false, $recurring); ?>><?php _e('All payments', 'invoicing'); ?></option> |
|
320 | + <option value="1" <?php selected(true, $recurring); ?>><?php _e('First payment only', 'invoicing'); ?></option> |
|
321 | 321 | </select> |
322 | - <p class="description"><?php _e( '<b>All payments:</b> Apply this discount to all recurring payments of the recurring invoice. <br><b>First payment only:</b> Apply this discount to only first payment of the recurring invoice.', 'invoicing' ); ?></p> |
|
322 | + <p class="description"><?php _e('<b>All payments:</b> Apply this discount to all recurring payments of the recurring invoice. <br><b>First payment only:</b> Apply this discount to only first payment of the recurring invoice.', 'invoicing'); ?></p> |
|
323 | 323 | </td> |
324 | 324 | </tr> |
325 | - <?php do_action( 'wpinv_discount_form_before_max_uses', $post ); ?> |
|
325 | + <?php do_action('wpinv_discount_form_before_max_uses', $post); ?> |
|
326 | 326 | <tr> |
327 | 327 | <th valign="top" scope="row"> |
328 | - <label for="wpinv_discount_max_uses"><?php _e( 'Max Uses', 'invoicing' ); ?></label> |
|
328 | + <label for="wpinv_discount_max_uses"><?php _e('Max Uses', 'invoicing'); ?></label> |
|
329 | 329 | </th> |
330 | 330 | <td> |
331 | 331 | <input type="number" min="0" step="1" id="wpinv_discount_max_uses" name="max_uses" class="medium-text" value="<?php echo $max_uses; ?>"> |
332 | - <p class="description"><?php _e( 'The maximum number of times this discount can be used. Leave blank for unlimited.', 'invoicing' ); ?></p> |
|
332 | + <p class="description"><?php _e('The maximum number of times this discount can be used. Leave blank for unlimited.', 'invoicing'); ?></p> |
|
333 | 333 | </td> |
334 | 334 | </tr> |
335 | - <?php do_action( 'wpinv_discount_form_before_single_use', $post ); ?> |
|
335 | + <?php do_action('wpinv_discount_form_before_single_use', $post); ?> |
|
336 | 336 | <tr> |
337 | 337 | <th valign="top" scope="row"> |
338 | - <label for="wpinv_discount_single_use"><?php _e( 'Use Once Per User', 'invoicing' ); ?></label> |
|
338 | + <label for="wpinv_discount_single_use"><?php _e('Use Once Per User', 'invoicing'); ?></label> |
|
339 | 339 | </th> |
340 | 340 | <td> |
341 | - <input type="checkbox" value="1" name="single_use" id="wpinv_discount_single_use" <?php checked( true, $single_use ); ?>> |
|
342 | - <span class="description"><?php _e( 'Limit this discount to a single use per user?', 'invoicing' ); ?></span> |
|
341 | + <input type="checkbox" value="1" name="single_use" id="wpinv_discount_single_use" <?php checked(true, $single_use); ?>> |
|
342 | + <span class="description"><?php _e('Limit this discount to a single use per user?', 'invoicing'); ?></span> |
|
343 | 343 | </td> |
344 | 344 | </tr> |
345 | - <?php do_action( 'wpinv_discount_form_last', $post ); ?> |
|
345 | + <?php do_action('wpinv_discount_form_last', $post); ?> |
|
346 | 346 | </tbody> |
347 | 347 | </table> |
348 | -<?php do_action( 'wpinv_discount_form_bottom', $post ); ?> |
|
348 | +<?php do_action('wpinv_discount_form_bottom', $post); ?> |
|
349 | 349 | <?php |
350 | 350 | } |
351 | 351 | |
352 | -function wpinv_discount_metabox_save( $post_id, $post, $update = false ) { |
|
353 | - $post_type = !empty( $post ) ? $post->post_type : ''; |
|
352 | +function wpinv_discount_metabox_save($post_id, $post, $update = false) { |
|
353 | + $post_type = !empty($post) ? $post->post_type : ''; |
|
354 | 354 | |
355 | - if ( $post_type != 'wpi_discount' ) { |
|
355 | + if ($post_type != 'wpi_discount') { |
|
356 | 356 | return; |
357 | 357 | } |
358 | 358 | |
359 | - if ( !isset( $_POST['wpinv_discount_metabox_nonce'] ) || ( isset( $_POST['wpinv_discount_metabox_nonce'] ) && !wp_verify_nonce( $_POST['wpinv_discount_metabox_nonce'], 'wpinv_discount_metabox_nonce' ) ) ) { |
|
359 | + if (!isset($_POST['wpinv_discount_metabox_nonce']) || (isset($_POST['wpinv_discount_metabox_nonce']) && !wp_verify_nonce($_POST['wpinv_discount_metabox_nonce'], 'wpinv_discount_metabox_nonce'))) { |
|
360 | 360 | return; |
361 | 361 | } |
362 | 362 | |
363 | - if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) { |
|
363 | + if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) { |
|
364 | 364 | return; |
365 | 365 | } |
366 | 366 | |
367 | - if ( !current_user_can( 'manage_options', $post_id ) ) { |
|
367 | + if (!current_user_can('manage_options', $post_id)) { |
|
368 | 368 | return; |
369 | 369 | } |
370 | 370 | |
371 | - if ( !empty( $_POST['start'] ) && isset( $_POST['start_h'] ) && isset( $_POST['start_m'] ) && $_POST['start_h'] !== '' && $_POST['start_m'] !== '' ) { |
|
371 | + if (!empty($_POST['start']) && isset($_POST['start_h']) && isset($_POST['start_m']) && $_POST['start_h'] !== '' && $_POST['start_m'] !== '') { |
|
372 | 372 | $_POST['start'] = $_POST['start'] . ' ' . $_POST['start_h'] . ':' . $_POST['start_m']; |
373 | 373 | } |
374 | 374 | |
375 | - if ( !empty( $_POST['expiration'] ) && isset( $_POST['expiration_h'] ) && isset( $_POST['expiration_m'] ) ) { |
|
375 | + if (!empty($_POST['expiration']) && isset($_POST['expiration_h']) && isset($_POST['expiration_m'])) { |
|
376 | 376 | $_POST['expiration'] = $_POST['expiration'] . ' ' . $_POST['expiration_h'] . ':' . $_POST['expiration_m']; |
377 | 377 | } |
378 | 378 | |
379 | - return wpinv_store_discount( $post_id, $_POST, $post, $update ); |
|
379 | + return wpinv_store_discount($post_id, $_POST, $post, $update); |
|
380 | 380 | } |
381 | -add_action( 'save_post', 'wpinv_discount_metabox_save', 10, 3 ); |
|
382 | 381 | \ No newline at end of file |
382 | +add_action('save_post', 'wpinv_discount_metabox_save', 10, 3); |
|
383 | 383 | \ No newline at end of file |
@@ -1,47 +1,47 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | class WPInv_Meta_Box_Items { |
8 | - public static function output( $post ) { |
|
8 | + public static function output($post) { |
|
9 | 9 | global $wpinv_euvat, $ajax_cart_details; |
10 | 10 | |
11 | - $post_id = !empty( $post->ID ) ? $post->ID : 0; |
|
12 | - $invoice = new WPInv_Invoice( $post_id ); |
|
11 | + $post_id = !empty($post->ID) ? $post->ID : 0; |
|
12 | + $invoice = new WPInv_Invoice($post_id); |
|
13 | 13 | $ajax_cart_details = $invoice->get_cart_details(); |
14 | - $subtotal = $invoice->get_subtotal( true ); |
|
14 | + $subtotal = $invoice->get_subtotal(true); |
|
15 | 15 | $discount_raw = $invoice->get_discount(); |
16 | - $discount = wpinv_price( $discount_raw, $invoice->get_currency() ); |
|
16 | + $discount = wpinv_price($discount_raw, $invoice->get_currency()); |
|
17 | 17 | $discounts = $discount_raw > 0 ? $invoice->get_discounts() : ''; |
18 | - $tax = $invoice->get_tax( true ); |
|
19 | - $total = $invoice->get_total( true ); |
|
18 | + $tax = $invoice->get_tax(true); |
|
19 | + $total = $invoice->get_total(true); |
|
20 | 20 | $item_quantities = wpinv_item_quantities_enabled(); |
21 | 21 | $use_taxes = wpinv_use_taxes(); |
22 | - if ( !$use_taxes && (float)$invoice->get_tax() > 0 ) { |
|
22 | + if (!$use_taxes && (float)$invoice->get_tax() > 0) { |
|
23 | 23 | $use_taxes = true; |
24 | 24 | } |
25 | - $item_types = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post ); |
|
25 | + $item_types = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post); |
|
26 | 26 | $is_recurring = $invoice->is_recurring(); |
27 | 27 | $post_type_object = get_post_type_object($invoice->post_type); |
28 | 28 | $type_title = $post_type_object->labels->singular_name; |
29 | 29 | |
30 | 30 | $cols = 5; |
31 | - if ( $item_quantities ) { |
|
31 | + if ($item_quantities) { |
|
32 | 32 | $cols++; |
33 | 33 | } |
34 | - if ( $use_taxes ) { |
|
34 | + if ($use_taxes) { |
|
35 | 35 | $cols++; |
36 | 36 | } |
37 | 37 | $class = ''; |
38 | - if ( $invoice->is_paid() ) { |
|
38 | + if ($invoice->is_paid()) { |
|
39 | 39 | $class .= ' wpinv-paid'; |
40 | 40 | } |
41 | - if ( $invoice->is_refunded() ) { |
|
41 | + if ($invoice->is_refunded()) { |
|
42 | 42 | $class .= ' wpinv-refunded'; |
43 | 43 | } |
44 | - if ( $is_recurring ) { |
|
44 | + if ($is_recurring) { |
|
45 | 45 | $class .= ' wpi-recurring'; |
46 | 46 | } |
47 | 47 | ?> |
@@ -49,21 +49,21 @@ discard block |
||
49 | 49 | <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0"> |
50 | 50 | <thead> |
51 | 51 | <tr> |
52 | - <th class="id"><?php _e( 'ID', 'invoicing' );?></th> |
|
53 | - <th class="title"><?php _e( 'Item', 'invoicing' );?></th> |
|
54 | - <th class="price"><?php _e( 'Price', 'invoicing' );?></th> |
|
55 | - <?php if ( $item_quantities ) { ?> |
|
56 | - <th class="qty"><?php _e( 'Qty', 'invoicing' );?></th> |
|
52 | + <th class="id"><?php _e('ID', 'invoicing'); ?></th> |
|
53 | + <th class="title"><?php _e('Item', 'invoicing'); ?></th> |
|
54 | + <th class="price"><?php _e('Price', 'invoicing'); ?></th> |
|
55 | + <?php if ($item_quantities) { ?> |
|
56 | + <th class="qty"><?php _e('Qty', 'invoicing'); ?></th> |
|
57 | 57 | <?php } ?> |
58 | - <th class="total"><?php _e( 'Total', 'invoicing' );?></th> |
|
59 | - <?php if ( $use_taxes ) { ?> |
|
60 | - <th class="tax"><?php _e( 'Tax (%)', 'invoicing' );?></th> |
|
58 | + <th class="total"><?php _e('Total', 'invoicing'); ?></th> |
|
59 | + <?php if ($use_taxes) { ?> |
|
60 | + <th class="tax"><?php _e('Tax (%)', 'invoicing'); ?></th> |
|
61 | 61 | <?php } ?> |
62 | 62 | <th class="action"></th> |
63 | 63 | </tr> |
64 | 64 | </thead> |
65 | 65 | <tbody class="wpinv-line-items"> |
66 | - <?php echo wpinv_admin_get_line_items( $invoice ); ?> |
|
66 | + <?php echo wpinv_admin_get_line_items($invoice); ?> |
|
67 | 67 | </tbody> |
68 | 68 | <tfoot class="wpinv-totals"> |
69 | 69 | <tr> |
@@ -74,45 +74,45 @@ discard block |
||
74 | 74 | <td class="id"> |
75 | 75 | </td> |
76 | 76 | <td class="title"> |
77 | - <input type="text" class="regular-text" placeholder="<?php _e( 'Item Name', 'invoicing' ); ?>" value="" name="_wpinv_quick[name]"> |
|
78 | - <?php if ( $wpinv_euvat->allow_vat_rules() ) { ?> |
|
77 | + <input type="text" class="regular-text" placeholder="<?php _e('Item Name', 'invoicing'); ?>" value="" name="_wpinv_quick[name]"> |
|
78 | + <?php if ($wpinv_euvat->allow_vat_rules()) { ?> |
|
79 | 79 | <div class="wp-clearfix"> |
80 | 80 | <label class="wpi-vat-rule"> |
81 | - <span class="title"><?php _e( 'VAT rule type', 'invoicing' );?></span> |
|
81 | + <span class="title"><?php _e('VAT rule type', 'invoicing'); ?></span> |
|
82 | 82 | <span class="input-text-wrap"> |
83 | - <?php echo wpinv_html_select( array( |
|
83 | + <?php echo wpinv_html_select(array( |
|
84 | 84 | 'options' => $wpinv_euvat->get_rules(), |
85 | 85 | 'name' => '_wpinv_quick[vat_rule]', |
86 | 86 | 'id' => '_wpinv_quick_vat_rule', |
87 | 87 | 'show_option_all' => false, |
88 | 88 | 'show_option_none' => false, |
89 | 89 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-rule wpi_select2', |
90 | - ) ); ?> |
|
90 | + )); ?> |
|
91 | 91 | </span> |
92 | 92 | </label> |
93 | 93 | </div> |
94 | - <?php } if ( $wpinv_euvat->allow_vat_classes() ) { ?> |
|
94 | + <?php } if ($wpinv_euvat->allow_vat_classes()) { ?> |
|
95 | 95 | <div class="wp-clearfix"> |
96 | 96 | <label class="wpi-vat-class"> |
97 | - <span class="title"><?php _e( 'VAT class', 'invoicing' );?></span> |
|
97 | + <span class="title"><?php _e('VAT class', 'invoicing'); ?></span> |
|
98 | 98 | <span class="input-text-wrap"> |
99 | - <?php echo wpinv_html_select( array( |
|
99 | + <?php echo wpinv_html_select(array( |
|
100 | 100 | 'options' => $wpinv_euvat->get_all_classes(), |
101 | 101 | 'name' => '_wpinv_quick[vat_class]', |
102 | 102 | 'id' => '_wpinv_quick_vat_class', |
103 | 103 | 'show_option_all' => false, |
104 | 104 | 'show_option_none' => false, |
105 | 105 | 'class' => 'gdmbx2-text-medium wpinv-quick-vat-class wpi_select2', |
106 | - ) ); ?> |
|
106 | + )); ?> |
|
107 | 107 | </span> |
108 | 108 | </label> |
109 | 109 | </div> |
110 | 110 | <?php } ?> |
111 | 111 | <div class="wp-clearfix"> |
112 | 112 | <label class="wpi-item-type"> |
113 | - <span class="title"><?php _e( 'Item type', 'invoicing' );?></span> |
|
113 | + <span class="title"><?php _e('Item type', 'invoicing'); ?></span> |
|
114 | 114 | <span class="input-text-wrap"> |
115 | - <?php echo wpinv_html_select( array( |
|
115 | + <?php echo wpinv_html_select(array( |
|
116 | 116 | 'options' => $item_types, |
117 | 117 | 'name' => '_wpinv_quick[type]', |
118 | 118 | 'id' => '_wpinv_quick_type', |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | 'show_option_all' => false, |
121 | 121 | 'show_option_none' => false, |
122 | 122 | 'class' => 'gdmbx2-text-medium wpinv-quick-type wpi_select2', |
123 | - ) ); ?> |
|
123 | + )); ?> |
|
124 | 124 | </span> |
125 | 125 | </label> |
126 | 126 | </div> |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | </div> |
134 | 134 | </td> |
135 | 135 | <td class="price"><input type="text" placeholder="0.00" class="wpi-field-price wpi-price" name="_wpinv_quick[price]" /></td> |
136 | - <?php if ( $item_quantities ) { ?> |
|
136 | + <?php if ($item_quantities) { ?> |
|
137 | 137 | <td class="qty"><input type="number" class="small-text" step="1" min="1" value="1" name="_wpinv_quick[qty]" /></td> |
138 | 138 | <?php } ?> |
139 | 139 | <td class="total"></td> |
140 | - <?php if ( $use_taxes ) { ?> |
|
140 | + <?php if ($use_taxes) { ?> |
|
141 | 141 | <td class="tax"></td> |
142 | 142 | <?php } ?> |
143 | 143 | <td class="action"></td> |
@@ -150,29 +150,29 @@ discard block |
||
150 | 150 | <td colspan="<?php echo $cols; ?>"></td> |
151 | 151 | </tr> |
152 | 152 | <tr class="totals"> |
153 | - <td colspan="<?php echo ( $cols - 4 ); ?>"></td> |
|
153 | + <td colspan="<?php echo ($cols - 4); ?>"></td> |
|
154 | 154 | <td colspan="4"> |
155 | 155 | <table cellspacing="0" cellpadding="0"> |
156 | 156 | <tr class="subtotal"> |
157 | - <td class="name"><?php _e( 'Sub Total:', 'invoicing' );?></td> |
|
158 | - <td class="total"><?php echo $subtotal;?></td> |
|
157 | + <td class="name"><?php _e('Sub Total:', 'invoicing'); ?></td> |
|
158 | + <td class="total"><?php echo $subtotal; ?></td> |
|
159 | 159 | <td class="action"></td> |
160 | 160 | </tr> |
161 | 161 | <tr class="discount"> |
162 | - <td class="name"><?php wpinv_get_discount_label( wpinv_discount_code( $invoice->ID ) ); ?>:</td> |
|
163 | - <td class="total"><?php echo wpinv_discount( $invoice->ID, true, true ); ?></td> |
|
162 | + <td class="name"><?php wpinv_get_discount_label(wpinv_discount_code($invoice->ID)); ?>:</td> |
|
163 | + <td class="total"><?php echo wpinv_discount($invoice->ID, true, true); ?></td> |
|
164 | 164 | <td class="action"></td> |
165 | 165 | </tr> |
166 | - <?php if ( $use_taxes ) { ?> |
|
166 | + <?php if ($use_taxes) { ?> |
|
167 | 167 | <tr class="tax"> |
168 | - <td class="name"><?php _e( 'Tax:', 'invoicing' );?></td> |
|
169 | - <td class="total"><?php echo $tax;?></td> |
|
168 | + <td class="name"><?php _e('Tax:', 'invoicing'); ?></td> |
|
169 | + <td class="total"><?php echo $tax; ?></td> |
|
170 | 170 | <td class="action"></td> |
171 | 171 | </tr> |
172 | 172 | <?php } ?> |
173 | 173 | <tr class="total"> |
174 | - <td class="name"><?php echo apply_filters( 'wpinv_invoice_items_total_label', __( 'Invoice Total:', 'invoicing' ), $invoice );?></td> |
|
175 | - <td class="total"><?php echo $total;?></td> |
|
174 | + <td class="name"><?php echo apply_filters('wpinv_invoice_items_total_label', __('Invoice Total:', 'invoicing'), $invoice); ?></td> |
|
175 | + <td class="total"><?php echo $total; ?></td> |
|
176 | 176 | <td class="action"></td> |
177 | 177 | </tr> |
178 | 178 | </table> |
@@ -183,90 +183,90 @@ discard block |
||
183 | 183 | <div class="wpinv-actions"> |
184 | 184 | <?php ob_start(); ?> |
185 | 185 | <?php |
186 | - if ( !$invoice->is_paid() && !$invoice->is_refunded() ) { |
|
187 | - if ( !$invoice->is_recurring() ) { |
|
188 | - echo wpinv_item_dropdown( array( |
|
186 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
187 | + if (!$invoice->is_recurring()) { |
|
188 | + echo wpinv_item_dropdown(array( |
|
189 | 189 | 'name' => 'wpinv_invoice_item', |
190 | 190 | 'id' => 'wpinv_invoice_item', |
191 | 191 | 'show_recurring' => true, |
192 | 192 | 'class' => 'wpi_select2', |
193 | - ) ); |
|
193 | + )); |
|
194 | 194 | ?> |
195 | - <input type="button" value="<?php echo sprintf(esc_attr__( 'Add item to %s', 'invoicing'), $type_title); ?>" class="button button-primary" id="wpinv-add-item"><input type="button" value="<?php esc_attr_e( 'Create new item', 'invoicing' );?>" class="button button-primary" id="wpinv-new-item"><?php } ?><input type="button" value="<?php esc_attr_e( 'Recalculate Totals', 'invoicing' );?>" class="button button-primary wpinv-flr" id="wpinv-recalc-totals"> |
|
195 | + <input type="button" value="<?php echo sprintf(esc_attr__('Add item to %s', 'invoicing'), $type_title); ?>" class="button button-primary" id="wpinv-add-item"><input type="button" value="<?php esc_attr_e('Create new item', 'invoicing'); ?>" class="button button-primary" id="wpinv-new-item"><?php } ?><input type="button" value="<?php esc_attr_e('Recalculate Totals', 'invoicing'); ?>" class="button button-primary wpinv-flr" id="wpinv-recalc-totals"> |
|
196 | 196 | <?php } ?> |
197 | - <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?> |
|
198 | - <?php $item_actions = ob_get_clean(); echo apply_filters( 'wpinv_invoice_items_actions_content', $item_actions, $invoice, $post ); ?> |
|
197 | + <?php do_action('wpinv_invoice_items_actions', $invoice); ?> |
|
198 | + <?php $item_actions = ob_get_clean(); echo apply_filters('wpinv_invoice_items_actions_content', $item_actions, $invoice, $post); ?> |
|
199 | 199 | </div> |
200 | 200 | </div> |
201 | 201 | <?php |
202 | 202 | } |
203 | 203 | |
204 | - public static function prices( $post ) { |
|
204 | + public static function prices($post) { |
|
205 | 205 | $symbol = wpinv_currency_symbol(); |
206 | 206 | $position = wpinv_currency_position(); |
207 | - $item = new WPInv_Item( $post->ID ); |
|
207 | + $item = new WPInv_Item($post->ID); |
|
208 | 208 | |
209 | 209 | $price = $item->get_price(); |
210 | 210 | $is_dynamic_pricing = $item->get_is_dynamic_pricing(); |
211 | 211 | $minimum_price = $item->get_minimum_price(); |
212 | 212 | $is_recurring = $item->is_recurring(); |
213 | 213 | $period = $item->get_recurring_period(); |
214 | - $interval = absint( $item->get_recurring_interval() ); |
|
215 | - $times = absint( $item->get_recurring_limit() ); |
|
214 | + $interval = absint($item->get_recurring_interval()); |
|
215 | + $times = absint($item->get_recurring_limit()); |
|
216 | 216 | $free_trial = $item->has_free_trial(); |
217 | 217 | $trial_interval = $item->get_trial_interval(); |
218 | 218 | $trial_period = $item->get_trial_period(); |
219 | 219 | |
220 | 220 | $intervals = array(); |
221 | - for ( $i = 1; $i <= 90; $i++ ) { |
|
221 | + for ($i = 1; $i <= 90; $i++) { |
|
222 | 222 | $intervals[$i] = $i; |
223 | 223 | } |
224 | 224 | |
225 | - $interval = $interval > 0 ? $interval : 1; |
|
225 | + $interval = $interval > 0 ? $interval : 1; |
|
226 | 226 | |
227 | 227 | $class = $is_recurring ? 'wpinv-recurring-y' : 'wpinv-recurring-n'; |
228 | 228 | |
229 | 229 | $minimum_price_style = 'margin-left: 24px;'; |
230 | - if(! $is_dynamic_pricing ) { |
|
230 | + if (!$is_dynamic_pricing) { |
|
231 | 231 | $minimum_price_style .= 'display: none;'; |
232 | 232 | } |
233 | 233 | |
234 | 234 | ?> |
235 | - <p class="wpinv-row-prices"><?php echo ( $position != 'right' ? $symbol . ' ' : '' );?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" value="<?php echo $price;?>" id="wpinv_item_price" name="wpinv_item_price" class="medium-text wpi-field-price wpi-price" <?php disabled( $item->is_editable(), false ); ?> /><?php echo ( $position == 'right' ? ' ' . $symbol : '' );?><input type="hidden" name="wpinv_vat_meta_box_nonce" value="<?php echo wp_create_nonce( 'wpinv_item_meta_box_save' ) ;?>" /> |
|
236 | - <?php do_action( 'wpinv_prices_metabox_price', $item ); ?> |
|
235 | + <p class="wpinv-row-prices"><?php echo ($position != 'right' ? $symbol . ' ' : ''); ?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" value="<?php echo $price; ?>" id="wpinv_item_price" name="wpinv_item_price" class="medium-text wpi-field-price wpi-price" <?php disabled($item->is_editable(), false); ?> /><?php echo ($position == 'right' ? ' ' . $symbol : ''); ?><input type="hidden" name="wpinv_vat_meta_box_nonce" value="<?php echo wp_create_nonce('wpinv_item_meta_box_save'); ?>" /> |
|
236 | + <?php do_action('wpinv_prices_metabox_price', $item); ?> |
|
237 | 237 | </p> |
238 | 238 | |
239 | - <?php if( $item->supports_dynamic_pricing() ) { ?> |
|
239 | + <?php if ($item->supports_dynamic_pricing()) { ?> |
|
240 | 240 | |
241 | 241 | <p class="wpinv-row-name-your-price"> |
242 | 242 | <label> |
243 | - <input type="checkbox" name="wpinv_name_your_price" id="wpinv_name_your_price" value="1" <?php checked( 1, $is_dynamic_pricing ); ?> /> |
|
244 | - <?php echo apply_filters( 'wpinv_name_your_price_toggle_text', __( 'User can set a custom price', 'invoicing' ) ); ?> |
|
243 | + <input type="checkbox" name="wpinv_name_your_price" id="wpinv_name_your_price" value="1" <?php checked(1, $is_dynamic_pricing); ?> /> |
|
244 | + <?php echo apply_filters('wpinv_name_your_price_toggle_text', __('User can set a custom price', 'invoicing')); ?> |
|
245 | 245 | </label> |
246 | - <?php do_action( 'wpinv_prices_metabox_name_your_price_field', $item ); ?> |
|
246 | + <?php do_action('wpinv_prices_metabox_name_your_price_field', $item); ?> |
|
247 | 247 | </p> |
248 | 248 | |
249 | 249 | <p class="wpinv-row-minimum-price" style="<?php echo $minimum_price_style; ?>"> |
250 | 250 | <label> |
251 | - <?php _e( 'Minimum Price', 'invoicing' ); ?> |
|
252 | - <?php echo ( $position != 'right' ? $symbol . ' ' : '' );?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" value="<?php echo $minimum_price;?>" id="wpinv_minimum_price" name="wpinv_minimum_price" class="medium-text wpi-field-price" <?php disabled( $item->is_editable(), false ); ?> /><?php echo ( $position == 'right' ? ' ' . $symbol : '' );?> |
|
251 | + <?php _e('Minimum Price', 'invoicing'); ?> |
|
252 | + <?php echo ($position != 'right' ? $symbol . ' ' : ''); ?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" value="<?php echo $minimum_price; ?>" id="wpinv_minimum_price" name="wpinv_minimum_price" class="medium-text wpi-field-price" <?php disabled($item->is_editable(), false); ?> /><?php echo ($position == 'right' ? ' ' . $symbol : ''); ?> |
|
253 | 253 | </label> |
254 | 254 | |
255 | - <?php do_action( 'wpinv_prices_metabox_minimum_price_field', $item ); ?> |
|
255 | + <?php do_action('wpinv_prices_metabox_minimum_price_field', $item); ?> |
|
256 | 256 | </p> |
257 | 257 | |
258 | 258 | <?php } ?> |
259 | 259 | |
260 | 260 | <p class="wpinv-row-is-recurring"> |
261 | 261 | <label for="wpinv_is_recurring"> |
262 | - <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked( 1, $is_recurring ); ?> /> |
|
263 | - <?php echo apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Is Recurring Item?', 'invoicing' ) ); ?> |
|
262 | + <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked(1, $is_recurring); ?> /> |
|
263 | + <?php echo apply_filters('wpinv_is_recurring_toggle_text', __('Is Recurring Item?', 'invoicing')); ?> |
|
264 | 264 | </label> |
265 | - <?php do_action( 'wpinv_prices_metabox_is_recurring_field', $item ); ?> |
|
265 | + <?php do_action('wpinv_prices_metabox_is_recurring_field', $item); ?> |
|
266 | 266 | </p> |
267 | - <p class="wpinv-row-recurring-fields <?php echo $class;?>"> |
|
268 | - <label class="wpinv-period" for="wpinv_recurring_period"><?php _e( 'Recurring', 'invoicing' );?> <select class="wpinv-select wpi_select2" id="wpinv_recurring_period" name="wpinv_recurring_period"><option value="D" data-text="<?php esc_attr_e( 'day(s)', 'invoicing' ); ?>" <?php selected( 'D', $period );?>><?php _e( 'Daily', 'invoicing' ); ?></option><option value="W" data-text="<?php esc_attr_e( 'week(s)', 'invoicing' ); ?>" <?php selected( 'W', $period );?>><?php _e( 'Weekly', 'invoicing' ); ?></option><option value="M" data-text="<?php esc_attr_e( 'month(s)', 'invoicing' ); ?>" <?php selected( 'M', $period );?>><?php _e( 'Monthly', 'invoicing' ); ?></option><option value="Y" data-text="<?php esc_attr_e( 'year(s)', 'invoicing' ); ?>" <?php selected( 'Y', $period );?>><?php _e( 'Yearly', 'invoicing' ); ?></option></select></label> |
|
269 | - <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e( 'at every', 'invoicing' );?> <?php echo wpinv_html_select( array( |
|
267 | + <p class="wpinv-row-recurring-fields <?php echo $class; ?>"> |
|
268 | + <label class="wpinv-period" for="wpinv_recurring_period"><?php _e('Recurring', 'invoicing'); ?> <select class="wpinv-select wpi_select2" id="wpinv_recurring_period" name="wpinv_recurring_period"><option value="D" data-text="<?php esc_attr_e('day(s)', 'invoicing'); ?>" <?php selected('D', $period); ?>><?php _e('Daily', 'invoicing'); ?></option><option value="W" data-text="<?php esc_attr_e('week(s)', 'invoicing'); ?>" <?php selected('W', $period); ?>><?php _e('Weekly', 'invoicing'); ?></option><option value="M" data-text="<?php esc_attr_e('month(s)', 'invoicing'); ?>" <?php selected('M', $period); ?>><?php _e('Monthly', 'invoicing'); ?></option><option value="Y" data-text="<?php esc_attr_e('year(s)', 'invoicing'); ?>" <?php selected('Y', $period); ?>><?php _e('Yearly', 'invoicing'); ?></option></select></label> |
|
269 | + <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e('at every', 'invoicing'); ?> <?php echo wpinv_html_select(array( |
|
270 | 270 | 'options' => $intervals, |
271 | 271 | 'name' => 'wpinv_recurring_interval', |
272 | 272 | 'id' => 'wpinv_recurring_interval', |
@@ -274,30 +274,30 @@ discard block |
||
274 | 274 | 'show_option_all' => false, |
275 | 275 | 'show_option_none' => false, |
276 | 276 | 'class' => 'wpi_select2', |
277 | - ) ); ?> <span id="wpinv_interval_text"><?php _e( 'day(s)', 'invoicing' );?></span></label> |
|
278 | - <label class="wpinv-times" for="wpinv_recurring_limit"> <?php _e( 'for', 'invoicing' );?> <input class="small-text" type="number" value="<?php echo $times;?>" size="4" id="wpinv_recurring_limit" name="wpinv_recurring_limit" step="1" min="0"> <?php _e( 'time(s) <i>(select 0 for recurring forever until cancelled</i>)', 'invoicing' );?></label> |
|
277 | + )); ?> <span id="wpinv_interval_text"><?php _e('day(s)', 'invoicing'); ?></span></label> |
|
278 | + <label class="wpinv-times" for="wpinv_recurring_limit"> <?php _e('for', 'invoicing'); ?> <input class="small-text" type="number" value="<?php echo $times; ?>" size="4" id="wpinv_recurring_limit" name="wpinv_recurring_limit" step="1" min="0"> <?php _e('time(s) <i>(select 0 for recurring forever until cancelled</i>)', 'invoicing'); ?></label> |
|
279 | 279 | <span class="clear wpi-trial-clr"></span> |
280 | 280 | <label class="wpinv-free-trial" for="wpinv_free_trial"> |
281 | - <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked( true, (bool)$free_trial ); ?> /> |
|
282 | - <?php echo __( 'Offer free trial for', 'invoicing' ); ?> |
|
281 | + <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked(true, (bool)$free_trial); ?> /> |
|
282 | + <?php echo __('Offer free trial for', 'invoicing'); ?> |
|
283 | 283 | </label> |
284 | 284 | <label class="wpinv-trial-interval" for="wpinv_trial_interval"> |
285 | - <input class="small-text" type="number" value="<?php echo $trial_interval;?>" size="4" id="wpinv_trial_interval" name="wpinv_trial_interval" step="1" min="1"> <select class="wpinv-select wpi_select2" id="wpinv_trial_period" name="wpinv_trial_period"><option value="D" <?php selected( 'D', $trial_period );?>><?php _e( 'day(s)', 'invoicing' ); ?></option><option value="W" <?php selected( 'W', $trial_period );?>><?php _e( 'week(s)', 'invoicing' ); ?></option><option value="M" <?php selected( 'M', $trial_period );?>><?php _e( 'month(s)', 'invoicing' ); ?></option><option value="Y" <?php selected( 'Y', $trial_period );?>><?php _e( 'year(s)', 'invoicing' ); ?></option></select> |
|
285 | + <input class="small-text" type="number" value="<?php echo $trial_interval; ?>" size="4" id="wpinv_trial_interval" name="wpinv_trial_interval" step="1" min="1"> <select class="wpinv-select wpi_select2" id="wpinv_trial_period" name="wpinv_trial_period"><option value="D" <?php selected('D', $trial_period); ?>><?php _e('day(s)', 'invoicing'); ?></option><option value="W" <?php selected('W', $trial_period); ?>><?php _e('week(s)', 'invoicing'); ?></option><option value="M" <?php selected('M', $trial_period); ?>><?php _e('month(s)', 'invoicing'); ?></option><option value="Y" <?php selected('Y', $trial_period); ?>><?php _e('year(s)', 'invoicing'); ?></option></select> |
|
286 | 286 | </label> |
287 | - <?php do_action( 'wpinv_prices_metabox_recurring_fields', $item ); ?> |
|
287 | + <?php do_action('wpinv_prices_metabox_recurring_fields', $item); ?> |
|
288 | 288 | </p> |
289 | - <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type( $post->ID ); ?>" /> |
|
290 | - <?php do_action( 'wpinv_item_price_field', $post->ID ); ?> |
|
289 | + <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type($post->ID); ?>" /> |
|
290 | + <?php do_action('wpinv_item_price_field', $post->ID); ?> |
|
291 | 291 | <?php |
292 | 292 | } |
293 | 293 | |
294 | - public static function vat_rules( $post ) { |
|
294 | + public static function vat_rules($post) { |
|
295 | 295 | global $wpinv_euvat; |
296 | 296 | |
297 | - $rule_type = $wpinv_euvat->get_item_rule( $post->ID ); |
|
297 | + $rule_type = $wpinv_euvat->get_item_rule($post->ID); |
|
298 | 298 | ?> |
299 | - <p><label for="wpinv_vat_rules"><strong><?php _e( 'Select how VAT rules will be applied:', 'invoicing' );?></strong></label> |
|
300 | - <?php echo wpinv_html_select( array( |
|
299 | + <p><label for="wpinv_vat_rules"><strong><?php _e('Select how VAT rules will be applied:', 'invoicing'); ?></strong></label> |
|
300 | + <?php echo wpinv_html_select(array( |
|
301 | 301 | 'options' => $wpinv_euvat->get_rules(), |
302 | 302 | 'name' => 'wpinv_vat_rules', |
303 | 303 | 'id' => 'wpinv_vat_rules', |
@@ -305,19 +305,19 @@ discard block |
||
305 | 305 | 'show_option_all' => false, |
306 | 306 | 'show_option_none' => false, |
307 | 307 | 'class' => 'gdmbx2-text-medium wpinv-vat-rules wpi_select2', |
308 | - ) ); ?> |
|
308 | + )); ?> |
|
309 | 309 | </p> |
310 | - <p class="wpi-m0"><?php _e( 'When you select physical product rules, only consumers and businesses in your country will be charged VAT. The VAT rate used will be the rate in your country.', 'invoicing' ); ?></p> |
|
311 | - <p class="wpi-m0"><?php _e( 'If you select Digital product rules, VAT will be charged at the rate that applies in the country of the consumer. Only businesses in your country will be charged VAT.', 'invoicing' ); ?></p> |
|
310 | + <p class="wpi-m0"><?php _e('When you select physical product rules, only consumers and businesses in your country will be charged VAT. The VAT rate used will be the rate in your country.', 'invoicing'); ?></p> |
|
311 | + <p class="wpi-m0"><?php _e('If you select Digital product rules, VAT will be charged at the rate that applies in the country of the consumer. Only businesses in your country will be charged VAT.', 'invoicing'); ?></p> |
|
312 | 312 | <?php |
313 | 313 | } |
314 | 314 | |
315 | - public static function vat_classes( $post ) { |
|
315 | + public static function vat_classes($post) { |
|
316 | 316 | global $wpinv_euvat; |
317 | 317 | |
318 | - $vat_class = $wpinv_euvat->get_item_class( $post->ID ); |
|
318 | + $vat_class = $wpinv_euvat->get_item_class($post->ID); |
|
319 | 319 | ?> |
320 | - <p><?php echo wpinv_html_select( array( |
|
320 | + <p><?php echo wpinv_html_select(array( |
|
321 | 321 | 'options' => $wpinv_euvat->get_all_classes(), |
322 | 322 | 'name' => 'wpinv_vat_class', |
323 | 323 | 'id' => 'wpinv_vat_class', |
@@ -325,18 +325,18 @@ discard block |
||
325 | 325 | 'show_option_all' => false, |
326 | 326 | 'show_option_none' => false, |
327 | 327 | 'class' => 'gdmbx2-text-medium wpinv-vat-class wpi_select2', |
328 | - ) ); ?> |
|
328 | + )); ?> |
|
329 | 329 | </p> |
330 | - <p class="wpi-m0"><?php _e( 'Select the VAT rate class to use for this invoice item.', 'invoicing' ); ?></p> |
|
330 | + <p class="wpi-m0"><?php _e('Select the VAT rate class to use for this invoice item.', 'invoicing'); ?></p> |
|
331 | 331 | <?php |
332 | 332 | } |
333 | 333 | |
334 | - public static function item_info( $post ) { |
|
335 | - $item_type = wpinv_get_item_type( $post->ID ); |
|
336 | - do_action( 'wpinv_item_info_metabox_before', $post ); |
|
334 | + public static function item_info($post) { |
|
335 | + $item_type = wpinv_get_item_type($post->ID); |
|
336 | + do_action('wpinv_item_info_metabox_before', $post); |
|
337 | 337 | ?> |
338 | - <p><label for="wpinv_item_type"><strong><?php _e( 'Type:', 'invoicing' );?></strong></label> |
|
339 | - <?php echo wpinv_html_select( array( |
|
338 | + <p><label for="wpinv_item_type"><strong><?php _e('Type:', 'invoicing'); ?></strong></label> |
|
339 | + <?php echo wpinv_html_select(array( |
|
340 | 340 | 'options' => wpinv_get_item_types(), |
341 | 341 | 'name' => 'wpinv_item_type', |
342 | 342 | 'id' => 'wpinv_item_type', |
@@ -344,114 +344,114 @@ discard block |
||
344 | 344 | 'show_option_all' => false, |
345 | 345 | 'show_option_none' => false, |
346 | 346 | 'class' => 'gdmbx2-text-medium wpinv-item-type', |
347 | - ) ); ?> |
|
347 | + )); ?> |
|
348 | 348 | </p> |
349 | - <p class="wpi-m0"><?php _e( 'Select item type.', 'invoicing' );?><br><?php _e( '<b>Standard:</b> Standard item type', 'invoicing' );?><br><?php _e( '<b>Fee:</b> Like Registration Fee, Sign up Fee etc.', 'invoicing' );?></p> |
|
349 | + <p class="wpi-m0"><?php _e('Select item type.', 'invoicing'); ?><br><?php _e('<b>Standard:</b> Standard item type', 'invoicing'); ?><br><?php _e('<b>Fee:</b> Like Registration Fee, Sign up Fee etc.', 'invoicing'); ?></p> |
|
350 | 350 | <?php |
351 | - do_action( 'wpinv_item_info_metabox_after', $post ); |
|
351 | + do_action('wpinv_item_info_metabox_after', $post); |
|
352 | 352 | } |
353 | 353 | |
354 | - public static function meta_values( $post ) { |
|
355 | - $meta_keys = apply_filters( 'wpinv_show_meta_values_for_keys', array( |
|
354 | + public static function meta_values($post) { |
|
355 | + $meta_keys = apply_filters('wpinv_show_meta_values_for_keys', array( |
|
356 | 356 | 'type', |
357 | 357 | 'custom_id' |
358 | - ) ); |
|
358 | + )); |
|
359 | 359 | |
360 | - if ( empty( $meta_keys ) ) { |
|
360 | + if (empty($meta_keys)) { |
|
361 | 361 | return; |
362 | 362 | } |
363 | 363 | |
364 | - do_action( 'wpinv_meta_values_metabox_before', $post ); |
|
364 | + do_action('wpinv_meta_values_metabox_before', $post); |
|
365 | 365 | |
366 | - foreach ( $meta_keys as $meta_key ) { |
|
366 | + foreach ($meta_keys as $meta_key) { |
|
367 | 367 | ?> |
368 | - <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta( $post->ID, '_wpinv_' . $meta_key, true ); ?></label></p> |
|
368 | + <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta($post->ID, '_wpinv_' . $meta_key, true); ?></label></p> |
|
369 | 369 | <?php |
370 | 370 | } |
371 | 371 | |
372 | - do_action( 'wpinv_meta_values_metabox_after', $post ); |
|
372 | + do_action('wpinv_meta_values_metabox_after', $post); |
|
373 | 373 | } |
374 | 374 | |
375 | - public static function save( $post_id, $data, $post ) { |
|
376 | - $invoice = new WPInv_Invoice( $post_id ); |
|
375 | + public static function save($post_id, $data, $post) { |
|
376 | + $invoice = new WPInv_Invoice($post_id); |
|
377 | 377 | |
378 | 378 | // Billing |
379 | - $first_name = sanitize_text_field( $data['wpinv_first_name'] ); |
|
380 | - $last_name = sanitize_text_field( $data['wpinv_last_name'] ); |
|
381 | - $company = sanitize_text_field( $data['wpinv_company'] ); |
|
382 | - $vat_number = sanitize_text_field( $data['wpinv_vat_number'] ); |
|
383 | - $phone = sanitize_text_field( $data['wpinv_phone'] ); |
|
384 | - $address = sanitize_text_field( $data['wpinv_address'] ); |
|
385 | - $city = sanitize_text_field( $data['wpinv_city'] ); |
|
386 | - $zip = sanitize_text_field( $data['wpinv_zip'] ); |
|
387 | - $country = sanitize_text_field( $data['wpinv_country'] ); |
|
388 | - $state = sanitize_text_field( $data['wpinv_state'] ); |
|
379 | + $first_name = sanitize_text_field($data['wpinv_first_name']); |
|
380 | + $last_name = sanitize_text_field($data['wpinv_last_name']); |
|
381 | + $company = sanitize_text_field($data['wpinv_company']); |
|
382 | + $vat_number = sanitize_text_field($data['wpinv_vat_number']); |
|
383 | + $phone = sanitize_text_field($data['wpinv_phone']); |
|
384 | + $address = sanitize_text_field($data['wpinv_address']); |
|
385 | + $city = sanitize_text_field($data['wpinv_city']); |
|
386 | + $zip = sanitize_text_field($data['wpinv_zip']); |
|
387 | + $country = sanitize_text_field($data['wpinv_country']); |
|
388 | + $state = sanitize_text_field($data['wpinv_state']); |
|
389 | 389 | |
390 | 390 | // Details |
391 | - $status = sanitize_text_field( $data['wpinv_status'] ); |
|
392 | - $old_status = !empty( $data['original_post_status'] ) ? sanitize_text_field( $data['original_post_status'] ) : $status; |
|
393 | - $number = sanitize_text_field( $data['wpinv_number'] ); |
|
394 | - $due_date = isset( $data['wpinv_due_date'] ) ? sanitize_text_field( $data['wpinv_due_date'] ) : ''; |
|
391 | + $status = sanitize_text_field($data['wpinv_status']); |
|
392 | + $old_status = !empty($data['original_post_status']) ? sanitize_text_field($data['original_post_status']) : $status; |
|
393 | + $number = sanitize_text_field($data['wpinv_number']); |
|
394 | + $due_date = isset($data['wpinv_due_date']) ? sanitize_text_field($data['wpinv_due_date']) : ''; |
|
395 | 395 | //$discounts = sanitize_text_field( $data['wpinv_discounts'] ); |
396 | 396 | //$discount = sanitize_text_field( $data['wpinv_discount'] ); |
397 | 397 | |
398 | - $ip = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip(); |
|
399 | - |
|
400 | - $invoice->set( 'due_date', $due_date ); |
|
401 | - $invoice->set( 'first_name', $first_name ); |
|
402 | - $invoice->set( 'last_name', $last_name ); |
|
403 | - $invoice->set( 'company', $company ); |
|
404 | - $invoice->set( 'vat_number', $vat_number ); |
|
405 | - $invoice->set( 'phone', $phone ); |
|
406 | - $invoice->set( 'address', $address ); |
|
407 | - $invoice->set( 'city', $city ); |
|
408 | - $invoice->set( 'zip', $zip ); |
|
409 | - $invoice->set( 'country', $country ); |
|
410 | - $invoice->set( 'state', $state ); |
|
411 | - $invoice->set( 'status', $status ); |
|
398 | + $ip = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip(); |
|
399 | + |
|
400 | + $invoice->set('due_date', $due_date); |
|
401 | + $invoice->set('first_name', $first_name); |
|
402 | + $invoice->set('last_name', $last_name); |
|
403 | + $invoice->set('company', $company); |
|
404 | + $invoice->set('vat_number', $vat_number); |
|
405 | + $invoice->set('phone', $phone); |
|
406 | + $invoice->set('address', $address); |
|
407 | + $invoice->set('city', $city); |
|
408 | + $invoice->set('zip', $zip); |
|
409 | + $invoice->set('country', $country); |
|
410 | + $invoice->set('state', $state); |
|
411 | + $invoice->set('status', $status); |
|
412 | 412 | //$invoice->set( 'number', $number ); |
413 | 413 | //$invoice->set( 'discounts', $discounts ); |
414 | 414 | //$invoice->set( 'discount', $discount ); |
415 | - $invoice->set( 'ip', $ip ); |
|
415 | + $invoice->set('ip', $ip); |
|
416 | 416 | $invoice->old_status = $_POST['original_post_status']; |
417 | 417 | $invoice->currency = wpinv_get_currency(); |
418 | - if ( !empty( $data['wpinv_gateway'] ) ) { |
|
419 | - $invoice->set( 'gateway', sanitize_text_field( $data['wpinv_gateway'] ) ); |
|
418 | + if (!empty($data['wpinv_gateway'])) { |
|
419 | + $invoice->set('gateway', sanitize_text_field($data['wpinv_gateway'])); |
|
420 | 420 | } |
421 | 421 | $saved = $invoice->save(); |
422 | 422 | |
423 | 423 | // Check for payment notes |
424 | - if ( !empty( $data['invoice_note'] ) ) { |
|
425 | - $note = wp_kses( $data['invoice_note'], array() ); |
|
426 | - $note_type = sanitize_text_field( $data['invoice_note_type'] ); |
|
424 | + if (!empty($data['invoice_note'])) { |
|
425 | + $note = wp_kses($data['invoice_note'], array()); |
|
426 | + $note_type = sanitize_text_field($data['invoice_note_type']); |
|
427 | 427 | $is_customer_note = $note_type == 'customer' ? 1 : 0; |
428 | 428 | |
429 | - wpinv_insert_payment_note( $invoice->ID, $note, $is_customer_note ); |
|
429 | + wpinv_insert_payment_note($invoice->ID, $note, $is_customer_note); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | // Update user address if empty. |
433 | - if ( $saved && !empty( $invoice ) ) { |
|
434 | - if ( $user_id = $invoice->get_user_id() ) { |
|
435 | - $user_address = wpinv_get_user_address( $user_id, false ); |
|
433 | + if ($saved && !empty($invoice)) { |
|
434 | + if ($user_id = $invoice->get_user_id()) { |
|
435 | + $user_address = wpinv_get_user_address($user_id, false); |
|
436 | 436 | |
437 | 437 | if (empty($user_address['first_name'])) { |
438 | - update_user_meta( $user_id, '_wpinv_first_name', $first_name ); |
|
439 | - update_user_meta( $user_id, '_wpinv_last_name', $last_name ); |
|
438 | + update_user_meta($user_id, '_wpinv_first_name', $first_name); |
|
439 | + update_user_meta($user_id, '_wpinv_last_name', $last_name); |
|
440 | 440 | } else if (empty($user_address['last_name']) && $user_address['first_name'] == $first_name) { |
441 | - update_user_meta( $user_id, '_wpinv_last_name', $last_name ); |
|
441 | + update_user_meta($user_id, '_wpinv_last_name', $last_name); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | if (empty($user_address['address']) || empty($user_address['city']) || empty($user_address['state']) || empty($user_address['country'])) { |
445 | - update_user_meta( $user_id, '_wpinv_address', $address ); |
|
446 | - update_user_meta( $user_id, '_wpinv_city', $city ); |
|
447 | - update_user_meta( $user_id, '_wpinv_state', $state ); |
|
448 | - update_user_meta( $user_id, '_wpinv_country', $country ); |
|
449 | - update_user_meta( $user_id, '_wpinv_zip', $zip ); |
|
450 | - update_user_meta( $user_id, '_wpinv_phone', $phone ); |
|
445 | + update_user_meta($user_id, '_wpinv_address', $address); |
|
446 | + update_user_meta($user_id, '_wpinv_city', $city); |
|
447 | + update_user_meta($user_id, '_wpinv_state', $state); |
|
448 | + update_user_meta($user_id, '_wpinv_country', $country); |
|
449 | + update_user_meta($user_id, '_wpinv_zip', $zip); |
|
450 | + update_user_meta($user_id, '_wpinv_phone', $phone); |
|
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
454 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
454 | + do_action('wpinv_invoice_metabox_saved', $invoice); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | return $saved; |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | case 'status' : |
102 | 102 | $value = $wpi_invoice->get_status( true ) . ( $wpi_invoice->is_recurring() && $wpi_invoice->is_parent() ? ' <span class="wpi-suffix">' . __( '(r)', 'invoicing' ) . '</span>' : '' ); |
103 | 103 | $is_viewed = wpinv_is_invoice_viewed( $wpi_invoice->ID ); |
104 | - $gateway_title = wpinv_get_gateway_admin_label( $wpi_invoice->get_gateway() ); |
|
105 | - $offline_gateways = apply_filters('wpinv_offline_payments', array('bank_transfer', 'cheque', 'cod')); |
|
106 | - $is_offline_payment = in_array($wpi_invoice->get_gateway(), $offline_gateways) ? true : false; |
|
104 | + $gateway_title = wpinv_get_gateway_admin_label( $wpi_invoice->get_gateway() ); |
|
105 | + $offline_gateways = apply_filters('wpinv_offline_payments', array('bank_transfer', 'cheque', 'cod')); |
|
106 | + $is_offline_payment = in_array($wpi_invoice->get_gateway(), $offline_gateways) ? true : false; |
|
107 | 107 | |
108 | 108 | if ( 1 == $is_viewed ) { |
109 | 109 | $value .= ' <i class="fa fa-eye" title="'.__( 'Viewed by Customer', 'invoicing' ).'"></i>'; |
@@ -174,69 +174,69 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | function wpinv_admin_messages() { |
177 | - global $wpinv_options, $pagenow, $post; |
|
177 | + global $wpinv_options, $pagenow, $post; |
|
178 | 178 | |
179 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
180 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' ); |
|
181 | - } |
|
179 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
180 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' ); |
|
181 | + } |
|
182 | 182 | |
183 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
184 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' ); |
|
185 | - } |
|
183 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
184 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' ); |
|
185 | + } |
|
186 | 186 | |
187 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
188 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' ); |
|
189 | - } |
|
187 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
188 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' ); |
|
189 | + } |
|
190 | 190 | |
191 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
192 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' ); |
|
193 | - } |
|
191 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
192 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' ); |
|
193 | + } |
|
194 | 194 | |
195 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
196 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' ); |
|
197 | - } |
|
195 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
196 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' ); |
|
197 | + } |
|
198 | 198 | |
199 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
200 | - add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' ); |
|
201 | - } |
|
199 | + if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
200 | + add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' ); |
|
201 | + } |
|
202 | 202 | |
203 | - if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
204 | - add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' ); |
|
205 | - } |
|
203 | + if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
204 | + add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' ); |
|
205 | + } |
|
206 | 206 | |
207 | - if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
208 | - add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' ); |
|
207 | + if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
208 | + add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' ); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | if ( isset( $_GET['wpinv-message'] ) && 'email_fail' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
212 | - add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' ); |
|
212 | + add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' ); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | if ( isset( $_GET['wpinv-message'] ) && 'invoice-note-deleted' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
216 | 216 | add_settings_error( 'wpinv-notices', 'wpinv-note-deleted', __( 'The invoice note has been deleted.', 'invoicing' ), 'updated' ); |
217 | 217 | } |
218 | 218 | |
219 | - if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
220 | - add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' ); |
|
221 | - } |
|
219 | + if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
220 | + add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' ); |
|
221 | + } |
|
222 | 222 | |
223 | - if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
224 | - add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' ); |
|
225 | - } |
|
223 | + if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
224 | + add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' ); |
|
225 | + } |
|
226 | 226 | |
227 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
228 | - add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' ); |
|
229 | - } |
|
227 | + if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
228 | + add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' ); |
|
229 | + } |
|
230 | 230 | |
231 | - if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) { |
|
232 | - $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID ); |
|
231 | + if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) { |
|
232 | + $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID ); |
|
233 | 233 | |
234 | - if ( !empty( $message ) ) { |
|
235 | - add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' ); |
|
236 | - } |
|
237 | - } |
|
234 | + if ( !empty( $message ) ) { |
|
235 | + add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' ); |
|
236 | + } |
|
237 | + } |
|
238 | 238 | |
239 | - settings_errors( 'wpinv-notices' ); |
|
239 | + settings_errors( 'wpinv-notices' ); |
|
240 | 240 | } |
241 | 241 | add_action( 'admin_notices', 'wpinv_admin_messages' ); |
242 | 242 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | break; |
327 | 327 | case 'id' : |
328 | 328 | echo $post->ID; |
329 | - echo '<div class="hidden" id="wpinv_inline-' . $post->ID . '"> |
|
329 | + echo '<div class="hidden" id="wpinv_inline-' . $post->ID . '"> |
|
330 | 330 | <div class="price">' . wpinv_get_item_price( $post->ID ) . '</div>'; |
331 | 331 | if ( $wpinv_euvat->allow_vat_rules() ) { |
332 | 332 | echo '<div class="vat_rule">' . $wpinv_euvat->get_item_rule( $post->ID ) . '</div>'; |
@@ -7,245 +7,245 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // MUST have WordPress. |
10 | -if ( !defined( 'WPINC' ) ) { |
|
11 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
10 | +if (!defined('WPINC')) { |
|
11 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
12 | 12 | } |
13 | 13 | |
14 | -function wpinv_columns( $columns ) { |
|
14 | +function wpinv_columns($columns) { |
|
15 | 15 | $columns = array( |
16 | 16 | 'cb' => $columns['cb'], |
17 | - 'number' => __( 'Number', 'invoicing' ), |
|
18 | - 'customer' => __( 'Customer', 'invoicing' ), |
|
19 | - 'amount' => __( 'Amount', 'invoicing' ), |
|
20 | - 'invoice_date' => __( 'Created Date', 'invoicing' ), |
|
21 | - 'payment_date' => __( 'Payment Date', 'invoicing' ), |
|
22 | - 'status' => __( 'Status', 'invoicing' ), |
|
23 | - 'ID' => __( 'ID', 'invoicing' ), |
|
24 | - 'wpi_actions' => __( 'Actions', 'invoicing' ), |
|
17 | + 'number' => __('Number', 'invoicing'), |
|
18 | + 'customer' => __('Customer', 'invoicing'), |
|
19 | + 'amount' => __('Amount', 'invoicing'), |
|
20 | + 'invoice_date' => __('Created Date', 'invoicing'), |
|
21 | + 'payment_date' => __('Payment Date', 'invoicing'), |
|
22 | + 'status' => __('Status', 'invoicing'), |
|
23 | + 'ID' => __('ID', 'invoicing'), |
|
24 | + 'wpi_actions' => __('Actions', 'invoicing'), |
|
25 | 25 | ); |
26 | 26 | |
27 | - return apply_filters( 'wpi_invoice_table_columns', $columns ); |
|
27 | + return apply_filters('wpi_invoice_table_columns', $columns); |
|
28 | 28 | } |
29 | -add_filter( 'manage_wpi_invoice_posts_columns', 'wpinv_columns' ); |
|
29 | +add_filter('manage_wpi_invoice_posts_columns', 'wpinv_columns'); |
|
30 | 30 | |
31 | -function wpinv_bulk_actions( $actions ) { |
|
32 | - if ( isset( $actions['edit'] ) ) { |
|
33 | - unset( $actions['edit'] ); |
|
31 | +function wpinv_bulk_actions($actions) { |
|
32 | + if (isset($actions['edit'])) { |
|
33 | + unset($actions['edit']); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | return $actions; |
37 | 37 | } |
38 | -add_filter( 'bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions' ); |
|
39 | -add_filter( 'bulk_actions-edit-wpi_item', 'wpinv_bulk_actions' ); |
|
38 | +add_filter('bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions'); |
|
39 | +add_filter('bulk_actions-edit-wpi_item', 'wpinv_bulk_actions'); |
|
40 | 40 | |
41 | -function wpinv_sortable_columns( $columns ) { |
|
41 | +function wpinv_sortable_columns($columns) { |
|
42 | 42 | $columns = array( |
43 | - 'ID' => array( 'ID', true ), |
|
44 | - 'number' => array( 'number', false ), |
|
45 | - 'amount' => array( 'amount', false ), |
|
46 | - 'invoice_date' => array( 'date', false ), |
|
47 | - 'payment_date' => array( 'payment_date', true ), |
|
48 | - 'customer' => array( 'customer', false ), |
|
49 | - 'status' => array( 'status', false ), |
|
43 | + 'ID' => array('ID', true), |
|
44 | + 'number' => array('number', false), |
|
45 | + 'amount' => array('amount', false), |
|
46 | + 'invoice_date' => array('date', false), |
|
47 | + 'payment_date' => array('payment_date', true), |
|
48 | + 'customer' => array('customer', false), |
|
49 | + 'status' => array('status', false), |
|
50 | 50 | ); |
51 | 51 | |
52 | - return apply_filters( 'wpi_invoice_table_sortable_columns', $columns ); |
|
52 | + return apply_filters('wpi_invoice_table_sortable_columns', $columns); |
|
53 | 53 | } |
54 | -add_filter( 'manage_edit-wpi_invoice_sortable_columns', 'wpinv_sortable_columns' ); |
|
54 | +add_filter('manage_edit-wpi_invoice_sortable_columns', 'wpinv_sortable_columns'); |
|
55 | 55 | |
56 | -add_action( 'manage_wpi_invoice_posts_custom_column', 'wpinv_posts_custom_column'); |
|
57 | -function wpinv_posts_custom_column( $column_name, $post_id = 0 ) { |
|
56 | +add_action('manage_wpi_invoice_posts_custom_column', 'wpinv_posts_custom_column'); |
|
57 | +function wpinv_posts_custom_column($column_name, $post_id = 0) { |
|
58 | 58 | global $post, $wpi_invoice; |
59 | 59 | |
60 | - if ( empty( $wpi_invoice ) || ( !empty( $wpi_invoice ) && $post->ID != $wpi_invoice->ID ) ) { |
|
61 | - $wpi_invoice = new WPInv_Invoice( $post->ID ); |
|
60 | + if (empty($wpi_invoice) || (!empty($wpi_invoice) && $post->ID != $wpi_invoice->ID)) { |
|
61 | + $wpi_invoice = new WPInv_Invoice($post->ID); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $value = NULL; |
65 | 65 | |
66 | - switch ( $column_name ) { |
|
66 | + switch ($column_name) { |
|
67 | 67 | case 'email' : |
68 | - $value = $wpi_invoice->get_email(); |
|
68 | + $value = $wpi_invoice->get_email(); |
|
69 | 69 | break; |
70 | 70 | case 'customer' : |
71 | 71 | $customer_name = $wpi_invoice->get_user_full_name(); |
72 | - $customer_name = $customer_name != '' ? $customer_name : __( 'Customer', 'invoicing' ); |
|
73 | - $value = '<a href="' . esc_url( get_edit_user_link( $wpi_invoice->get_user_id() ) ) . '">' . $customer_name . '</a>'; |
|
74 | - if ( $email = $wpi_invoice->get_email() ) { |
|
72 | + $customer_name = $customer_name != '' ? $customer_name : __('Customer', 'invoicing'); |
|
73 | + $value = '<a href="' . esc_url(get_edit_user_link($wpi_invoice->get_user_id())) . '">' . $customer_name . '</a>'; |
|
74 | + if ($email = $wpi_invoice->get_email()) { |
|
75 | 75 | $value .= '<br><a class="email" href="mailto:' . $email . '">' . $email . '</a>'; |
76 | 76 | } |
77 | 77 | break; |
78 | 78 | case 'amount' : |
79 | - echo $wpi_invoice->get_total( true ); |
|
79 | + echo $wpi_invoice->get_total(true); |
|
80 | 80 | break; |
81 | 81 | case 'invoice_date' : |
82 | - $date_format = get_option( 'date_format' ); |
|
82 | + $date_format = get_option('date_format'); |
|
83 | 83 | |
84 | 84 | $m_time = $post->post_date; |
85 | - $h_time = mysql2date( $date_format, $m_time ); |
|
85 | + $h_time = mysql2date($date_format, $m_time); |
|
86 | 86 | |
87 | - $value = '<abbr title="' . $m_time . '">' . $h_time . '</abbr>'; |
|
87 | + $value = '<abbr title="' . $m_time . '">' . $h_time . '</abbr>'; |
|
88 | 88 | break; |
89 | 89 | case 'payment_date' : |
90 | - if ( $date_completed = $wpi_invoice->get_meta( '_wpinv_completed_date', true ) ) { |
|
91 | - $date_format = get_option( 'date_format' ); |
|
90 | + if ($date_completed = $wpi_invoice->get_meta('_wpinv_completed_date', true)) { |
|
91 | + $date_format = get_option('date_format'); |
|
92 | 92 | |
93 | 93 | $m_time = $date_completed; |
94 | - $h_time = mysql2date( $date_format, $m_time ); |
|
94 | + $h_time = mysql2date($date_format, $m_time); |
|
95 | 95 | |
96 | - $value = '<abbr title="' . $m_time . '">' . $h_time . '</abbr>'; |
|
96 | + $value = '<abbr title="' . $m_time . '">' . $h_time . '</abbr>'; |
|
97 | 97 | } else { |
98 | 98 | $value = '-'; |
99 | 99 | } |
100 | 100 | break; |
101 | 101 | case 'status' : |
102 | - $value = $wpi_invoice->get_status( true ) . ( $wpi_invoice->is_recurring() && $wpi_invoice->is_parent() ? ' <span class="wpi-suffix">' . __( '(r)', 'invoicing' ) . '</span>' : '' ); |
|
103 | - $is_viewed = wpinv_is_invoice_viewed( $wpi_invoice->ID ); |
|
104 | - $gateway_title = wpinv_get_gateway_admin_label( $wpi_invoice->get_gateway() ); |
|
102 | + $value = $wpi_invoice->get_status(true) . ($wpi_invoice->is_recurring() && $wpi_invoice->is_parent() ? ' <span class="wpi-suffix">' . __('(r)', 'invoicing') . '</span>' : ''); |
|
103 | + $is_viewed = wpinv_is_invoice_viewed($wpi_invoice->ID); |
|
104 | + $gateway_title = wpinv_get_gateway_admin_label($wpi_invoice->get_gateway()); |
|
105 | 105 | $offline_gateways = apply_filters('wpinv_offline_payments', array('bank_transfer', 'cheque', 'cod')); |
106 | 106 | $is_offline_payment = in_array($wpi_invoice->get_gateway(), $offline_gateways) ? true : false; |
107 | 107 | |
108 | - if ( 1 == $is_viewed ) { |
|
109 | - $value .= ' <i class="fa fa-eye" title="'.__( 'Viewed by Customer', 'invoicing' ).'"></i>'; |
|
108 | + if (1 == $is_viewed) { |
|
109 | + $value .= ' <i class="fa fa-eye" title="' . __('Viewed by Customer', 'invoicing') . '"></i>'; |
|
110 | 110 | } |
111 | - if ( ( $wpi_invoice->is_paid() || $wpi_invoice->is_refunded() || $is_offline_payment ) && ( isset( $gateway_title ) ) ) { |
|
112 | - $value .= '<br><small class="meta gateway">' . wp_sprintf( __( 'Via %s', 'invoicing' ), $gateway_title ) . '</small>'; |
|
111 | + if (($wpi_invoice->is_paid() || $wpi_invoice->is_refunded() || $is_offline_payment) && (isset($gateway_title))) { |
|
112 | + $value .= '<br><small class="meta gateway">' . wp_sprintf(__('Via %s', 'invoicing'), $gateway_title) . '</small>'; |
|
113 | 113 | } |
114 | 114 | break; |
115 | 115 | case 'number' : |
116 | - $edit_link = get_edit_post_link( $post->ID ); |
|
117 | - $value = '<a title="' . esc_attr__( 'View Invoice Details', 'invoicing' ) . '" href="' . esc_url( $edit_link ) . '">' . $wpi_invoice->get_number() . '</a>'; |
|
116 | + $edit_link = get_edit_post_link($post->ID); |
|
117 | + $value = '<a title="' . esc_attr__('View Invoice Details', 'invoicing') . '" href="' . esc_url($edit_link) . '">' . $wpi_invoice->get_number() . '</a>'; |
|
118 | 118 | break; |
119 | 119 | case 'wpi_actions' : |
120 | 120 | $value = ''; |
121 | - if ( !empty( $post->post_name ) ) { |
|
122 | - $value .= '<a title="' . esc_attr__( 'Print invoice', 'invoicing' ) . '" href="' . esc_url( get_permalink( $post->ID ) ) . '" class="button ui-tip column-act-btn" title="" target="_blank"><span class="dashicons dashicons-print"><i style="" class="fa fa-print"></i></span></a>'; |
|
121 | + if (!empty($post->post_name)) { |
|
122 | + $value .= '<a title="' . esc_attr__('Print invoice', 'invoicing') . '" href="' . esc_url(get_permalink($post->ID)) . '" class="button ui-tip column-act-btn" title="" target="_blank"><span class="dashicons dashicons-print"><i style="" class="fa fa-print"></i></span></a>'; |
|
123 | 123 | } |
124 | 124 | |
125 | - if ( $email = $wpi_invoice->get_email() ) { |
|
126 | - $value .= '<a title="' . esc_attr__( 'Send invoice to customer', 'invoicing' ) . '" href="' . esc_url( add_query_arg( array( 'wpi_action' => 'send_invoice', 'invoice_id' => $post->ID ) ) ) . '" class="button ui-tip column-act-btn"><span class="dashicons dashicons-email-alt"></span></a>'; |
|
125 | + if ($email = $wpi_invoice->get_email()) { |
|
126 | + $value .= '<a title="' . esc_attr__('Send invoice to customer', 'invoicing') . '" href="' . esc_url(add_query_arg(array('wpi_action' => 'send_invoice', 'invoice_id' => $post->ID))) . '" class="button ui-tip column-act-btn"><span class="dashicons dashicons-email-alt"></span></a>'; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | break; |
130 | 130 | default: |
131 | - $value = isset( $post->$column_name ) ? $post->$column_name : ''; |
|
131 | + $value = isset($post->$column_name) ? $post->$column_name : ''; |
|
132 | 132 | break; |
133 | 133 | |
134 | 134 | } |
135 | - $value = apply_filters( 'wpinv_payments_table_column', $value, $post->ID, $column_name ); |
|
135 | + $value = apply_filters('wpinv_payments_table_column', $value, $post->ID, $column_name); |
|
136 | 136 | |
137 | - if ( $value !== NULL ) { |
|
137 | + if ($value !== NULL) { |
|
138 | 138 | echo $value; |
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | -function wpinv_admin_post_id( $id = 0 ) { |
|
142 | +function wpinv_admin_post_id($id = 0) { |
|
143 | 143 | global $post; |
144 | 144 | |
145 | - if ( isset( $id ) && ! empty( $id ) ) { |
|
145 | + if (isset($id) && !empty($id)) { |
|
146 | 146 | return (int)$id; |
147 | - } else if ( get_the_ID() ) { |
|
148 | - return (int) get_the_ID(); |
|
149 | - } else if ( isset( $post->ID ) && !empty( $post->ID ) ) { |
|
150 | - return (int) $post->ID; |
|
151 | - } else if ( isset( $_GET['post'] ) && !empty( $_GET['post'] ) ) { |
|
152 | - return (int) $_GET['post']; |
|
153 | - } else if ( isset( $_GET['id'] ) && !empty( $_GET['id'] ) ) { |
|
154 | - return (int) $_GET['id']; |
|
155 | - } else if ( isset( $_POST['id'] ) && !empty( $_POST['id'] ) ) { |
|
156 | - return (int) $_POST['id']; |
|
147 | + } else if (get_the_ID()) { |
|
148 | + return (int)get_the_ID(); |
|
149 | + } else if (isset($post->ID) && !empty($post->ID)) { |
|
150 | + return (int)$post->ID; |
|
151 | + } else if (isset($_GET['post']) && !empty($_GET['post'])) { |
|
152 | + return (int)$_GET['post']; |
|
153 | + } else if (isset($_GET['id']) && !empty($_GET['id'])) { |
|
154 | + return (int)$_GET['id']; |
|
155 | + } else if (isset($_POST['id']) && !empty($_POST['id'])) { |
|
156 | + return (int)$_POST['id']; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | return null; |
160 | 160 | } |
161 | 161 | |
162 | -function wpinv_admin_post_type( $id = 0 ) { |
|
163 | - if ( !$id ) { |
|
162 | +function wpinv_admin_post_type($id = 0) { |
|
163 | + if (!$id) { |
|
164 | 164 | $id = wpinv_admin_post_id(); |
165 | 165 | } |
166 | 166 | |
167 | - $type = get_post_type( $id ); |
|
167 | + $type = get_post_type($id); |
|
168 | 168 | |
169 | - if ( !$type ) { |
|
170 | - $type = isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) ? $_GET['post_type'] : null; |
|
169 | + if (!$type) { |
|
170 | + $type = isset($_GET['post_type']) && !empty($_GET['post_type']) ? $_GET['post_type'] : null; |
|
171 | 171 | } |
172 | 172 | |
173 | - return apply_filters( 'wpinv_admin_post_type', $type, $id ); |
|
173 | + return apply_filters('wpinv_admin_post_type', $type, $id); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | function wpinv_admin_messages() { |
177 | 177 | global $wpinv_options, $pagenow, $post; |
178 | 178 | |
179 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
180 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' ); |
|
179 | + if (isset($_GET['wpinv-message']) && 'discount_added' == $_GET['wpinv-message'] && current_user_can('manage_options')) { |
|
180 | + add_settings_error('wpinv-notices', 'wpinv-discount-added', __('Discount code added.', 'invoicing'), 'updated'); |
|
181 | 181 | } |
182 | 182 | |
183 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
184 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' ); |
|
183 | + if (isset($_GET['wpinv-message']) && 'discount_add_failed' == $_GET['wpinv-message'] && current_user_can('manage_options')) { |
|
184 | + add_settings_error('wpinv-notices', 'wpinv-discount-add-fail', __('There was a problem adding your discount code, please try again.', 'invoicing'), 'error'); |
|
185 | 185 | } |
186 | 186 | |
187 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
188 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' ); |
|
187 | + if (isset($_GET['wpinv-message']) && 'discount_exists' == $_GET['wpinv-message'] && current_user_can('manage_options')) { |
|
188 | + add_settings_error('wpinv-notices', 'wpinv-discount-exists', __('A discount with that code already exists, please use a different code.', 'invoicing'), 'error'); |
|
189 | 189 | } |
190 | 190 | |
191 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
192 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' ); |
|
191 | + if (isset($_GET['wpinv-message']) && 'discount_updated' == $_GET['wpinv-message'] && current_user_can('manage_options')) { |
|
192 | + add_settings_error('wpinv-notices', 'wpinv-discount-updated', __('Discount code updated.', 'invoicing'), 'updated'); |
|
193 | 193 | } |
194 | 194 | |
195 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
196 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' ); |
|
195 | + if (isset($_GET['wpinv-message']) && 'discount_update_failed' == $_GET['wpinv-message'] && current_user_can('manage_options')) { |
|
196 | + add_settings_error('wpinv-notices', 'wpinv-discount-updated-fail', __('There was a problem updating your discount code, please try again.', 'invoicing'), 'error'); |
|
197 | 197 | } |
198 | 198 | |
199 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
200 | - add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' ); |
|
199 | + if (isset($_GET['wpinv-message']) && 'invoice_deleted' == $_GET['wpinv-message'] && current_user_can('manage_options')) { |
|
200 | + add_settings_error('wpinv-notices', 'wpinv-deleted', __('The invoice has been deleted.', 'invoicing'), 'updated'); |
|
201 | 201 | } |
202 | 202 | |
203 | - if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
204 | - add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' ); |
|
203 | + if (isset($_GET['wpinv-message']) && 'email_disabled' == $_GET['wpinv-message'] && current_user_can('manage_options')) { |
|
204 | + add_settings_error('wpinv-notices', 'wpinv-sent-fail', __('Email notification is disabled. Please check settings.', 'invoicing'), 'error'); |
|
205 | 205 | } |
206 | 206 | |
207 | - if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
208 | - add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' ); |
|
207 | + if (isset($_GET['wpinv-message']) && 'email_sent' == $_GET['wpinv-message'] && current_user_can('manage_options')) { |
|
208 | + add_settings_error('wpinv-notices', 'wpinv-sent', __('The email has been sent to customer.', 'invoicing'), 'updated'); |
|
209 | 209 | } |
210 | 210 | |
211 | - if ( isset( $_GET['wpinv-message'] ) && 'email_fail' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
212 | - add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' ); |
|
211 | + if (isset($_GET['wpinv-message']) && 'email_fail' == $_GET['wpinv-message'] && current_user_can('manage_options')) { |
|
212 | + add_settings_error('wpinv-notices', 'wpinv-sent-fail', __('Fail to send email to the customer.', 'invoicing'), 'error'); |
|
213 | 213 | } |
214 | 214 | |
215 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice-note-deleted' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
216 | - add_settings_error( 'wpinv-notices', 'wpinv-note-deleted', __( 'The invoice note has been deleted.', 'invoicing' ), 'updated' ); |
|
215 | + if (isset($_GET['wpinv-message']) && 'invoice-note-deleted' == $_GET['wpinv-message'] && current_user_can('manage_options')) { |
|
216 | + add_settings_error('wpinv-notices', 'wpinv-note-deleted', __('The invoice note has been deleted.', 'invoicing'), 'updated'); |
|
217 | 217 | } |
218 | 218 | |
219 | - if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
220 | - add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' ); |
|
219 | + if (isset($_GET['wpinv-message']) && 'settings-imported' == $_GET['wpinv-message'] && current_user_can('manage_options')) { |
|
220 | + add_settings_error('wpinv-notices', 'wpinv-settings-imported', __('The settings have been imported.', 'invoicing'), 'updated'); |
|
221 | 221 | } |
222 | 222 | |
223 | - if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
224 | - add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' ); |
|
223 | + if (isset($_GET['wpinv-message']) && 'note-added' == $_GET['wpinv-message'] && current_user_can('manage_options')) { |
|
224 | + add_settings_error('wpinv-notices', 'wpinv-note-added', __('The invoice note has been added successfully.', 'invoicing'), 'updated'); |
|
225 | 225 | } |
226 | 226 | |
227 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && current_user_can( 'manage_options' ) ) { |
|
228 | - add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' ); |
|
227 | + if (isset($_GET['wpinv-message']) && 'invoice-updated' == $_GET['wpinv-message'] && current_user_can('manage_options')) { |
|
228 | + add_settings_error('wpinv-notices', 'wpinv-updated', __('The invoice has been successfully updated.', 'invoicing'), 'updated'); |
|
229 | 229 | } |
230 | 230 | |
231 | - if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) { |
|
232 | - $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID ); |
|
231 | + if ($pagenow == 'post.php' && !empty($post->post_type) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable($post)) { |
|
232 | + $message = apply_filters('wpinv_item_non_editable_message', __('This item in not editable.', 'invoicing'), $post->ID); |
|
233 | 233 | |
234 | - if ( !empty( $message ) ) { |
|
235 | - add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' ); |
|
234 | + if (!empty($message)) { |
|
235 | + add_settings_error('wpinv-notices', 'wpinv-edit-n', $message, 'updated'); |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
239 | - settings_errors( 'wpinv-notices' ); |
|
239 | + settings_errors('wpinv-notices'); |
|
240 | 240 | } |
241 | -add_action( 'admin_notices', 'wpinv_admin_messages' ); |
|
241 | +add_action('admin_notices', 'wpinv_admin_messages'); |
|
242 | 242 | |
243 | -add_action( 'admin_init', 'wpinv_show_test_payment_gateway_notice' ); |
|
244 | -function wpinv_show_test_payment_gateway_notice(){ |
|
245 | - add_action( 'admin_notices', 'wpinv_test_payment_gateway_messages' ); |
|
243 | +add_action('admin_init', 'wpinv_show_test_payment_gateway_notice'); |
|
244 | +function wpinv_show_test_payment_gateway_notice() { |
|
245 | + add_action('admin_notices', 'wpinv_test_payment_gateway_messages'); |
|
246 | 246 | } |
247 | 247 | |
248 | -function wpinv_test_payment_gateway_messages(){ |
|
248 | +function wpinv_test_payment_gateway_messages() { |
|
249 | 249 | $gateways = wpinv_get_enabled_payment_gateways(); |
250 | 250 | $name = array(); $test_gateways = ''; |
251 | 251 | if ($gateways) { |
@@ -256,9 +256,9 @@ discard block |
||
256 | 256 | } |
257 | 257 | $test_gateways = implode(', ', $name); |
258 | 258 | } |
259 | - if(isset($test_gateways) && !empty($test_gateways)){ |
|
259 | + if (isset($test_gateways) && !empty($test_gateways)) { |
|
260 | 260 | $link = admin_url('admin.php?page=wpinv-settings&tab=gateways'); |
261 | - $notice = wp_sprintf( __('<strong>Important:</strong> Payment Gateway(s) %s are in testing mode and will not receive real payments. Go to <a href="%s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link ); |
|
261 | + $notice = wp_sprintf(__('<strong>Important:</strong> Payment Gateway(s) %s are in testing mode and will not receive real payments. Go to <a href="%s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link); |
|
262 | 262 | ?> |
263 | 263 | <div class="notice notice-warning is-dismissible"> |
264 | 264 | <p><?php echo $notice; ?></p> |
@@ -267,29 +267,29 @@ discard block |
||
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
270 | -function wpinv_items_columns( $existing_columns ) { |
|
270 | +function wpinv_items_columns($existing_columns) { |
|
271 | 271 | global $wpinv_euvat; |
272 | 272 | |
273 | 273 | $columns = array(); |
274 | 274 | $columns['cb'] = $existing_columns['cb']; |
275 | - $columns['title'] = __( 'Title', 'invoicing' ); |
|
276 | - $columns['price'] = __( 'Price', 'invoicing' ); |
|
277 | - if ( $wpinv_euvat->allow_vat_rules() ) { |
|
278 | - $columns['vat_rule'] = __( 'VAT rule type', 'invoicing' ); |
|
275 | + $columns['title'] = __('Title', 'invoicing'); |
|
276 | + $columns['price'] = __('Price', 'invoicing'); |
|
277 | + if ($wpinv_euvat->allow_vat_rules()) { |
|
278 | + $columns['vat_rule'] = __('VAT rule type', 'invoicing'); |
|
279 | 279 | } |
280 | - if ( $wpinv_euvat->allow_vat_classes() ) { |
|
281 | - $columns['vat_class'] = __( 'VAT class', 'invoicing' ); |
|
280 | + if ($wpinv_euvat->allow_vat_classes()) { |
|
281 | + $columns['vat_class'] = __('VAT class', 'invoicing'); |
|
282 | 282 | } |
283 | - $columns['type'] = __( 'Type', 'invoicing' ); |
|
284 | - $columns['recurring'] = __( 'Recurring', 'invoicing' ); |
|
285 | - $columns['date'] = __( 'Date', 'invoicing' ); |
|
286 | - $columns['id'] = __( 'ID', 'invoicing' ); |
|
283 | + $columns['type'] = __('Type', 'invoicing'); |
|
284 | + $columns['recurring'] = __('Recurring', 'invoicing'); |
|
285 | + $columns['date'] = __('Date', 'invoicing'); |
|
286 | + $columns['id'] = __('ID', 'invoicing'); |
|
287 | 287 | |
288 | - return apply_filters( 'wpinv_items_columns', $columns ); |
|
288 | + return apply_filters('wpinv_items_columns', $columns); |
|
289 | 289 | } |
290 | -add_filter( 'manage_wpi_item_posts_columns', 'wpinv_items_columns' ); |
|
290 | +add_filter('manage_wpi_item_posts_columns', 'wpinv_items_columns'); |
|
291 | 291 | |
292 | -function wpinv_items_sortable_columns( $columns ) { |
|
292 | +function wpinv_items_sortable_columns($columns) { |
|
293 | 293 | $columns['price'] = 'price'; |
294 | 294 | $columns['vat_rule'] = 'vat_rule'; |
295 | 295 | $columns['vat_class'] = 'vat_class'; |
@@ -299,151 +299,151 @@ discard block |
||
299 | 299 | |
300 | 300 | return $columns; |
301 | 301 | } |
302 | -add_filter( 'manage_edit-wpi_item_sortable_columns', 'wpinv_items_sortable_columns' ); |
|
302 | +add_filter('manage_edit-wpi_item_sortable_columns', 'wpinv_items_sortable_columns'); |
|
303 | 303 | |
304 | -function wpinv_items_table_custom_column( $column ) { |
|
304 | +function wpinv_items_table_custom_column($column) { |
|
305 | 305 | global $wpinv_euvat, $post, $wpi_item; |
306 | 306 | |
307 | - if ( empty( $wpi_item ) || ( !empty( $wpi_item ) && $post->ID != $wpi_item->ID ) ) { |
|
308 | - $wpi_item = new WPInv_Item( $post->ID ); |
|
307 | + if (empty($wpi_item) || (!empty($wpi_item) && $post->ID != $wpi_item->ID)) { |
|
308 | + $wpi_item = new WPInv_Item($post->ID); |
|
309 | 309 | } |
310 | 310 | |
311 | - switch ( $column ) { |
|
311 | + switch ($column) { |
|
312 | 312 | case 'price' : |
313 | - echo wpinv_item_price( $post->ID ); |
|
313 | + echo wpinv_item_price($post->ID); |
|
314 | 314 | break; |
315 | 315 | case 'vat_rule' : |
316 | - echo $wpinv_euvat->item_rule_label( $post->ID ); |
|
316 | + echo $wpinv_euvat->item_rule_label($post->ID); |
|
317 | 317 | break; |
318 | 318 | case 'vat_class' : |
319 | - echo $wpinv_euvat->item_class_label( $post->ID ); |
|
319 | + echo $wpinv_euvat->item_class_label($post->ID); |
|
320 | 320 | break; |
321 | 321 | case 'type' : |
322 | - echo wpinv_item_type( $post->ID ) . '<span class="meta">' . $wpi_item->get_custom_singular_name() . '</span>'; |
|
322 | + echo wpinv_item_type($post->ID) . '<span class="meta">' . $wpi_item->get_custom_singular_name() . '</span>'; |
|
323 | 323 | break; |
324 | 324 | case 'recurring' : |
325 | - echo ( wpinv_is_recurring_item( $post->ID ) ? '<i class="fa fa-check fa-recurring-y"></i>' : '<i class="fa fa-close fa-recurring-n"></i>' ); |
|
325 | + echo (wpinv_is_recurring_item($post->ID) ? '<i class="fa fa-check fa-recurring-y"></i>' : '<i class="fa fa-close fa-recurring-n"></i>'); |
|
326 | 326 | break; |
327 | 327 | case 'id' : |
328 | 328 | echo $post->ID; |
329 | 329 | echo '<div class="hidden" id="wpinv_inline-' . $post->ID . '"> |
330 | - <div class="price">' . wpinv_get_item_price( $post->ID ) . '</div>'; |
|
331 | - if ( $wpinv_euvat->allow_vat_rules() ) { |
|
332 | - echo '<div class="vat_rule">' . $wpinv_euvat->get_item_rule( $post->ID ) . '</div>'; |
|
330 | + <div class="price">' . wpinv_get_item_price($post->ID) . '</div>'; |
|
331 | + if ($wpinv_euvat->allow_vat_rules()) { |
|
332 | + echo '<div class="vat_rule">' . $wpinv_euvat->get_item_rule($post->ID) . '</div>'; |
|
333 | 333 | } |
334 | - if ( $wpinv_euvat->allow_vat_classes() ) { |
|
335 | - echo '<div class="vat_class">' . $wpinv_euvat->get_item_class( $post->ID ) . '</div>'; |
|
334 | + if ($wpinv_euvat->allow_vat_classes()) { |
|
335 | + echo '<div class="vat_class">' . $wpinv_euvat->get_item_class($post->ID) . '</div>'; |
|
336 | 336 | } |
337 | - echo '<div class="type">' . wpinv_get_item_type( $post->ID ) . '</div> |
|
337 | + echo '<div class="type">' . wpinv_get_item_type($post->ID) . '</div> |
|
338 | 338 | </div>'; |
339 | 339 | break; |
340 | 340 | } |
341 | 341 | |
342 | - do_action( 'wpinv_items_table_column_item_' . $column, $wpi_item, $post ); |
|
342 | + do_action('wpinv_items_table_column_item_' . $column, $wpi_item, $post); |
|
343 | 343 | } |
344 | -add_action( 'manage_wpi_item_posts_custom_column', 'wpinv_items_table_custom_column' ); |
|
344 | +add_action('manage_wpi_item_posts_custom_column', 'wpinv_items_table_custom_column'); |
|
345 | 345 | |
346 | 346 | function wpinv_add_items_filters() { |
347 | 347 | global $wpinv_euvat, $typenow; |
348 | 348 | |
349 | 349 | // Checks if the current post type is 'item' |
350 | - if ( $typenow == 'wpi_item') { |
|
351 | - if ( $wpinv_euvat->allow_vat_rules() ) { |
|
352 | - echo wpinv_html_select( array( |
|
353 | - 'options' => array_merge( array( '' => __( 'All VAT rules', 'invoicing' ) ), $wpinv_euvat->get_rules() ), |
|
350 | + if ($typenow == 'wpi_item') { |
|
351 | + if ($wpinv_euvat->allow_vat_rules()) { |
|
352 | + echo wpinv_html_select(array( |
|
353 | + 'options' => array_merge(array('' => __('All VAT rules', 'invoicing')), $wpinv_euvat->get_rules()), |
|
354 | 354 | 'name' => 'vat_rule', |
355 | 355 | 'id' => 'vat_rule', |
356 | - 'selected' => ( isset( $_GET['vat_rule'] ) ? $_GET['vat_rule'] : '' ), |
|
356 | + 'selected' => (isset($_GET['vat_rule']) ? $_GET['vat_rule'] : ''), |
|
357 | 357 | 'show_option_all' => false, |
358 | 358 | 'show_option_none' => false, |
359 | 359 | 'class' => 'gdmbx2-text-medium wpi_select2', |
360 | - ) ); |
|
360 | + )); |
|
361 | 361 | } |
362 | 362 | |
363 | - if ( $wpinv_euvat->allow_vat_classes() ) { |
|
364 | - echo wpinv_html_select( array( |
|
365 | - 'options' => array_merge( array( '' => __( 'All VAT classes', 'invoicing' ) ), $wpinv_euvat->get_all_classes() ), |
|
363 | + if ($wpinv_euvat->allow_vat_classes()) { |
|
364 | + echo wpinv_html_select(array( |
|
365 | + 'options' => array_merge(array('' => __('All VAT classes', 'invoicing')), $wpinv_euvat->get_all_classes()), |
|
366 | 366 | 'name' => 'vat_class', |
367 | 367 | 'id' => 'vat_class', |
368 | - 'selected' => ( isset( $_GET['vat_class'] ) ? $_GET['vat_class'] : '' ), |
|
368 | + 'selected' => (isset($_GET['vat_class']) ? $_GET['vat_class'] : ''), |
|
369 | 369 | 'show_option_all' => false, |
370 | 370 | 'show_option_none' => false, |
371 | 371 | 'class' => 'gdmbx2-text-medium wpi_select2', |
372 | - ) ); |
|
372 | + )); |
|
373 | 373 | } |
374 | 374 | |
375 | - echo wpinv_html_select( array( |
|
376 | - 'options' => array_merge( array( '' => __( 'All item types', 'invoicing' ) ), wpinv_get_item_types() ), |
|
375 | + echo wpinv_html_select(array( |
|
376 | + 'options' => array_merge(array('' => __('All item types', 'invoicing')), wpinv_get_item_types()), |
|
377 | 377 | 'name' => 'type', |
378 | 378 | 'id' => 'type', |
379 | - 'selected' => ( isset( $_GET['type'] ) ? $_GET['type'] : '' ), |
|
379 | + 'selected' => (isset($_GET['type']) ? $_GET['type'] : ''), |
|
380 | 380 | 'show_option_all' => false, |
381 | 381 | 'show_option_none' => false, |
382 | 382 | 'class' => 'gdmbx2-text-medium', |
383 | - ) ); |
|
383 | + )); |
|
384 | 384 | |
385 | - if ( isset( $_REQUEST['all_posts'] ) && '1' === $_REQUEST['all_posts'] ) { |
|
385 | + if (isset($_REQUEST['all_posts']) && '1' === $_REQUEST['all_posts']) { |
|
386 | 386 | echo '<input type="hidden" name="all_posts" value="1" />'; |
387 | 387 | } |
388 | 388 | } |
389 | 389 | } |
390 | -add_action( 'restrict_manage_posts', 'wpinv_add_items_filters', 100 ); |
|
390 | +add_action('restrict_manage_posts', 'wpinv_add_items_filters', 100); |
|
391 | 391 | |
392 | -function wpinv_send_invoice_after_save( $invoice ) { |
|
393 | - if ( empty( $_POST['wpi_save_send'] ) ) { |
|
392 | +function wpinv_send_invoice_after_save($invoice) { |
|
393 | + if (empty($_POST['wpi_save_send'])) { |
|
394 | 394 | return; |
395 | 395 | } |
396 | 396 | |
397 | - if ( !empty( $invoice->ID ) && !empty( $invoice->post_type ) && 'wpi_invoice' == $invoice->post_type ) { |
|
398 | - wpinv_user_invoice_notification( $invoice->ID ); |
|
397 | + if (!empty($invoice->ID) && !empty($invoice->post_type) && 'wpi_invoice' == $invoice->post_type) { |
|
398 | + wpinv_user_invoice_notification($invoice->ID); |
|
399 | 399 | } |
400 | 400 | } |
401 | -add_action( 'wpinv_invoice_metabox_saved', 'wpinv_send_invoice_after_save', 100, 1 ); |
|
401 | +add_action('wpinv_invoice_metabox_saved', 'wpinv_send_invoice_after_save', 100, 1); |
|
402 | 402 | |
403 | -function wpinv_send_register_new_user( $data, $postarr ) { |
|
404 | - if ( current_user_can( 'manage_options' ) && !empty( $data['post_type'] ) && ( 'wpi_invoice' == $data['post_type'] || 'wpi_quote' == $data['post_type'] ) ) { |
|
405 | - $is_new_user = !empty( $postarr['wpinv_new_user'] ) ? true : false; |
|
406 | - $email = !empty( $postarr['wpinv_email'] ) && $postarr['wpinv_email'] && is_email( $postarr['wpinv_email'] ) ? $postarr['wpinv_email'] : NULL; |
|
403 | +function wpinv_send_register_new_user($data, $postarr) { |
|
404 | + if (current_user_can('manage_options') && !empty($data['post_type']) && ('wpi_invoice' == $data['post_type'] || 'wpi_quote' == $data['post_type'])) { |
|
405 | + $is_new_user = !empty($postarr['wpinv_new_user']) ? true : false; |
|
406 | + $email = !empty($postarr['wpinv_email']) && $postarr['wpinv_email'] && is_email($postarr['wpinv_email']) ? $postarr['wpinv_email'] : NULL; |
|
407 | 407 | |
408 | - if ( $is_new_user && $email && !email_exists( $email ) ) { |
|
409 | - $first_name = !empty( $postarr['wpinv_first_name'] ) ? sanitize_text_field( $postarr['wpinv_first_name'] ) : ''; |
|
410 | - $last_name = !empty( $postarr['wpinv_last_name'] ) ? sanitize_text_field( $postarr['wpinv_last_name'] ) : ''; |
|
411 | - $display_name = $first_name || $last_name ? trim( $first_name . ' ' . $last_name ) : ''; |
|
412 | - $user_nicename = $display_name ? trim( $display_name ) : $email; |
|
413 | - $user_company = !empty( $postarr['wpinv_company'] ) ? sanitize_text_field( $postarr['wpinv_company'] ) : ''; |
|
408 | + if ($is_new_user && $email && !email_exists($email)) { |
|
409 | + $first_name = !empty($postarr['wpinv_first_name']) ? sanitize_text_field($postarr['wpinv_first_name']) : ''; |
|
410 | + $last_name = !empty($postarr['wpinv_last_name']) ? sanitize_text_field($postarr['wpinv_last_name']) : ''; |
|
411 | + $display_name = $first_name || $last_name ? trim($first_name . ' ' . $last_name) : ''; |
|
412 | + $user_nicename = $display_name ? trim($display_name) : $email; |
|
413 | + $user_company = !empty($postarr['wpinv_company']) ? sanitize_text_field($postarr['wpinv_company']) : ''; |
|
414 | 414 | |
415 | - $user_login = sanitize_user( str_replace( ' ', '', $display_name ), true ); |
|
416 | - if ( !( validate_username( $user_login ) && !username_exists( $user_login ) ) ) { |
|
415 | + $user_login = sanitize_user(str_replace(' ', '', $display_name), true); |
|
416 | + if (!(validate_username($user_login) && !username_exists($user_login))) { |
|
417 | 417 | $new_user_login = strstr($email, '@', true); |
418 | - if ( validate_username( $user_login ) && username_exists( $user_login ) ) { |
|
419 | - $user_login = sanitize_user($new_user_login, true ); |
|
418 | + if (validate_username($user_login) && username_exists($user_login)) { |
|
419 | + $user_login = sanitize_user($new_user_login, true); |
|
420 | 420 | } |
421 | - if ( validate_username( $user_login ) && username_exists( $user_login ) ) { |
|
422 | - $user_append_text = rand(10,1000); |
|
423 | - $user_login = sanitize_user($new_user_login.$user_append_text, true ); |
|
421 | + if (validate_username($user_login) && username_exists($user_login)) { |
|
422 | + $user_append_text = rand(10, 1000); |
|
423 | + $user_login = sanitize_user($new_user_login . $user_append_text, true); |
|
424 | 424 | } |
425 | 425 | |
426 | - if ( !( validate_username( $user_login ) && !username_exists( $user_login ) ) ) { |
|
426 | + if (!(validate_username($user_login) && !username_exists($user_login))) { |
|
427 | 427 | $user_login = $email; |
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
431 | 431 | $userdata = array( |
432 | 432 | 'user_login' => $user_login, |
433 | - 'user_pass' => wp_generate_password( 12, false ), |
|
434 | - 'user_email' => sanitize_text_field( $email ), |
|
433 | + 'user_pass' => wp_generate_password(12, false), |
|
434 | + 'user_email' => sanitize_text_field($email), |
|
435 | 435 | 'first_name' => $first_name, |
436 | 436 | 'last_name' => $last_name, |
437 | - 'user_nicename' => wpinv_utf8_substr( $user_nicename, 0, 50 ), |
|
437 | + 'user_nicename' => wpinv_utf8_substr($user_nicename, 0, 50), |
|
438 | 438 | 'nickname' => $display_name, |
439 | 439 | 'display_name' => $display_name, |
440 | 440 | ); |
441 | 441 | |
442 | - $userdata = apply_filters( 'wpinv_register_new_user_data', $userdata ); |
|
442 | + $userdata = apply_filters('wpinv_register_new_user_data', $userdata); |
|
443 | 443 | |
444 | - $new_user_id = wp_insert_user( $userdata ); |
|
444 | + $new_user_id = wp_insert_user($userdata); |
|
445 | 445 | |
446 | - if ( !is_wp_error( $new_user_id ) ) { |
|
446 | + if (!is_wp_error($new_user_id)) { |
|
447 | 447 | $data['post_author'] = $new_user_id; |
448 | 448 | $_POST['post_author'] = $new_user_id; |
449 | 449 | $_POST['post_author_override'] = $new_user_id; |
@@ -464,72 +464,72 @@ discard block |
||
464 | 464 | |
465 | 465 | $meta = array(); |
466 | 466 | ///$meta['_wpinv_user_id'] = $new_user_id; |
467 | - foreach ( $meta_fields as $field ) { |
|
468 | - $meta['_wpinv_' . $field] = isset( $postarr['wpinv_' . $field] ) ? sanitize_text_field( $postarr['wpinv_' . $field] ) : ''; |
|
467 | + foreach ($meta_fields as $field) { |
|
468 | + $meta['_wpinv_' . $field] = isset($postarr['wpinv_' . $field]) ? sanitize_text_field($postarr['wpinv_' . $field]) : ''; |
|
469 | 469 | } |
470 | 470 | |
471 | - $meta = apply_filters( 'wpinv_register_new_user_meta', $meta, $new_user_id ); |
|
471 | + $meta = apply_filters('wpinv_register_new_user_meta', $meta, $new_user_id); |
|
472 | 472 | |
473 | 473 | // Update user meta. |
474 | - foreach ( $meta as $key => $value ) { |
|
475 | - update_user_meta( $new_user_id, $key, $value ); |
|
474 | + foreach ($meta as $key => $value) { |
|
475 | + update_user_meta($new_user_id, $key, $value); |
|
476 | 476 | } |
477 | 477 | |
478 | - if ( function_exists( 'wp_send_new_user_notifications' ) ) { |
|
478 | + if (function_exists('wp_send_new_user_notifications')) { |
|
479 | 479 | // Send email notifications related to the creation of new user. |
480 | - wp_send_new_user_notifications( $new_user_id, 'user' ); |
|
480 | + wp_send_new_user_notifications($new_user_id, 'user'); |
|
481 | 481 | } |
482 | 482 | } else { |
483 | - wpinv_error_log( $new_user_id->get_error_message(), 'Invoice add new user', __FILE__, __LINE__ ); |
|
483 | + wpinv_error_log($new_user_id->get_error_message(), 'Invoice add new user', __FILE__, __LINE__); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | } |
487 | 487 | |
488 | 488 | return $data; |
489 | 489 | } |
490 | -add_filter( 'wp_insert_post_data', 'wpinv_send_register_new_user', 10, 2 ); |
|
490 | +add_filter('wp_insert_post_data', 'wpinv_send_register_new_user', 10, 2); |
|
491 | 491 | |
492 | -function wpinv_show_recurring_supported_gateways( $item_ID ) { |
|
492 | +function wpinv_show_recurring_supported_gateways($item_ID) { |
|
493 | 493 | $all_gateways = wpinv_get_payment_gateways(); |
494 | 494 | |
495 | - if ( !empty( $all_gateways ) ) { |
|
495 | + if (!empty($all_gateways)) { |
|
496 | 496 | $gateways = array(); |
497 | 497 | |
498 | - foreach ( $all_gateways as $key => $gateway ) { |
|
499 | - if ( wpinv_gateway_support_subscription( $key ) ) { |
|
498 | + foreach ($all_gateways as $key => $gateway) { |
|
499 | + if (wpinv_gateway_support_subscription($key)) { |
|
500 | 500 | $gateways[] = $gateway['admin_label']; |
501 | 501 | } |
502 | 502 | } |
503 | 503 | |
504 | - if ( !empty( $gateways ) ) { |
|
504 | + if (!empty($gateways)) { |
|
505 | 505 | ?> |
506 | - <span class="description"><?php echo wp_sprintf( __( 'Recurring payments only supported by: %s', 'invoicing' ), implode( ', ', $gateways ) ); ?></span> |
|
506 | + <span class="description"><?php echo wp_sprintf(__('Recurring payments only supported by: %s', 'invoicing'), implode(', ', $gateways)); ?></span> |
|
507 | 507 | <?php |
508 | 508 | } |
509 | 509 | } |
510 | 510 | } |
511 | -add_action( 'wpinv_item_price_field', 'wpinv_show_recurring_supported_gateways', -10, 1 ); |
|
511 | +add_action('wpinv_item_price_field', 'wpinv_show_recurring_supported_gateways', -10, 1); |
|
512 | 512 | |
513 | -function wpinv_post_updated_messages( $messages ) { |
|
513 | +function wpinv_post_updated_messages($messages) { |
|
514 | 514 | global $post, $post_ID; |
515 | 515 | |
516 | 516 | $messages['wpi_discount'] = array( |
517 | 517 | 0 => '', |
518 | - 1 => __( 'Discount updated.', 'invoicing' ), |
|
519 | - 2 => __( 'Custom field updated.', 'invoicing' ), |
|
520 | - 3 => __( 'Custom field deleted.', 'invoicing' ), |
|
521 | - 4 => __( 'Discount updated.', 'invoicing' ), |
|
522 | - 5 => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
523 | - 6 => __( 'Discount updated.', 'invoicing' ), |
|
524 | - 7 => __( 'Discount saved.', 'invoicing' ), |
|
525 | - 8 => __( 'Discount submitted.', 'invoicing' ), |
|
526 | - 9 => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ), |
|
527 | - 10 => __( 'Discount draft updated.', 'invoicing' ), |
|
518 | + 1 => __('Discount updated.', 'invoicing'), |
|
519 | + 2 => __('Custom field updated.', 'invoicing'), |
|
520 | + 3 => __('Custom field deleted.', 'invoicing'), |
|
521 | + 4 => __('Discount updated.', 'invoicing'), |
|
522 | + 5 => isset($_GET['revision']) ? wp_sprintf(__('Discount restored to revision from %s', 'invoicing'), wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
523 | + 6 => __('Discount updated.', 'invoicing'), |
|
524 | + 7 => __('Discount saved.', 'invoicing'), |
|
525 | + 8 => __('Discount submitted.', 'invoicing'), |
|
526 | + 9 => wp_sprintf(__('Discount scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))), |
|
527 | + 10 => __('Discount draft updated.', 'invoicing'), |
|
528 | 528 | ); |
529 | 529 | |
530 | 530 | return $messages; |
531 | 531 | } |
532 | -add_filter( 'post_updated_messages', 'wpinv_post_updated_messages', 10, 1 ); |
|
532 | +add_filter('post_updated_messages', 'wpinv_post_updated_messages', 10, 1); |
|
533 | 533 | |
534 | 534 | add_action('admin_init', 'admin_init_example_type'); |
535 | 535 | |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | function admin_init_example_type() { |
540 | 540 | global $typenow; |
541 | 541 | |
542 | - if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote' ) { |
|
542 | + if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote') { |
|
543 | 543 | add_filter('posts_search', 'posts_search_example_type', 10, 2); |
544 | 544 | } |
545 | 545 | } |
@@ -554,9 +554,9 @@ discard block |
||
554 | 554 | global $wpdb; |
555 | 555 | |
556 | 556 | if ($query->is_main_query() && !empty($query->query['s'])) { |
557 | - $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql( $query->query['s'] ) . "%' )"; |
|
558 | - if ( ! empty( $search ) ) { |
|
559 | - $search = preg_replace( '/^ AND /', '', $search ); |
|
557 | + $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql($query->query['s']) . "%' )"; |
|
558 | + if (!empty($search)) { |
|
559 | + $search = preg_replace('/^ AND /', '', $search); |
|
560 | 560 | $search = " AND ( {$search} OR ( {$conditions_str} ) )"; |
561 | 561 | } else { |
562 | 562 | $search = " AND ( {$conditions_str} )"; |
@@ -566,9 +566,9 @@ discard block |
||
566 | 566 | return $search; |
567 | 567 | } |
568 | 568 | |
569 | -add_action( 'admin_init', 'wpinv_reset_invoice_count' ); |
|
570 | -function wpinv_reset_invoice_count(){ |
|
571 | - if(isset($_GET['reset_invoice_count']) && 1 == $_GET['reset_invoice_count'] && isset($_GET['_nonce']) && wp_verify_nonce($_GET['_nonce'], 'reset_invoice_count')) { |
|
569 | +add_action('admin_init', 'wpinv_reset_invoice_count'); |
|
570 | +function wpinv_reset_invoice_count() { |
|
571 | + if (isset($_GET['reset_invoice_count']) && 1 == $_GET['reset_invoice_count'] && isset($_GET['_nonce']) && wp_verify_nonce($_GET['_nonce'], 'reset_invoice_count')) { |
|
572 | 572 | wpinv_update_option('invoice_sequence_start', 1); |
573 | 573 | delete_option('wpinv_last_invoice_number'); |
574 | 574 | $url = add_query_arg(array('reset_invoice_done' => 1)); |
@@ -579,8 +579,8 @@ discard block |
||
579 | 579 | } |
580 | 580 | |
581 | 581 | add_action('admin_notices', 'wpinv_invoice_count_reset_message'); |
582 | -function wpinv_invoice_count_reset_message(){ |
|
583 | - if(isset($_GET['reset_invoice_done']) && 1 == $_GET['reset_invoice_done']) { |
|
582 | +function wpinv_invoice_count_reset_message() { |
|
583 | + if (isset($_GET['reset_invoice_done']) && 1 == $_GET['reset_invoice_done']) { |
|
584 | 584 | $notice = __('Invoice number sequence reset successfully.', 'invoicing'); |
585 | 585 | ?> |
586 | 586 | <div class="notice notice-success is-dismissible"> |
@@ -12,19 +12,19 @@ |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // MUST have WordPress. |
15 | -if ( !defined( 'WPINC' ) ) { |
|
16 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
15 | +if (!defined('WPINC')) { |
|
16 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
17 | 17 | } |
18 | 18 | |
19 | -if ( !defined( 'WPINV_VERSION' ) ) { |
|
20 | - define( 'WPINV_VERSION', '1.0.11' ); |
|
19 | +if (!defined('WPINV_VERSION')) { |
|
20 | + define('WPINV_VERSION', '1.0.11'); |
|
21 | 21 | } |
22 | 22 | |
23 | -if ( !defined( 'WPINV_PLUGIN_FILE' ) ) { |
|
24 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
23 | +if (!defined('WPINV_PLUGIN_FILE')) { |
|
24 | + define('WPINV_PLUGIN_FILE', __FILE__); |
|
25 | 25 | } |
26 | 26 | |
27 | -require plugin_dir_path( __FILE__ ) . 'includes/class-wpinv.php'; |
|
27 | +require plugin_dir_path(__FILE__) . 'includes/class-wpinv.php'; |
|
28 | 28 | |
29 | 29 | function wpinv_run() { |
30 | 30 | global $invoicing; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | if ( ! defined( 'ABSPATH' ) ) { |
7 | - exit; |
|
7 | + exit; |
|
8 | 8 | } |
9 | 9 | add_ThickBox(); |
10 | 10 | ?> |
@@ -14,18 +14,18 @@ discard block |
||
14 | 14 | <?php if ( $tabs ){ ?> |
15 | 15 | <nav class="nav-tab-wrapper wpi-nav-tab-wrapper"> |
16 | 16 | <?php |
17 | - foreach ( $tabs as $name => $label ) { |
|
18 | - echo '<a href="' . admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>'; |
|
19 | - } |
|
20 | - do_action( 'wpi_addons_tabs' ); |
|
21 | - ?> |
|
17 | + foreach ( $tabs as $name => $label ) { |
|
18 | + echo '<a href="' . admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>'; |
|
19 | + } |
|
20 | + do_action( 'wpi_addons_tabs' ); |
|
21 | + ?> |
|
22 | 22 | </nav> |
23 | 23 | |
24 | 24 | <?php |
25 | 25 | |
26 | - if($current_tab == 'membership'){ |
|
26 | + if($current_tab == 'membership'){ |
|
27 | 27 | |
28 | - ?> |
|
28 | + ?> |
|
29 | 29 | |
30 | 30 | <div class="wpi-membership-tab-conatiner"> |
31 | 31 | <div class="membership-content"> |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | <h2><?php _e("Have a membership key?","invoicing");?></h2> |
37 | 37 | <p> |
38 | 38 | <?php |
39 | - $wpeu_admin = new External_Updates_Admin('wpinvoicing.com','1'); |
|
40 | - echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership',array(95, 106, 108)); |
|
41 | - ?> |
|
39 | + $wpeu_admin = new External_Updates_Admin('wpinvoicing.com','1'); |
|
40 | + echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership',array(95, 106, 108)); |
|
41 | + ?> |
|
42 | 42 | </p> |
43 | 43 | <?php }?> |
44 | 44 | |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | <div class="feature-list"> |
49 | 49 | <ul> |
50 | 50 | <?php |
51 | - $addon_obj = new WPInv_Admin_Addons(); |
|
52 | - if ($addons = $addon_obj->get_section_data( 'addons' ) ) { |
|
53 | - foreach ( $addons as $addon ) { |
|
54 | - echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>'; |
|
55 | - } |
|
56 | - } |
|
57 | - ?> |
|
51 | + $addon_obj = new WPInv_Admin_Addons(); |
|
52 | + if ($addons = $addon_obj->get_section_data( 'addons' ) ) { |
|
53 | + foreach ( $addons as $addon ) { |
|
54 | + echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>'; |
|
55 | + } |
|
56 | + } |
|
57 | + ?> |
|
58 | 58 | </ul> |
59 | 59 | |
60 | 60 | <div class="feature-cta"> |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | <h3><?php _e("Included Gateways:","invoicing");?></h3> |
66 | 66 | <ul> |
67 | 67 | <?php |
68 | - if ($addons = $addon_obj->get_section_data( 'gateways' ) ) { |
|
69 | - foreach ( $addons as $addon ) { |
|
70 | - echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>'; |
|
71 | - } |
|
72 | - } |
|
73 | - ?> |
|
68 | + if ($addons = $addon_obj->get_section_data( 'gateways' ) ) { |
|
69 | + foreach ( $addons as $addon ) { |
|
70 | + echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>'; |
|
71 | + } |
|
72 | + } |
|
73 | + ?> |
|
74 | 74 | </ul> |
75 | 75 | </div> |
76 | 76 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | <div class="testimonial-content"> |
82 | 82 | <div class="t-image"> |
83 | 83 | <?php |
84 | - echo '<img src="' . plugins_url( 'images/t-image2.png', dirname(__FILE__) ) . '" > '; |
|
85 | - ?> |
|
84 | + echo '<img src="' . plugins_url( 'images/t-image2.png', dirname(__FILE__) ) . '" > '; |
|
85 | + ?> |
|
86 | 86 | </div> |
87 | 87 | <div class="t-content"> |
88 | 88 | <p> |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | <div class="testimonial-content"> |
102 | 102 | <div class="t-image"> |
103 | 103 | <?php |
104 | - echo '<img src="' . plugins_url( 'images/t-image1.png', dirname(__FILE__) ) . '" > '; |
|
105 | - ?> |
|
104 | + echo '<img src="' . plugins_url( 'images/t-image1.png', dirname(__FILE__) ) . '" > '; |
|
105 | + ?> |
|
106 | 106 | </div> |
107 | 107 | <div class="t-content"> |
108 | 108 | <p> |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | </div> |
127 | 127 | </div> |
128 | 128 | <?php |
129 | - }else{ |
|
130 | - $installed_plugins = get_plugins(); |
|
129 | + }else{ |
|
130 | + $installed_plugins = get_plugins(); |
|
131 | 131 | $addon_obj = new WPInv_Admin_Addons(); |
132 | - if ($addons = $addon_obj->get_section_data( $current_tab ) ) : |
|
133 | - ?> |
|
132 | + if ($addons = $addon_obj->get_section_data( $current_tab ) ) : |
|
133 | + ?> |
|
134 | 134 | <ul class="wpi-products"><?php foreach ( $addons as $addon ) : |
135 | 135 | if(965==$addon->info->id){continue;}// don't show quote add on |
136 | - ?><li class="wpi-product"> |
|
136 | + ?><li class="wpi-product"> |
|
137 | 137 | <div class="wpi-product-title"> |
138 | 138 | <h3><?php |
139 | - if ( ! empty( $addon->info->excerpt) ){ |
|
140 | - echo wpi_help_tip( $addon->info->excerpt ); |
|
141 | - } |
|
142 | - echo esc_html( $addon->info->title ); ?></h3> |
|
139 | + if ( ! empty( $addon->info->excerpt) ){ |
|
140 | + echo wpi_help_tip( $addon->info->excerpt ); |
|
141 | + } |
|
142 | + echo esc_html( $addon->info->title ); ?></h3> |
|
143 | 143 | </div> |
144 | 144 | |
145 | 145 | <span class="wpi-product-image"> |
@@ -147,27 +147,27 @@ discard block |
||
147 | 147 | <img src="<?php echo esc_attr( $addon->info->thumbnail ); ?>"/> |
148 | 148 | <?php endif; |
149 | 149 | |
150 | - if(isset($addon->info->link) && substr( $addon->info->link, 0, 21 ) === "https://wordpress.org"){ |
|
151 | - echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
|
152 | - echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
|
153 | - echo '</a>'; |
|
154 | - }elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
155 | - if(defined('WP_EASY_UPDATES_ACTIVE')){ |
|
156 | - $url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com&TB_iframe=true'); |
|
157 | - }else{ |
|
158 | - // if installed show activation link |
|
159 | - if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){ |
|
160 | - $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation'; |
|
161 | - }else{ |
|
162 | - $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external'; |
|
163 | - } |
|
164 | - } |
|
165 | - echo '<a href="'.$url.'" class="thickbox">'; |
|
166 | - echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
|
167 | - echo '</a>'; |
|
168 | - } |
|
169 | - |
|
170 | - ?> |
|
150 | + if(isset($addon->info->link) && substr( $addon->info->link, 0, 21 ) === "https://wordpress.org"){ |
|
151 | + echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
|
152 | + echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
|
153 | + echo '</a>'; |
|
154 | + }elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
155 | + if(defined('WP_EASY_UPDATES_ACTIVE')){ |
|
156 | + $url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com&TB_iframe=true'); |
|
157 | + }else{ |
|
158 | + // if installed show activation link |
|
159 | + if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){ |
|
160 | + $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation'; |
|
161 | + }else{ |
|
162 | + $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external'; |
|
163 | + } |
|
164 | + } |
|
165 | + echo '<a href="'.$url.'" class="thickbox">'; |
|
166 | + echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
|
167 | + echo '</a>'; |
|
168 | + } |
|
169 | + |
|
170 | + ?> |
|
171 | 171 | |
172 | 172 | </span> |
173 | 173 | |
@@ -175,15 +175,15 @@ discard block |
||
175 | 175 | <span class="wpi-product-button"> |
176 | 176 | <?php |
177 | 177 | $addon_obj->output_button( $addon ); |
178 | - ?> |
|
178 | + ?> |
|
179 | 179 | </span> |
180 | 180 | |
181 | 181 | <span class="wpi-price"><?php //print_r($addon); //echo wp_kses_post( $addon->price ); ?></span></li><?php endforeach; ?></ul> |
182 | 182 | <?php endif; |
183 | - } |
|
183 | + } |
|
184 | 184 | |
185 | - } |
|
186 | - ?> |
|
185 | + } |
|
186 | + ?> |
|
187 | 187 | |
188 | 188 | |
189 | 189 | <div class="clearfix" ></div> |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | <input class="wpeu-licence-key" type="text" placeholder="<?php _e("Enter your licence key",'invoicing');?>"> <button class="button-primary wpeu-licence-popup-button" ><?php _e("Install",'invoicing');?></button> |
203 | 203 | <br> |
204 | 204 | <?php |
205 | - echo sprintf( __('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">','</a>','<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">','</a>' ); |
|
206 | - ?> |
|
205 | + echo sprintf( __('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">','</a>','<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">','</a>' ); |
|
206 | + ?> |
|
207 | 207 | </span> |
208 | 208 | </div> |
209 | 209 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: Page - Addons |
4 | 4 | * |
5 | 5 | */ |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if (!defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | add_ThickBox(); |
@@ -11,19 +11,19 @@ discard block |
||
11 | 11 | <div class="wrap wpi_addons_wrap"> |
12 | 12 | <h1><?php echo get_admin_page_title(); ?></h1> |
13 | 13 | |
14 | - <?php if ( $tabs ){ ?> |
|
14 | + <?php if ($tabs) { ?> |
|
15 | 15 | <nav class="nav-tab-wrapper wpi-nav-tab-wrapper"> |
16 | 16 | <?php |
17 | - foreach ( $tabs as $name => $label ) { |
|
18 | - echo '<a href="' . admin_url( 'admin.php?page=wpi-addons&tab=' . $name ) . '" class="nav-tab ' . ( $current_tab == $name ? 'nav-tab-active' : '' ) . '">' . $label . '</a>'; |
|
17 | + foreach ($tabs as $name => $label) { |
|
18 | + echo '<a href="' . admin_url('admin.php?page=wpi-addons&tab=' . $name) . '" class="nav-tab ' . ($current_tab == $name ? 'nav-tab-active' : '') . '">' . $label . '</a>'; |
|
19 | 19 | } |
20 | - do_action( 'wpi_addons_tabs' ); |
|
20 | + do_action('wpi_addons_tabs'); |
|
21 | 21 | ?> |
22 | 22 | </nav> |
23 | 23 | |
24 | 24 | <?php |
25 | 25 | |
26 | - if($current_tab == 'membership'){ |
|
26 | + if ($current_tab == 'membership') { |
|
27 | 27 | |
28 | 28 | ?> |
29 | 29 | |
@@ -32,42 +32,42 @@ discard block |
||
32 | 32 | <!-- |
33 | 33 | <h2>With our WPInvoicing Membership you get access to all our products!</h2> |
34 | 34 | <p><a class="button button-primary" href="https://wpinvoicing.com/downloads/membership/">View Memberships</a></p>--> |
35 | - <?php if(defined('WP_EASY_UPDATES_ACTIVE')){?> |
|
36 | - <h2><?php _e("Have a membership key?","invoicing");?></h2> |
|
35 | + <?php if (defined('WP_EASY_UPDATES_ACTIVE')) {?> |
|
36 | + <h2><?php _e("Have a membership key?", "invoicing"); ?></h2> |
|
37 | 37 | <p> |
38 | 38 | <?php |
39 | - $wpeu_admin = new External_Updates_Admin('wpinvoicing.com','1'); |
|
40 | - echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership',array(95, 106, 108)); |
|
39 | + $wpeu_admin = new External_Updates_Admin('wpinvoicing.com', '1'); |
|
40 | + echo $wpeu_admin->render_licence_actions('wpinvoicing.com', 'membership', array(95, 106, 108)); |
|
41 | 41 | ?> |
42 | 42 | </p> |
43 | 43 | <?php }?> |
44 | 44 | |
45 | 45 | <div class="membership-cta-contet"> |
46 | 46 | <div class="main-cta"> |
47 | - <h2><?php _e("Membership benefits Include:","invoicing");?></h2> |
|
47 | + <h2><?php _e("Membership benefits Include:", "invoicing"); ?></h2> |
|
48 | 48 | <div class="feature-list"> |
49 | 49 | <ul> |
50 | 50 | <?php |
51 | 51 | $addon_obj = new WPInv_Admin_Addons(); |
52 | - if ($addons = $addon_obj->get_section_data( 'addons' ) ) { |
|
53 | - foreach ( $addons as $addon ) { |
|
54 | - echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>'; |
|
52 | + if ($addons = $addon_obj->get_section_data('addons')) { |
|
53 | + foreach ($addons as $addon) { |
|
54 | + echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html($addon->info->title) . '</li>'; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | ?> |
58 | 58 | </ul> |
59 | 59 | |
60 | 60 | <div class="feature-cta"> |
61 | - <h3><?php _e("Membership Starts from","invoicing");?></h3> |
|
61 | + <h3><?php _e("Membership Starts from", "invoicing"); ?></h3> |
|
62 | 62 | <h4>$99</h4> |
63 | - <a href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership","invoicing");?></a> |
|
63 | + <a href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership", "invoicing"); ?></a> |
|
64 | 64 | </div> |
65 | - <h3><?php _e("Included Gateways:","invoicing");?></h3> |
|
65 | + <h3><?php _e("Included Gateways:", "invoicing"); ?></h3> |
|
66 | 66 | <ul> |
67 | 67 | <?php |
68 | - if ($addons = $addon_obj->get_section_data( 'gateways' ) ) { |
|
69 | - foreach ( $addons as $addon ) { |
|
70 | - echo '<li><i class="far fa-check-circle fa-sm"></i> '.esc_html( $addon->info->title ).'</li>'; |
|
68 | + if ($addons = $addon_obj->get_section_data('gateways')) { |
|
69 | + foreach ($addons as $addon) { |
|
70 | + echo '<li><i class="far fa-check-circle fa-sm"></i> ' . esc_html($addon->info->title) . '</li>'; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | ?> |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | <div class="testimonial-content"> |
82 | 82 | <div class="t-image"> |
83 | 83 | <?php |
84 | - echo '<img src="' . plugins_url( 'images/t-image2.png', dirname(__FILE__) ) . '" > '; |
|
84 | + echo '<img src="' . plugins_url('images/t-image2.png', dirname(__FILE__)) . '" > '; |
|
85 | 85 | ?> |
86 | 86 | </div> |
87 | 87 | <div class="t-content"> |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | <div class="testimonial-content"> |
102 | 102 | <div class="t-image"> |
103 | 103 | <?php |
104 | - echo '<img src="' . plugins_url( 'images/t-image1.png', dirname(__FILE__) ) . '" > '; |
|
104 | + echo '<img src="' . plugins_url('images/t-image1.png', dirname(__FILE__)) . '" > '; |
|
105 | 105 | ?> |
106 | 106 | </div> |
107 | 107 | <div class="t-content"> |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | </div> |
118 | 118 | </div> |
119 | 119 | <div class="member-footer"> |
120 | - <a class="footer-btn" href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership","invoicing");?></a> |
|
121 | - <a class="footer-link" href="post-new.php?post_type=wpi_invoice"><?php _e("Create Invoice","invoicing");?></a> |
|
120 | + <a class="footer-btn" href="https://wpinvoicing.com/downloads/membership/" target="_blank"><?php _e("Buy Membership", "invoicing"); ?></a> |
|
121 | + <a class="footer-link" href="post-new.php?post_type=wpi_invoice"><?php _e("Create Invoice", "invoicing"); ?></a> |
|
122 | 122 | </div> |
123 | 123 | </div> |
124 | 124 | |
@@ -126,44 +126,44 @@ discard block |
||
126 | 126 | </div> |
127 | 127 | </div> |
128 | 128 | <?php |
129 | - }else{ |
|
129 | + } else { |
|
130 | 130 | $installed_plugins = get_plugins(); |
131 | 131 | $addon_obj = new WPInv_Admin_Addons(); |
132 | - if ($addons = $addon_obj->get_section_data( $current_tab ) ) : |
|
132 | + if ($addons = $addon_obj->get_section_data($current_tab)) : |
|
133 | 133 | ?> |
134 | - <ul class="wpi-products"><?php foreach ( $addons as $addon ) : |
|
135 | - if(965==$addon->info->id){continue;}// don't show quote add on |
|
134 | + <ul class="wpi-products"><?php foreach ($addons as $addon) : |
|
135 | + if (965 == $addon->info->id) {continue; }// don't show quote add on |
|
136 | 136 | ?><li class="wpi-product"> |
137 | 137 | <div class="wpi-product-title"> |
138 | 138 | <h3><?php |
139 | - if ( ! empty( $addon->info->excerpt) ){ |
|
140 | - echo wpi_help_tip( $addon->info->excerpt ); |
|
139 | + if (!empty($addon->info->excerpt)) { |
|
140 | + echo wpi_help_tip($addon->info->excerpt); |
|
141 | 141 | } |
142 | - echo esc_html( $addon->info->title ); ?></h3> |
|
142 | + echo esc_html($addon->info->title); ?></h3> |
|
143 | 143 | </div> |
144 | 144 | |
145 | 145 | <span class="wpi-product-image"> |
146 | - <?php if ( ! empty( $addon->info->thumbnail) ) : ?> |
|
147 | - <img src="<?php echo esc_attr( $addon->info->thumbnail ); ?>"/> |
|
146 | + <?php if (!empty($addon->info->thumbnail)) : ?> |
|
147 | + <img src="<?php echo esc_attr($addon->info->thumbnail); ?>"/> |
|
148 | 148 | <?php endif; |
149 | 149 | |
150 | - if(isset($addon->info->link) && substr( $addon->info->link, 0, 21 ) === "https://wordpress.org"){ |
|
151 | - echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
|
152 | - echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
|
150 | + if (isset($addon->info->link) && substr($addon->info->link, 0, 21) === "https://wordpress.org") { |
|
151 | + echo '<a href="' . admin_url('/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug) . '&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
|
152 | + echo '<span class="wpi-product-info">' . __('More info', 'invoicing') . '</span>'; |
|
153 | 153 | echo '</a>'; |
154 | - }elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
155 | - if(defined('WP_EASY_UPDATES_ACTIVE')){ |
|
156 | - $url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com&TB_iframe=true'); |
|
157 | - }else{ |
|
154 | + }elseif (isset($addon->info->link) && substr($addon->info->link, 0, 23) === "https://wpinvoicing.com") { |
|
155 | + if (defined('WP_EASY_UPDATES_ACTIVE')) { |
|
156 | + $url = admin_url('/plugin-install.php?tab=plugin-information&plugin=' . $addon->info->slug . '&width=770&height=660&item_id=' . $addon->info->id . '&update_url=https://wpinvoicing.com&TB_iframe=true'); |
|
157 | + } else { |
|
158 | 158 | // if installed show activation link |
159 | - if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){ |
|
159 | + if (isset($installed_plugins['wp-easy-updates/external-updates.php'])) { |
|
160 | 160 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation'; |
161 | - }else{ |
|
161 | + } else { |
|
162 | 162 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external'; |
163 | 163 | } |
164 | 164 | } |
165 | - echo '<a href="'.$url.'" class="thickbox">'; |
|
166 | - echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
|
165 | + echo '<a href="' . $url . '" class="thickbox">'; |
|
166 | + echo '<span class="wpi-product-info">' . __('More info', 'invoicing') . '</span>'; |
|
167 | 167 | echo '</a>'; |
168 | 168 | } |
169 | 169 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | <span class="wpi-product-button"> |
176 | 176 | <?php |
177 | - $addon_obj->output_button( $addon ); |
|
177 | + $addon_obj->output_button($addon); |
|
178 | 178 | ?> |
179 | 179 | </span> |
180 | 180 | |
@@ -188,21 +188,21 @@ discard block |
||
188 | 188 | |
189 | 189 | <div class="clearfix" ></div> |
190 | 190 | |
191 | - <?php if($current_tab =='addons'){ ?> |
|
192 | - <p><?php printf( __( 'All of our Invoicing Addons can be found on WPInvoicing.com here: <a href="%s">Invoicing Addons</a>', 'invoicing' ), 'https://wpinvoicing.com/downloads/category/addons/' ); ?></p> |
|
193 | - <?php } if($current_tab =='gateways'){ ?> |
|
194 | - <p><?php printf( __( 'All of our Invoicing Payment Gateways can be found on WPInvoicing.com here: <a href="%s">Invoicing Payment Gateways</a>', 'invoicing' ), 'https://wpinvoicing.com/downloads/category/gateways/' ); ?></p> |
|
191 | + <?php if ($current_tab == 'addons') { ?> |
|
192 | + <p><?php printf(__('All of our Invoicing Addons can be found on WPInvoicing.com here: <a href="%s">Invoicing Addons</a>', 'invoicing'), 'https://wpinvoicing.com/downloads/category/addons/'); ?></p> |
|
193 | + <?php } if ($current_tab == 'gateways') { ?> |
|
194 | + <p><?php printf(__('All of our Invoicing Payment Gateways can be found on WPInvoicing.com here: <a href="%s">Invoicing Payment Gateways</a>', 'invoicing'), 'https://wpinvoicing.com/downloads/category/gateways/'); ?></p> |
|
195 | 195 | <?php } ?> |
196 | 196 | |
197 | - <div id="wpi-wpeu-required-activation" style="display:none;"><span class="wpi-notification "><?php printf( __("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s'>activate</a> it now.",'invoicing'),wp_nonce_url(admin_url('plugins.php?action=activate&plugin=wp-easy-updates/external-updates.php'), 'activate-plugin_wp-easy-updates/external-updates.php'));?></span></div> |
|
198 | - <div id="wpi-wpeu-required-for-external" style="display:none;"><span class="wpi-notification "><?php printf( __("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s' onclick='window.open(\"https://wpeasyupdates.com/wp-easy-updates.zip\", \"_blank\");' >download</a> and install it now.",'invoicing'),admin_url("plugin-install.php?tab=upload&wpeu-install=true"));?></span></div> |
|
197 | + <div id="wpi-wpeu-required-activation" style="display:none;"><span class="wpi-notification "><?php printf(__("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s'>activate</a> it now.", 'invoicing'), wp_nonce_url(admin_url('plugins.php?action=activate&plugin=wp-easy-updates/external-updates.php'), 'activate-plugin_wp-easy-updates/external-updates.php')); ?></span></div> |
|
198 | + <div id="wpi-wpeu-required-for-external" style="display:none;"><span class="wpi-notification "><?php printf(__("The plugin <a href='https://wpeasyupdates.com/' target='_blank'>WP Easy Updates</a> is required to check for and update some installed plugins/themes, please <a href='%s' onclick='window.open(\"https://wpeasyupdates.com/wp-easy-updates.zip\", \"_blank\");' >download</a> and install it now.", 'invoicing'), admin_url("plugin-install.php?tab=upload&wpeu-install=true")); ?></span></div> |
|
199 | 199 | <div id="wpeu-licence-popup" style="display:none;"> |
200 | 200 | <span class="wpi-notification noti-white"> |
201 | - <h3 class="wpeu-licence-title"><?php _e("Licence key",'invoicing');?></h3> |
|
202 | - <input class="wpeu-licence-key" type="text" placeholder="<?php _e("Enter your licence key",'invoicing');?>"> <button class="button-primary wpeu-licence-popup-button" ><?php _e("Install",'invoicing');?></button> |
|
201 | + <h3 class="wpeu-licence-title"><?php _e("Licence key", 'invoicing'); ?></h3> |
|
202 | + <input class="wpeu-licence-key" type="text" placeholder="<?php _e("Enter your licence key", 'invoicing'); ?>"> <button class="button-primary wpeu-licence-popup-button" ><?php _e("Install", 'invoicing'); ?></button> |
|
203 | 203 | <br> |
204 | 204 | <?php |
205 | - echo sprintf( __('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">','</a>','<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">','</a>' ); |
|
205 | + echo sprintf(__('%sFind your licence key here%s OR %sBuy one here%s', 'invoicing'), '<a href="https://wpinvoicing.com/your-account/" target="_blank">', '</a>', '<a class="wpeu-licence-link" href="https://wpinvoicing.com/downloads/category/addons/" target="_blank">', '</a>'); |
|
206 | 206 | ?> |
207 | 207 | </span> |
208 | 208 | </div> |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | </div> |
127 | 127 | </div> |
128 | 128 | <?php |
129 | - }else{ |
|
129 | + } else{ |
|
130 | 130 | $installed_plugins = get_plugins(); |
131 | 131 | $addon_obj = new WPInv_Admin_Addons(); |
132 | 132 | if ($addons = $addon_obj->get_section_data( $current_tab ) ) : |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | echo '<a href="'.admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug).'&width=770&height=660&TB_iframe=true" class="thickbox" >'; |
152 | 152 | echo '<span class="wpi-product-info">'.__('More info','invoicing').'</span>'; |
153 | 153 | echo '</a>'; |
154 | - }elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
154 | + } elseif(isset($addon->info->link) && substr( $addon->info->link, 0, 23 ) === "https://wpinvoicing.com"){ |
|
155 | 155 | if(defined('WP_EASY_UPDATES_ACTIVE')){ |
156 | 156 | $url = admin_url('/plugin-install.php?tab=plugin-information&plugin='.$addon->info->slug.'&width=770&height=660&item_id='.$addon->info->id.'&update_url=https://wpinvoicing.com&TB_iframe=true'); |
157 | - }else{ |
|
157 | + } else{ |
|
158 | 158 | // if installed show activation link |
159 | 159 | if(isset($installed_plugins['wp-easy-updates/external-updates.php'])){ |
160 | 160 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-activation'; |
161 | - }else{ |
|
161 | + } else{ |
|
162 | 162 | $url = '#TB_inline?width=600&height=50&inlineId=wpi-wpeu-required-for-external'; |
163 | 163 | } |
164 | 164 | } |