@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; // Exit if accessed directly |
|
11 | + exit; // Exit if accessed directly |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | class GetPaid_Meta_Box_Invoice_Details { |
18 | 18 | |
19 | 19 | /** |
20 | - * Output the metabox. |
|
21 | - * |
|
22 | - * @param WP_Post $post |
|
23 | - */ |
|
20 | + * Output the metabox. |
|
21 | + * |
|
22 | + * @param WP_Post $post |
|
23 | + */ |
|
24 | 24 | public static function output( $post ) { |
25 | 25 | |
26 | 26 | // Prepare the invoice. |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | 28 | |
29 | 29 | // Nonce field. |
30 | - wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ; |
|
30 | + wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | ?> |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | |
47 | 47 | <div class="bsui" style="margin-top: 1.5rem"> |
48 | 48 | |
49 | - <?php do_action( 'getpaid_invoice_edit_before_viewed_by_customer', $invoice ); ?> |
|
50 | - <?php if ( ! $invoice->is_draft() ) : ?> |
|
49 | + <?php do_action('getpaid_invoice_edit_before_viewed_by_customer', $invoice); ?> |
|
50 | + <?php if (!$invoice->is_draft()) : ?> |
|
51 | 51 | <div class="form-group"> |
52 | - <strong><?php _e( 'Viewed by Customer:', 'invoicing' );?></strong> |
|
53 | - <?php ( $invoice->get_is_viewed() ) ? _e( 'Yes', 'invoicing' ) : _e( 'No', 'invoicing' ); ?> |
|
52 | + <strong><?php _e('Viewed by Customer:', 'invoicing'); ?></strong> |
|
53 | + <?php ($invoice->get_is_viewed()) ? _e('Yes', 'invoicing') : _e('No', 'invoicing'); ?> |
|
54 | 54 | </div> |
55 | 55 | <?php endif; ?> |
56 | 56 | |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | |
59 | 59 | // Date created. |
60 | 60 | $label = sprintf( |
61 | - __( '%s Date:', 'invoicing' ), |
|
62 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
61 | + __('%s Date:', 'invoicing'), |
|
62 | + ucfirst($invoice->get_invoice_quote_type()) |
|
63 | 63 | ); |
64 | 64 | |
65 | - $info = sprintf( |
|
66 | - __( 'The date this %s was created.', 'invoicing' ), |
|
67 | - strtolower( $invoice->get_invoice_quote_type() ) |
|
65 | + $info = sprintf( |
|
66 | + __('The date this %s was created.', 'invoicing'), |
|
67 | + strtolower($invoice->get_invoice_quote_type()) |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | echo aui()->input( |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | 'type' => 'datepicker', |
73 | 73 | 'id' => 'wpinv_date_created', |
74 | 74 | 'name' => 'date_created', |
75 | - 'label' => $label . getpaid_get_help_tip( $info ), |
|
75 | + 'label' => $label . getpaid_get_help_tip($info), |
|
76 | 76 | 'label_type' => 'vertical', |
77 | 77 | 'placeholder' => 'YYYY-MM-DD 00:00', |
78 | 78 | 'class' => 'form-control-sm', |
79 | - 'value' => $invoice->get_date_created( 'edit' ), |
|
79 | + 'value' => $invoice->get_date_created('edit'), |
|
80 | 80 | 'extra_attributes' => array( |
81 | 81 | 'data-enable-time' => 'true', |
82 | 82 | 'data-time_24hr' => 'true', |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | ); |
88 | 88 | |
89 | 89 | // Date paid. |
90 | - $date_paid = $invoice->get_date_completed( 'edit' ); |
|
91 | - if ( ! empty( $date_paid ) && $invoice->is_paid() ) { |
|
90 | + $date_paid = $invoice->get_date_completed('edit'); |
|
91 | + if (!empty($date_paid) && $invoice->is_paid()) { |
|
92 | 92 | |
93 | 93 | echo aui()->input( |
94 | 94 | array( |
95 | 95 | 'type' => 'text', |
96 | 96 | 'id' => 'wpinv_date_completed', |
97 | 97 | 'name' => 'wpinv_date_completed', |
98 | - 'label' => __( 'Date Completed:', 'invoicing' ), |
|
98 | + 'label' => __('Date Completed:', 'invoicing'), |
|
99 | 99 | 'label_type' => 'vertical', |
100 | 100 | 'class' => 'form-control-sm', |
101 | 101 | 'value' => $date_paid, |
@@ -109,56 +109,56 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | // Due date. |
112 | - if ( $invoice->is_type( 'invoice' ) && wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->is_draft() ) ) { |
|
112 | + if ($invoice->is_type('invoice') && wpinv_get_option('overdue_active') && ($invoice->needs_payment() || $invoice->is_draft())) { |
|
113 | 113 | |
114 | 114 | echo aui()->input( |
115 | 115 | array( |
116 | 116 | 'type' => 'text', |
117 | 117 | 'id' => 'wpinv_due_date', |
118 | 118 | 'name' => 'wpinv_due_date', |
119 | - 'label' => __( 'Due Date:', 'invoicing' ) . getpaid_get_help_tip( __( 'Leave blank to disable automated reminder emails for this invoice.', 'invoicing' ) ), |
|
119 | + 'label' => __('Due Date:', 'invoicing') . getpaid_get_help_tip(__('Leave blank to disable automated reminder emails for this invoice.', 'invoicing')), |
|
120 | 120 | 'label_type' => 'vertical', |
121 | - 'placeholder' => __( 'No due date', 'invoicing' ), |
|
121 | + 'placeholder' => __('No due date', 'invoicing'), |
|
122 | 122 | 'class' => 'form-control-sm', |
123 | - 'value' => $invoice->get_due_date( 'edit' ), |
|
123 | + 'value' => $invoice->get_due_date('edit'), |
|
124 | 124 | ) |
125 | 125 | ); |
126 | 126 | |
127 | 127 | } |
128 | 128 | |
129 | - do_action( 'wpinv_meta_box_details_after_due_date', $invoice->get_id() ); |
|
130 | - do_action( 'getpaid_metabox_after_due_date', $invoice ); |
|
129 | + do_action('wpinv_meta_box_details_after_due_date', $invoice->get_id()); |
|
130 | + do_action('getpaid_metabox_after_due_date', $invoice); |
|
131 | 131 | |
132 | 132 | // Status. |
133 | 133 | $label = sprintf( |
134 | - __( '%s Status:', 'invoicing' ), |
|
135 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
134 | + __('%s Status:', 'invoicing'), |
|
135 | + ucfirst($invoice->get_invoice_quote_type()) |
|
136 | 136 | ); |
137 | 137 | |
138 | - $status = $invoice->get_status( 'edit' ); |
|
138 | + $status = $invoice->get_status('edit'); |
|
139 | 139 | echo aui()->select( |
140 | 140 | array( |
141 | 141 | 'id' => 'wpinv_status', |
142 | 142 | 'name' => 'wpinv_status', |
143 | 143 | 'label' => $label, |
144 | 144 | 'label_type' => 'vertical', |
145 | - 'placeholder' => __( 'Select Status', 'invoicing' ), |
|
146 | - 'value' => array_key_exists( $status, $invoice->get_all_statuses() ) ? $status : $invoice->get_default_status(), |
|
145 | + 'placeholder' => __('Select Status', 'invoicing'), |
|
146 | + 'value' => array_key_exists($status, $invoice->get_all_statuses()) ? $status : $invoice->get_default_status(), |
|
147 | 147 | 'select2' => true, |
148 | 148 | 'data-allow-clear' => 'false', |
149 | - 'options' => wpinv_get_invoice_statuses( true, false, $invoice ) |
|
149 | + 'options' => wpinv_get_invoice_statuses(true, false, $invoice) |
|
150 | 150 | ) |
151 | 151 | ); |
152 | 152 | |
153 | 153 | // Invoice number. |
154 | 154 | $label = sprintf( |
155 | - __( '%s Number:', 'invoicing' ), |
|
156 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
155 | + __('%s Number:', 'invoicing'), |
|
156 | + ucfirst($invoice->get_invoice_quote_type()) |
|
157 | 157 | ); |
158 | 158 | |
159 | - $info = sprintf( |
|
160 | - __( 'Each %s number must be unique.', 'invoicing' ), |
|
161 | - strtolower( $invoice->get_invoice_quote_type() ) |
|
159 | + $info = sprintf( |
|
160 | + __('Each %s number must be unique.', 'invoicing'), |
|
161 | + strtolower($invoice->get_invoice_quote_type()) |
|
162 | 162 | ); |
163 | 163 | |
164 | 164 | echo aui()->input( |
@@ -166,11 +166,11 @@ discard block |
||
166 | 166 | 'type' => 'text', |
167 | 167 | 'id' => 'wpinv_number', |
168 | 168 | 'name' => 'wpinv_number', |
169 | - 'label' => $label . getpaid_get_help_tip( $info ), |
|
169 | + 'label' => $label . getpaid_get_help_tip($info), |
|
170 | 170 | 'label_type' => 'vertical', |
171 | - 'placeholder' => __( 'Autogenerate', 'invoicing' ), |
|
171 | + 'placeholder' => __('Autogenerate', 'invoicing'), |
|
172 | 172 | 'class' => 'form-control-sm', |
173 | - 'value' => $invoice->get_number( 'edit' ), |
|
173 | + 'value' => $invoice->get_number('edit'), |
|
174 | 174 | ) |
175 | 175 | ); |
176 | 176 | |
@@ -180,25 +180,25 @@ discard block |
||
180 | 180 | 'type' => 'text', |
181 | 181 | 'id' => 'wpinv_cc', |
182 | 182 | 'name' => 'wpinv_cc', |
183 | - 'label' => __( 'Email CC:', 'invoicing' ) . getpaid_get_help_tip( __( 'Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing' ) ), |
|
183 | + 'label' => __('Email CC:', 'invoicing') . getpaid_get_help_tip(__('Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing')), |
|
184 | 184 | 'label_type' => 'vertical', |
185 | - 'placeholder' => __( '[email protected], [email protected]', 'invoicing' ), |
|
185 | + 'placeholder' => __('[email protected], [email protected]', 'invoicing'), |
|
186 | 186 | 'class' => 'form-control-sm', |
187 | - 'value' => $invoice->get_email_cc( 'edit' ), |
|
187 | + 'value' => $invoice->get_email_cc('edit'), |
|
188 | 188 | ) |
189 | 189 | ); |
190 | 190 | |
191 | - do_action( 'wpinv_meta_box_details_inner', $invoice->get_id() ); |
|
191 | + do_action('wpinv_meta_box_details_inner', $invoice->get_id()); |
|
192 | 192 | |
193 | 193 | // Disable taxes. |
194 | - if ( wpinv_use_taxes() && ! ( $invoice->is_paid() || $invoice->is_refunded() ) ) { |
|
194 | + if (wpinv_use_taxes() && !($invoice->is_paid() || $invoice->is_refunded())) { |
|
195 | 195 | |
196 | 196 | echo aui()->input( |
197 | 197 | array( |
198 | 198 | 'id' => 'wpinv_taxable', |
199 | 199 | 'name' => 'disable_taxes', |
200 | 200 | 'type' => 'checkbox', |
201 | - 'label' => __( 'Disable taxes', 'invoicing' ), |
|
201 | + 'label' => __('Disable taxes', 'invoicing'), |
|
202 | 202 | 'value' => '1', |
203 | 203 | 'checked' => (bool) $invoice->get_disable_taxes(), |
204 | 204 | ) |
@@ -207,17 +207,17 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | // Apply a discount. |
210 | - if ( $invoice->get_discount_code( 'edit' ) ) { |
|
210 | + if ($invoice->get_discount_code('edit')) { |
|
211 | 211 | |
212 | 212 | echo aui()->input( |
213 | 213 | array( |
214 | 214 | 'type' => 'text', |
215 | 215 | 'id' => 'wpinv_discount_code', |
216 | 216 | 'name' => 'wpinv_discount_code', |
217 | - 'label' => __( 'Discount Code:', 'invoicing' ), |
|
217 | + 'label' => __('Discount Code:', 'invoicing'), |
|
218 | 218 | 'label_type' => 'vertical', |
219 | 219 | 'class' => 'form-control-sm', |
220 | - 'value' => $invoice->get_discount_code( 'edit' ), |
|
220 | + 'value' => $invoice->get_discount_code('edit'), |
|
221 | 221 | 'extra_attributes' => array( |
222 | 222 | 'onclick' => 'this.select();', |
223 | 223 | 'readonly' => 'true', |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | } |
229 | 229 | |
230 | - do_action( 'getpaid_metabox_after_invoice_details', $invoice ); |
|
230 | + do_action('getpaid_metabox_after_invoice_details', $invoice); |
|
231 | 231 | |
232 | 232 | ?> |
233 | 233 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
9 | - exit; // Exit if accessed directly |
|
9 | + exit; // Exit if accessed directly |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | /** |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | class GetPaid_Meta_Box_Resend_Invoice { |
16 | 16 | |
17 | 17 | /** |
18 | - * Output the metabox. |
|
19 | - * |
|
20 | - * @param WP_Post $post |
|
21 | - */ |
|
18 | + * Output the metabox. |
|
19 | + * |
|
20 | + * @param WP_Post $post |
|
21 | + */ |
|
22 | 22 | public static function output( $post ) { |
23 | 23 | |
24 | 24 | // Fetch the invoice. |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | -if ( ! defined( 'ABSPATH' ) ) { |
|
8 | +if (!defined('ABSPATH')) { |
|
9 | 9 | exit; // Exit if accessed directly |
10 | 10 | } |
11 | 11 | |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @param WP_Post $post |
21 | 21 | */ |
22 | - public static function output( $post ) { |
|
22 | + public static function output($post) { |
|
23 | 23 | |
24 | 24 | // Fetch the invoice. |
25 | - $invoice = new WPInv_Invoice( $post ); |
|
25 | + $invoice = new WPInv_Invoice($post); |
|
26 | 26 | |
27 | - do_action( 'wpinv_metabox_resend_invoice_before', $invoice ); |
|
27 | + do_action('wpinv_metabox_resend_invoice_before', $invoice); |
|
28 | 28 | |
29 | 29 | $invoice_actions = array( |
30 | 30 | 'resend-email' => array( |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | 'getpaid-nonce', |
39 | 39 | 'getpaid-nonce' |
40 | 40 | ), |
41 | - 'label' => __( 'Resend Invoice', 'invoicing' ), |
|
41 | + 'label' => __('Resend Invoice', 'invoicing'), |
|
42 | 42 | ) |
43 | 43 | ); |
44 | 44 | |
45 | - if ( $invoice->needs_payment() ) { |
|
45 | + if ($invoice->needs_payment()) { |
|
46 | 46 | |
47 | 47 | $invoice_actions['send-reminder'] = array( |
48 | 48 | 'url' => wp_nonce_url( |
@@ -55,29 +55,29 @@ discard block |
||
55 | 55 | 'getpaid-nonce', |
56 | 56 | 'getpaid-nonce' |
57 | 57 | ), |
58 | - 'label' => __( 'Send Reminder', 'invoicing' ), |
|
58 | + 'label' => __('Send Reminder', 'invoicing'), |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | } |
62 | 62 | |
63 | - $invoice_actions = apply_filters( 'getpaid_edit_invoice_actions', $invoice_actions, $invoice ); |
|
63 | + $invoice_actions = apply_filters('getpaid_edit_invoice_actions', $invoice_actions, $invoice); |
|
64 | 64 | |
65 | - foreach ( $invoice_actions as $key => $action ) { |
|
65 | + foreach ($invoice_actions as $key => $action) { |
|
66 | 66 | |
67 | - if ( 'resend-email' === $key ) { |
|
68 | - echo wpautop( __( "This will send a copy of the invoice to the customer's email address.", 'invoicing' ) ); |
|
67 | + if ('resend-email' === $key) { |
|
68 | + echo wpautop(__("This will send a copy of the invoice to the customer's email address.", 'invoicing')); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | printf( |
72 | 72 | '<p class="wpi-meta-row wpi-%s"><a href="%s" class="button button-secondary">%s</a>', |
73 | - esc_attr( $key ), |
|
74 | - esc_url( $action['url'] ), |
|
75 | - sanitize_text_field( $action['label'] ) |
|
73 | + esc_attr($key), |
|
74 | + esc_url($action['url']), |
|
75 | + sanitize_text_field($action['label']) |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | - do_action( 'wpinv_metabox_resend_invoice_after', $invoice ); |
|
80 | + do_action('wpinv_metabox_resend_invoice_after', $invoice); |
|
81 | 81 | |
82 | 82 | } |
83 | 83 |
@@ -1,39 +1,39 @@ |
||
1 | 1 | <?php |
2 | 2 | // MUST have WordPress. |
3 | -if ( !defined( 'WPINC' ) ) { |
|
4 | - exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) ); |
|
3 | +if (!defined('WPINC')) { |
|
4 | + exit('Do NOT access this file directly: ' . basename(__FILE__)); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | class WPInv_Meta_Box_Notes { |
8 | - public static function output( $post ) { |
|
8 | + public static function output($post) { |
|
9 | 9 | global $post; |
10 | 10 | |
11 | - $notes = wpinv_get_invoice_notes( $post->ID ); |
|
11 | + $notes = wpinv_get_invoice_notes($post->ID); |
|
12 | 12 | |
13 | 13 | echo '<ul class="invoice_notes">'; |
14 | 14 | |
15 | - if ( $notes ) { |
|
16 | - foreach( $notes as $note ) { |
|
17 | - wpinv_get_invoice_note_line_item( $note ); |
|
15 | + if ($notes) { |
|
16 | + foreach ($notes as $note) { |
|
17 | + wpinv_get_invoice_note_line_item($note); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | } else { |
21 | - echo '<li>' . __( 'There are no notes yet.', 'invoicing' ) . '</li>'; |
|
21 | + echo '<li>' . __('There are no notes yet.', 'invoicing') . '</li>'; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | echo '</ul>'; |
25 | 25 | ?> |
26 | 26 | <div class="add_note"> |
27 | - <h4><?php _e( 'Add note', 'invoicing' ); ?></h4> |
|
27 | + <h4><?php _e('Add note', 'invoicing'); ?></h4> |
|
28 | 28 | <p> |
29 | 29 | <textarea type="text" name="invoice_note" id="add_invoice_note" class="input-text" cols="20" rows="5"></textarea> |
30 | 30 | </p> |
31 | 31 | <p> |
32 | 32 | <select name="invoice_note_type" id="invoice_note_type" class="regular-text"> |
33 | - <option value=""><?php _e( 'Private note', 'invoicing' ); ?></option> |
|
34 | - <option value="customer"><?php _e( 'Note to customer', 'invoicing' ); ?></option> |
|
33 | + <option value=""><?php _e('Private note', 'invoicing'); ?></option> |
|
34 | + <option value="customer"><?php _e('Note to customer', 'invoicing'); ?></option> |
|
35 | 35 | </select> |
36 | - <a href="#" class="add_note button"><?php _e( 'Add', 'invoicing' ); ?></a> <span class="description"><?php _e( 'Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing' ); ?></span> |
|
36 | + <a href="#" class="add_note button"><?php _e('Add', 'invoicing'); ?></a> <span class="description"><?php _e('Add a note for your reference, or add a customer note (the user will be notified).', 'invoicing'); ?></span> |
|
37 | 37 | </p> |
38 | 38 | </div> |
39 | 39 | <?php |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; // Exit if accessed directly |
|
11 | + exit; // Exit if accessed directly |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | class GetPaid_Meta_Box_Item_Details { |
18 | 18 | |
19 | 19 | /** |
20 | - * Output the metabox. |
|
21 | - * |
|
22 | - * @param WP_Post $post |
|
23 | - */ |
|
20 | + * Output the metabox. |
|
21 | + * |
|
22 | + * @param WP_Post $post |
|
23 | + */ |
|
24 | 24 | public static function output( $post ) { |
25 | 25 | |
26 | 26 | // Prepare the item. |
@@ -289,35 +289,35 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
292 | - * Save meta box data. |
|
293 | - * |
|
294 | - * @param int $post_id |
|
295 | - */ |
|
296 | - public static function save( $post_id ) { |
|
292 | + * Save meta box data. |
|
293 | + * |
|
294 | + * @param int $post_id |
|
295 | + */ |
|
296 | + public static function save( $post_id ) { |
|
297 | 297 | |
298 | 298 | // Prepare the item. |
299 | 299 | $item = new WPInv_Item( $post_id ); |
300 | 300 | |
301 | 301 | // Load new data. |
302 | 302 | $item->set_props( |
303 | - array( |
|
304 | - 'price' => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null, |
|
305 | - 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
306 | - 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
307 | - 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
308 | - 'is_dynamic_pricing' => isset( $_POST['wpinv_name_your_price'] ), |
|
303 | + array( |
|
304 | + 'price' => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null, |
|
305 | + 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
306 | + 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
307 | + 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
308 | + 'is_dynamic_pricing' => isset( $_POST['wpinv_name_your_price'] ), |
|
309 | 309 | 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? (float) $_POST['wpinv_minimum_price'] : null, |
310 | - 'is_recurring' => isset( $_POST['wpinv_is_recurring'] ), |
|
311 | - 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
312 | - 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
313 | - 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
314 | - 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
315 | - 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
316 | - 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
317 | - ) |
|
310 | + 'is_recurring' => isset( $_POST['wpinv_is_recurring'] ), |
|
311 | + 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
312 | + 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
313 | + 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
314 | + 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
315 | + 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
316 | + 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
317 | + ) |
|
318 | 318 | ); |
319 | 319 | |
320 | - $item->save(); |
|
321 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
322 | - } |
|
320 | + $item->save(); |
|
321 | + do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
322 | + } |
|
323 | 323 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,27 +21,27 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the item. |
27 | - $item = new WPInv_Item( $post ); |
|
27 | + $item = new WPInv_Item($post); |
|
28 | 28 | |
29 | 29 | // Nonce field. |
30 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
30 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
31 | 31 | |
32 | 32 | // Set the currency position. |
33 | 33 | $position = wpinv_currency_position(); |
34 | 34 | |
35 | - if ( $position == 'left_space' ) { |
|
35 | + if ($position == 'left_space') { |
|
36 | 36 | $position = 'left'; |
37 | 37 | } |
38 | 38 | |
39 | - if ( $position == 'right_space' ) { |
|
39 | + if ($position == 'right_space') { |
|
40 | 40 | $position = 'right'; |
41 | 41 | } |
42 | 42 | |
43 | 43 | ?> |
44 | - <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr( $item->get_type( 'edit' ) ); ?>" /> |
|
44 | + <input type="hidden" id="_wpi_current_type" value="<?php echo esc_attr($item->get_type('edit')); ?>" /> |
|
45 | 45 | <style> |
46 | 46 | #poststuff .input-group-text, |
47 | 47 | #poststuff .form-control { |
@@ -55,21 +55,21 @@ discard block |
||
55 | 55 | </style> |
56 | 56 | <div class='bsui' style='max-width: 600px;padding-top: 10px;'> |
57 | 57 | |
58 | - <?php do_action( 'wpinv_item_details_metabox_before_price', $item ); ?> |
|
58 | + <?php do_action('wpinv_item_details_metabox_before_price', $item); ?> |
|
59 | 59 | <div class="form-group row"> |
60 | - <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php _e( 'Item Price', 'invoicing' )?></span></label> |
|
60 | + <label class="col-sm-3 col-form-label" for="wpinv_item_price"><span><?php _e('Item Price', 'invoicing')?></span></label> |
|
61 | 61 | <div class="col-sm-8"> |
62 | 62 | <div class="row"> |
63 | 63 | <div class="col-sm-4 getpaid-price-input"> |
64 | 64 | <div class="input-group input-group-sm"> |
65 | - <?php if( 'left' == $position ) : ?> |
|
65 | + <?php if ('left' == $position) : ?> |
|
66 | 66 | <div class="input-group-prepend"> |
67 | 67 | <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
68 | 68 | </div> |
69 | 69 | <?php endif; ?> |
70 | - <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr( $item->get_price( 'edit' ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
70 | + <input type="text" name="wpinv_item_price" id="wpinv_item_price" value="<?php echo esc_attr($item->get_price('edit')); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
71 | 71 | |
72 | - <?php if( 'left' != $position ) : ?> |
|
72 | + <?php if ('left' != $position) : ?> |
|
73 | 73 | <div class="input-group-append"> |
74 | 74 | <span class="input-group-text" id="wpinv_item_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
75 | 75 | </div> |
@@ -83,25 +83,25 @@ discard block |
||
83 | 83 | array( |
84 | 84 | 'id' => 'wpinv_recurring_interval', |
85 | 85 | 'name' => 'wpinv_recurring_interval', |
86 | - 'label' => __( 'Interval', 'invoicing' ), |
|
87 | - 'placeholder' => __( 'Select Interval', 'invoicing' ), |
|
88 | - 'value' => $item->get_recurring_interval( 'edit' ), |
|
86 | + 'label' => __('Interval', 'invoicing'), |
|
87 | + 'placeholder' => __('Select Interval', 'invoicing'), |
|
88 | + 'value' => $item->get_recurring_interval('edit'), |
|
89 | 89 | 'select2' => true, |
90 | 90 | 'data-allow-clear' => 'false', |
91 | 91 | 'options' => array( |
92 | - '1' => __( 'every', 'invoicing' ), |
|
93 | - '2' => __( 'every 2nd', 'invoicing' ), |
|
94 | - '3' => __( 'every 3rd', 'invoicing' ), |
|
95 | - '4' => __( 'every 4th', 'invoicing' ), |
|
96 | - '5' => __( 'every 5th', 'invoicing' ), |
|
97 | - '6' => __( 'every 6th', 'invoicing' ), |
|
98 | - '8' => __( 'every 8th', 'invoicing' ), |
|
99 | - '9' => __( 'every 9th', 'invoicing' ), |
|
100 | - '10' => __( 'every 10th', 'invoicing' ), |
|
101 | - '11' => __( 'every 11th', 'invoicing' ), |
|
102 | - '12' => __( 'every 12th', 'invoicing' ), |
|
103 | - '13' => __( 'every 13th', 'invoicing' ), |
|
104 | - '14' => __( 'every 14th', 'invoicing' ), |
|
92 | + '1' => __('every', 'invoicing'), |
|
93 | + '2' => __('every 2nd', 'invoicing'), |
|
94 | + '3' => __('every 3rd', 'invoicing'), |
|
95 | + '4' => __('every 4th', 'invoicing'), |
|
96 | + '5' => __('every 5th', 'invoicing'), |
|
97 | + '6' => __('every 6th', 'invoicing'), |
|
98 | + '8' => __('every 8th', 'invoicing'), |
|
99 | + '9' => __('every 9th', 'invoicing'), |
|
100 | + '10' => __('every 10th', 'invoicing'), |
|
101 | + '11' => __('every 11th', 'invoicing'), |
|
102 | + '12' => __('every 12th', 'invoicing'), |
|
103 | + '13' => __('every 13th', 'invoicing'), |
|
104 | + '14' => __('every 14th', 'invoicing'), |
|
105 | 105 | ) |
106 | 106 | ) |
107 | 107 | ); |
@@ -113,16 +113,16 @@ discard block |
||
113 | 113 | array( |
114 | 114 | 'id' => 'wpinv_recurring_period', |
115 | 115 | 'name' => 'wpinv_recurring_period', |
116 | - 'label' => __( 'Period', 'invoicing' ), |
|
117 | - 'placeholder' => __( 'Select Period', 'invoicing' ), |
|
118 | - 'value' => $item->get_recurring_period( 'edit' ), |
|
116 | + 'label' => __('Period', 'invoicing'), |
|
117 | + 'placeholder' => __('Select Period', 'invoicing'), |
|
118 | + 'value' => $item->get_recurring_period('edit'), |
|
119 | 119 | 'select2' => true, |
120 | 120 | 'data-allow-clear' => 'false', |
121 | 121 | 'options' => array( |
122 | - 'D' => __( 'day', 'invoicing' ), |
|
123 | - 'W' => __( 'week', 'invoicing' ), |
|
124 | - 'M' => __( 'month', 'invoicing' ), |
|
125 | - 'Y' => __( 'year', 'invoicing' ), |
|
122 | + 'D' => __('day', 'invoicing'), |
|
123 | + 'W' => __('week', 'invoicing'), |
|
124 | + 'M' => __('month', 'invoicing'), |
|
125 | + 'Y' => __('year', 'invoicing'), |
|
126 | 126 | ) |
127 | 127 | ) |
128 | 128 | ); |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | <?php |
135 | 135 | |
136 | 136 | // Dynamic pricing. |
137 | - if( $item->supports_dynamic_pricing() ) { |
|
137 | + if ($item->supports_dynamic_pricing()) { |
|
138 | 138 | |
139 | - do_action( 'wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item ); |
|
139 | + do_action('wpinv_item_details_metabox_before_dynamic_pricing_checkbox', $item); |
|
140 | 140 | |
141 | 141 | // NYP toggle. |
142 | 142 | echo aui()->input( |
@@ -144,31 +144,31 @@ discard block |
||
144 | 144 | 'id' => 'wpinv_name_your_price', |
145 | 145 | 'name' => 'wpinv_name_your_price', |
146 | 146 | 'type' => 'checkbox', |
147 | - 'label' => apply_filters( 'wpinv_name_your_price_toggle_text', __( 'Let customers name their price', 'invoicing' ) ), |
|
147 | + 'label' => apply_filters('wpinv_name_your_price_toggle_text', __('Let customers name their price', 'invoicing')), |
|
148 | 148 | 'value' => '1', |
149 | 149 | 'checked' => $item->user_can_set_their_price(), |
150 | 150 | 'no_wrap' => true, |
151 | 151 | ) |
152 | 152 | ); |
153 | 153 | |
154 | - do_action( 'wpinv_item_details_metabox_dynamic_pricing_checkbox', $item ); |
|
154 | + do_action('wpinv_item_details_metabox_dynamic_pricing_checkbox', $item); |
|
155 | 155 | |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Subscriptions. |
159 | - do_action( 'wpinv_item_details_metabox_before_subscription_checkbox', $item ); |
|
159 | + do_action('wpinv_item_details_metabox_before_subscription_checkbox', $item); |
|
160 | 160 | echo aui()->input( |
161 | 161 | array( |
162 | 162 | 'id' => 'wpinv_is_recurring', |
163 | 163 | 'name' => 'wpinv_is_recurring', |
164 | 164 | 'type' => 'checkbox', |
165 | - 'label' => apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Charge customers a recurring amount for this item', 'invoicing' ) ), |
|
165 | + 'label' => apply_filters('wpinv_is_recurring_toggle_text', __('Charge customers a recurring amount for this item', 'invoicing')), |
|
166 | 166 | 'value' => '1', |
167 | 167 | 'checked' => $item->is_recurring(), |
168 | 168 | 'no_wrap' => true, |
169 | 169 | ) |
170 | 170 | ); |
171 | - do_action( 'wpinv_item_details_metabox_subscription_checkbox', $item ); |
|
171 | + do_action('wpinv_item_details_metabox_subscription_checkbox', $item); |
|
172 | 172 | |
173 | 173 | ?> |
174 | 174 | <div class="wpinv_show_if_recurring"> |
@@ -178,30 +178,30 @@ discard block |
||
178 | 178 | </div> |
179 | 179 | </div> |
180 | 180 | <div class="col-sm-1 pt-2 pl-0"> |
181 | - <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e( 'Set the subscription price, billing interval and period.', 'invoicing' ); ?>"></span> |
|
181 | + <span class="wpi-help-tip dashicons dashicons-editor-help wpinv_show_if_recurring" title="<?php esc_attr_e('Set the subscription price, billing interval and period.', 'invoicing'); ?>"></span> |
|
182 | 182 | </div> |
183 | 183 | </div> |
184 | - <?php do_action( 'wpinv_item_details_metabox_after_price', $item ); ?> |
|
184 | + <?php do_action('wpinv_item_details_metabox_after_price', $item); ?> |
|
185 | 185 | |
186 | - <?php if( $item->supports_dynamic_pricing() ) : ?> |
|
187 | - <?php do_action( 'wpinv_item_details_metabox_before_minimum_price', $item ); ?> |
|
186 | + <?php if ($item->supports_dynamic_pricing()) : ?> |
|
187 | + <?php do_action('wpinv_item_details_metabox_before_minimum_price', $item); ?> |
|
188 | 188 | <div class="wpinv_show_if_dynamic wpinv_minimum_price"> |
189 | 189 | |
190 | 190 | <div class="form-group row"> |
191 | 191 | <label for="wpinv_minimum_price" class="col-sm-3 col-form-label"> |
192 | - <?php _e( 'Minimum Price', 'invoicing' );?> |
|
192 | + <?php _e('Minimum Price', 'invoicing'); ?> |
|
193 | 193 | </label> |
194 | 194 | <div class="col-sm-8"> |
195 | 195 | <div class="input-group input-group-sm"> |
196 | - <?php if( 'left' == $position ) : ?> |
|
196 | + <?php if ('left' == $position) : ?> |
|
197 | 197 | <div class="input-group-prepend"> |
198 | 198 | <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
199 | 199 | </div> |
200 | 200 | <?php endif; ?> |
201 | 201 | |
202 | - <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr( $item->get_minimum_price( 'edit' ) ); ?>" placeholder="<?php echo esc_attr( wpinv_sanitize_amount( 0 ) ); ?>" class="form-control"> |
|
202 | + <input type="text" name="wpinv_minimum_price" id="wpinv_minimum_price" value="<?php echo esc_attr($item->get_minimum_price('edit')); ?>" placeholder="<?php echo esc_attr(wpinv_sanitize_amount(0)); ?>" class="form-control"> |
|
203 | 203 | |
204 | - <?php if( 'left' != $position ) : ?> |
|
204 | + <?php if ('left' != $position) : ?> |
|
205 | 205 | <div class="input-group-append"> |
206 | 206 | <span class="input-group-text" id="wpinv_item_minimum_price_symbol"><?php echo wpinv_currency_symbol(); ?></span> |
207 | 207 | </div> |
@@ -210,45 +210,45 @@ discard block |
||
210 | 210 | </div> |
211 | 211 | |
212 | 212 | <div class="col-sm-1 pt-2 pl-0"> |
213 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the minimum amount that users are allowed to set', 'invoicing' ); ?>"></span> |
|
213 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the minimum amount that users are allowed to set', 'invoicing'); ?>"></span> |
|
214 | 214 | </div> |
215 | 215 | </div> |
216 | 216 | |
217 | 217 | </div> |
218 | - <?php do_action( 'wpinv_item_details_metabox_minimum_price', $item ); ?> |
|
218 | + <?php do_action('wpinv_item_details_metabox_minimum_price', $item); ?> |
|
219 | 219 | <?php endif; ?> |
220 | 220 | |
221 | - <?php do_action( 'wpinv_item_details_metabox_before_maximum_renewals', $item ); ?> |
|
221 | + <?php do_action('wpinv_item_details_metabox_before_maximum_renewals', $item); ?> |
|
222 | 222 | <div class="wpinv_show_if_recurring wpinv_maximum_renewals"> |
223 | 223 | |
224 | 224 | <div class="form-group row"> |
225 | 225 | <label for="wpinv_recurring_limit" class="col-sm-3 col-form-label"> |
226 | - <?php _e( 'Maximum Renewals', 'invoicing' );?> |
|
226 | + <?php _e('Maximum Renewals', 'invoicing'); ?> |
|
227 | 227 | </label> |
228 | 228 | <div class="col-sm-8"> |
229 | - <input type="number" value="<?php echo esc_attr( $item->get_recurring_limit( 'edit' ) ); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" /> |
|
229 | + <input type="number" value="<?php echo esc_attr($item->get_recurring_limit('edit')); ?>" placeholder="0" name="wpinv_recurring_limit" id="wpinv_recurring_limit" style="width: 100%;" /> |
|
230 | 230 | </div> |
231 | 231 | <div class="col-sm-1 pt-2 pl-0"> |
232 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing' ); ?>"></span> |
|
232 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Leave empty if you want the subscription to renew until it is cancelled.', 'invoicing'); ?>"></span> |
|
233 | 233 | </div> |
234 | 234 | </div> |
235 | 235 | |
236 | 236 | </div> |
237 | - <?php do_action( 'wpinv_item_details_metabox_maximum_renewals', $item ); ?> |
|
237 | + <?php do_action('wpinv_item_details_metabox_maximum_renewals', $item); ?> |
|
238 | 238 | |
239 | - <?php do_action( 'wpinv_item_details_metabox_before_free_trial', $item ); ?> |
|
239 | + <?php do_action('wpinv_item_details_metabox_before_free_trial', $item); ?> |
|
240 | 240 | <div class="wpinv_show_if_recurring wpinv_free_trial"> |
241 | 241 | |
242 | 242 | <div class="form-group row"> |
243 | - <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php _e( 'Free Trial', 'invoicing' )?></label> |
|
243 | + <label class="col-sm-3 col-form-label" for="wpinv_trial_interval"><?php _e('Free Trial', 'invoicing')?></label> |
|
244 | 244 | |
245 | 245 | <div class="col-sm-8"> |
246 | 246 | <div class="row"> |
247 | 247 | <div class="col-sm-6"> |
248 | - <?php $value = $item->has_free_trial() ? $item->get_trial_interval( 'edit' ) : 0;?> |
|
248 | + <?php $value = $item->has_free_trial() ? $item->get_trial_interval('edit') : 0; ?> |
|
249 | 249 | |
250 | 250 | <div> |
251 | - <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr( $value ); ?>" > |
|
251 | + <input type="number" name="wpinv_trial_interval" style="width: 100%;" placeholder="0" id="wpinv_trial_interval" value="<?php echo esc_attr($value); ?>" > |
|
252 | 252 | </div> |
253 | 253 | </div> |
254 | 254 | <div class="col-sm-6"> |
@@ -257,17 +257,17 @@ discard block |
||
257 | 257 | array( |
258 | 258 | 'id' => 'wpinv_trial_period', |
259 | 259 | 'name' => 'wpinv_trial_period', |
260 | - 'label' => __( 'Trial Period', 'invoicing' ), |
|
261 | - 'placeholder' => __( 'Trial Period', 'invoicing' ), |
|
262 | - 'value' => $item->get_trial_period( 'edit' ), |
|
260 | + 'label' => __('Trial Period', 'invoicing'), |
|
261 | + 'placeholder' => __('Trial Period', 'invoicing'), |
|
262 | + 'value' => $item->get_trial_period('edit'), |
|
263 | 263 | 'select2' => true, |
264 | 264 | 'data-allow-clear' => 'false', |
265 | 265 | 'no_wrap' => true, |
266 | 266 | 'options' => array( |
267 | - 'D' => __( 'day(s)', 'invoicing' ), |
|
268 | - 'W' => __( 'week(s)', 'invoicing' ), |
|
269 | - 'M' => __( 'month(s)', 'invoicing' ), |
|
270 | - 'Y' => __( 'year(s)', 'invoicing' ), |
|
267 | + 'D' => __('day(s)', 'invoicing'), |
|
268 | + 'W' => __('week(s)', 'invoicing'), |
|
269 | + 'M' => __('month(s)', 'invoicing'), |
|
270 | + 'Y' => __('year(s)', 'invoicing'), |
|
271 | 271 | ) |
272 | 272 | ) |
273 | 273 | ); |
@@ -278,15 +278,15 @@ discard block |
||
278 | 278 | </div> |
279 | 279 | |
280 | 280 | <div class="col-sm-1 pt-2 pl-0"> |
281 | - <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'An optional period of time to wait before charging the first recurring payment.', 'invoicing' ); ?>"></span> |
|
281 | + <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('An optional period of time to wait before charging the first recurring payment.', 'invoicing'); ?>"></span> |
|
282 | 282 | </div> |
283 | 283 | |
284 | 284 | </div> |
285 | 285 | |
286 | 286 | </div> |
287 | - <?php do_action( 'wpinv_item_details_metabox__free_trial', $item ); ?> |
|
287 | + <?php do_action('wpinv_item_details_metabox__free_trial', $item); ?> |
|
288 | 288 | |
289 | - <?php do_action( 'wpinv_item_details_metabox_item_details', $item ); ?> |
|
289 | + <?php do_action('wpinv_item_details_metabox_item_details', $item); ?> |
|
290 | 290 | </div> |
291 | 291 | <?php |
292 | 292 | |
@@ -297,31 +297,31 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @param int $post_id |
299 | 299 | */ |
300 | - public static function save( $post_id ) { |
|
300 | + public static function save($post_id) { |
|
301 | 301 | |
302 | 302 | // Prepare the item. |
303 | - $item = new WPInv_Item( $post_id ); |
|
303 | + $item = new WPInv_Item($post_id); |
|
304 | 304 | |
305 | 305 | // Load new data. |
306 | 306 | $item->set_props( |
307 | 307 | array( |
308 | - 'price' => isset( $_POST['wpinv_item_price'] ) ? (float) $_POST['wpinv_item_price'] : null, |
|
309 | - 'vat_rule' => isset( $_POST['wpinv_vat_rules'] ) ? wpinv_clean( $_POST['wpinv_vat_rules'] ) : null, |
|
310 | - 'vat_class' => isset( $_POST['wpinv_vat_class'] ) ? wpinv_clean( $_POST['wpinv_vat_class'] ) : null, |
|
311 | - 'type' => isset( $_POST['wpinv_item_type'] ) ? wpinv_clean( $_POST['wpinv_item_type'] ) : null, |
|
312 | - 'is_dynamic_pricing' => isset( $_POST['wpinv_name_your_price'] ), |
|
313 | - 'minimum_price' => isset( $_POST['wpinv_minimum_price'] ) ? (float) $_POST['wpinv_minimum_price'] : null, |
|
314 | - 'is_recurring' => isset( $_POST['wpinv_is_recurring'] ), |
|
315 | - 'recurring_period' => isset( $_POST['wpinv_recurring_period'] ) ? wpinv_clean( $_POST['wpinv_recurring_period'] ) : null, |
|
316 | - 'recurring_interval' => isset( $_POST['wpinv_recurring_interval'] ) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
317 | - 'recurring_limit' => isset( $_POST['wpinv_recurring_limit'] ) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
318 | - 'is_free_trial' => isset( $_POST['wpinv_trial_interval'] ) ? ( 0 != (int) $_POST['wpinv_trial_interval'] ) : null, |
|
319 | - 'trial_period' => isset( $_POST['wpinv_trial_period'] ) ? wpinv_clean( $_POST['wpinv_trial_period'] ) : null, |
|
320 | - 'trial_interval' => isset( $_POST['wpinv_trial_interval'] ) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
308 | + 'price' => isset($_POST['wpinv_item_price']) ? (float) $_POST['wpinv_item_price'] : null, |
|
309 | + 'vat_rule' => isset($_POST['wpinv_vat_rules']) ? wpinv_clean($_POST['wpinv_vat_rules']) : null, |
|
310 | + 'vat_class' => isset($_POST['wpinv_vat_class']) ? wpinv_clean($_POST['wpinv_vat_class']) : null, |
|
311 | + 'type' => isset($_POST['wpinv_item_type']) ? wpinv_clean($_POST['wpinv_item_type']) : null, |
|
312 | + 'is_dynamic_pricing' => isset($_POST['wpinv_name_your_price']), |
|
313 | + 'minimum_price' => isset($_POST['wpinv_minimum_price']) ? (float) $_POST['wpinv_minimum_price'] : null, |
|
314 | + 'is_recurring' => isset($_POST['wpinv_is_recurring']), |
|
315 | + 'recurring_period' => isset($_POST['wpinv_recurring_period']) ? wpinv_clean($_POST['wpinv_recurring_period']) : null, |
|
316 | + 'recurring_interval' => isset($_POST['wpinv_recurring_interval']) ? (int) $_POST['wpinv_recurring_interval'] : null, |
|
317 | + 'recurring_limit' => isset($_POST['wpinv_recurring_limit']) ? (int) $_POST['wpinv_recurring_limit'] : null, |
|
318 | + 'is_free_trial' => isset($_POST['wpinv_trial_interval']) ? (0 != (int) $_POST['wpinv_trial_interval']) : null, |
|
319 | + 'trial_period' => isset($_POST['wpinv_trial_period']) ? wpinv_clean($_POST['wpinv_trial_period']) : null, |
|
320 | + 'trial_interval' => isset($_POST['wpinv_trial_interval']) ? (int) $_POST['wpinv_trial_interval'] : null, |
|
321 | 321 | ) |
322 | 322 | ); |
323 | 323 | |
324 | 324 | $item->save(); |
325 | - do_action( 'getpaid_item_metabox_save', $post_id, $item ); |
|
325 | + do_action('getpaid_item_metabox_save', $post_id, $item); |
|
326 | 326 | } |
327 | 327 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
11 | - exit; // Exit if accessed directly |
|
11 | + exit; // Exit if accessed directly |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | class GetPaid_Meta_Box_Invoice_Address { |
18 | 18 | |
19 | 19 | /** |
20 | - * Output the metabox. |
|
21 | - * |
|
22 | - * @param WP_Post $post |
|
23 | - */ |
|
20 | + * Output the metabox. |
|
21 | + * |
|
22 | + * @param WP_Post $post |
|
23 | + */ |
|
24 | 24 | public static function output( $post ) { |
25 | 25 | |
26 | 26 | // Prepare the invoice. |
@@ -300,18 +300,18 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
303 | - * Save meta box data. |
|
304 | - * |
|
305 | - * @param int $post_id |
|
306 | - */ |
|
307 | - public static function save( $post_id ) { |
|
303 | + * Save meta box data. |
|
304 | + * |
|
305 | + * @param int $post_id |
|
306 | + */ |
|
307 | + public static function save( $post_id ) { |
|
308 | 308 | |
309 | 309 | // Prepare the invoice. |
310 | 310 | $invoice = new WPInv_Invoice( $post_id ); |
311 | 311 | |
312 | 312 | // Load new data. |
313 | 313 | $invoice->set_props( |
314 | - array( |
|
314 | + array( |
|
315 | 315 | 'template' => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null, |
316 | 316 | 'email_cc' => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null, |
317 | 317 | 'disable_taxes' => isset( $_POST['disable_taxes'] ), |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | 'due_date' => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null, |
333 | 333 | 'number' => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null, |
334 | 334 | 'status' => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null, |
335 | - ) |
|
335 | + ) |
|
336 | 336 | ); |
337 | 337 | |
338 | 338 | // Recalculate totals. |
@@ -362,6 +362,6 @@ discard block |
||
362 | 362 | } |
363 | 363 | |
364 | 364 | // Fires after an invoice is saved. |
365 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
366 | - } |
|
365 | + do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
366 | + } |
|
367 | 367 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | 28 | |
29 | - wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' ); |
|
29 | + wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce'); |
|
30 | 30 | |
31 | 31 | ?> |
32 | 32 | |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | <div class="col-12 col-sm-6"> |
42 | 42 | <div id="getpaid-invoice-user-id-wrapper" class="form-group"> |
43 | 43 | <div> |
44 | - <label for="post_author_override"><?php _e( 'Customer', 'invoicing' );?></label> |
|
44 | + <label for="post_author_override"><?php _e('Customer', 'invoicing'); ?></label> |
|
45 | 45 | </div> |
46 | 46 | <?php |
47 | 47 | wpinv_dropdown_users( |
48 | 48 | array( |
49 | 49 | 'name' => 'post_author_override', |
50 | - 'selected' => $invoice->get_id() ? $invoice->get_user_id( 'edit' ) : get_current_user_id(), |
|
50 | + 'selected' => $invoice->get_id() ? $invoice->get_user_id('edit') : get_current_user_id(), |
|
51 | 51 | 'include_selected' => true, |
52 | 52 | 'show' => 'display_name_with_login', |
53 | 53 | 'orderby' => 'user_email', |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | 'type' => 'text', |
66 | 66 | 'id' => 'getpaid-invoice-new-user-email', |
67 | 67 | 'name' => 'wpinv_email', |
68 | - 'label' => __( 'Email', 'invoicing' ) . '<span class="required">*</span>', |
|
68 | + 'label' => __('Email', 'invoicing') . '<span class="required">*</span>', |
|
69 | 69 | 'label_type' => 'vertical', |
70 | 70 | 'placeholder' => '[email protected]', |
71 | 71 | 'class' => 'form-control-sm', |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | </div> |
76 | 76 | </div> |
77 | 77 | <div class="col-12 col-sm-6 form-group mt-sm-4"> |
78 | - <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?> |
|
78 | + <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?> |
|
79 | 79 | <a id="getpaid-invoice-fill-user-details" class="button button-small button-secondary" href="javascript:void(0)"> |
80 | 80 | <i aria-hidden="true" class="fa fa-refresh"></i> |
81 | - <?php _e( 'Fill User Details', 'invoicing' );?> |
|
81 | + <?php _e('Fill User Details', 'invoicing'); ?> |
|
82 | 82 | </a> |
83 | 83 | <a id="getpaid-invoice-create-new-user-button" class="button button-small button-secondary" href="javascript:void(0)"> |
84 | 84 | <i aria-hidden="true" class="fa fa-plus"></i> |
85 | - <?php _e( 'Add New User', 'invoicing' );?> |
|
85 | + <?php _e('Add New User', 'invoicing'); ?> |
|
86 | 86 | </a> |
87 | 87 | <a id="getpaid-invoice-cancel-create-new-user" class="button button-small button-secondary d-none" href="javascript:void(0)"> |
88 | 88 | <i aria-hidden="true" class="fa fa-close"></i> |
89 | - <?php _e( 'Cancel', 'invoicing' );?> |
|
89 | + <?php _e('Cancel', 'invoicing'); ?> |
|
90 | 90 | </a> |
91 | 91 | <?php endif; ?> |
92 | 92 | </div> |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | 'type' => 'text', |
100 | 100 | 'id' => 'wpinv_first_name', |
101 | 101 | 'name' => 'wpinv_first_name', |
102 | - 'label' => __( 'First Name', 'invoicing' ), |
|
102 | + 'label' => __('First Name', 'invoicing'), |
|
103 | 103 | 'label_type' => 'vertical', |
104 | 104 | 'placeholder' => '', |
105 | 105 | 'class' => 'form-control-sm', |
106 | - 'value' => $invoice->get_first_name( 'edit' ), |
|
106 | + 'value' => $invoice->get_first_name('edit'), |
|
107 | 107 | ) |
108 | 108 | ); |
109 | 109 | ?> |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | 'type' => 'text', |
116 | 116 | 'id' => 'wpinv_last_name', |
117 | 117 | 'name' => 'wpinv_last_name', |
118 | - 'label' => __( 'Last Name', 'invoicing' ), |
|
118 | + 'label' => __('Last Name', 'invoicing'), |
|
119 | 119 | 'label_type' => 'vertical', |
120 | 120 | 'placeholder' => '', |
121 | 121 | 'class' => 'form-control-sm', |
122 | - 'value' => $invoice->get_last_name( 'edit' ), |
|
122 | + 'value' => $invoice->get_last_name('edit'), |
|
123 | 123 | ) |
124 | 124 | ); |
125 | 125 | ?> |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | 'type' => 'text', |
135 | 135 | 'id' => 'wpinv_company', |
136 | 136 | 'name' => 'wpinv_company', |
137 | - 'label' => __( 'Company', 'invoicing' ), |
|
137 | + 'label' => __('Company', 'invoicing'), |
|
138 | 138 | 'label_type' => 'vertical', |
139 | 139 | 'placeholder' => '', |
140 | 140 | 'class' => 'form-control-sm', |
141 | - 'value' => $invoice->get_company( 'edit' ), |
|
141 | + 'value' => $invoice->get_company('edit'), |
|
142 | 142 | ) |
143 | 143 | ); |
144 | 144 | ?> |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | 'type' => 'text', |
151 | 151 | 'id' => 'wpinv_vat_number', |
152 | 152 | 'name' => 'wpinv_vat_number', |
153 | - 'label' => __( 'Vat Number', 'invoicing' ), |
|
153 | + 'label' => __('Vat Number', 'invoicing'), |
|
154 | 154 | 'label_type' => 'vertical', |
155 | 155 | 'placeholder' => '', |
156 | 156 | 'class' => 'form-control-sm', |
157 | - 'value' => $invoice->get_vat_number( 'edit' ), |
|
157 | + 'value' => $invoice->get_vat_number('edit'), |
|
158 | 158 | ) |
159 | 159 | ); |
160 | 160 | ?> |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | 'type' => 'text', |
170 | 170 | 'id' => 'wpinv_address', |
171 | 171 | 'name' => 'wpinv_address', |
172 | - 'label' => __( 'Address', 'invoicing' ), |
|
172 | + 'label' => __('Address', 'invoicing'), |
|
173 | 173 | 'label_type' => 'vertical', |
174 | 174 | 'placeholder' => '', |
175 | 175 | 'class' => 'form-control-sm', |
176 | - 'value' => $invoice->get_address( 'edit' ), |
|
176 | + 'value' => $invoice->get_address('edit'), |
|
177 | 177 | ) |
178 | 178 | ); |
179 | 179 | ?> |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | 'type' => 'text', |
186 | 186 | 'id' => 'wpinv_city', |
187 | 187 | 'name' => 'wpinv_city', |
188 | - 'label' => __( 'City', 'invoicing' ), |
|
188 | + 'label' => __('City', 'invoicing'), |
|
189 | 189 | 'label_type' => 'vertical', |
190 | 190 | 'placeholder' => '', |
191 | 191 | 'class' => 'form-control-sm', |
192 | - 'value' => $invoice->get_city( 'edit' ), |
|
192 | + 'value' => $invoice->get_city('edit'), |
|
193 | 193 | ) |
194 | 194 | ); |
195 | 195 | ?> |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | array( |
204 | 204 | 'id' => 'wpinv_country', |
205 | 205 | 'name' => 'wpinv_country', |
206 | - 'label' => __( 'Country', 'invoicing' ), |
|
206 | + 'label' => __('Country', 'invoicing'), |
|
207 | 207 | 'label_type' => 'vertical', |
208 | - 'placeholder' => __( 'Choose a country', 'invoicing' ), |
|
208 | + 'placeholder' => __('Choose a country', 'invoicing'), |
|
209 | 209 | 'class' => 'form-control-sm', |
210 | - 'value' => $invoice->get_country( 'edit' ), |
|
210 | + 'value' => $invoice->get_country('edit'), |
|
211 | 211 | 'options' => wpinv_get_country_list(), |
212 | 212 | 'data-allow-clear' => 'false', |
213 | 213 | 'select2' => true, |
@@ -218,20 +218,20 @@ discard block |
||
218 | 218 | <div class="col-12 col-sm-6"> |
219 | 219 | <?php |
220 | 220 | |
221 | - $states = wpinv_get_country_states( $invoice->get_country( 'edit' ) ); |
|
221 | + $states = wpinv_get_country_states($invoice->get_country('edit')); |
|
222 | 222 | |
223 | - if ( empty( $states ) ) { |
|
223 | + if (empty($states)) { |
|
224 | 224 | |
225 | 225 | echo aui()->input( |
226 | 226 | array( |
227 | 227 | 'type' => 'text', |
228 | 228 | 'id' => 'wpinv_state', |
229 | 229 | 'name' => 'wpinv_state', |
230 | - 'label' => __( 'State', 'invoicing' ), |
|
230 | + 'label' => __('State', 'invoicing'), |
|
231 | 231 | 'label_type' => 'vertical', |
232 | 232 | 'placeholder' => '', |
233 | 233 | 'class' => 'form-control-sm', |
234 | - 'value' => $invoice->get_state( 'edit' ), |
|
234 | + 'value' => $invoice->get_state('edit'), |
|
235 | 235 | ) |
236 | 236 | ); |
237 | 237 | |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | array( |
242 | 242 | 'id' => 'wpinv_state', |
243 | 243 | 'name' => 'wpinv_state', |
244 | - 'label' => __( 'State', 'invoicing' ), |
|
244 | + 'label' => __('State', 'invoicing'), |
|
245 | 245 | 'label_type' => 'vertical', |
246 | - 'placeholder' => __( 'Select a state', 'invoicing' ), |
|
246 | + 'placeholder' => __('Select a state', 'invoicing'), |
|
247 | 247 | 'class' => 'form-control-sm', |
248 | - 'value' => $invoice->get_state( 'edit' ), |
|
248 | + 'value' => $invoice->get_state('edit'), |
|
249 | 249 | 'options' => $states, |
250 | 250 | 'data-allow-clear' => 'false', |
251 | 251 | 'select2' => true, |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | 'type' => 'text', |
267 | 267 | 'id' => 'wpinv_zip', |
268 | 268 | 'name' => 'wpinv_zip', |
269 | - 'label' => __( 'Zip / Postal Code', 'invoicing' ), |
|
269 | + 'label' => __('Zip / Postal Code', 'invoicing'), |
|
270 | 270 | 'label_type' => 'vertical', |
271 | 271 | 'placeholder' => '', |
272 | 272 | 'class' => 'form-control-sm', |
273 | - 'value' => $invoice->get_zip( 'edit' ), |
|
273 | + 'value' => $invoice->get_zip('edit'), |
|
274 | 274 | ) |
275 | 275 | ); |
276 | 276 | ?> |
@@ -282,11 +282,11 @@ discard block |
||
282 | 282 | 'type' => 'text', |
283 | 283 | 'id' => 'wpinv_phone', |
284 | 284 | 'name' => 'wpinv_phone', |
285 | - 'label' => __( 'Phone', 'invoicing' ), |
|
285 | + 'label' => __('Phone', 'invoicing'), |
|
286 | 286 | 'label_type' => 'vertical', |
287 | 287 | 'placeholder' => '', |
288 | 288 | 'class' => 'form-control-sm', |
289 | - 'value' => $invoice->get_phone( 'edit' ), |
|
289 | + 'value' => $invoice->get_phone('edit'), |
|
290 | 290 | ) |
291 | 291 | ); |
292 | 292 | ?> |
@@ -302,34 +302,34 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @param int $post_id |
304 | 304 | */ |
305 | - public static function save( $post_id ) { |
|
305 | + public static function save($post_id) { |
|
306 | 306 | |
307 | 307 | // Prepare the invoice. |
308 | - $invoice = new WPInv_Invoice( $post_id ); |
|
308 | + $invoice = new WPInv_Invoice($post_id); |
|
309 | 309 | |
310 | 310 | // Load new data. |
311 | 311 | $invoice->set_props( |
312 | 312 | array( |
313 | - 'template' => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null, |
|
314 | - 'email_cc' => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null, |
|
315 | - 'disable_taxes' => isset( $_POST['disable_taxes'] ), |
|
316 | - 'currency' => isset( $_POST['wpinv_currency'] ) ? wpinv_clean( $_POST['wpinv_currency'] ) : null, |
|
317 | - 'gateway' => isset( $_POST['wpinv_gateway'] ) ? wpinv_clean( $_POST['wpinv_gateway'] ) : null, |
|
318 | - 'address' => isset( $_POST['wpinv_address'] ) ? wpinv_clean( $_POST['wpinv_address'] ) : null, |
|
319 | - 'vat_number' => isset( $_POST['wpinv_vat_number'] ) ? wpinv_clean( $_POST['wpinv_vat_number'] ) : null, |
|
320 | - 'company' => isset( $_POST['wpinv_company'] ) ? wpinv_clean( $_POST['wpinv_company'] ) : null, |
|
321 | - 'zip' => isset( $_POST['wpinv_zip'] ) ? wpinv_clean( $_POST['wpinv_zip'] ) : null, |
|
322 | - 'state' => isset( $_POST['wpinv_state'] ) ? wpinv_clean( $_POST['wpinv_state'] ) : null, |
|
323 | - 'city' => isset( $_POST['wpinv_city'] ) ? wpinv_clean( $_POST['wpinv_city'] ) : null, |
|
324 | - 'country' => isset( $_POST['wpinv_country'] ) ? wpinv_clean( $_POST['wpinv_country'] ) : null, |
|
325 | - 'phone' => isset( $_POST['wpinv_phone'] ) ? wpinv_clean( $_POST['wpinv_phone'] ) : null, |
|
326 | - 'first_name' => isset( $_POST['wpinv_first_name'] ) ? wpinv_clean( $_POST['wpinv_first_name'] ) : null, |
|
327 | - 'last_name' => isset( $_POST['wpinv_last_name'] ) ? wpinv_clean( $_POST['wpinv_last_name'] ) : null, |
|
328 | - 'author' => isset( $_POST['post_author_override'] ) ? wpinv_clean( $_POST['post_author_override'] ) : null, |
|
329 | - 'date_created' => isset( $_POST['date_created'] ) ? wpinv_clean( $_POST['date_created'] ) : null, |
|
330 | - 'due_date' => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null, |
|
331 | - 'number' => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null, |
|
332 | - 'status' => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null, |
|
313 | + 'template' => isset($_POST['wpinv_template']) ? wpinv_clean($_POST['wpinv_template']) : null, |
|
314 | + 'email_cc' => isset($_POST['wpinv_cc']) ? wpinv_clean($_POST['wpinv_cc']) : null, |
|
315 | + 'disable_taxes' => isset($_POST['disable_taxes']), |
|
316 | + 'currency' => isset($_POST['wpinv_currency']) ? wpinv_clean($_POST['wpinv_currency']) : null, |
|
317 | + 'gateway' => isset($_POST['wpinv_gateway']) ? wpinv_clean($_POST['wpinv_gateway']) : null, |
|
318 | + 'address' => isset($_POST['wpinv_address']) ? wpinv_clean($_POST['wpinv_address']) : null, |
|
319 | + 'vat_number' => isset($_POST['wpinv_vat_number']) ? wpinv_clean($_POST['wpinv_vat_number']) : null, |
|
320 | + 'company' => isset($_POST['wpinv_company']) ? wpinv_clean($_POST['wpinv_company']) : null, |
|
321 | + 'zip' => isset($_POST['wpinv_zip']) ? wpinv_clean($_POST['wpinv_zip']) : null, |
|
322 | + 'state' => isset($_POST['wpinv_state']) ? wpinv_clean($_POST['wpinv_state']) : null, |
|
323 | + 'city' => isset($_POST['wpinv_city']) ? wpinv_clean($_POST['wpinv_city']) : null, |
|
324 | + 'country' => isset($_POST['wpinv_country']) ? wpinv_clean($_POST['wpinv_country']) : null, |
|
325 | + 'phone' => isset($_POST['wpinv_phone']) ? wpinv_clean($_POST['wpinv_phone']) : null, |
|
326 | + 'first_name' => isset($_POST['wpinv_first_name']) ? wpinv_clean($_POST['wpinv_first_name']) : null, |
|
327 | + 'last_name' => isset($_POST['wpinv_last_name']) ? wpinv_clean($_POST['wpinv_last_name']) : null, |
|
328 | + 'author' => isset($_POST['post_author_override']) ? wpinv_clean($_POST['post_author_override']) : null, |
|
329 | + 'date_created' => isset($_POST['date_created']) ? wpinv_clean($_POST['date_created']) : null, |
|
330 | + 'due_date' => isset($_POST['wpinv_due_date']) ? wpinv_clean($_POST['wpinv_due_date']) : null, |
|
331 | + 'number' => isset($_POST['wpinv_number']) ? wpinv_clean($_POST['wpinv_number']) : null, |
|
332 | + 'status' => isset($_POST['wpinv_status']) ? wpinv_clean($_POST['wpinv_status']) : null, |
|
333 | 333 | ) |
334 | 334 | ); |
335 | 335 | |
@@ -337,17 +337,17 @@ discard block |
||
337 | 337 | $invoice->recalculate_total(); |
338 | 338 | |
339 | 339 | // If we're creating a new user... |
340 | - if ( ! empty( $_POST['wpinv_new_user'] ) && is_email( $_POST['wpinv_email'] ) ) { |
|
340 | + if (!empty($_POST['wpinv_new_user']) && is_email($_POST['wpinv_email'])) { |
|
341 | 341 | |
342 | 342 | // Attempt to create the user. |
343 | - $user = wpinv_create_user( sanitize_email( $_POST['wpinv_email'] ) ); |
|
343 | + $user = wpinv_create_user(sanitize_email($_POST['wpinv_email'])); |
|
344 | 344 | |
345 | 345 | |
346 | 346 | // If successful, update the invoice author. |
347 | - if ( is_numeric( $user ) ) { |
|
348 | - $invoice->set_author( $user ); |
|
347 | + if (is_numeric($user)) { |
|
348 | + $invoice->set_author($user); |
|
349 | 349 | } else { |
350 | - wpinv_error_log( $user->get_error_message(), __( 'Invoice add new user', 'invoicing' ), __FILE__, __LINE__ ); |
|
350 | + wpinv_error_log($user->get_error_message(), __('Invoice add new user', 'invoicing'), __FILE__, __LINE__); |
|
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | $invoice->save(); |
356 | 356 | |
357 | 357 | // (Maybe) send new user notification. |
358 | - if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', true ) ) { |
|
359 | - wp_send_new_user_notifications( $user, 'user' ); |
|
358 | + if (!empty($user) && is_numeric($user) && apply_filters('getpaid_send_new_user_notification', true)) { |
|
359 | + wp_send_new_user_notifications($user, 'user'); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | // Fires after an invoice is saved. |
363 | - do_action( 'wpinv_invoice_metabox_saved', $invoice ); |
|
363 | + do_action('wpinv_invoice_metabox_saved', $invoice); |
|
364 | 364 | } |
365 | 365 | } |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$invoice = new WPInv_Invoice( $invoice ); |
|
13 | -$address_row = wpinv_get_invoice_address_markup( $invoice->get_user_info() ); |
|
12 | +$invoice = new WPInv_Invoice($invoice); |
|
13 | +$address_row = wpinv_get_invoice_address_markup($invoice->get_user_info()); |
|
14 | 14 | $phone = $invoice->get_phone(); |
15 | 15 | $email = $invoice->get_email(); |
16 | 16 | |
@@ -21,36 +21,36 @@ discard block |
||
21 | 21 | |
22 | 22 | |
23 | 23 | <div class="invoice-billing-address-label col-2"> |
24 | - <strong><?php _e( 'To:', 'invoicing' ) ?></strong> |
|
24 | + <strong><?php _e('To:', 'invoicing') ?></strong> |
|
25 | 25 | </div> |
26 | 26 | |
27 | 27 | |
28 | 28 | <div class="invoice-billing-address-value col-10"> |
29 | 29 | |
30 | - <?php do_action( 'getpaid_billing_address_top' ); ?> |
|
30 | + <?php do_action('getpaid_billing_address_top'); ?> |
|
31 | 31 | |
32 | - <?php if ( ! empty( $address_row ) ) : ?> |
|
32 | + <?php if (!empty($address_row)) : ?> |
|
33 | 33 | <div class="billing-address"> |
34 | 34 | <?php echo $address_row; ?> |
35 | 35 | </div> |
36 | 36 | <?php endif; ?> |
37 | 37 | |
38 | 38 | |
39 | - <?php if ( ! empty( $phone ) ) : ?> |
|
39 | + <?php if (!empty($phone)) : ?> |
|
40 | 40 | <div class="billing-phone"> |
41 | - <?php echo wp_sprintf( __( 'Phone: %s', 'invoicing' ), esc_html( $phone ) ); ?> |
|
41 | + <?php echo wp_sprintf(__('Phone: %s', 'invoicing'), esc_html($phone)); ?> |
|
42 | 42 | </div> |
43 | 43 | <?php endif; ?> |
44 | 44 | |
45 | 45 | |
46 | - <?php if ( ! empty( $email ) ) : ?> |
|
46 | + <?php if (!empty($email)) : ?> |
|
47 | 47 | <div class="billing-email"> |
48 | - <?php echo wp_sprintf( __( 'Email: %s', 'invoicing' ), sanitize_email( $email ) ); ?> |
|
48 | + <?php echo wp_sprintf(__('Email: %s', 'invoicing'), sanitize_email($email)); ?> |
|
49 | 49 | </div> |
50 | 50 | <?php endif; ?> |
51 | 51 | |
52 | 52 | |
53 | - <?php do_action( 'getpaid_billing_address_bottom' ); ?> |
|
53 | + <?php do_action('getpaid_billing_address_bottom'); ?> |
|
54 | 54 | |
55 | 55 | </div> |
56 | 56 |
@@ -7,26 +7,26 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 | |
14 | - <?php do_action( 'getpaid_before_invoice_details_main', $invoice ); ?> |
|
14 | + <?php do_action('getpaid_before_invoice_details_main', $invoice); ?> |
|
15 | 15 | |
16 | 16 | <div class="getpaid-invoice-details mt-3 mb-3"> |
17 | 17 | <div class="row"> |
18 | 18 | |
19 | 19 | <div class="col-12 col-sm-6"> |
20 | - <?php do_action( 'getpaid_invoice_details_left', $invoice ); ?> |
|
20 | + <?php do_action('getpaid_invoice_details_left', $invoice); ?> |
|
21 | 21 | </div> |
22 | 22 | |
23 | 23 | <div class="col-12 col-sm-6"> |
24 | - <?php do_action( 'getpaid_invoice_details_right', $invoice ); ?> |
|
24 | + <?php do_action('getpaid_invoice_details_right', $invoice); ?> |
|
25 | 25 | </div> |
26 | 26 | |
27 | 27 | </div> |
28 | 28 | </div> |
29 | 29 | |
30 | - <?php do_action( 'getpaid_after_invoice_details_main', $invoice ); ?> |
|
30 | + <?php do_action('getpaid_after_invoice_details_main', $invoice); ?> |
|
31 | 31 | |
32 | 32 | <?php |
@@ -7,13 +7,13 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -if ( empty( $text ) ) { |
|
13 | - $text = __( 'Total to pay:', 'invoicing' ); |
|
12 | +if (empty($text)) { |
|
13 | + $text = __('Total to pay:', 'invoicing'); |
|
14 | 14 | } |
15 | 15 | ?> |
16 | 16 | <div class="form-group mt-4"> |
17 | - <strong><?php echo sanitize_text_field( $text ); ?></strong> |
|
17 | + <strong><?php echo sanitize_text_field($text); ?></strong> |
|
18 | 18 | <span class="getpaid-checkout-total-payable"></span> |
19 | 19 | </div> |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * @deprecated |
247 | 247 | */ |
248 | 248 | function wpinv_get_payment_key( $invoice = 0 ) { |
249 | - $invoice = new WPInv_Invoice( $invoice ); |
|
249 | + $invoice = new WPInv_Invoice( $invoice ); |
|
250 | 250 | return $invoice->get_key(); |
251 | 251 | } |
252 | 252 | |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @deprecated |
425 | 425 | */ |
426 | 426 | function wpinv_get_checkout_session() { |
427 | - return false; |
|
427 | + return false; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Invoicing |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @deprecated |
@@ -19,48 +19,48 @@ discard block |
||
19 | 19 | * @deprecated |
20 | 20 | */ |
21 | 21 | function wpinv_get_invoice_cart() { |
22 | - return wpinv_get_invoice( getpaid_get_current_invoice_id() ); |
|
22 | + return wpinv_get_invoice(getpaid_get_current_invoice_id()); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @deprecated |
27 | 27 | */ |
28 | -function wpinv_get_invoice_description( $invoice ) { |
|
29 | - $invoice = new WPInv_Invoice( $invoice ); |
|
28 | +function wpinv_get_invoice_description($invoice) { |
|
29 | + $invoice = new WPInv_Invoice($invoice); |
|
30 | 30 | return $invoice->get_description(); |
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @deprecated |
35 | 35 | */ |
36 | -function wpinv_get_invoice_currency_code( $invoice ) { |
|
37 | - $invoice = new WPInv_Invoice( $invoice ); |
|
36 | +function wpinv_get_invoice_currency_code($invoice) { |
|
37 | + $invoice = new WPInv_Invoice($invoice); |
|
38 | 38 | return $invoice->get_currency(); |
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | 42 | * @deprecated |
43 | 43 | */ |
44 | -function wpinv_get_payment_user_email( $invoice ) { |
|
45 | - $invoice = new WPInv_Invoice( $invoice ); |
|
44 | +function wpinv_get_payment_user_email($invoice) { |
|
45 | + $invoice = new WPInv_Invoice($invoice); |
|
46 | 46 | return $invoice->get_email(); |
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @deprecated |
51 | 51 | */ |
52 | -function wpinv_get_user_id( $invoice ) { |
|
53 | - $invoice = new WPInv_Invoice( $invoice ); |
|
52 | +function wpinv_get_user_id($invoice) { |
|
53 | + $invoice = new WPInv_Invoice($invoice); |
|
54 | 54 | return $invoice->get_user_id(); |
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @deprecated |
59 | 59 | */ |
60 | -function wpinv_get_invoice_status( $invoice, $return_label = false ) { |
|
61 | - $invoice = new WPInv_Invoice( $invoice ); |
|
60 | +function wpinv_get_invoice_status($invoice, $return_label = false) { |
|
61 | + $invoice = new WPInv_Invoice($invoice); |
|
62 | 62 | |
63 | - if ( $return_label ) { |
|
63 | + if ($return_label) { |
|
64 | 64 | return $invoice->get_status_nicename(); |
65 | 65 | } |
66 | 66 | |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | /** |
71 | 71 | * @deprecated |
72 | 72 | */ |
73 | -function wpinv_get_payment_gateway( $invoice, $return_label = false ) { |
|
74 | - $invoice = new WPInv_Invoice( $invoice ); |
|
73 | +function wpinv_get_payment_gateway($invoice, $return_label = false) { |
|
74 | + $invoice = new WPInv_Invoice($invoice); |
|
75 | 75 | |
76 | - if ( $return_label ) { |
|
76 | + if ($return_label) { |
|
77 | 77 | return $invoice->get_gateway_title(); |
78 | 78 | } |
79 | 79 | |
@@ -83,75 +83,75 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * @deprecated |
85 | 85 | */ |
86 | -function wpinv_get_payment_gateway_name( $invoice ) { |
|
87 | - return wpinv_get_payment_gateway( $invoice, true ); |
|
86 | +function wpinv_get_payment_gateway_name($invoice) { |
|
87 | + return wpinv_get_payment_gateway($invoice, true); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | 91 | * @deprecated |
92 | 92 | */ |
93 | -function wpinv_get_payment_transaction_id( $invoice ) { |
|
94 | - $invoice = new WPInv_Invoice( $invoice ); |
|
93 | +function wpinv_get_payment_transaction_id($invoice) { |
|
94 | + $invoice = new WPInv_Invoice($invoice); |
|
95 | 95 | return $invoice->get_transaction_id(); |
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | 99 | * @deprecated |
100 | 100 | */ |
101 | -function wpinv_get_invoice_meta( $invoice_id = 0, $meta_key = '_wpinv_payment_meta', $single = true ) { |
|
102 | - $invoice = new WPInv_Invoice( $invoice_id ); |
|
103 | - return $invoice->get_meta( $meta_key, $single ); |
|
101 | +function wpinv_get_invoice_meta($invoice_id = 0, $meta_key = '_wpinv_payment_meta', $single = true) { |
|
102 | + $invoice = new WPInv_Invoice($invoice_id); |
|
103 | + return $invoice->get_meta($meta_key, $single); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
107 | 107 | * @deprecated |
108 | 108 | */ |
109 | -function wpinv_update_invoice_meta( $invoice_id = 0, $meta_key = '', $meta_value = '' ) { |
|
110 | - $invoice = new WPInv_Invoice( $invoice_id ); |
|
111 | - return $invoice->update_meta_data( $meta_key, $meta_value ); |
|
109 | +function wpinv_update_invoice_meta($invoice_id = 0, $meta_key = '', $meta_value = '') { |
|
110 | + $invoice = new WPInv_Invoice($invoice_id); |
|
111 | + return $invoice->update_meta_data($meta_key, $meta_value); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
115 | 115 | * @deprecated |
116 | 116 | */ |
117 | -function wpinv_get_items( $invoice = 0 ) { |
|
118 | - $invoice = new WPInv_Invoice( $invoice ); |
|
117 | +function wpinv_get_items($invoice = 0) { |
|
118 | + $invoice = new WPInv_Invoice($invoice); |
|
119 | 119 | return $invoice->get_items(); |
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | 123 | * @deprecated |
124 | 124 | */ |
125 | -function wpinv_get_fees( $invoice = 0 ) { |
|
126 | - $invoice = new WPInv_Invoice( $invoice ); |
|
125 | +function wpinv_get_fees($invoice = 0) { |
|
126 | + $invoice = new WPInv_Invoice($invoice); |
|
127 | 127 | return $invoice->get_fees(); |
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | 131 | * @deprecated |
132 | 132 | */ |
133 | -function wpinv_get_invoice_ip( $invoice ) { |
|
134 | - $invoice = new WPInv_Invoice( $invoice ); |
|
133 | +function wpinv_get_invoice_ip($invoice) { |
|
134 | + $invoice = new WPInv_Invoice($invoice); |
|
135 | 135 | return $invoice->get_ip(); |
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
139 | 139 | * @deprecated |
140 | 140 | */ |
141 | -function wpinv_get_invoice_user_info( $invoice ) { |
|
142 | - $invoice = new WPInv_Invoice( $invoice ); |
|
141 | +function wpinv_get_invoice_user_info($invoice) { |
|
142 | + $invoice = new WPInv_Invoice($invoice); |
|
143 | 143 | return $invoice->get_user_info(); |
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
147 | 147 | * @deprecated |
148 | 148 | */ |
149 | -function wpinv_subtotal( $invoice = 0, $currency = false ) { |
|
150 | - $invoice = new WPInv_Invoice( $invoice ); |
|
149 | +function wpinv_subtotal($invoice = 0, $currency = false) { |
|
150 | + $invoice = new WPInv_Invoice($invoice); |
|
151 | 151 | $subtotal = $invoice->get_subtotal(); |
152 | 152 | |
153 | - if ( $currency ) { |
|
154 | - return wpinv_price( $subtotal, $invoice->get_currency() ); |
|
153 | + if ($currency) { |
|
154 | + return wpinv_price($subtotal, $invoice->get_currency()); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | return $subtotal; |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | /** |
161 | 161 | * @deprecated |
162 | 162 | */ |
163 | -function wpinv_tax( $invoice = 0, $currency = false ) { |
|
164 | - $invoice = new WPInv_Invoice( $invoice ); |
|
163 | +function wpinv_tax($invoice = 0, $currency = false) { |
|
164 | + $invoice = new WPInv_Invoice($invoice); |
|
165 | 165 | $tax = $invoice->get_total_tax(); |
166 | 166 | |
167 | - if ( $currency ) { |
|
168 | - return wpinv_price( $tax, $invoice->get_currency() ); |
|
167 | + if ($currency) { |
|
168 | + return wpinv_price($tax, $invoice->get_currency()); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | return $tax; |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | /** |
175 | 175 | * @deprecated |
176 | 176 | */ |
177 | -function wpinv_discount( $invoice = 0, $currency = false, $deprecated ) { |
|
178 | - $invoice = new WPInv_Invoice( $invoice ); |
|
177 | +function wpinv_discount($invoice = 0, $currency = false, $deprecated) { |
|
178 | + $invoice = new WPInv_Invoice($invoice); |
|
179 | 179 | $discount = $invoice->get_total_discount(); |
180 | 180 | |
181 | - if ( $currency ) { |
|
182 | - return wpinv_price( $discount, $invoice->get_currency() ); |
|
181 | + if ($currency) { |
|
182 | + return wpinv_price($discount, $invoice->get_currency()); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | return $discount; |
@@ -188,20 +188,20 @@ discard block |
||
188 | 188 | /** |
189 | 189 | * @deprecated |
190 | 190 | */ |
191 | -function wpinv_discount_code( $invoice = 0 ) { |
|
192 | - $invoice = new WPInv_Invoice( $invoice ); |
|
191 | +function wpinv_discount_code($invoice = 0) { |
|
192 | + $invoice = new WPInv_Invoice($invoice); |
|
193 | 193 | return $invoice->get_discount_code(); |
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
197 | 197 | * @deprecated |
198 | 198 | */ |
199 | -function wpinv_payment_total( $invoice = 0, $currency = false ) { |
|
200 | - $invoice = new WPInv_Invoice( $invoice ); |
|
199 | +function wpinv_payment_total($invoice = 0, $currency = false) { |
|
200 | + $invoice = new WPInv_Invoice($invoice); |
|
201 | 201 | $total = $invoice->get_total(); |
202 | 202 | |
203 | - if ( $currency ) { |
|
204 | - return wpinv_price( $total, $invoice->get_currency() ); |
|
203 | + if ($currency) { |
|
204 | + return wpinv_price($total, $invoice->get_currency()); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return $total; |
@@ -210,51 +210,51 @@ discard block |
||
210 | 210 | /** |
211 | 211 | * @deprecated |
212 | 212 | */ |
213 | -function wpinv_get_date_created( $invoice = 0, $format = '' ) { |
|
214 | - $invoice = new WPInv_Invoice( $invoice ); |
|
213 | +function wpinv_get_date_created($invoice = 0, $format = '') { |
|
214 | + $invoice = new WPInv_Invoice($invoice); |
|
215 | 215 | |
216 | - $format = ! empty( $format ) ? $format : get_option( 'date_format' ); |
|
216 | + $format = !empty($format) ? $format : get_option('date_format'); |
|
217 | 217 | $date_created = $invoice->get_created_date(); |
218 | 218 | |
219 | - return empty( $date_created ) ? date_i18n( $format, strtotime( $date_created ) ) : ''; |
|
219 | + return empty($date_created) ? date_i18n($format, strtotime($date_created)) : ''; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
223 | 223 | * @deprecated |
224 | 224 | */ |
225 | -function wpinv_get_invoice_date( $invoice = 0, $format = '' ) { |
|
226 | - wpinv_get_date_created( $invoice, $format ); |
|
225 | +function wpinv_get_invoice_date($invoice = 0, $format = '') { |
|
226 | + wpinv_get_date_created($invoice, $format); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
230 | 230 | * @deprecated |
231 | 231 | */ |
232 | -function wpinv_get_invoice_vat_number( $invoice = 0 ) { |
|
233 | - $invoice = new WPInv_Invoice( $invoice ); |
|
232 | +function wpinv_get_invoice_vat_number($invoice = 0) { |
|
233 | + $invoice = new WPInv_Invoice($invoice); |
|
234 | 234 | return $invoice->get_vat_number(); |
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
238 | 238 | * @deprecated |
239 | 239 | */ |
240 | -function wpinv_insert_payment_note( $invoice = 0, $note = '', $user_type = false, $added_by_user = false, $system = false ) { |
|
241 | - $invoice = new WPInv_Invoice( $invoice ); |
|
242 | - return $invoice->add_note( $note, $user_type, $added_by_user, $system ); |
|
240 | +function wpinv_insert_payment_note($invoice = 0, $note = '', $user_type = false, $added_by_user = false, $system = false) { |
|
241 | + $invoice = new WPInv_Invoice($invoice); |
|
242 | + return $invoice->add_note($note, $user_type, $added_by_user, $system); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
246 | 246 | * @deprecated |
247 | 247 | */ |
248 | -function wpinv_get_payment_key( $invoice = 0 ) { |
|
249 | - $invoice = new WPInv_Invoice( $invoice ); |
|
248 | +function wpinv_get_payment_key($invoice = 0) { |
|
249 | + $invoice = new WPInv_Invoice($invoice); |
|
250 | 250 | return $invoice->get_key(); |
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
254 | 254 | * @deprecated |
255 | 255 | */ |
256 | -function wpinv_get_invoice_number( $invoice = 0 ) { |
|
257 | - $invoice = new WPInv_Invoice( $invoice ); |
|
256 | +function wpinv_get_invoice_number($invoice = 0) { |
|
257 | + $invoice = new WPInv_Invoice($invoice); |
|
258 | 258 | return $invoice->get_number(); |
259 | 259 | } |
260 | 260 | |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | /** |
402 | 402 | * @deprecated |
403 | 403 | */ |
404 | -function wpinv_update_payment_status( $invoice, $new_status = 'publish' ) { |
|
405 | - $invoice = new WPInv_Invoice( $invoice ); |
|
406 | - return $invoice->update_status( $new_status ); |
|
404 | +function wpinv_update_payment_status($invoice, $new_status = 'publish') { |
|
405 | + $invoice = new WPInv_Invoice($invoice); |
|
406 | + return $invoice->update_status($new_status); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
@@ -456,22 +456,22 @@ discard block |
||
456 | 456 | /** |
457 | 457 | * @deprecated |
458 | 458 | */ |
459 | -function wpinv_set_payment_transaction_id( $invoice_id = 0, $transaction_id = '' ) { |
|
459 | +function wpinv_set_payment_transaction_id($invoice_id = 0, $transaction_id = '') { |
|
460 | 460 | |
461 | 461 | // Fetch the invoice. |
462 | - $invoice = new WPInv_Invoice( $invoice_id ); |
|
462 | + $invoice = new WPInv_Invoice($invoice_id); |
|
463 | 463 | |
464 | - if ( 0 == $invoice->get_id() ) { |
|
464 | + if (0 == $invoice->get_id()) { |
|
465 | 465 | return false; |
466 | 466 | } |
467 | 467 | |
468 | 468 | // Prepare the transaction id. |
469 | - if ( empty( $transaction_id ) ) { |
|
469 | + if (empty($transaction_id)) { |
|
470 | 470 | $transaction_id = $invoice_id; |
471 | 471 | } |
472 | 472 | |
473 | 473 | // Set the transaction id; |
474 | - $invoice->set_transaction_id( apply_filters( 'wpinv_set_payment_transaction_id', $transaction_id, $invoice ) ); |
|
474 | + $invoice->set_transaction_id(apply_filters('wpinv_set_payment_transaction_id', $transaction_id, $invoice)); |
|
475 | 475 | |
476 | 476 | // Save the invoice. |
477 | 477 | return $invoice->save(); |
@@ -484,12 +484,12 @@ discard block |
||
484 | 484 | * @param WPInv_Invoice $invoice |
485 | 485 | * @param string $gateway |
486 | 486 | */ |
487 | -function wpinv_send_to_gateway( $gateway, $invoice ) { |
|
487 | +function wpinv_send_to_gateway($gateway, $invoice) { |
|
488 | 488 | |
489 | 489 | $payment_data = array( |
490 | 490 | 'invoice_id' => $invoice->get_id(), |
491 | 491 | 'items' => $invoice->get_cart_details(), |
492 | - 'cart_discounts' => array( $invoice->get_discount_code() ), |
|
492 | + 'cart_discounts' => array($invoice->get_discount_code()), |
|
493 | 493 | 'fees' => $invoice->get_total_fees(), |
494 | 494 | 'subtotal' => $invoice->get_subtotal(), |
495 | 495 | 'discount' => $invoice->get_total_discount(), |
@@ -497,16 +497,16 @@ discard block |
||
497 | 497 | 'price' => $invoice->get_total(), |
498 | 498 | 'invoice_key' => $invoice->get_key(), |
499 | 499 | 'user_email' => $invoice->get_email(), |
500 | - 'date' => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ), |
|
500 | + 'date' => date('Y-m-d H:i:s', current_time('timestamp')), |
|
501 | 501 | 'user_info' => $invoice->get_user_info(), |
502 | - 'post_data' => stripslashes_deep( $_POST ), |
|
502 | + 'post_data' => stripslashes_deep($_POST), |
|
503 | 503 | 'cart_details' => $invoice->get_cart_details(), |
504 | 504 | 'gateway' => $gateway, |
505 | 505 | 'card_info' => array(), |
506 | 506 | 'gateway_nonce' => wp_create_nonce('wpi-gateway'), |
507 | 507 | ); |
508 | 508 | |
509 | - do_action( 'wpinv_gateway_' . $gateway, $payment_data ); |
|
509 | + do_action('wpinv_gateway_' . $gateway, $payment_data); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | /** |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | /** |
520 | 520 | * @deprecated |
521 | 521 | */ |
522 | -function wpinv_die( $message = '', $title = '', $status = 400 ) { |
|
523 | - add_filter( 'wp_die_ajax_handler', 'wpinv_die_handler', 10, 3 ); |
|
524 | - add_filter( 'wp_die_handler', 'wpinv_die_handler', 10, 3 ); |
|
525 | - wp_die( $message, $title, array( 'response' => $status )); |
|
522 | +function wpinv_die($message = '', $title = '', $status = 400) { |
|
523 | + add_filter('wp_die_ajax_handler', 'wpinv_die_handler', 10, 3); |
|
524 | + add_filter('wp_die_handler', 'wpinv_die_handler', 10, 3); |
|
525 | + wp_die($message, $title, array('response' => $status)); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | /** |
@@ -640,14 +640,14 @@ discard block |
||
640 | 640 | /** |
641 | 641 | * @deprecated |
642 | 642 | */ |
643 | -function wpinv_invoice_status_label( $status, $status_display = '' ) { |
|
644 | - return empty( $status_display ) ? sanitize_text_field( $status ) : sanitize_text_field( $status_display ); |
|
643 | +function wpinv_invoice_status_label($status, $status_display = '') { |
|
644 | + return empty($status_display) ? sanitize_text_field($status) : sanitize_text_field($status_display); |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | /** |
648 | 648 | * @deprecated |
649 | 649 | */ |
650 | -function wpinv_clean_invoice_number( $number ) { |
|
650 | +function wpinv_clean_invoice_number($number) { |
|
651 | 651 | return $number; |
652 | 652 | } |
653 | 653 | |
@@ -852,12 +852,12 @@ discard block |
||
852 | 852 | /** |
853 | 853 | * @deprecated |
854 | 854 | */ |
855 | -function wpinv_item_show_price( $item_id = 0, $echo = true ) { |
|
855 | +function wpinv_item_show_price($item_id = 0, $echo = true) { |
|
856 | 856 | |
857 | - if ( $echo ) { |
|
858 | - echo wpinv_item_price( $item_id ); |
|
857 | + if ($echo) { |
|
858 | + echo wpinv_item_price($item_id); |
|
859 | 859 | } else { |
860 | - return wpinv_item_price( $item_id ); |
|
860 | + return wpinv_item_price($item_id); |
|
861 | 861 | } |
862 | 862 | |
863 | 863 | } |