Passed
Push — master ( e88989...0a9164 )
by Brian
06:02 queued 40s
created
includes/wpinv-email-functions.php 1 patch
Spacing   +588 added lines, -588 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
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 14
 function wpinv_init_transactional_emails() {
15
-    $email_actions = apply_filters( 'wpinv_email_actions', array(
15
+    $email_actions = apply_filters('wpinv_email_actions', array(
16 16
         'wpinv_status_wpi-pending_to_wpi-processing',
17 17
         'wpinv_status_wpi-pending_to_publish',
18 18
         'wpinv_status_wpi-pending_to_wpi-cancelled',
@@ -30,381 +30,381 @@  discard block
 block discarded – undo
30 30
         'wpinv_fully_refunded',
31 31
         'wpinv_partially_refunded',
32 32
         'wpinv_new_invoice_note'
33
-    ) );
33
+    ));
34 34
 
35
-    foreach ( $email_actions as $action ) {
36
-        add_action( $action, 'wpinv_send_transactional_email', 10, 10 );
35
+    foreach ($email_actions as $action) {
36
+        add_action($action, 'wpinv_send_transactional_email', 10, 10);
37 37
     }
38 38
 }
39
-add_action( 'init', 'wpinv_init_transactional_emails' );
39
+add_action('init', 'wpinv_init_transactional_emails');
40 40
 
41 41
 // New invoice email
42
-add_action( 'wpinv_status_wpi-pending_to_wpi-processing_notification', 'wpinv_new_invoice_notification' );
43
-add_action( 'wpinv_status_wpi-pending_to_publish_notification', 'wpinv_new_invoice_notification' );
44
-add_action( 'wpinv_status_wpi-pending_to_wpi-onhold_notification', 'wpinv_new_invoice_notification' );
45
-add_action( 'wpinv_status_wpi-failed_to_wpi-processing_notification', 'wpinv_new_invoice_notification' );
46
-add_action( 'wpinv_status_wpi-failed_to_publish_notification', 'wpinv_new_invoice_notification' );
47
-add_action( 'wpinv_status_wpi-failed_to_wpi-onhold_notification', 'wpinv_new_invoice_notification' );
42
+add_action('wpinv_status_wpi-pending_to_wpi-processing_notification', 'wpinv_new_invoice_notification');
43
+add_action('wpinv_status_wpi-pending_to_publish_notification', 'wpinv_new_invoice_notification');
44
+add_action('wpinv_status_wpi-pending_to_wpi-onhold_notification', 'wpinv_new_invoice_notification');
45
+add_action('wpinv_status_wpi-failed_to_wpi-processing_notification', 'wpinv_new_invoice_notification');
46
+add_action('wpinv_status_wpi-failed_to_publish_notification', 'wpinv_new_invoice_notification');
47
+add_action('wpinv_status_wpi-failed_to_wpi-onhold_notification', 'wpinv_new_invoice_notification');
48 48
 
49 49
 // Cancelled invoice email
50
-add_action( 'wpinv_status_wpi-pending_to_wpi-cancelled_notification', 'wpinv_cancelled_invoice_notification' );
51
-add_action( 'wpinv_status_wpi-onhold_to_wpi-cancelled_notification', 'wpinv_cancelled_invoice_notification' );
50
+add_action('wpinv_status_wpi-pending_to_wpi-cancelled_notification', 'wpinv_cancelled_invoice_notification');
51
+add_action('wpinv_status_wpi-onhold_to_wpi-cancelled_notification', 'wpinv_cancelled_invoice_notification');
52 52
 
53 53
 // Failed invoice email
54
-add_action( 'wpinv_status_wpi-pending_to_wpi-failed_notification', 'wpinv_failed_invoice_notification' );
55
-add_action( 'wpinv_status_wpi-onhold_to_wpi-failed_notification', 'wpinv_failed_invoice_notification' );
54
+add_action('wpinv_status_wpi-pending_to_wpi-failed_notification', 'wpinv_failed_invoice_notification');
55
+add_action('wpinv_status_wpi-onhold_to_wpi-failed_notification', 'wpinv_failed_invoice_notification');
56 56
 
57 57
 // On hold invoice email
58
-add_action( 'wpinv_status_wpi-pending_to_wpi-onhold_notification', 'wpinv_onhold_invoice_notification' );
59
-add_action( 'wpinv_status_wpi-failed_to_wpi-onhold_notification', 'wpinv_onhold_invoice_notification' );
58
+add_action('wpinv_status_wpi-pending_to_wpi-onhold_notification', 'wpinv_onhold_invoice_notification');
59
+add_action('wpinv_status_wpi-failed_to_wpi-onhold_notification', 'wpinv_onhold_invoice_notification');
60 60
 
61 61
 // Processing invoice email
62
-add_action( 'wpinv_status_wpi-pending_to_wpi-processing_notification', 'wpinv_processing_invoice_notification' );
62
+add_action('wpinv_status_wpi-pending_to_wpi-processing_notification', 'wpinv_processing_invoice_notification');
63 63
 
64 64
 // Paid invoice email
65
-add_action( 'wpinv_status_publish_notification', 'wpinv_completed_invoice_notification' );
65
+add_action('wpinv_status_publish_notification', 'wpinv_completed_invoice_notification');
66 66
 
67 67
 // Refunded invoice email
68
-add_action( 'wpinv_fully_refunded_notification', 'wpinv_fully_refunded_notification' );
69
-add_action( 'wpinv_partially_refunded_notification', 'wpinv_partially_refunded_notification' );
70
-add_action( 'wpinv_status_publish_to_wpi-refunded_notification', 'wpinv_fully_refunded_notification' );
71
-add_action( 'wpinv_status_wpi-processing_to_wpi-refunded_notification', 'wpinv_fully_refunded_notification' );
68
+add_action('wpinv_fully_refunded_notification', 'wpinv_fully_refunded_notification');
69
+add_action('wpinv_partially_refunded_notification', 'wpinv_partially_refunded_notification');
70
+add_action('wpinv_status_publish_to_wpi-refunded_notification', 'wpinv_fully_refunded_notification');
71
+add_action('wpinv_status_wpi-processing_to_wpi-refunded_notification', 'wpinv_fully_refunded_notification');
72 72
 
73 73
 // Invoice note
74
-add_action( 'wpinv_new_invoice_note_notification', 'wpinv_new_invoice_note_notification' );
74
+add_action('wpinv_new_invoice_note_notification', 'wpinv_new_invoice_note_notification');
75 75
 
76
-add_action( 'wpinv_email_header', 'wpinv_email_header' );
77
-add_action( 'wpinv_email_footer', 'wpinv_email_footer' );
78
-add_action( 'wpinv_email_invoice_details', 'wpinv_email_invoice_details', 10, 3 );
79
-add_action( 'wpinv_email_invoice_items', 'wpinv_email_invoice_items', 10, 3 );
80
-add_action( 'wpinv_email_billing_details', 'wpinv_email_billing_details', 10, 3 );
76
+add_action('wpinv_email_header', 'wpinv_email_header');
77
+add_action('wpinv_email_footer', 'wpinv_email_footer');
78
+add_action('wpinv_email_invoice_details', 'wpinv_email_invoice_details', 10, 3);
79
+add_action('wpinv_email_invoice_items', 'wpinv_email_invoice_items', 10, 3);
80
+add_action('wpinv_email_billing_details', 'wpinv_email_billing_details', 10, 3);
81 81
 
82 82
 function wpinv_send_transactional_email() {
83 83
     $args       = func_get_args();
84 84
     $function   = current_filter() . '_notification';
85
-    do_action_ref_array( $function, $args );
85
+    do_action_ref_array($function, $args);
86 86
 }
87 87
 
88
-function wpinv_new_invoice_notification( $invoice_id, $new_status = '' ) {
88
+function wpinv_new_invoice_notification($invoice_id, $new_status = '') {
89 89
     $email_type = 'new_invoice';
90
-    if ( !wpinv_email_is_enabled( $email_type ) ) {
90
+    if (!wpinv_email_is_enabled($email_type)) {
91 91
         return false;
92 92
     }
93 93
 
94
-    $invoice = wpinv_get_invoice( $invoice_id );
95
-    if ( empty( $invoice ) ) {
94
+    $invoice = wpinv_get_invoice($invoice_id);
95
+    if (empty($invoice)) {
96 96
         return false;
97 97
     }
98 98
 
99
-    if ( !("wpi_invoice" === $invoice->post_type) ) {
99
+    if (!("wpi_invoice" === $invoice->post_type)) {
100 100
         return false;
101 101
     }
102 102
 
103
-    $recipient      = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice );
104
-    if ( !is_email( $recipient ) ) {
103
+    $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice);
104
+    if (!is_email($recipient)) {
105 105
         return false;
106 106
     }
107 107
 
108
-    do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type, true );
108
+    do_action('wpinv_pre_send_invoice_notification', $invoice, $email_type, true);
109 109
 
110
-    $subject        = wpinv_email_get_subject( $email_type, $invoice_id, $invoice );
111
-    $email_heading  = wpinv_email_get_heading( $email_type, $invoice_id, $invoice );
112
-    $headers        = wpinv_email_get_headers( $email_type, $invoice_id, $invoice );
113
-    $message_body   = wpinv_email_get_content( $email_type, $invoice_id, $invoice );
114
-    $attachments    = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice );
110
+    $subject        = wpinv_email_get_subject($email_type, $invoice_id, $invoice);
111
+    $email_heading  = wpinv_email_get_heading($email_type, $invoice_id, $invoice);
112
+    $headers        = wpinv_email_get_headers($email_type, $invoice_id, $invoice);
113
+    $message_body   = wpinv_email_get_content($email_type, $invoice_id, $invoice);
114
+    $attachments    = wpinv_email_get_attachments($email_type, $invoice_id, $invoice);
115 115
 
116
-    $content        = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array(
116
+    $content        = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array(
117 117
             'invoice'       => $invoice,
118 118
             'email_type'    => $email_type,
119 119
             'email_heading' => $email_heading,
120 120
             'sent_to_admin' => true,
121 121
             'plain_text'    => false,
122 122
             'message_body'  => $message_body,
123
-        ) );
123
+        ));
124 124
 
125
-    $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
125
+    $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
126 126
 
127
-    do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type, true );
127
+    do_action('wpinv_post_send_invoice_notification', $invoice, $email_type, true);
128 128
 
129 129
     return $sent;
130 130
 }
131 131
 
132
-function wpinv_cancelled_invoice_notification( $invoice_id, $new_status = '' ) {
132
+function wpinv_cancelled_invoice_notification($invoice_id, $new_status = '') {
133 133
     $email_type = 'cancelled_invoice';
134
-    if ( !wpinv_email_is_enabled( $email_type ) ) {
134
+    if (!wpinv_email_is_enabled($email_type)) {
135 135
         return false;
136 136
     }
137 137
 
138
-    $invoice = wpinv_get_invoice( $invoice_id );
139
-    if ( empty( $invoice ) ) {
138
+    $invoice = wpinv_get_invoice($invoice_id);
139
+    if (empty($invoice)) {
140 140
         return false;
141 141
     }
142 142
 
143
-    if ( !("wpi_invoice" === $invoice->post_type) ) {
143
+    if (!("wpi_invoice" === $invoice->post_type)) {
144 144
         return false;
145 145
     }
146 146
 
147
-    $recipient      = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice );
148
-    if ( !is_email( $recipient ) ) {
147
+    $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice);
148
+    if (!is_email($recipient)) {
149 149
         return false;
150 150
     }
151 151
 
152
-    do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type, true );
152
+    do_action('wpinv_pre_send_invoice_notification', $invoice, $email_type, true);
153 153
 
154
-    $subject        = wpinv_email_get_subject( $email_type, $invoice_id, $invoice );
155
-    $email_heading  = wpinv_email_get_heading( $email_type, $invoice_id, $invoice );
156
-    $headers        = wpinv_email_get_headers( $email_type, $invoice_id, $invoice );
157
-    $message_body   = wpinv_email_get_content( $email_type, $invoice_id, $invoice );
158
-    $attachments    = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice );
154
+    $subject        = wpinv_email_get_subject($email_type, $invoice_id, $invoice);
155
+    $email_heading  = wpinv_email_get_heading($email_type, $invoice_id, $invoice);
156
+    $headers        = wpinv_email_get_headers($email_type, $invoice_id, $invoice);
157
+    $message_body   = wpinv_email_get_content($email_type, $invoice_id, $invoice);
158
+    $attachments    = wpinv_email_get_attachments($email_type, $invoice_id, $invoice);
159 159
 
160
-    $content        = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array(
160
+    $content        = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array(
161 161
             'invoice'       => $invoice,
162 162
             'email_type'    => $email_type,
163 163
             'email_heading' => $email_heading,
164 164
             'sent_to_admin' => true,
165 165
             'plain_text'    => false,
166 166
             'message_body'  => $message_body,
167
-        ) );
167
+        ));
168 168
 
169
-    $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
169
+    $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
170 170
 
171
-    do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type, true );
171
+    do_action('wpinv_post_send_invoice_notification', $invoice, $email_type, true);
172 172
 
173 173
     return $sent;
174 174
 }
175 175
 
176
-function wpinv_failed_invoice_notification( $invoice_id, $new_status = '' ) {
176
+function wpinv_failed_invoice_notification($invoice_id, $new_status = '') {
177 177
     $email_type = 'failed_invoice';
178
-    if ( !wpinv_email_is_enabled( $email_type ) ) {
178
+    if (!wpinv_email_is_enabled($email_type)) {
179 179
         return false;
180 180
     }
181 181
     
182
-    $invoice = wpinv_get_invoice( $invoice_id );
183
-    if ( empty( $invoice ) ) {
182
+    $invoice = wpinv_get_invoice($invoice_id);
183
+    if (empty($invoice)) {
184 184
         return false;
185 185
     }
186 186
 
187
-    if ( !("wpi_invoice" === $invoice->post_type) ) {
187
+    if (!("wpi_invoice" === $invoice->post_type)) {
188 188
         return false;
189 189
     }
190 190
 
191
-    $recipient      = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice );
192
-    if ( !is_email( $recipient ) ) {
191
+    $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice);
192
+    if (!is_email($recipient)) {
193 193
         return false;
194 194
     }
195 195
 
196
-    do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type, true );
196
+    do_action('wpinv_pre_send_invoice_notification', $invoice, $email_type, true);
197 197
 
198
-    $subject        = wpinv_email_get_subject( $email_type, $invoice_id, $invoice );
199
-    $email_heading  = wpinv_email_get_heading( $email_type, $invoice_id, $invoice );
200
-    $headers        = wpinv_email_get_headers( $email_type, $invoice_id, $invoice );
201
-    $message_body   = wpinv_email_get_content( $email_type, $invoice_id, $invoice );
202
-    $attachments    = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice );
198
+    $subject        = wpinv_email_get_subject($email_type, $invoice_id, $invoice);
199
+    $email_heading  = wpinv_email_get_heading($email_type, $invoice_id, $invoice);
200
+    $headers        = wpinv_email_get_headers($email_type, $invoice_id, $invoice);
201
+    $message_body   = wpinv_email_get_content($email_type, $invoice_id, $invoice);
202
+    $attachments    = wpinv_email_get_attachments($email_type, $invoice_id, $invoice);
203 203
     
204
-    $content        = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array(
204
+    $content        = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array(
205 205
             'invoice'       => $invoice,
206 206
             'email_type'    => $email_type,
207 207
             'email_heading' => $email_heading,
208 208
             'sent_to_admin' => true,
209 209
             'plain_text'    => false,
210 210
             'message_body'  => $message_body,
211
-        ) );
211
+        ));
212 212
 
213
-    $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
213
+    $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
214 214
 
215
-    do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type, true );
215
+    do_action('wpinv_post_send_invoice_notification', $invoice, $email_type, true);
216 216
 
217 217
     return $sent;
218 218
 }
219 219
 
220
-function wpinv_onhold_invoice_notification( $invoice_id, $new_status = '' ) {
220
+function wpinv_onhold_invoice_notification($invoice_id, $new_status = '') {
221 221
     $email_type = 'onhold_invoice';
222
-    if ( !wpinv_email_is_enabled( $email_type ) ) {
222
+    if (!wpinv_email_is_enabled($email_type)) {
223 223
         return false;
224 224
     }
225 225
 
226
-    $invoice = wpinv_get_invoice( $invoice_id );
227
-    if ( empty( $invoice ) ) {
226
+    $invoice = wpinv_get_invoice($invoice_id);
227
+    if (empty($invoice)) {
228 228
         return false;
229 229
     }
230 230
 
231
-    if ( !("wpi_invoice" === $invoice->post_type) ) {
231
+    if (!("wpi_invoice" === $invoice->post_type)) {
232 232
         return false;
233 233
     }
234 234
 
235
-    $recipient      = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice );
236
-    if ( !is_email( $recipient ) ) {
235
+    $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice);
236
+    if (!is_email($recipient)) {
237 237
         return false;
238 238
     }
239 239
 
240
-    do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type );
240
+    do_action('wpinv_pre_send_invoice_notification', $invoice, $email_type);
241 241
 
242
-    $subject        = wpinv_email_get_subject( $email_type, $invoice_id, $invoice );
243
-    $email_heading  = wpinv_email_get_heading( $email_type, $invoice_id, $invoice );
244
-    $headers        = wpinv_email_get_headers( $email_type, $invoice_id, $invoice );
245
-    $message_body   = wpinv_email_get_content( $email_type, $invoice_id, $invoice );
246
-    $attachments    = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice );
242
+    $subject        = wpinv_email_get_subject($email_type, $invoice_id, $invoice);
243
+    $email_heading  = wpinv_email_get_heading($email_type, $invoice_id, $invoice);
244
+    $headers        = wpinv_email_get_headers($email_type, $invoice_id, $invoice);
245
+    $message_body   = wpinv_email_get_content($email_type, $invoice_id, $invoice);
246
+    $attachments    = wpinv_email_get_attachments($email_type, $invoice_id, $invoice);
247 247
     
248
-    $content        = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array(
248
+    $content        = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array(
249 249
             'invoice'       => $invoice,
250 250
             'email_type'    => $email_type,
251 251
             'email_heading' => $email_heading,
252 252
             'sent_to_admin' => false,
253 253
             'plain_text'    => false,
254 254
             'message_body'  => $message_body,
255
-        ) );
255
+        ));
256 256
     
257
-    $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
257
+    $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
258 258
     
259
-    if ( wpinv_mail_admin_bcc_active( $email_type ) ) {
260
-        $recipient  = wpinv_get_admin_email();
261
-        $subject    .= ' - ADMIN BCC COPY';
262
-        wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
259
+    if (wpinv_mail_admin_bcc_active($email_type)) {
260
+        $recipient = wpinv_get_admin_email();
261
+        $subject .= ' - ADMIN BCC COPY';
262
+        wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
263 263
     }
264 264
 
265
-    do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type );
265
+    do_action('wpinv_post_send_invoice_notification', $invoice, $email_type);
266 266
 
267 267
     return $sent;
268 268
 }
269 269
 
270
-function wpinv_processing_invoice_notification( $invoice_id, $new_status = '' ) {
270
+function wpinv_processing_invoice_notification($invoice_id, $new_status = '') {
271 271
     $email_type = 'processing_invoice';
272
-    if ( !wpinv_email_is_enabled( $email_type ) ) {
272
+    if (!wpinv_email_is_enabled($email_type)) {
273 273
         return false;
274 274
     }
275 275
 
276
-    $invoice = wpinv_get_invoice( $invoice_id );
277
-    if ( empty( $invoice ) ) {
276
+    $invoice = wpinv_get_invoice($invoice_id);
277
+    if (empty($invoice)) {
278 278
         return false;
279 279
     }
280 280
 
281
-    if ( !("wpi_invoice" === $invoice->post_type) ) {
281
+    if (!("wpi_invoice" === $invoice->post_type)) {
282 282
         return false;
283 283
     }
284 284
 
285
-    $recipient      = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice );
286
-    if ( !is_email( $recipient ) ) {
285
+    $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice);
286
+    if (!is_email($recipient)) {
287 287
         return false;
288 288
     }
289 289
 
290
-    do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type );
290
+    do_action('wpinv_pre_send_invoice_notification', $invoice, $email_type);
291 291
 
292 292
     $search                     = array();
293 293
     $search['invoice_number']   = '{invoice_number}';
294 294
     $search['invoice_date']     = '{invoice_date}';
295 295
     $search['name']             = '{name}';
296 296
 
297
-    $subject        = wpinv_email_get_subject( $email_type, $invoice_id, $invoice );
298
-    $email_heading  = wpinv_email_get_heading( $email_type, $invoice_id, $invoice );
299
-    $headers        = wpinv_email_get_headers( $email_type, $invoice_id, $invoice );
300
-    $message_body   = wpinv_email_get_content( $email_type, $invoice_id, $invoice );
301
-    $attachments    = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice );
297
+    $subject        = wpinv_email_get_subject($email_type, $invoice_id, $invoice);
298
+    $email_heading  = wpinv_email_get_heading($email_type, $invoice_id, $invoice);
299
+    $headers        = wpinv_email_get_headers($email_type, $invoice_id, $invoice);
300
+    $message_body   = wpinv_email_get_content($email_type, $invoice_id, $invoice);
301
+    $attachments    = wpinv_email_get_attachments($email_type, $invoice_id, $invoice);
302 302
     
303
-    $content        = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array(
303
+    $content        = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array(
304 304
             'invoice'       => $invoice,
305 305
             'email_type'    => $email_type,
306 306
             'email_heading' => $email_heading,
307 307
             'sent_to_admin' => false,
308 308
             'plain_text'    => false,
309 309
             'message_body'  => $message_body,
310
-        ) );
310
+        ));
311 311
 
312
-    $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
312
+    $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
313 313
 
314
-    if ( wpinv_mail_admin_bcc_active( $email_type ) ) {
315
-        $recipient  = wpinv_get_admin_email();
316
-        $subject    .= ' - ADMIN BCC COPY';
317
-        wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
314
+    if (wpinv_mail_admin_bcc_active($email_type)) {
315
+        $recipient = wpinv_get_admin_email();
316
+        $subject .= ' - ADMIN BCC COPY';
317
+        wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
318 318
     }
319 319
 
320
-    do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type );
320
+    do_action('wpinv_post_send_invoice_notification', $invoice, $email_type);
321 321
 
322 322
     return $sent;
323 323
 }
324 324
 
325
-function wpinv_completed_invoice_notification( $invoice_id, $new_status = '' ) {
325
+function wpinv_completed_invoice_notification($invoice_id, $new_status = '') {
326 326
     $email_type = 'completed_invoice';
327
-    if ( !wpinv_email_is_enabled( $email_type ) ) {
327
+    if (!wpinv_email_is_enabled($email_type)) {
328 328
         return false;
329 329
     }
330 330
 
331
-    $invoice = wpinv_get_invoice( $invoice_id );
332
-    if ( empty( $invoice ) ) {
331
+    $invoice = wpinv_get_invoice($invoice_id);
332
+    if (empty($invoice)) {
333 333
         return false;
334 334
     }
335 335
 
336
-    if ( !("wpi_invoice" === $invoice->post_type) ) {
336
+    if (!("wpi_invoice" === $invoice->post_type)) {
337 337
         return false;
338 338
     }
339 339
 
340
-    if($invoice->is_renewal() && wpinv_email_is_enabled( 'completed_invoice_renewal' )){
340
+    if ($invoice->is_renewal() && wpinv_email_is_enabled('completed_invoice_renewal')) {
341 341
         return false;
342 342
     }
343 343
 
344
-    $recipient      = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice );
345
-    if ( !is_email( $recipient ) ) {
344
+    $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice);
345
+    if (!is_email($recipient)) {
346 346
         return false;
347 347
     }
348 348
 
349
-    do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type );
349
+    do_action('wpinv_pre_send_invoice_notification', $invoice, $email_type);
350 350
 
351
-    $subject        = wpinv_email_get_subject( $email_type, $invoice_id, $invoice );
352
-    $email_heading  = wpinv_email_get_heading( $email_type, $invoice_id, $invoice );
353
-    $headers        = wpinv_email_get_headers( $email_type, $invoice_id, $invoice );
354
-    $message_body   = wpinv_email_get_content( $email_type, $invoice_id, $invoice );
355
-    $attachments    = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice );
351
+    $subject        = wpinv_email_get_subject($email_type, $invoice_id, $invoice);
352
+    $email_heading  = wpinv_email_get_heading($email_type, $invoice_id, $invoice);
353
+    $headers        = wpinv_email_get_headers($email_type, $invoice_id, $invoice);
354
+    $message_body   = wpinv_email_get_content($email_type, $invoice_id, $invoice);
355
+    $attachments    = wpinv_email_get_attachments($email_type, $invoice_id, $invoice);
356 356
 
357
-    $content        = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array(
357
+    $content        = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array(
358 358
             'invoice'       => $invoice,
359 359
             'email_type'    => $email_type,
360 360
             'email_heading' => $email_heading,
361 361
             'sent_to_admin' => false,
362 362
             'plain_text'    => false,
363 363
             'message_body'  => $message_body,
364
-        ) );
364
+        ));
365 365
 
366
-    $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
366
+    $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
367 367
 
368
-    if ( wpinv_mail_admin_bcc_active( $email_type ) ) {
369
-        $recipient  = wpinv_get_admin_email();
370
-        $subject    .= ' - ADMIN BCC COPY';
371
-        wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
368
+    if (wpinv_mail_admin_bcc_active($email_type)) {
369
+        $recipient = wpinv_get_admin_email();
370
+        $subject .= ' - ADMIN BCC COPY';
371
+        wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
372 372
     }
373 373
 
374
-    do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type );
374
+    do_action('wpinv_post_send_invoice_notification', $invoice, $email_type);
375 375
 
376 376
     return $sent;
377 377
 }
378 378
 
379
-function wpinv_fully_refunded_notification( $invoice_id, $new_status = '' ) {
379
+function wpinv_fully_refunded_notification($invoice_id, $new_status = '') {
380 380
     $email_type = 'refunded_invoice';
381
-    if ( !wpinv_email_is_enabled( $email_type ) ) {
381
+    if (!wpinv_email_is_enabled($email_type)) {
382 382
         return false;
383 383
     }
384 384
 
385
-    $invoice = wpinv_get_invoice( $invoice_id );
386
-    if ( empty( $invoice ) ) {
385
+    $invoice = wpinv_get_invoice($invoice_id);
386
+    if (empty($invoice)) {
387 387
         return false;
388 388
     }
389 389
 
390
-    if ( !("wpi_invoice" === $invoice->post_type) ) {
390
+    if (!("wpi_invoice" === $invoice->post_type)) {
391 391
         return false;
392 392
     }
393 393
 
394
-    $recipient      = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice );
395
-    if ( !is_email( $recipient ) ) {
394
+    $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice);
395
+    if (!is_email($recipient)) {
396 396
         return false;
397 397
     }
398 398
 
399
-    do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type );
399
+    do_action('wpinv_pre_send_invoice_notification', $invoice, $email_type);
400 400
 
401
-    $subject        = wpinv_email_get_subject( $email_type, $invoice_id, $invoice );
402
-    $email_heading  = wpinv_email_get_heading( $email_type, $invoice_id, $invoice );
403
-    $headers        = wpinv_email_get_headers( $email_type, $invoice_id, $invoice );
404
-    $message_body   = wpinv_email_get_content( $email_type, $invoice_id, $invoice );
405
-    $attachments    = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice );
401
+    $subject        = wpinv_email_get_subject($email_type, $invoice_id, $invoice);
402
+    $email_heading  = wpinv_email_get_heading($email_type, $invoice_id, $invoice);
403
+    $headers        = wpinv_email_get_headers($email_type, $invoice_id, $invoice);
404
+    $message_body   = wpinv_email_get_content($email_type, $invoice_id, $invoice);
405
+    $attachments    = wpinv_email_get_attachments($email_type, $invoice_id, $invoice);
406 406
 
407
-    $content        = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array(
407
+    $content        = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array(
408 408
             'invoice'           => $invoice,
409 409
             'email_type'        => $email_type,
410 410
             'email_heading'     => $email_heading,
@@ -412,50 +412,50 @@  discard block
 block discarded – undo
412 412
             'plain_text'        => false,
413 413
             'partial_refund'    => false,
414 414
             'message_body'      => $message_body,
415
-        ) );
415
+        ));
416 416
 
417
-    $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
417
+    $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
418 418
 
419
-    if ( wpinv_mail_admin_bcc_active( $email_type ) ) {
420
-        $recipient  = wpinv_get_admin_email();
421
-        $subject    .= ' - ADMIN BCC COPY';
422
-        wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
419
+    if (wpinv_mail_admin_bcc_active($email_type)) {
420
+        $recipient = wpinv_get_admin_email();
421
+        $subject .= ' - ADMIN BCC COPY';
422
+        wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
423 423
     }
424 424
 
425
-    do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type );
425
+    do_action('wpinv_post_send_invoice_notification', $invoice, $email_type);
426 426
 
427 427
     return $sent;
428 428
 }
429 429
 
430
-function wpinv_partially_refunded_notification( $invoice_id, $new_status = '' ) {
430
+function wpinv_partially_refunded_notification($invoice_id, $new_status = '') {
431 431
     $email_type = 'refunded_invoice';
432
-    if ( !wpinv_email_is_enabled( $email_type ) ) {
432
+    if (!wpinv_email_is_enabled($email_type)) {
433 433
         return false;
434 434
     }
435 435
 
436
-    $invoice = wpinv_get_invoice( $invoice_id );
437
-    if ( empty( $invoice ) ) {
436
+    $invoice = wpinv_get_invoice($invoice_id);
437
+    if (empty($invoice)) {
438 438
         return false;
439 439
     }
440 440
 
441
-    if ( !("wpi_invoice" === $invoice->post_type) ) {
441
+    if (!("wpi_invoice" === $invoice->post_type)) {
442 442
         return false;
443 443
     }
444 444
 
445
-    $recipient      = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice );
446
-    if ( !is_email( $recipient ) ) {
445
+    $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice);
446
+    if (!is_email($recipient)) {
447 447
         return false;
448 448
     }
449 449
 
450
-    do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type );
450
+    do_action('wpinv_pre_send_invoice_notification', $invoice, $email_type);
451 451
 
452
-    $subject        = wpinv_email_get_subject( $email_type, $invoice_id, $invoice );
453
-    $email_heading  = wpinv_email_get_heading( $email_type, $invoice_id, $invoice );
454
-    $headers        = wpinv_email_get_headers( $email_type, $invoice_id, $invoice );
455
-    $message_body   = wpinv_email_get_content( $email_type, $invoice_id, $invoice );
456
-    $attachments    = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice );
452
+    $subject        = wpinv_email_get_subject($email_type, $invoice_id, $invoice);
453
+    $email_heading  = wpinv_email_get_heading($email_type, $invoice_id, $invoice);
454
+    $headers        = wpinv_email_get_headers($email_type, $invoice_id, $invoice);
455
+    $message_body   = wpinv_email_get_content($email_type, $invoice_id, $invoice);
456
+    $attachments    = wpinv_email_get_attachments($email_type, $invoice_id, $invoice);
457 457
 
458
-    $content        = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array(
458
+    $content        = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array(
459 459
             'invoice'           => $invoice,
460 460
             'email_type'        => $email_type,
461 461
             'email_heading'     => $email_heading,
@@ -463,95 +463,95 @@  discard block
 block discarded – undo
463 463
             'plain_text'        => false,
464 464
             'partial_refund'    => true,
465 465
             'message_body'      => $message_body,
466
-        ) );
466
+        ));
467 467
 
468
-    $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
468
+    $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
469 469
 
470
-    if ( wpinv_mail_admin_bcc_active( $email_type ) ) {
471
-        $recipient  = wpinv_get_admin_email();
472
-        $subject    .= ' - ADMIN BCC COPY';
473
-        wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
470
+    if (wpinv_mail_admin_bcc_active($email_type)) {
471
+        $recipient = wpinv_get_admin_email();
472
+        $subject .= ' - ADMIN BCC COPY';
473
+        wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
474 474
     }
475 475
 
476
-    do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type );
476
+    do_action('wpinv_post_send_invoice_notification', $invoice, $email_type);
477 477
 
478 478
     return $sent;
479 479
 }
480 480
 
481
-function wpinv_new_invoice_note_notification( $invoice_id, $new_status = '' ) {
481
+function wpinv_new_invoice_note_notification($invoice_id, $new_status = '') {
482 482
 }
483 483
 
484
-function wpinv_user_invoice_notification( $invoice_id ) {
484
+function wpinv_user_invoice_notification($invoice_id) {
485 485
     $email_type = 'user_invoice';
486
-    if ( !wpinv_email_is_enabled( $email_type ) ) {
486
+    if (!wpinv_email_is_enabled($email_type)) {
487 487
         return -1;
488 488
     }
489 489
 
490
-    $invoice = wpinv_get_invoice( $invoice_id );
491
-    if ( empty( $invoice ) ) {
490
+    $invoice = wpinv_get_invoice($invoice_id);
491
+    if (empty($invoice)) {
492 492
         return false;
493 493
     }
494 494
 
495
-    if ( !("wpi_invoice" === $invoice->post_type) ) {
495
+    if (!("wpi_invoice" === $invoice->post_type)) {
496 496
         return false;
497 497
     }
498 498
 
499
-    $recipient      = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice );
500
-    if ( !is_email( $recipient ) ) {
499
+    $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice);
500
+    if (!is_email($recipient)) {
501 501
         return false;
502 502
     }
503 503
 
504
-    do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type );
504
+    do_action('wpinv_pre_send_invoice_notification', $invoice, $email_type);
505 505
 
506
-    $subject        = wpinv_email_get_subject( $email_type, $invoice_id, $invoice );
507
-    $email_heading  = wpinv_email_get_heading( $email_type, $invoice_id, $invoice );
508
-    $headers        = wpinv_email_get_headers( $email_type, $invoice_id, $invoice );
509
-    $message_body   = wpinv_email_get_content( $email_type, $invoice_id, $invoice );
510
-    $attachments    = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice );
506
+    $subject        = wpinv_email_get_subject($email_type, $invoice_id, $invoice);
507
+    $email_heading  = wpinv_email_get_heading($email_type, $invoice_id, $invoice);
508
+    $headers        = wpinv_email_get_headers($email_type, $invoice_id, $invoice);
509
+    $message_body   = wpinv_email_get_content($email_type, $invoice_id, $invoice);
510
+    $attachments    = wpinv_email_get_attachments($email_type, $invoice_id, $invoice);
511 511
     
512
-    $content        = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array(
512
+    $content        = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array(
513 513
             'invoice'       => $invoice,
514 514
             'email_type'    => $email_type,
515 515
             'email_heading' => $email_heading,
516 516
             'sent_to_admin' => false,
517 517
             'plain_text'    => false,
518 518
             'message_body'  => $message_body,
519
-        ) );
519
+        ));
520 520
 
521
-    $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
521
+    $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
522 522
 
523
-    if ( wpinv_mail_admin_bcc_active( $email_type ) ) {
524
-        $recipient  = wpinv_get_admin_email();
525
-        $subject    .= ' - ADMIN BCC COPY';
526
-        wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
523
+    if (wpinv_mail_admin_bcc_active($email_type)) {
524
+        $recipient = wpinv_get_admin_email();
525
+        $subject .= ' - ADMIN BCC COPY';
526
+        wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
527 527
     }
528 528
 
529
-    do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type );
529
+    do_action('wpinv_post_send_invoice_notification', $invoice, $email_type);
530 530
 
531
-    if ( $sent ) {
532
-        $note = __( 'Invoice has been emailed to the user.', 'invoicing' );
531
+    if ($sent) {
532
+        $note = __('Invoice has been emailed to the user.', 'invoicing');
533 533
     } else {
534
-        $note = __( 'Fail to send invoice to the user!', 'invoicing' );
534
+        $note = __('Fail to send invoice to the user!', 'invoicing');
535 535
     }
536 536
 
537
-    $invoice->add_note( $note, '', '', true ); // Add system note.
537
+    $invoice->add_note($note, '', '', true); // Add system note.
538 538
 
539 539
     return $sent;
540 540
 }
541 541
 
542
-function wpinv_user_note_notification( $invoice_id, $args = array() ) {
542
+function wpinv_user_note_notification($invoice_id, $args = array()) {
543 543
     $email_type = 'user_note';
544
-    if ( !wpinv_email_is_enabled( $email_type ) ) {
544
+    if (!wpinv_email_is_enabled($email_type)) {
545 545
         return false;
546 546
     }
547 547
 
548
-    $invoice = wpinv_get_invoice( $invoice_id );
549
-    if ( empty( $invoice ) ) {
548
+    $invoice = wpinv_get_invoice($invoice_id);
549
+    if (empty($invoice)) {
550 550
         return false;
551 551
     }
552 552
 
553
-    $recipient      = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice );
554
-    if ( !is_email( $recipient ) ) {
553
+    $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice);
554
+    if (!is_email($recipient)) {
555 555
         return false;
556 556
     }
557 557
 
@@ -559,19 +559,19 @@  discard block
 block discarded – undo
559 559
         'user_note' => ''
560 560
     );
561 561
 
562
-    $args = wp_parse_args( $args, $defaults );
562
+    $args = wp_parse_args($args, $defaults);
563 563
 
564
-    do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type );
564
+    do_action('wpinv_pre_send_invoice_notification', $invoice, $email_type);
565 565
 
566
-    $subject        = wpinv_email_get_subject( $email_type, $invoice_id, $invoice );
567
-    $email_heading  = wpinv_email_get_heading( $email_type, $invoice_id, $invoice );
568
-    $headers        = wpinv_email_get_headers( $email_type, $invoice_id, $invoice );
569
-    $message_body   = wpinv_email_get_content( $email_type, $invoice_id, $invoice );
570
-    $attachments    = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice );
566
+    $subject        = wpinv_email_get_subject($email_type, $invoice_id, $invoice);
567
+    $email_heading  = wpinv_email_get_heading($email_type, $invoice_id, $invoice);
568
+    $headers        = wpinv_email_get_headers($email_type, $invoice_id, $invoice);
569
+    $message_body   = wpinv_email_get_content($email_type, $invoice_id, $invoice);
570
+    $attachments    = wpinv_email_get_attachments($email_type, $invoice_id, $invoice);
571 571
 
572
-    $message_body   = str_replace( '{customer_note}', $args['user_note'], $message_body );
572
+    $message_body   = str_replace('{customer_note}', $args['user_note'], $message_body);
573 573
 
574
-    $content        = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array(
574
+    $content        = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array(
575 575
             'invoice'       => $invoice,
576 576
             'email_type'    => $email_type,
577 577
             'email_heading' => $email_heading,
@@ -579,36 +579,36 @@  discard block
 block discarded – undo
579 579
             'plain_text'    => false,
580 580
             'message_body'  => $message_body,
581 581
             'customer_note' => $args['user_note']
582
-        ) );
582
+        ));
583 583
 
584
-    $content        = wpinv_email_format_text( $content, $invoice );
584
+    $content = wpinv_email_format_text($content, $invoice);
585 585
 
586
-    $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
586
+    $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
587 587
 
588
-    do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type );
588
+    do_action('wpinv_post_send_invoice_notification', $invoice, $email_type);
589 589
 
590 590
     return $sent;
591 591
 }
592 592
 
593 593
 function wpinv_mail_get_from_address() {
594
-    $from_address = apply_filters( 'wpinv_mail_from_address', wpinv_get_option( 'email_from' ) );
595
-    return sanitize_email( $from_address );
594
+    $from_address = apply_filters('wpinv_mail_from_address', wpinv_get_option('email_from'));
595
+    return sanitize_email($from_address);
596 596
 }
597 597
 
598 598
 function wpinv_mail_get_from_name() {
599
-    $from_name = apply_filters( 'wpinv_mail_from_name', wpinv_get_option( 'email_from_name' ) );
600
-    return wp_specialchars_decode( esc_html( $from_name ), ENT_QUOTES );
599
+    $from_name = apply_filters('wpinv_mail_from_name', wpinv_get_option('email_from_name'));
600
+    return wp_specialchars_decode(esc_html($from_name), ENT_QUOTES);
601 601
 }
602 602
 
603
-function wpinv_mail_admin_bcc_active( $mail_type = '' ) {
604
-    $active = apply_filters( 'wpinv_mail_admin_bcc_active', wpinv_get_option( 'email_' . $mail_type . '_admin_bcc' ) );
605
-    return ( $active ? true : false );
603
+function wpinv_mail_admin_bcc_active($mail_type = '') {
604
+    $active = apply_filters('wpinv_mail_admin_bcc_active', wpinv_get_option('email_' . $mail_type . '_admin_bcc'));
605
+    return ($active ? true : false);
606 606
 }
607 607
     
608
-function wpinv_mail_get_content_type(  $content_type = 'text/html', $email_type = 'html' ) {
609
-    $email_type = apply_filters( 'wpinv_mail_content_type', $email_type );
608
+function wpinv_mail_get_content_type($content_type = 'text/html', $email_type = 'html') {
609
+    $email_type = apply_filters('wpinv_mail_content_type', $email_type);
610 610
 
611
-    switch ( $email_type ) {
611
+    switch ($email_type) {
612 612
         case 'html' :
613 613
             $content_type = 'text/html';
614 614
             break;
@@ -623,35 +623,35 @@  discard block
 block discarded – undo
623 623
     return $content_type;
624 624
 }
625 625
     
626
-function wpinv_mail_send( $to, $subject, $message, $headers, $attachments ) {
627
-    add_filter( 'wp_mail_from', 'wpinv_mail_get_from_address' );
628
-    add_filter( 'wp_mail_from_name', 'wpinv_mail_get_from_name' );
629
-    add_filter( 'wp_mail_content_type', 'wpinv_mail_get_content_type' );
626
+function wpinv_mail_send($to, $subject, $message, $headers, $attachments) {
627
+    add_filter('wp_mail_from', 'wpinv_mail_get_from_address');
628
+    add_filter('wp_mail_from_name', 'wpinv_mail_get_from_name');
629
+    add_filter('wp_mail_content_type', 'wpinv_mail_get_content_type');
630 630
 
631
-    $message = wpinv_email_style_body( $message );
632
-    $message = apply_filters( 'wpinv_mail_content', $message );
631
+    $message = wpinv_email_style_body($message);
632
+    $message = apply_filters('wpinv_mail_content', $message);
633 633
 
634
-    $sent  = wp_mail( $to, $subject, $message, $headers, $attachments );
634
+    $sent = wp_mail($to, $subject, $message, $headers, $attachments);
635 635
 
636
-    if ( !$sent ) {
637
-        $log_message = wp_sprintf( __( "\nTime: %s\nTo: %s\nSubject: %s\n", 'invoicing' ), date_i18n( 'F j Y H:i:s', current_time( 'timestamp' ) ), ( is_array( $to ) ? implode( ', ', $to ) : $to ), $subject );
638
-        wpinv_error_log( $log_message, __( "Email from Invoicing plugin failed to send", 'invoicing' ), __FILE__, __LINE__ );
636
+    if (!$sent) {
637
+        $log_message = wp_sprintf(__("\nTime: %s\nTo: %s\nSubject: %s\n", 'invoicing'), date_i18n('F j Y H:i:s', current_time('timestamp')), (is_array($to) ? implode(', ', $to) : $to), $subject);
638
+        wpinv_error_log($log_message, __("Email from Invoicing plugin failed to send", 'invoicing'), __FILE__, __LINE__);
639 639
     }
640 640
 
641
-    remove_filter( 'wp_mail_from', 'wpinv_mail_get_from_address' );
642
-    remove_filter( 'wp_mail_from_name', 'wpinv_mail_get_from_name' );
643
-    remove_filter( 'wp_mail_content_type', 'wpinv_mail_get_content_type' );
641
+    remove_filter('wp_mail_from', 'wpinv_mail_get_from_address');
642
+    remove_filter('wp_mail_from_name', 'wpinv_mail_get_from_name');
643
+    remove_filter('wp_mail_content_type', 'wpinv_mail_get_content_type');
644 644
 
645 645
     return $sent;
646 646
 }
647 647
     
648 648
 function wpinv_get_emails() {
649 649
     $overdue_days_options       = array();
650
-    $overdue_days_options[0]    = __( 'On the Due Date', 'invoicing' );
651
-    $overdue_days_options[1]    = __( '1 day after Due Date', 'invoicing' );
650
+    $overdue_days_options[0]    = __('On the Due Date', 'invoicing');
651
+    $overdue_days_options[1]    = __('1 day after Due Date', 'invoicing');
652 652
 
653
-    for ( $i = 2; $i <= 10; $i++ ) {
654
-        $overdue_days_options[$i]   = wp_sprintf( __( '%d days after Due Date', 'invoicing' ), $i );
653
+    for ($i = 2; $i <= 10; $i++) {
654
+        $overdue_days_options[$i] = wp_sprintf(__('%d days after Due Date', 'invoicing'), $i);
655 655
     }
656 656
 
657 657
     // Default, built-in gateways
@@ -659,39 +659,39 @@  discard block
 block discarded – undo
659 659
             'new_invoice' => array(
660 660
             'email_new_invoice_header' => array(
661 661
                 'id'   => 'email_new_invoice_header',
662
-                'name' => '<h3>' . __( 'New Invoice', 'invoicing' ) . '</h3>',
663
-                'desc' => __( 'New invoice emails are sent to admin when a new invoice is received.', 'invoicing' ),
662
+                'name' => '<h3>' . __('New Invoice', 'invoicing') . '</h3>',
663
+                'desc' => __('New invoice emails are sent to admin when a new invoice is received.', 'invoicing'),
664 664
                 'type' => 'header',
665 665
             ),
666 666
             'email_new_invoice_active' => array(
667 667
                 'id'   => 'email_new_invoice_active',
668
-                'name' => __( 'Enable/Disable', 'invoicing' ),
669
-                'desc' => __( 'Enable this email notification', 'invoicing' ),
668
+                'name' => __('Enable/Disable', 'invoicing'),
669
+                'desc' => __('Enable this email notification', 'invoicing'),
670 670
                 'type' => 'checkbox',
671 671
                 'std'  => 1
672 672
             ),
673 673
             'email_new_invoice_subject' => array(
674 674
                 'id'   => 'email_new_invoice_subject',
675
-                'name' => __( 'Subject', 'invoicing' ),
676
-                'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
675
+                'name' => __('Subject', 'invoicing'),
676
+                'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
677 677
                 'type' => 'text',
678
-                'std'  => __( '[{site_title}] New payment invoice ({invoice_number}) - {invoice_date}', 'invoicing' ),
678
+                'std'  => __('[{site_title}] New payment invoice ({invoice_number}) - {invoice_date}', 'invoicing'),
679 679
                 'size' => 'large'
680 680
             ),
681 681
             'email_new_invoice_heading' => array(
682 682
                 'id'   => 'email_new_invoice_heading',
683
-                'name' => __( 'Email Heading', 'invoicing' ),
684
-                'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ),
683
+                'name' => __('Email Heading', 'invoicing'),
684
+                'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'),
685 685
                 'type' => 'text',
686
-                'std'  => __( 'New payment invoice', 'invoicing' ),
686
+                'std'  => __('New payment invoice', 'invoicing'),
687 687
                 'size' => 'large'
688 688
             ),
689 689
             'email_new_invoice_body' => array(
690 690
                 'id'   => 'email_new_invoice_body',
691
-                'name' => __( 'Email Content', 'invoicing' ),
692
-                'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ),
691
+                'name' => __('Email Content', 'invoicing'),
692
+                'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'),
693 693
                 'type' => 'rich_editor',
694
-                'std'  => __( '<p>Hi Admin,</p><p>You have received payment invoice from {name}.</p>', 'invoicing' ),
694
+                'std'  => __('<p>Hi Admin,</p><p>You have received payment invoice from {name}.</p>', 'invoicing'),
695 695
                 'class' => 'large',
696 696
                 'size' => '10'
697 697
             ),
@@ -699,39 +699,39 @@  discard block
 block discarded – undo
699 699
         'cancelled_invoice' => array(
700 700
             'email_cancelled_invoice_header' => array(
701 701
                 'id'   => 'email_cancelled_invoice_header',
702
-                'name' => '<h3>' . __( 'Cancelled Invoice', 'invoicing' ) . '</h3>',
703
-                'desc' => __( 'Cancelled invoice emails are sent to admin when invoices have been marked cancelled.', 'invoicing' ),
702
+                'name' => '<h3>' . __('Cancelled Invoice', 'invoicing') . '</h3>',
703
+                'desc' => __('Cancelled invoice emails are sent to admin when invoices have been marked cancelled.', 'invoicing'),
704 704
                 'type' => 'header',
705 705
             ),
706 706
             'email_cancelled_invoice_active' => array(
707 707
                 'id'   => 'email_cancelled_invoice_active',
708
-                'name' => __( 'Enable/Disable', 'invoicing' ),
709
-                'desc' => __( 'Enable this email notification', 'invoicing' ),
708
+                'name' => __('Enable/Disable', 'invoicing'),
709
+                'desc' => __('Enable this email notification', 'invoicing'),
710 710
                 'type' => 'checkbox',
711 711
                 'std'  => 1
712 712
             ),
713 713
             'email_cancelled_invoice_subject' => array(
714 714
                 'id'   => 'email_cancelled_invoice_subject',
715
-                'name' => __( 'Subject', 'invoicing' ),
716
-                'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
715
+                'name' => __('Subject', 'invoicing'),
716
+                'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
717 717
                 'type' => 'text',
718
-                'std'  => __( '[{site_title}] Cancelled invoice ({invoice_number})', 'invoicing' ),
718
+                'std'  => __('[{site_title}] Cancelled invoice ({invoice_number})', 'invoicing'),
719 719
                 'size' => 'large'
720 720
             ),
721 721
             'email_cancelled_invoice_heading' => array(
722 722
                 'id'   => 'email_cancelled_invoice_heading',
723
-                'name' => __( 'Email Heading', 'invoicing' ),
724
-                'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ),
723
+                'name' => __('Email Heading', 'invoicing'),
724
+                'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'),
725 725
                 'type' => 'text',
726
-                'std'  => __( 'Cancelled invoice', 'invoicing' ),
726
+                'std'  => __('Cancelled invoice', 'invoicing'),
727 727
                 'size' => 'large'
728 728
             ),
729 729
             'email_cancelled_invoice_body' => array(
730 730
                 'id'   => 'email_cancelled_invoice_body',
731
-                'name' => __( 'Email Content', 'invoicing' ),
732
-                'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ),
731
+                'name' => __('Email Content', 'invoicing'),
732
+                'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'),
733 733
                 'type' => 'rich_editor',
734
-                'std'  => __( '<p>Hi Admin,</p><p>The invoice #{invoice_number} from {site_title} has been cancelled.</p>', 'invoicing' ),
734
+                'std'  => __('<p>Hi Admin,</p><p>The invoice #{invoice_number} from {site_title} has been cancelled.</p>', 'invoicing'),
735 735
                 'class' => 'large',
736 736
                 'size' => '10'
737 737
             ),
@@ -739,39 +739,39 @@  discard block
 block discarded – undo
739 739
         'failed_invoice' => array(
740 740
             'email_failed_invoice_header' => array(
741 741
                 'id'   => 'email_failed_invoice_header',
742
-                'name' => '<h3>' . __( 'Failed Invoice', 'invoicing' ) . '</h3>',
743
-                'desc' => __( 'Failed invoice emails are sent to admin when invoices have been marked failed (if they were previously processing or on-hold).', 'invoicing' ),
742
+                'name' => '<h3>' . __('Failed Invoice', 'invoicing') . '</h3>',
743
+                'desc' => __('Failed invoice emails are sent to admin when invoices have been marked failed (if they were previously processing or on-hold).', 'invoicing'),
744 744
                 'type' => 'header',
745 745
             ),
746 746
             'email_failed_invoice_active' => array(
747 747
                 'id'   => 'email_failed_invoice_active',
748
-                'name' => __( 'Enable/Disable', 'invoicing' ),
749
-                'desc' => __( 'Enable this email notification', 'invoicing' ),
748
+                'name' => __('Enable/Disable', 'invoicing'),
749
+                'desc' => __('Enable this email notification', 'invoicing'),
750 750
                 'type' => 'checkbox',
751 751
                 'std'  => 1
752 752
             ),
753 753
             'email_failed_invoice_subject' => array(
754 754
                 'id'   => 'email_failed_invoice_subject',
755
-                'name' => __( 'Subject', 'invoicing' ),
756
-                'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
755
+                'name' => __('Subject', 'invoicing'),
756
+                'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
757 757
                 'type' => 'text',
758
-                'std'  => __( '[{site_title}] Failed invoice ({invoice_number})', 'invoicing' ),
758
+                'std'  => __('[{site_title}] Failed invoice ({invoice_number})', 'invoicing'),
759 759
                 'size' => 'large'
760 760
             ),
761 761
             'email_failed_invoice_heading' => array(
762 762
                 'id'   => 'email_failed_invoice_heading',
763
-                'name' => __( 'Email Heading', 'invoicing' ),
764
-                'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ),
763
+                'name' => __('Email Heading', 'invoicing'),
764
+                'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'),
765 765
                 'type' => 'text',
766
-                'std'  => __( 'Failed invoice', 'invoicing' ),
766
+                'std'  => __('Failed invoice', 'invoicing'),
767 767
                 'size' => 'large'
768 768
             ),
769 769
             'email_failed_invoice_body' => array(
770 770
                 'id'   => 'email_failed_invoice_body',
771
-                'name' => __( 'Email Content', 'invoicing' ),
772
-                'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ),
771
+                'name' => __('Email Content', 'invoicing'),
772
+                'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'),
773 773
                 'type' => 'rich_editor',
774
-                'std'  => __( '<p>Hi Admin,</p><p>Payment for invoice #{invoice_number} from {site_title} has been failed.</p>', 'invoicing' ),
774
+                'std'  => __('<p>Hi Admin,</p><p>Payment for invoice #{invoice_number} from {site_title} has been failed.</p>', 'invoicing'),
775 775
                 'class' => 'large',
776 776
                 'size' => '10'
777 777
             ),
@@ -779,46 +779,46 @@  discard block
 block discarded – undo
779 779
         'onhold_invoice' => array(
780 780
             'email_onhold_invoice_header' => array(
781 781
                 'id'   => 'email_onhold_invoice_header',
782
-                'name' => '<h3>' . __( 'On Hold Invoice', 'invoicing' ) . '</h3>',
783
-                'desc' => __( 'This is an invoice notification sent to users containing invoice details after an invoice is placed on-hold.', 'invoicing' ),
782
+                'name' => '<h3>' . __('On Hold Invoice', 'invoicing') . '</h3>',
783
+                'desc' => __('This is an invoice notification sent to users containing invoice details after an invoice is placed on-hold.', 'invoicing'),
784 784
                 'type' => 'header',
785 785
             ),
786 786
             'email_onhold_invoice_active' => array(
787 787
                 'id'   => 'email_onhold_invoice_active',
788
-                'name' => __( 'Enable/Disable', 'invoicing' ),
789
-                'desc' => __( 'Enable this email notification', 'invoicing' ),
788
+                'name' => __('Enable/Disable', 'invoicing'),
789
+                'desc' => __('Enable this email notification', 'invoicing'),
790 790
                 'type' => 'checkbox',
791 791
                 'std'  => 1
792 792
             ),
793 793
             'email_onhold_invoice_subject' => array(
794 794
                 'id'   => 'email_onhold_invoice_subject',
795
-                'name' => __( 'Subject', 'invoicing' ),
796
-                'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
795
+                'name' => __('Subject', 'invoicing'),
796
+                'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
797 797
                 'type' => 'text',
798
-                'std'  => __( '[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing' ),
798
+                'std'  => __('[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing'),
799 799
                 'size' => 'large'
800 800
             ),
801 801
             'email_onhold_invoice_heading' => array(
802 802
                 'id'   => 'email_onhold_invoice_heading',
803
-                'name' => __( 'Email Heading', 'invoicing' ),
804
-                'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ),
803
+                'name' => __('Email Heading', 'invoicing'),
804
+                'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'),
805 805
                 'type' => 'text',
806
-                'std'  => __( 'Thank you for your invoice', 'invoicing' ),
806
+                'std'  => __('Thank you for your invoice', 'invoicing'),
807 807
                 'size' => 'large'
808 808
             ),
809 809
             'email_onhold_invoice_admin_bcc' => array(
810 810
                 'id'   => 'email_onhold_invoice_admin_bcc',
811
-                'name' => __( 'Enable Admin BCC', 'invoicing' ),
812
-                'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ),
811
+                'name' => __('Enable Admin BCC', 'invoicing'),
812
+                'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'),
813 813
                 'type' => 'checkbox',
814 814
                 'std'  => 1
815 815
             ),
816 816
             'email_onhold_invoice_body' => array(
817 817
                 'id'   => 'email_onhold_invoice_body',
818
-                'name' => __( 'Email Content', 'invoicing' ),
819
-                'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ),
818
+                'name' => __('Email Content', 'invoicing'),
819
+                'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'),
820 820
                 'type' => 'rich_editor',
821
-                'std'  => __( '<p>Hi {name},</p><p>Your invoice is on-hold until we confirm your payment has been received.</p>', 'invoicing' ),
821
+                'std'  => __('<p>Hi {name},</p><p>Your invoice is on-hold until we confirm your payment has been received.</p>', 'invoicing'),
822 822
                 'class' => 'large',
823 823
                 'size' => '10'
824 824
             ),
@@ -826,46 +826,46 @@  discard block
 block discarded – undo
826 826
         'processing_invoice' => array(
827 827
             'email_processing_invoice_header' => array(
828 828
                 'id'   => 'email_processing_invoice_header',
829
-                'name' => '<h3>' . __( 'Processing Invoice', 'invoicing' ) . '</h3>',
830
-                'desc' => __( 'This is an invoice notification sent to users containing invoice details after payment.', 'invoicing' ),
829
+                'name' => '<h3>' . __('Processing Invoice', 'invoicing') . '</h3>',
830
+                'desc' => __('This is an invoice notification sent to users containing invoice details after payment.', 'invoicing'),
831 831
                 'type' => 'header',
832 832
             ),
833 833
             'email_processing_invoice_active' => array(
834 834
                 'id'   => 'email_processing_invoice_active',
835
-                'name' => __( 'Enable/Disable', 'invoicing' ),
836
-                'desc' => __( 'Enable this email notification', 'invoicing' ),
835
+                'name' => __('Enable/Disable', 'invoicing'),
836
+                'desc' => __('Enable this email notification', 'invoicing'),
837 837
                 'type' => 'checkbox',
838 838
                 'std'  => 1
839 839
             ),
840 840
             'email_processing_invoice_subject' => array(
841 841
                 'id'   => 'email_processing_invoice_subject',
842
-                'name' => __( 'Subject', 'invoicing' ),
843
-                'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
842
+                'name' => __('Subject', 'invoicing'),
843
+                'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
844 844
                 'type' => 'text',
845
-                'std'  => __( '[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing' ),
845
+                'std'  => __('[{site_title}] Your invoice receipt from {invoice_date}', 'invoicing'),
846 846
                 'size' => 'large'
847 847
             ),
848 848
             'email_processing_invoice_heading' => array(
849 849
                 'id'   => 'email_processing_invoice_heading',
850
-                'name' => __( 'Email Heading', 'invoicing' ),
851
-                'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ),
850
+                'name' => __('Email Heading', 'invoicing'),
851
+                'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'),
852 852
                 'type' => 'text',
853
-                'std'  => __( 'Thank you for your invoice', 'invoicing' ),
853
+                'std'  => __('Thank you for your invoice', 'invoicing'),
854 854
                 'size' => 'large'
855 855
             ),
856 856
             'email_processing_invoice_admin_bcc' => array(
857 857
                 'id'   => 'email_processing_invoice_admin_bcc',
858
-                'name' => __( 'Enable Admin BCC', 'invoicing' ),
859
-                'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ),
858
+                'name' => __('Enable Admin BCC', 'invoicing'),
859
+                'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'),
860 860
                 'type' => 'checkbox',
861 861
                 'std'  => 1
862 862
             ),
863 863
             'email_processing_invoice_body' => array(
864 864
                 'id'   => 'email_processing_invoice_body',
865
-                'name' => __( 'Email Content', 'invoicing' ),
866
-                'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ),
865
+                'name' => __('Email Content', 'invoicing'),
866
+                'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'),
867 867
                 'type' => 'rich_editor',
868
-                'std'  => __( '<p>Hi {name},</p><p>Your invoice has been received at {site_title} and is now being processed.</p>', 'invoicing' ),
868
+                'std'  => __('<p>Hi {name},</p><p>Your invoice has been received at {site_title} and is now being processed.</p>', 'invoicing'),
869 869
                 'class' => 'large',
870 870
                 'size' => '10'
871 871
             ),
@@ -873,52 +873,52 @@  discard block
 block discarded – undo
873 873
         'completed_invoice' => array(
874 874
             'email_completed_invoice_header' => array(
875 875
                 'id'   => 'email_completed_invoice_header',
876
-                'name' => '<h3>' . __( 'Paid Invoice', 'invoicing' ) . '</h3>',
877
-                'desc' => __( 'Invoice paid emails are sent to users when their invoices are marked paid and usually indicate that their payment has been done.', 'invoicing' ),
876
+                'name' => '<h3>' . __('Paid Invoice', 'invoicing') . '</h3>',
877
+                'desc' => __('Invoice paid emails are sent to users when their invoices are marked paid and usually indicate that their payment has been done.', 'invoicing'),
878 878
                 'type' => 'header',
879 879
             ),
880 880
             'email_completed_invoice_active' => array(
881 881
                 'id'   => 'email_completed_invoice_active',
882
-                'name' => __( 'Enable/Disable', 'invoicing' ),
883
-                'desc' => __( 'Enable this email notification', 'invoicing' ),
882
+                'name' => __('Enable/Disable', 'invoicing'),
883
+                'desc' => __('Enable this email notification', 'invoicing'),
884 884
                 'type' => 'checkbox',
885 885
                 'std'  => 1
886 886
             ),
887 887
             'email_completed_invoice_renewal_active' => array(
888 888
                 'id'   => 'email_completed_invoice_renewal_active',
889
-                'name' => __( 'Enable renewal notification', 'invoicing' ),
890
-                'desc' => __( 'Enable renewal invoice email notification. This notification will be sent on renewal.', 'invoicing' ),
889
+                'name' => __('Enable renewal notification', 'invoicing'),
890
+                'desc' => __('Enable renewal invoice email notification. This notification will be sent on renewal.', 'invoicing'),
891 891
                 'type' => 'checkbox',
892 892
                 'std'  => 0
893 893
             ),
894 894
             'email_completed_invoice_subject' => array(
895 895
                 'id'   => 'email_completed_invoice_subject',
896
-                'name' => __( 'Subject', 'invoicing' ),
897
-                'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
896
+                'name' => __('Subject', 'invoicing'),
897
+                'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
898 898
                 'type' => 'text',
899
-                'std'  => __( '[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing' ),
899
+                'std'  => __('[{site_title}] Your invoice from {invoice_date} has been paid', 'invoicing'),
900 900
                 'size' => 'large'
901 901
             ),
902 902
             'email_completed_invoice_heading' => array(
903 903
                 'id'   => 'email_completed_invoice_heading',
904
-                'name' => __( 'Email Heading', 'invoicing' ),
905
-                'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ),
904
+                'name' => __('Email Heading', 'invoicing'),
905
+                'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'),
906 906
                 'type' => 'text',
907
-                'std'  => __( 'Your invoice has been paid', 'invoicing' ),
907
+                'std'  => __('Your invoice has been paid', 'invoicing'),
908 908
                 'size' => 'large'
909 909
             ),
910 910
             'email_completed_invoice_admin_bcc' => array(
911 911
                 'id'   => 'email_completed_invoice_admin_bcc',
912
-                'name' => __( 'Enable Admin BCC', 'invoicing' ),
913
-                'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ),
912
+                'name' => __('Enable Admin BCC', 'invoicing'),
913
+                'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'),
914 914
                 'type' => 'checkbox',
915 915
             ),
916 916
             'email_completed_invoice_body' => array(
917 917
                 'id'   => 'email_completed_invoice_body',
918
-                'name' => __( 'Email Content', 'invoicing' ),
919
-                'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ),
918
+                'name' => __('Email Content', 'invoicing'),
919
+                'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'),
920 920
                 'type' => 'rich_editor',
921
-                'std'  => __( '<p>Hi {name},</p><p>Your recent invoice on {site_title} has been paid.</p>', 'invoicing' ),
921
+                'std'  => __('<p>Hi {name},</p><p>Your recent invoice on {site_title} has been paid.</p>', 'invoicing'),
922 922
                 'class' => 'large',
923 923
                 'size' => '10'
924 924
             ),
@@ -927,46 +927,46 @@  discard block
 block discarded – undo
927 927
         'refunded_invoice' => array(
928 928
             'email_refunded_invoice_header' => array(
929 929
                 'id'   => 'email_refunded_invoice_header',
930
-                'name' => '<h3>' . __( 'Refunded Invoice', 'invoicing' ) . '</h3>',
931
-                'desc' => __( 'Invoice refunded emails are sent to users when their invoices are marked refunded.', 'invoicing' ),
930
+                'name' => '<h3>' . __('Refunded Invoice', 'invoicing') . '</h3>',
931
+                'desc' => __('Invoice refunded emails are sent to users when their invoices are marked refunded.', 'invoicing'),
932 932
                 'type' => 'header',
933 933
             ),
934 934
             'email_refunded_invoice_active' => array(
935 935
                 'id'   => 'email_refunded_invoice_active',
936
-                'name' => __( 'Enable/Disable', 'invoicing' ),
937
-                'desc' => __( 'Enable this email notification', 'invoicing' ),
936
+                'name' => __('Enable/Disable', 'invoicing'),
937
+                'desc' => __('Enable this email notification', 'invoicing'),
938 938
                 'type' => 'checkbox',
939 939
                 'std'  => 1
940 940
             ),
941 941
             'email_refunded_invoice_subject' => array(
942 942
                 'id'   => 'email_refunded_invoice_subject',
943
-                'name' => __( 'Subject', 'invoicing' ),
944
-                'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
943
+                'name' => __('Subject', 'invoicing'),
944
+                'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
945 945
                 'type' => 'text',
946
-                'std'  => __( '[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing' ),
946
+                'std'  => __('[{site_title}] Your invoice from {invoice_date} has been refunded', 'invoicing'),
947 947
                 'size' => 'large'
948 948
             ),
949 949
             'email_refunded_invoice_heading' => array(
950 950
                 'id'   => 'email_refunded_invoice_heading',
951
-                'name' => __( 'Email Heading', 'invoicing' ),
952
-                'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ),
951
+                'name' => __('Email Heading', 'invoicing'),
952
+                'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'),
953 953
                 'type' => 'text',
954
-                'std'  => __( 'Your invoice has been refunded', 'invoicing' ),
954
+                'std'  => __('Your invoice has been refunded', 'invoicing'),
955 955
                 'size' => 'large'
956 956
             ),
957 957
             'email_refunded_invoice_admin_bcc' => array(
958 958
                 'id'   => 'email_refunded_invoice_admin_bcc',
959
-                'name' => __( 'Enable Admin BCC', 'invoicing' ),
960
-                'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ),
959
+                'name' => __('Enable Admin BCC', 'invoicing'),
960
+                'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'),
961 961
                 'type' => 'checkbox',
962 962
                 'std'  => 1
963 963
             ),
964 964
             'email_refunded_invoice_body' => array(
965 965
                 'id'   => 'email_refunded_invoice_body',
966
-                'name' => __( 'Email Content', 'invoicing' ),
967
-                'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ),
966
+                'name' => __('Email Content', 'invoicing'),
967
+                'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'),
968 968
                 'type' => 'rich_editor',
969
-                'std'  => __( '<p>Hi {name},</p><p>Your invoice on {site_title} has been refunded.</p>', 'invoicing' ),
969
+                'std'  => __('<p>Hi {name},</p><p>Your invoice on {site_title} has been refunded.</p>', 'invoicing'),
970 970
                 'class' => 'large',
971 971
                 'size' => '10'
972 972
             ),
@@ -974,46 +974,46 @@  discard block
 block discarded – undo
974 974
         'user_invoice' => array(
975 975
             'email_user_invoice_header' => array(
976 976
                 'id'   => 'email_user_invoice_header',
977
-                'name' => '<h3>' . __( 'Customer Invoice', 'invoicing' ) . '</h3>',
978
-                'desc' => __( 'Customer invoice emails can be sent to customers containing their invoice information and payment links.', 'invoicing' ),
977
+                'name' => '<h3>' . __('Customer Invoice', 'invoicing') . '</h3>',
978
+                'desc' => __('Customer invoice emails can be sent to customers containing their invoice information and payment links.', 'invoicing'),
979 979
                 'type' => 'header',
980 980
             ),
981 981
             'email_user_invoice_active' => array(
982 982
                 'id'   => 'email_user_invoice_active',
983
-                'name' => __( 'Enable/Disable', 'invoicing' ),
984
-                'desc' => __( 'Enable this email notification', 'invoicing' ),
983
+                'name' => __('Enable/Disable', 'invoicing'),
984
+                'desc' => __('Enable this email notification', 'invoicing'),
985 985
                 'type' => 'checkbox',
986 986
                 'std'  => 1
987 987
             ),
988 988
             'email_user_invoice_subject' => array(
989 989
                 'id'   => 'email_user_invoice_subject',
990
-                'name' => __( 'Subject', 'invoicing' ),
991
-                'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
990
+                'name' => __('Subject', 'invoicing'),
991
+                'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
992 992
                 'type' => 'text',
993
-                'std'  => __( '[{site_title}] Your invoice from {invoice_date}', 'invoicing' ),
993
+                'std'  => __('[{site_title}] Your invoice from {invoice_date}', 'invoicing'),
994 994
                 'size' => 'large'
995 995
             ),
996 996
             'email_user_invoice_heading' => array(
997 997
                 'id'   => 'email_user_invoice_heading',
998
-                'name' => __( 'Email Heading', 'invoicing' ),
999
-                'desc' => __( 'Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing' ),
998
+                'name' => __('Email Heading', 'invoicing'),
999
+                'desc' => __('Enter the main heading contained within the email notification for the invoice receipt email.', 'invoicing'),
1000 1000
                 'type' => 'text',
1001
-                'std'  => __( 'Your invoice {invoice_number} details', 'invoicing' ),
1001
+                'std'  => __('Your invoice {invoice_number} details', 'invoicing'),
1002 1002
                 'size' => 'large'
1003 1003
             ),
1004 1004
             'email_user_invoice_admin_bcc' => array(
1005 1005
                 'id'   => 'email_user_invoice_admin_bcc',
1006
-                'name' => __( 'Enable Admin BCC', 'invoicing' ),
1007
-                'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ),
1006
+                'name' => __('Enable Admin BCC', 'invoicing'),
1007
+                'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'),
1008 1008
                 'type' => 'checkbox',
1009 1009
                 'std'  => 1
1010 1010
             ),
1011 1011
             'email_user_invoice_body' => array(
1012 1012
                 'id'   => 'email_user_invoice_body',
1013
-                'name' => __( 'Email Content', 'invoicing' ),
1014
-                'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ),
1013
+                'name' => __('Email Content', 'invoicing'),
1014
+                'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'),
1015 1015
                 'type' => 'rich_editor',
1016
-                'std'  => __( '<p>Hi {name},</p><p>An invoice has been created for you on {site_title}. To view / pay for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing' ),
1016
+                'std'  => __('<p>Hi {name},</p><p>An invoice has been created for you on {site_title}. To view / pay for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing'),
1017 1017
                 'class' => 'large',
1018 1018
                 'size' => '10'
1019 1019
             ),
@@ -1021,39 +1021,39 @@  discard block
 block discarded – undo
1021 1021
         'user_note' => array(
1022 1022
             'email_user_note_header' => array(
1023 1023
                 'id'   => 'email_user_note_header',
1024
-                'name' => '<h3>' . __( 'Customer Note', 'invoicing' ) . '</h3>',
1025
-                'desc' => __( 'Customer note emails are sent when you add a note to an invoice/quote.', 'invoicing' ),
1024
+                'name' => '<h3>' . __('Customer Note', 'invoicing') . '</h3>',
1025
+                'desc' => __('Customer note emails are sent when you add a note to an invoice/quote.', 'invoicing'),
1026 1026
                 'type' => 'header',
1027 1027
             ),
1028 1028
             'email_user_note_active' => array(
1029 1029
                 'id'   => 'email_user_note_active',
1030
-                'name' => __( 'Enable/Disable', 'invoicing' ),
1031
-                'desc' => __( 'Enable this email notification', 'invoicing' ),
1030
+                'name' => __('Enable/Disable', 'invoicing'),
1031
+                'desc' => __('Enable this email notification', 'invoicing'),
1032 1032
                 'type' => 'checkbox',
1033 1033
                 'std'  => 1
1034 1034
             ),
1035 1035
             'email_user_note_subject' => array(
1036 1036
                 'id'   => 'email_user_note_subject',
1037
-                'name' => __( 'Subject', 'invoicing' ),
1038
-                'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
1037
+                'name' => __('Subject', 'invoicing'),
1038
+                'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
1039 1039
                 'type' => 'text',
1040
-                'std'  => __( '[{site_title}] Note added to your {invoice_label} #{invoice_number} from {invoice_date}', 'invoicing' ),
1040
+                'std'  => __('[{site_title}] Note added to your {invoice_label} #{invoice_number} from {invoice_date}', 'invoicing'),
1041 1041
                 'size' => 'large'
1042 1042
             ),
1043 1043
             'email_user_note_heading' => array(
1044 1044
                 'id'   => 'email_user_note_heading',
1045
-                'name' => __( 'Email Heading', 'invoicing' ),
1046
-                'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ),
1045
+                'name' => __('Email Heading', 'invoicing'),
1046
+                'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'),
1047 1047
                 'type' => 'text',
1048
-                'std'  => __( 'A note has been added to your {invoice_label}', 'invoicing' ),
1048
+                'std'  => __('A note has been added to your {invoice_label}', 'invoicing'),
1049 1049
                 'size' => 'large'
1050 1050
             ),
1051 1051
             'email_user_note_body' => array(
1052 1052
                 'id'   => 'email_user_note_body',
1053
-                'name' => __( 'Email Content', 'invoicing' ),
1054
-                'desc' => __( 'The content of the email (wildcards and HTML are allowed).', 'invoicing' ),
1053
+                'name' => __('Email Content', 'invoicing'),
1054
+                'desc' => __('The content of the email (wildcards and HTML are allowed).', 'invoicing'),
1055 1055
                 'type' => 'rich_editor',
1056
-                'std'  => __( '<p>Hi {name},</p><p>Following note has been added to your {invoice_label}:</p><blockquote class="wpinv-note">{customer_note}</blockquote>', 'invoicing' ),
1056
+                'std'  => __('<p>Hi {name},</p><p>Following note has been added to your {invoice_label}:</p><blockquote class="wpinv-note">{customer_note}</blockquote>', 'invoicing'),
1057 1057
                 'class' => 'large',
1058 1058
                 'size' => '10'
1059 1059
             ),
@@ -1062,165 +1062,165 @@  discard block
 block discarded – undo
1062 1062
         'overdue' => array(
1063 1063
             'email_overdue_header' => array(
1064 1064
                 'id'   => 'email_overdue_header',
1065
-                'name' => '<h3>' . __( 'Payment Reminder', 'invoicing' ) . '</h3>',
1066
-                'desc' => __( 'Payment reminder emails are sent to user automatically.', 'invoicing' ),
1065
+                'name' => '<h3>' . __('Payment Reminder', 'invoicing') . '</h3>',
1066
+                'desc' => __('Payment reminder emails are sent to user automatically.', 'invoicing'),
1067 1067
                 'type' => 'header',
1068 1068
             ),
1069 1069
             'email_overdue_active' => array(
1070 1070
                 'id'   => 'email_overdue_active',
1071
-                'name' => __( 'Enable/Disable', 'invoicing' ),
1072
-                'desc' => __( 'Enable this email notification', 'invoicing' ),
1071
+                'name' => __('Enable/Disable', 'invoicing'),
1072
+                'desc' => __('Enable this email notification', 'invoicing'),
1073 1073
                 'type' => 'checkbox',
1074 1074
                 'std'  => 1
1075 1075
             ),
1076 1076
             'email_due_reminder_days' => array(
1077 1077
                 'id'        => 'email_due_reminder_days',
1078
-                'name'      => __( 'When to Send', 'invoicing' ),
1079
-                'desc'      => __( 'Check when you would like payment reminders sent out.', 'invoicing' ),
1078
+                'name'      => __('When to Send', 'invoicing'),
1079
+                'desc'      => __('Check when you would like payment reminders sent out.', 'invoicing'),
1080 1080
                 'default'   => '',
1081 1081
                 'type'      => 'multicheck',
1082 1082
                 'options'   => $overdue_days_options,
1083 1083
             ),
1084 1084
             'email_overdue_subject' => array(
1085 1085
                 'id'   => 'email_overdue_subject',
1086
-                'name' => __( 'Subject', 'invoicing' ),
1087
-                'desc' => __( 'Enter the subject line for the invoice receipt email.', 'invoicing' ),
1086
+                'name' => __('Subject', 'invoicing'),
1087
+                'desc' => __('Enter the subject line for the invoice receipt email.', 'invoicing'),
1088 1088
                 'type' => 'text',
1089
-                'std'  => __( '[{site_title}] Payment Reminder', 'invoicing' ),
1089
+                'std'  => __('[{site_title}] Payment Reminder', 'invoicing'),
1090 1090
                 'size' => 'large'
1091 1091
             ),
1092 1092
             'email_overdue_heading' => array(
1093 1093
                 'id'   => 'email_overdue_heading',
1094
-                'name' => __( 'Email Heading', 'invoicing' ),
1095
-                'desc' => __( 'Enter the main heading contained within the email notification.', 'invoicing' ),
1094
+                'name' => __('Email Heading', 'invoicing'),
1095
+                'desc' => __('Enter the main heading contained within the email notification.', 'invoicing'),
1096 1096
                 'type' => 'text',
1097
-                'std'  => __( 'Payment reminder for your invoice', 'invoicing' ),
1097
+                'std'  => __('Payment reminder for your invoice', 'invoicing'),
1098 1098
                 'size' => 'large'
1099 1099
             ),
1100 1100
             'email_overdue_admin_bcc' => array(
1101 1101
                 'id'   => 'email_overdue_admin_bcc',
1102
-                'name' => __( 'Enable Admin BCC', 'invoicing' ),
1103
-                'desc' => __( 'Check if you want to send this notification email to site Admin.', 'invoicing' ),
1102
+                'name' => __('Enable Admin BCC', 'invoicing'),
1103
+                'desc' => __('Check if you want to send this notification email to site Admin.', 'invoicing'),
1104 1104
                 'type' => 'checkbox',
1105 1105
                 'std'  => 1
1106 1106
             ),
1107 1107
             'email_overdue_body' => array(
1108 1108
                 'id'   => 'email_overdue_body',
1109
-                'name' => __( 'Email Content', 'invoicing' ),
1110
-                'desc' => __( 'The content of the email.', 'invoicing' ),
1109
+                'name' => __('Email Content', 'invoicing'),
1110
+                'desc' => __('The content of the email.', 'invoicing'),
1111 1111
                 'type' => 'rich_editor',
1112
-                'std'  => __( '<p>Hi {full_name},</p><p>This is just a friendly reminder that your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To view / pay now for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing' ),
1112
+                'std'  => __('<p>Hi {full_name},</p><p>This is just a friendly reminder that your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To view / pay now for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing'),
1113 1113
                 'class' => 'large',
1114 1114
                 'size'  => 10,
1115 1115
             ),
1116 1116
         ),
1117 1117
     );
1118 1118
 
1119
-    return apply_filters( 'wpinv_get_emails', $emails );
1119
+    return apply_filters('wpinv_get_emails', $emails);
1120 1120
 }
1121 1121
 
1122
-function wpinv_settings_emails( $settings = array() ) {
1122
+function wpinv_settings_emails($settings = array()) {
1123 1123
     $emails = wpinv_get_emails();
1124 1124
 
1125
-    if ( !empty( $emails ) ) {
1126
-        foreach ( $emails as $key => $email ) {
1125
+    if (!empty($emails)) {
1126
+        foreach ($emails as $key => $email) {
1127 1127
             $settings[$key] = $email;
1128 1128
         }
1129 1129
     }
1130 1130
 
1131
-    return apply_filters( 'wpinv_settings_get_emails', $settings );
1131
+    return apply_filters('wpinv_settings_get_emails', $settings);
1132 1132
 }
1133
-add_filter( 'wpinv_settings_emails', 'wpinv_settings_emails', 10, 1 );
1133
+add_filter('wpinv_settings_emails', 'wpinv_settings_emails', 10, 1);
1134 1134
 
1135
-function wpinv_settings_sections_emails( $settings ) {
1135
+function wpinv_settings_sections_emails($settings) {
1136 1136
     $emails = wpinv_get_emails();
1137 1137
 
1138 1138
     if (!empty($emails)) {
1139
-        foreach  ($emails as $key => $email) {
1140
-            $settings[$key] = !empty( $email['email_' . $key . '_header']['name'] ) ? strip_tags( $email['email_' . $key . '_header']['name'] ) : $key;
1139
+        foreach ($emails as $key => $email) {
1140
+            $settings[$key] = !empty($email['email_' . $key . '_header']['name']) ? strip_tags($email['email_' . $key . '_header']['name']) : $key;
1141 1141
         }
1142 1142
     }
1143 1143
 
1144 1144
     return $settings;    
1145 1145
 }
1146
-add_filter( 'wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1 );
1146
+add_filter('wpinv_settings_sections_emails', 'wpinv_settings_sections_emails', 10, 1);
1147 1147
 
1148
-function wpinv_email_is_enabled( $email_type ) {
1148
+function wpinv_email_is_enabled($email_type) {
1149 1149
     $emails = wpinv_get_emails();
1150
-    $enabled = isset( $emails[$email_type] ) && wpinv_get_option( 'email_'. $email_type . '_active', 0 ) ? true : false;
1150
+    $enabled = isset($emails[$email_type]) && wpinv_get_option('email_' . $email_type . '_active', 0) ? true : false;
1151 1151
 
1152
-    return apply_filters( 'wpinv_email_is_enabled', $enabled, $email_type );
1152
+    return apply_filters('wpinv_email_is_enabled', $enabled, $email_type);
1153 1153
 }
1154 1154
 
1155
-function wpinv_email_get_recipient( $email_type = '', $invoice_id = 0, $invoice = array() ) {
1156
-    switch ( $email_type ) {
1155
+function wpinv_email_get_recipient($email_type = '', $invoice_id = 0, $invoice = array()) {
1156
+    switch ($email_type) {
1157 1157
         case 'new_invoice':
1158 1158
         case 'cancelled_invoice':
1159 1159
         case 'failed_invoice':
1160 1160
             $recipient  = wpinv_get_admin_email();
1161 1161
         break;
1162 1162
         default:
1163
-            $invoice    = !empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : NULL );
1164
-            $recipient  = !empty( $invoice ) ? $invoice->get_email() : '';
1163
+            $invoice    = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : NULL);
1164
+            $recipient  = !empty($invoice) ? $invoice->get_email() : '';
1165 1165
         break;
1166 1166
     }
1167 1167
 
1168
-    return apply_filters( 'wpinv_email_recipient', $recipient, $email_type, $invoice_id, $invoice );
1168
+    return apply_filters('wpinv_email_recipient', $recipient, $email_type, $invoice_id, $invoice);
1169 1169
 }
1170 1170
 
1171
-function wpinv_email_get_subject( $email_type = '', $invoice_id = 0, $invoice = array() ) {
1172
-    $subject    = wpinv_get_option( 'email_' . $email_type . '_subject' );
1173
-    $subject    = __( $subject, 'invoicing' );
1171
+function wpinv_email_get_subject($email_type = '', $invoice_id = 0, $invoice = array()) {
1172
+    $subject    = wpinv_get_option('email_' . $email_type . '_subject');
1173
+    $subject    = __($subject, 'invoicing');
1174 1174
 
1175
-    $subject    = wpinv_email_format_text( $subject, $invoice );
1175
+    $subject    = wpinv_email_format_text($subject, $invoice);
1176 1176
 
1177
-    return apply_filters( 'wpinv_email_subject', $subject, $email_type, $invoice_id, $invoice );
1177
+    return apply_filters('wpinv_email_subject', $subject, $email_type, $invoice_id, $invoice);
1178 1178
 }
1179 1179
 
1180
-function wpinv_email_get_heading( $email_type = '', $invoice_id = 0, $invoice = array() ) {
1181
-    $email_heading = wpinv_get_option( 'email_' . $email_type . '_heading' );
1182
-    $email_heading = __( $email_heading, 'invoicing' );
1180
+function wpinv_email_get_heading($email_type = '', $invoice_id = 0, $invoice = array()) {
1181
+    $email_heading = wpinv_get_option('email_' . $email_type . '_heading');
1182
+    $email_heading = __($email_heading, 'invoicing');
1183 1183
 
1184
-    $email_heading = wpinv_email_format_text( $email_heading, $invoice );
1184
+    $email_heading = wpinv_email_format_text($email_heading, $invoice);
1185 1185
 
1186
-    return apply_filters( 'wpinv_email_heading', $email_heading, $email_type, $invoice_id, $invoice );
1186
+    return apply_filters('wpinv_email_heading', $email_heading, $email_type, $invoice_id, $invoice);
1187 1187
 }
1188 1188
 
1189
-function wpinv_email_get_content( $email_type = '', $invoice_id = 0, $invoice = array() ) {
1190
-    $content    = wpinv_get_option( 'email_' . $email_type . '_body' );
1191
-    $content    = __( $content, 'invoicing' );
1189
+function wpinv_email_get_content($email_type = '', $invoice_id = 0, $invoice = array()) {
1190
+    $content    = wpinv_get_option('email_' . $email_type . '_body');
1191
+    $content    = __($content, 'invoicing');
1192 1192
 
1193
-    $content    = wpinv_email_format_text( $content, $invoice );
1193
+    $content    = wpinv_email_format_text($content, $invoice);
1194 1194
 
1195
-    return apply_filters( 'wpinv_email_content', $content, $email_type, $invoice_id, $invoice );
1195
+    return apply_filters('wpinv_email_content', $content, $email_type, $invoice_id, $invoice);
1196 1196
 }
1197 1197
 
1198
-function wpinv_email_get_headers( $email_type = '', $invoice_id = 0, $invoice = array() ) {
1198
+function wpinv_email_get_headers($email_type = '', $invoice_id = 0, $invoice = array()) {
1199 1199
     $from_name = wpinv_mail_get_from_address();
1200 1200
     $from_email = wpinv_mail_get_from_address();
1201 1201
     
1202
-    $invoice    = !empty( $invoice ) && is_object( $invoice ) ? $invoice : ( $invoice_id > 0 ? wpinv_get_invoice( $invoice_id ) : NULL );
1202
+    $invoice    = !empty($invoice) && is_object($invoice) ? $invoice : ($invoice_id > 0 ? wpinv_get_invoice($invoice_id) : NULL);
1203 1203
     
1204
-    $headers    = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
1205
-    $headers    .= "Reply-To: ". $from_email . "\r\n";
1204
+    $headers    = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <$from_email>\r\n";
1205
+    $headers    .= "Reply-To: " . $from_email . "\r\n";
1206 1206
     $headers    .= "Content-Type: " . wpinv_mail_get_content_type() . "\r\n";
1207 1207
     
1208
-    return apply_filters( 'wpinv_email_headers', $headers, $email_type, $invoice_id, $invoice );
1208
+    return apply_filters('wpinv_email_headers', $headers, $email_type, $invoice_id, $invoice);
1209 1209
 }
1210 1210
 
1211
-function wpinv_email_get_attachments( $email_type = '', $invoice_id = 0, $invoice = array() ) {
1211
+function wpinv_email_get_attachments($email_type = '', $invoice_id = 0, $invoice = array()) {
1212 1212
     $attachments = array();
1213 1213
     
1214
-    return apply_filters( 'wpinv_email_attachments', $attachments, $email_type, $invoice_id, $invoice );
1214
+    return apply_filters('wpinv_email_attachments', $attachments, $email_type, $invoice_id, $invoice);
1215 1215
 }
1216 1216
 
1217
-function wpinv_email_format_text( $content, $invoice ) {
1217
+function wpinv_email_format_text($content, $invoice) {
1218 1218
     $replace_array = array(
1219 1219
         '{site_title}'      => wpinv_get_blogname(),
1220
-        '{date}'            => date_i18n( get_option( 'date_format' ), (int) current_time( 'timestamp' ) ),
1220
+        '{date}'            => date_i18n(get_option('date_format'), (int) current_time('timestamp')),
1221 1221
     );
1222 1222
     
1223
-    if ( !empty( $invoice->ID ) ) {
1223
+    if (!empty($invoice->ID)) {
1224 1224
         $replace_array = array_merge(
1225 1225
             $replace_array, 
1226 1226
             array(
@@ -1230,65 +1230,65 @@  discard block
 block discarded – undo
1230 1230
                 '{last_name}'       => $invoice->get_last_name(),
1231 1231
                 '{email}'           => $invoice->get_email(),
1232 1232
                 '{invoice_number}'  => $invoice->get_number(),
1233
-                '{invoice_total}'   => $invoice->get_total( true ),
1234
-                '{invoice_link}'    => $invoice->get_view_url( true ),
1235
-                '{invoice_pay_link}'=> $invoice->get_view_url( true ),
1236
-                '{invoice_date}'    => $invoice->get_invoice_date( true ),
1237
-                '{invoice_due_date}'=> $invoice->get_due_date( true ),
1238
-                '{invoice_quote}'   => $invoice->get_invoice_quote_type( $invoice->ID ),
1239
-                '{invoice_label}'   => $invoice->get_invoice_quote_type( $invoice->ID ),
1240
-                '{is_was}'          => strtotime( $invoice->get_due_date() ) < strtotime( date_i18n( 'Y-m-d' ) ) ? __( 'was', 'invoicing' ) : __( 'is', 'invoicing' ),
1233
+                '{invoice_total}'   => $invoice->get_total(true),
1234
+                '{invoice_link}'    => $invoice->get_view_url(true),
1235
+                '{invoice_pay_link}'=> $invoice->get_view_url(true),
1236
+                '{invoice_date}'    => $invoice->get_invoice_date(true),
1237
+                '{invoice_due_date}'=> $invoice->get_due_date(true),
1238
+                '{invoice_quote}'   => $invoice->get_invoice_quote_type($invoice->ID),
1239
+                '{invoice_label}'   => $invoice->get_invoice_quote_type($invoice->ID),
1240
+                '{is_was}'          => strtotime($invoice->get_due_date()) < strtotime(date_i18n('Y-m-d')) ? __('was', 'invoicing') : __('is', 'invoicing'),
1241 1241
             )
1242 1242
         );
1243 1243
     }
1244 1244
 
1245
-    $replace_array = apply_filters( 'wpinv_email_format_text', $replace_array, $content, $invoice );
1245
+    $replace_array = apply_filters('wpinv_email_format_text', $replace_array, $content, $invoice);
1246 1246
 
1247
-    foreach ( $replace_array as $key => $value ) {
1248
-        $content = str_replace( $key, $value, $content );
1247
+    foreach ($replace_array as $key => $value) {
1248
+        $content = str_replace($key, $value, $content);
1249 1249
     }
1250 1250
 
1251
-    return apply_filters( 'wpinv_email_content_replace', $content );
1251
+    return apply_filters('wpinv_email_content_replace', $content);
1252 1252
 }
1253 1253
 
1254
-function wpinv_email_style_body( $content ) {
1254
+function wpinv_email_style_body($content) {
1255 1255
     // make sure we only inline CSS for html emails
1256
-    if ( in_array( wpinv_mail_get_content_type(), array( 'text/html', 'multipart/alternative' ) ) && class_exists( 'DOMDocument' ) ) {
1256
+    if (in_array(wpinv_mail_get_content_type(), array('text/html', 'multipart/alternative')) && class_exists('DOMDocument')) {
1257 1257
         ob_start();
1258
-        wpinv_get_template( 'emails/wpinv-email-styles.php' );
1259
-        $css = apply_filters( 'wpinv_email_styles', ob_get_clean() );
1258
+        wpinv_get_template('emails/wpinv-email-styles.php');
1259
+        $css = apply_filters('wpinv_email_styles', ob_get_clean());
1260 1260
 
1261 1261
         // apply CSS styles inline for picky email clients
1262 1262
         try {
1263
-            $emogrifier = new Emogrifier( $content, $css );
1263
+            $emogrifier = new Emogrifier($content, $css);
1264 1264
             $content    = $emogrifier->emogrify();
1265
-        } catch ( Exception $e ) {
1266
-            wpinv_error_log( $e->getMessage(), 'emogrifier' );
1265
+        } catch (Exception $e) {
1266
+            wpinv_error_log($e->getMessage(), 'emogrifier');
1267 1267
         }
1268 1268
     }
1269 1269
     return $content;
1270 1270
 }
1271 1271
 
1272
-function wpinv_email_header( $email_heading = '', $invoice = array(), $email_type = '', $sent_to_admin = false ) {
1273
-    wpinv_get_template( 'emails/wpinv-email-header.php', array( 'email_heading' => $email_heading, 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) );
1272
+function wpinv_email_header($email_heading = '', $invoice = array(), $email_type = '', $sent_to_admin = false) {
1273
+    wpinv_get_template('emails/wpinv-email-header.php', array('email_heading' => $email_heading, 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin));
1274 1274
 }
1275 1275
 
1276 1276
 /**
1277 1277
  * Get the email footer.
1278 1278
  */
1279
-function wpinv_email_footer( $invoice = array(), $email_type = '', $sent_to_admin = false ) {
1280
-    wpinv_get_template( 'emails/wpinv-email-footer.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) );
1279
+function wpinv_email_footer($invoice = array(), $email_type = '', $sent_to_admin = false) {
1280
+    wpinv_get_template('emails/wpinv-email-footer.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin));
1281 1281
 }
1282 1282
 
1283
-function wpinv_email_wrap_message( $message ) {
1283
+function wpinv_email_wrap_message($message) {
1284 1284
     // Buffer
1285 1285
     ob_start();
1286 1286
 
1287
-    do_action( 'wpinv_email_header' );
1287
+    do_action('wpinv_email_header');
1288 1288
 
1289
-    echo wpautop( wptexturize( $message ) );
1289
+    echo wpautop(wptexturize($message));
1290 1290
 
1291
-    do_action( 'wpinv_email_footer' );
1291
+    do_action('wpinv_email_footer');
1292 1292
 
1293 1293
     // Get contents
1294 1294
     $message = ob_get_clean();
@@ -1296,92 +1296,92 @@  discard block
 block discarded – undo
1296 1296
     return $message;
1297 1297
 }
1298 1298
 
1299
-function wpinv_email_invoice_details( $invoice, $email_type = '', $sent_to_admin = false ) {
1300
-    wpinv_get_template( 'emails/wpinv-email-invoice-details.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) );
1299
+function wpinv_email_invoice_details($invoice, $email_type = '', $sent_to_admin = false) {
1300
+    wpinv_get_template('emails/wpinv-email-invoice-details.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin));
1301 1301
 }
1302 1302
 
1303
-function wpinv_email_invoice_items( $invoice, $email_type = '', $sent_to_admin = false ) {
1304
-    wpinv_get_template( 'emails/wpinv-email-invoice-items.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) );
1303
+function wpinv_email_invoice_items($invoice, $email_type = '', $sent_to_admin = false) {
1304
+    wpinv_get_template('emails/wpinv-email-invoice-items.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin));
1305 1305
 }
1306 1306
 
1307
-function wpinv_email_billing_details( $invoice, $email_type = '', $sent_to_admin = false ) {
1308
-    wpinv_get_template( 'emails/wpinv-email-billing-details.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) );
1307
+function wpinv_email_billing_details($invoice, $email_type = '', $sent_to_admin = false) {
1308
+    wpinv_get_template('emails/wpinv-email-billing-details.php', array('invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin));
1309 1309
 }
1310 1310
 
1311
-function wpinv_send_customer_invoice( $data = array() ) {
1312
-    $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL;
1311
+function wpinv_send_customer_invoice($data = array()) {
1312
+    $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL;
1313 1313
 
1314
-    if ( empty( $invoice_id ) ) {
1314
+    if (empty($invoice_id)) {
1315 1315
         return;
1316 1316
     }
1317 1317
 
1318
-    if ( !wpinv_current_user_can_manage_invoicing() ) {
1319
-        wp_die( __( 'You do not have permission to send invoice notification', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) );
1318
+    if (!wpinv_current_user_can_manage_invoicing()) {
1319
+        wp_die(__('You do not have permission to send invoice notification', 'invoicing'), __('Error', 'invoicing'), array('response' => 403));
1320 1320
     }
1321 1321
     
1322
-    $sent = wpinv_user_invoice_notification( $invoice_id );
1322
+    $sent = wpinv_user_invoice_notification($invoice_id);
1323 1323
 
1324 1324
     if ( -1 === $sent ) {
1325 1325
         $status = 'email_disabled';
1326
-    } elseif ( $sent ) {
1326
+    } elseif ($sent) {
1327 1327
         $status = 'email_sent';
1328 1328
     } else {
1329 1329
         $status = 'email_fail';
1330 1330
     }
1331 1331
 
1332
-    $redirect = add_query_arg( array( 'wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false ) );
1333
-    wp_redirect( $redirect );
1332
+    $redirect = add_query_arg(array('wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false));
1333
+    wp_redirect($redirect);
1334 1334
     exit;
1335 1335
 }
1336
-add_action( 'wpinv_send_invoice', 'wpinv_send_customer_invoice' );
1336
+add_action('wpinv_send_invoice', 'wpinv_send_customer_invoice');
1337 1337
 
1338
-function wpinv_send_overdue_reminder( $data = array() ) {
1339
-    $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL;
1338
+function wpinv_send_overdue_reminder($data = array()) {
1339
+    $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL;
1340 1340
 
1341
-    if ( empty( $invoice_id ) ) {
1341
+    if (empty($invoice_id)) {
1342 1342
         return;
1343 1343
     }
1344 1344
 
1345
-    if ( !wpinv_current_user_can_manage_invoicing() ) {
1346
-        wp_die( __( 'You do not have permission to send reminder notification', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) );
1345
+    if (!wpinv_current_user_can_manage_invoicing()) {
1346
+        wp_die(__('You do not have permission to send reminder notification', 'invoicing'), __('Error', 'invoicing'), array('response' => 403));
1347 1347
     }
1348 1348
 
1349
-    $sent = wpinv_send_payment_reminder_notification( $invoice_id );
1349
+    $sent = wpinv_send_payment_reminder_notification($invoice_id);
1350 1350
     
1351 1351
     $status = $sent ? 'email_sent' : 'email_fail';
1352 1352
 
1353
-    $redirect = add_query_arg( array( 'wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false ) );
1354
-    wp_redirect( $redirect );
1353
+    $redirect = add_query_arg(array('wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false));
1354
+    wp_redirect($redirect);
1355 1355
     exit;
1356 1356
 }
1357
-add_action( 'wpinv_send_reminder', 'wpinv_send_overdue_reminder' );
1357
+add_action('wpinv_send_reminder', 'wpinv_send_overdue_reminder');
1358 1358
 
1359
-function wpinv_send_customer_note_email( $data ) {
1360
-    $invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL;
1359
+function wpinv_send_customer_note_email($data) {
1360
+    $invoice_id = !empty($data['invoice_id']) ? absint($data['invoice_id']) : NULL;
1361 1361
 
1362
-    if ( empty( $invoice_id ) ) {
1362
+    if (empty($invoice_id)) {
1363 1363
         return;
1364 1364
     }
1365 1365
 
1366
-    $sent = wpinv_user_note_notification( $invoice_id, $data );
1366
+    $sent = wpinv_user_note_notification($invoice_id, $data);
1367 1367
 }
1368
-add_action( 'wpinv_new_customer_note', 'wpinv_send_customer_note_email', 10, 1 );
1368
+add_action('wpinv_new_customer_note', 'wpinv_send_customer_note_email', 10, 1);
1369 1369
 
1370
-function wpinv_add_notes_to_invoice_email( $invoice, $email_type, $sent_to_admin ) {
1371
-    if ( !empty( $invoice ) && $email_type == 'user_invoice' && $invoice_notes = wpinv_get_invoice_notes( $invoice->ID, true ) ) {
1372
-        $date_format = get_option( 'date_format' );
1373
-        $time_format = get_option( 'time_format' );
1370
+function wpinv_add_notes_to_invoice_email($invoice, $email_type, $sent_to_admin) {
1371
+    if (!empty($invoice) && $email_type == 'user_invoice' && $invoice_notes = wpinv_get_invoice_notes($invoice->ID, true)) {
1372
+        $date_format = get_option('date_format');
1373
+        $time_format = get_option('time_format');
1374 1374
         ?>
1375 1375
         <div id="wpinv-email-notes">
1376
-            <h3 class="wpinv-notes-t"><?php echo apply_filters( 'wpinv_email_invoice_notes_title', __( 'Invoice Notes', 'invoicing' ) ); ?></h3>
1376
+            <h3 class="wpinv-notes-t"><?php echo apply_filters('wpinv_email_invoice_notes_title', __('Invoice Notes', 'invoicing')); ?></h3>
1377 1377
             <ol class="wpinv-notes-lists">
1378 1378
         <?php
1379
-        foreach ( $invoice_notes as $note ) {
1380
-            $note_time = strtotime( $note->comment_date );
1379
+        foreach ($invoice_notes as $note) {
1380
+            $note_time = strtotime($note->comment_date);
1381 1381
             ?>
1382 1382
             <li class="comment wpinv-note">
1383
-            <p class="wpinv-note-date meta"><?php printf( __( '%2$s at %3$s', 'invoicing' ), $note->comment_author, date_i18n( $date_format, $note_time ), date_i18n( $time_format, $note_time ), $note_time ); ?></p>
1384
-            <div class="wpinv-note-desc description"><?php echo wpautop( wptexturize( $note->comment_content ) ); ?></div>
1383
+            <p class="wpinv-note-date meta"><?php printf(__('%2$s at %3$s', 'invoicing'), $note->comment_author, date_i18n($date_format, $note_time), date_i18n($time_format, $note_time), $note_time); ?></p>
1384
+            <div class="wpinv-note-desc description"><?php echo wpautop(wptexturize($note->comment_content)); ?></div>
1385 1385
             </li>
1386 1386
             <?php
1387 1387
         }
@@ -1390,21 +1390,21 @@  discard block
 block discarded – undo
1390 1390
         <?php
1391 1391
     }
1392 1392
 }
1393
-add_action( 'wpinv_email_billing_details', 'wpinv_add_notes_to_invoice_email', 10, 3 );
1393
+add_action('wpinv_email_billing_details', 'wpinv_add_notes_to_invoice_email', 10, 3);
1394 1394
 
1395 1395
 function wpinv_email_payment_reminders() {
1396 1396
     global $wpi_auto_reminder;
1397
-    if ( !wpinv_get_option( 'email_overdue_active' ) ) {
1397
+    if (!wpinv_get_option('email_overdue_active')) {
1398 1398
         return;
1399 1399
     }
1400 1400
 
1401
-    if ( $reminder_days = wpinv_get_option( 'email_due_reminder_days' ) ) {
1402
-        $reminder_days  = is_array( $reminder_days ) ? array_values( $reminder_days ) : '';
1401
+    if ($reminder_days = wpinv_get_option('email_due_reminder_days')) {
1402
+        $reminder_days  = is_array($reminder_days) ? array_values($reminder_days) : '';
1403 1403
 
1404
-        if ( empty( $reminder_days ) ) {
1404
+        if (empty($reminder_days)) {
1405 1405
             return;
1406 1406
         }
1407
-        $reminder_days  = array_unique( array_map( 'absint', $reminder_days ) );
1407
+        $reminder_days = array_unique(array_map('absint', $reminder_days));
1408 1408
 
1409 1409
         $args = array(
1410 1410
             'post_type'     => 'wpi_invoice',
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
             'meta_query'    => array(
1415 1415
                 array(
1416 1416
                     'key'       =>  '_wpinv_due_date',
1417
-                    'value'     =>  array( '', 'none' ),
1417
+                    'value'     =>  array('', 'none'),
1418 1418
                     'compare'   =>  'NOT IN',
1419 1419
                 )
1420 1420
             ),
@@ -1423,149 +1423,149 @@  discard block
 block discarded – undo
1423 1423
             'order'         => 'ASC',
1424 1424
         );
1425 1425
 
1426
-        $invoices = get_posts( $args );
1426
+        $invoices = get_posts($args);
1427 1427
 
1428
-        if ( empty( $invoices ) ) {
1428
+        if (empty($invoices)) {
1429 1429
             return;
1430 1430
         }
1431 1431
 
1432
-        $date_to_send   = array();
1432
+        $date_to_send = array();
1433 1433
 
1434
-        foreach ( $invoices as $id ) {
1435
-            $due_date = get_post_meta( $id, '_wpinv_due_date', true );
1434
+        foreach ($invoices as $id) {
1435
+            $due_date = get_post_meta($id, '_wpinv_due_date', true);
1436 1436
 
1437
-            foreach ( $reminder_days as $key => $days ) {
1438
-                if ( $days !== '' ) {
1439
-                    $date_to_send[$id][] = date_i18n( 'Y-m-d', strtotime( $due_date ) + ( $days * DAY_IN_SECONDS ) );
1437
+            foreach ($reminder_days as $key => $days) {
1438
+                if ($days !== '') {
1439
+                    $date_to_send[$id][] = date_i18n('Y-m-d', strtotime($due_date) + ($days * DAY_IN_SECONDS));
1440 1440
                 }
1441 1441
             }
1442 1442
         }
1443 1443
 
1444
-        $today              = date_i18n( 'Y-m-d' );
1444
+        $today              = date_i18n('Y-m-d');
1445 1445
         $wpi_auto_reminder  = true;
1446 1446
 
1447
-        foreach ( $date_to_send as $id => $values ) {
1448
-            if ( in_array( $today, $values ) ) {
1449
-                $sent = get_post_meta( $id, '_wpinv_reminder_sent', true );
1447
+        foreach ($date_to_send as $id => $values) {
1448
+            if (in_array($today, $values)) {
1449
+                $sent = get_post_meta($id, '_wpinv_reminder_sent', true);
1450 1450
 
1451
-                if ( isset( $sent ) && !empty( $sent ) ) {
1452
-                    if ( !in_array( $today, $sent ) ) {
1453
-                        do_action( 'wpinv_send_payment_reminder_notification', $id );
1451
+                if (isset($sent) && !empty($sent)) {
1452
+                    if (!in_array($today, $sent)) {
1453
+                        do_action('wpinv_send_payment_reminder_notification', $id);
1454 1454
                     }
1455 1455
                 } else {
1456
-                    do_action( 'wpinv_send_payment_reminder_notification', $id );
1456
+                    do_action('wpinv_send_payment_reminder_notification', $id);
1457 1457
                 }
1458 1458
             }
1459 1459
         }
1460 1460
 
1461
-        $wpi_auto_reminder  = false;
1461
+        $wpi_auto_reminder = false;
1462 1462
     }
1463 1463
 }
1464 1464
 
1465
-function wpinv_send_payment_reminder_notification( $invoice_id ) {
1465
+function wpinv_send_payment_reminder_notification($invoice_id) {
1466 1466
     $email_type = 'overdue';
1467
-    if ( !wpinv_email_is_enabled( $email_type ) ) {
1467
+    if (!wpinv_email_is_enabled($email_type)) {
1468 1468
         return false;
1469 1469
     }
1470 1470
 
1471
-    $invoice    = wpinv_get_invoice( $invoice_id );
1472
-    if ( empty( $invoice ) ) {
1471
+    $invoice = wpinv_get_invoice($invoice_id);
1472
+    if (empty($invoice)) {
1473 1473
         return false;
1474 1474
     }
1475 1475
 
1476
-    if ( !$invoice->needs_payment() ) {
1476
+    if (!$invoice->needs_payment()) {
1477 1477
         return false;
1478 1478
     }
1479 1479
 
1480
-    $recipient  = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice );
1481
-    if ( !is_email( $recipient ) ) {
1480
+    $recipient = wpinv_email_get_recipient($email_type, $invoice_id, $invoice);
1481
+    if (!is_email($recipient)) {
1482 1482
         return false;
1483 1483
     }
1484 1484
 
1485
-    do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type );
1485
+    do_action('wpinv_pre_send_invoice_notification', $invoice, $email_type);
1486 1486
 
1487
-    $subject        = wpinv_email_get_subject( $email_type, $invoice_id, $invoice );
1488
-    $email_heading  = wpinv_email_get_heading( $email_type, $invoice_id, $invoice );
1489
-    $headers        = wpinv_email_get_headers( $email_type, $invoice_id, $invoice );
1490
-    $message_body   = wpinv_email_get_content( $email_type, $invoice_id, $invoice );
1491
-    $attachments    = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice );
1487
+    $subject        = wpinv_email_get_subject($email_type, $invoice_id, $invoice);
1488
+    $email_heading  = wpinv_email_get_heading($email_type, $invoice_id, $invoice);
1489
+    $headers        = wpinv_email_get_headers($email_type, $invoice_id, $invoice);
1490
+    $message_body   = wpinv_email_get_content($email_type, $invoice_id, $invoice);
1491
+    $attachments    = wpinv_email_get_attachments($email_type, $invoice_id, $invoice);
1492 1492
 
1493
-    $content        = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array(
1493
+    $content        = wpinv_get_template_html('emails/wpinv-email-' . $email_type . '.php', array(
1494 1494
             'invoice'       => $invoice,
1495 1495
             'email_type'    => $email_type,
1496 1496
             'email_heading' => $email_heading,
1497 1497
             'sent_to_admin' => false,
1498 1498
             'plain_text'    => false,
1499 1499
             'message_body'  => $message_body
1500
-        ) );
1500
+        ));
1501 1501
 
1502
-    $content        = wpinv_email_format_text( $content, $invoice );
1502
+    $content = wpinv_email_format_text($content, $invoice);
1503 1503
 
1504
-    $sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
1505
-    if ( $sent ) {
1506
-        do_action( 'wpinv_payment_reminder_sent', $invoice_id, $invoice );
1504
+    $sent = wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
1505
+    if ($sent) {
1506
+        do_action('wpinv_payment_reminder_sent', $invoice_id, $invoice);
1507 1507
     }
1508 1508
 
1509
-    if ( wpinv_mail_admin_bcc_active( $email_type ) ) {
1510
-        $recipient  = wpinv_get_admin_email();
1511
-        $subject    .= ' - ADMIN BCC COPY';
1512
-        wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments );
1509
+    if (wpinv_mail_admin_bcc_active($email_type)) {
1510
+        $recipient = wpinv_get_admin_email();
1511
+        $subject .= ' - ADMIN BCC COPY';
1512
+        wpinv_mail_send($recipient, $subject, $content, $headers, $attachments);
1513 1513
     }
1514 1514
 
1515
-    do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type );
1515
+    do_action('wpinv_post_send_invoice_notification', $invoice, $email_type);
1516 1516
 
1517 1517
     return $sent;
1518 1518
 }
1519
-add_action( 'wpinv_send_payment_reminder_notification', 'wpinv_send_payment_reminder_notification', 10, 1 );
1519
+add_action('wpinv_send_payment_reminder_notification', 'wpinv_send_payment_reminder_notification', 10, 1);
1520 1520
 
1521
-function wpinv_payment_reminder_sent( $invoice_id, $invoice ) {
1521
+function wpinv_payment_reminder_sent($invoice_id, $invoice) {
1522 1522
     global $wpi_auto_reminder;
1523 1523
 
1524
-    $sent = get_post_meta( $invoice_id, '_wpinv_reminder_sent', true );
1524
+    $sent = get_post_meta($invoice_id, '_wpinv_reminder_sent', true);
1525 1525
 
1526
-    if ( empty( $sent ) ) {
1526
+    if (empty($sent)) {
1527 1527
         $sent = array();
1528 1528
     }
1529
-    $sent[] = date_i18n( 'Y-m-d' );
1529
+    $sent[] = date_i18n('Y-m-d');
1530 1530
 
1531
-    update_post_meta( $invoice_id, '_wpinv_reminder_sent', $sent );
1531
+    update_post_meta($invoice_id, '_wpinv_reminder_sent', $sent);
1532 1532
 
1533
-    if ( $wpi_auto_reminder ) { // Auto reminder note.
1534
-        $note = __( 'Automated reminder sent to the user.', 'invoicing' );
1535
-        $invoice->add_note( $note, false, false, true );
1533
+    if ($wpi_auto_reminder) { // Auto reminder note.
1534
+        $note = __('Automated reminder sent to the user.', 'invoicing');
1535
+        $invoice->add_note($note, false, false, true);
1536 1536
     } else { // Menual reminder note.
1537
-        $note = __( 'Manual reminder sent to the user.', 'invoicing' );
1538
-        $invoice->add_note( $note );
1537
+        $note = __('Manual reminder sent to the user.', 'invoicing');
1538
+        $invoice->add_note($note);
1539 1539
     }
1540 1540
 }
1541
-add_action( 'wpinv_payment_reminder_sent', 'wpinv_payment_reminder_sent', 10, 2 );
1541
+add_action('wpinv_payment_reminder_sent', 'wpinv_payment_reminder_sent', 10, 2);
1542 1542
 
1543
-function wpinv_invoice_notification_set_locale( $invoice, $email_type, $site = false ) {
1544
-    if ( empty( $invoice ) ) {
1543
+function wpinv_invoice_notification_set_locale($invoice, $email_type, $site = false) {
1544
+    if (empty($invoice)) {
1545 1545
         return;
1546 1546
     }
1547 1547
 
1548
-    if ( is_int( $invoice ) ) {
1549
-        $invoice = wpinv_get_invoice( $invoice );
1548
+    if (is_int($invoice)) {
1549
+        $invoice = wpinv_get_invoice($invoice);
1550 1550
     }
1551 1551
 
1552
-    if ( ! empty( $invoice ) && is_object( $invoice ) ) {
1553
-        if ( ! $site && function_exists( 'get_user_locale' ) ) {
1554
-            $locale = get_user_locale( $invoice->get_user_id() );
1552
+    if (!empty($invoice) && is_object($invoice)) {
1553
+        if (!$site && function_exists('get_user_locale')) {
1554
+            $locale = get_user_locale($invoice->get_user_id());
1555 1555
         } else {
1556 1556
             $locale = get_locale();
1557 1557
         }
1558 1558
 
1559
-        wpinv_switch_to_locale( $locale );
1559
+        wpinv_switch_to_locale($locale);
1560 1560
     }
1561 1561
 }
1562
-add_action( 'wpinv_pre_send_invoice_notification', 'wpinv_invoice_notification_set_locale', 10, 3 );
1562
+add_action('wpinv_pre_send_invoice_notification', 'wpinv_invoice_notification_set_locale', 10, 3);
1563 1563
 
1564
-function wpinv_invoice_notification_restore_locale( $invoice, $email_type, $site = false ) {
1565
-    if ( empty( $invoice ) ) {
1564
+function wpinv_invoice_notification_restore_locale($invoice, $email_type, $site = false) {
1565
+    if (empty($invoice)) {
1566 1566
         return;
1567 1567
     }
1568 1568
 
1569 1569
     wpinv_restore_locale();
1570 1570
 }
1571
-add_action( 'wpinv_post_send_invoice_notification', 'wpinv_invoice_notification_restore_locale', 10, 3 );
1571
+add_action('wpinv_post_send_invoice_notification', 'wpinv_invoice_notification_restore_locale', 10, 3);
Please login to merge, or discard this patch.
includes/class-wpinv.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
172 172
         require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
173 173
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
174
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
175
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
176
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
177
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
178
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
174
+        require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
175
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
176
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
177
+        require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
178
+        require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
179 179
         require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
180 180
         require_once( WPINV_PLUGIN_DIR . 'widgets/payment-form.php' );
181 181
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' );
@@ -491,19 +491,19 @@  discard block
 block discarded – undo
491 491
         require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
492 492
     }
493 493
 
494
-	/**
495
-	 * Register widgets
496
-	 *
497
-	 */
498
-	public function register_widgets() {
499
-		register_widget( "WPInv_Checkout_Widget" );
500
-		register_widget( "WPInv_History_Widget" );
501
-		register_widget( "WPInv_Receipt_Widget" );
502
-		register_widget( "WPInv_Subscriptions_Widget" );
503
-		register_widget( "WPInv_Buy_Item_Widget" );
494
+    /**
495
+     * Register widgets
496
+     *
497
+     */
498
+    public function register_widgets() {
499
+        register_widget( "WPInv_Checkout_Widget" );
500
+        register_widget( "WPInv_History_Widget" );
501
+        register_widget( "WPInv_Receipt_Widget" );
502
+        register_widget( "WPInv_Subscriptions_Widget" );
503
+        register_widget( "WPInv_Buy_Item_Widget" );
504 504
         register_widget( "WPInv_Messages_Widget" );
505 505
         register_widget( 'WPInv_Payment_Form_Widget' );
506
-	}
506
+    }
507 507
     
508 508
     /**
509 509
      * Remove our pages from yoast sitemaps.
Please login to merge, or discard this patch.
Spacing   +244 added lines, -244 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
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 14
 class WPInv_Plugin {
15 15
     private static $instance;
16 16
     
17 17
     public static function run() {
18
-        if ( !isset( self::$instance ) && !( self::$instance instanceof WPInv_Plugin ) ) {
18
+        if (!isset(self::$instance) && !(self::$instance instanceof WPInv_Plugin)) {
19 19
             self::$instance = new WPInv_Plugin;
20 20
             self::$instance->includes();
21 21
             self::$instance->actions();
@@ -33,34 +33,34 @@  discard block
 block discarded – undo
33 33
     }
34 34
     
35 35
     public function define_constants() {
36
-        define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) );
37
-        define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) );
36
+        define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE));
37
+        define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE));
38 38
     }
39 39
     
40 40
     private function actions() {
41 41
         /* Internationalize the text strings used. */
42
-        add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) );
42
+        add_action('plugins_loaded', array(&$this, 'plugins_loaded'));
43 43
         
44 44
         /* Perform actions on admin initialization. */
45
-        add_action( 'admin_init', array( &$this, 'admin_init') );
46
-        add_action( 'init', array( &$this, 'init' ), 3 );
47
-        add_action( 'init', array( &$this, 'wpinv_actions' ) );
45
+        add_action('admin_init', array(&$this, 'admin_init'));
46
+        add_action('init', array(&$this, 'init'), 3);
47
+        add_action('init', array(&$this, 'wpinv_actions'));
48 48
         
49
-        if ( class_exists( 'BuddyPress' ) ) {
50
-            add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) );
49
+        if (class_exists('BuddyPress')) {
50
+            add_action('bp_include', array(&$this, 'bp_invoicing_init'));
51 51
         }
52 52
 
53
-        add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
54
-        add_action( 'widgets_init', array( &$this, 'register_widgets' ) );
55
-        add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) );
53
+        add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts'));
54
+        add_action('widgets_init', array(&$this, 'register_widgets'));
55
+        add_filter('wpseo_exclude_from_sitemap_by_post_ids', array($this, 'wpseo_exclude_from_sitemap_by_post_ids'));
56 56
 
57
-        if ( is_admin() ) {
58
-            add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
59
-            add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ) );
60
-            add_action( 'admin_init', array( &$this, 'init_ayecode_connect_helper' ) );
57
+        if (is_admin()) {
58
+            add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
59
+            add_filter('admin_body_class', array(&$this, 'admin_body_class'));
60
+            add_action('admin_init', array(&$this, 'init_ayecode_connect_helper'));
61 61
 
62 62
         } else {
63
-            add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
63
+            add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
64 64
         }
65 65
         
66 66
         /**
@@ -70,28 +70,28 @@  discard block
 block discarded – undo
70 70
          *
71 71
          * @param WPInv_Plugin $this. Current WPInv_Plugin instance. Passed by reference.
72 72
          */
73
-        do_action_ref_array( 'wpinv_actions', array( &$this ) );
73
+        do_action_ref_array('wpinv_actions', array(&$this));
74 74
 
75
-        add_action( 'admin_init', array( &$this, 'activation_redirect') );
75
+        add_action('admin_init', array(&$this, 'activation_redirect'));
76 76
     }
77 77
 
78 78
     /**
79 79
      * Maybe show the AyeCode Connect Notice.
80 80
      */
81
-    public function init_ayecode_connect_helper(){
81
+    public function init_ayecode_connect_helper() {
82 82
         // AyeCode Connect notice
83
-        if ( is_admin() ){
83
+        if (is_admin()) {
84 84
             // set the strings so they can be translated
85 85
             $strings = array(
86
-                'connect_title' => __("WP Invoicing - an AyeCode product!","invoicing"),
87
-                'connect_external'  => __( "Please confirm you wish to connect your site?","invoicing" ),
88
-                'connect'           => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s","invoicing" ),"<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>","</a>" ),
89
-                'connect_button'    => __("Connect Site","invoicing"),
90
-                'connecting_button'    => __("Connecting...","invoicing"),
91
-                'error_localhost'   => __( "This service will only work with a live domain, not a localhost.","invoicing" ),
92
-                'error'             => __( "Something went wrong, please refresh and try again.","invoicing" ),
86
+                'connect_title' => __("WP Invoicing - an AyeCode product!", "invoicing"),
87
+                'connect_external'  => __("Please confirm you wish to connect your site?", "invoicing"),
88
+                'connect'           => sprintf(__("<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", "invoicing"), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>"),
89
+                'connect_button'    => __("Connect Site", "invoicing"),
90
+                'connecting_button'    => __("Connecting...", "invoicing"),
91
+                'error_localhost'   => __("This service will only work with a live domain, not a localhost.", "invoicing"),
92
+                'error'             => __("Something went wrong, please refresh and try again.", "invoicing"),
93 93
             );
94
-            new AyeCode_Connect_Helper($strings,array('wpi-addons'));
94
+            new AyeCode_Connect_Helper($strings, array('wpi-addons'));
95 95
         }
96 96
     }
97 97
     
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
         /* Internationalize the text strings used. */
100 100
         $this->load_textdomain();
101 101
 
102
-        do_action( 'wpinv_loaded' );
102
+        do_action('wpinv_loaded');
103 103
 
104 104
         // Fix oxygen page builder conflict
105
-        if ( function_exists( 'ct_css_output' ) ) {
105
+        if (function_exists('ct_css_output')) {
106 106
             wpinv_oxygen_fix_conflict();
107 107
         }
108 108
     }
@@ -112,237 +112,237 @@  discard block
 block discarded – undo
112 112
      *
113 113
      * @since 1.0
114 114
      */
115
-    public function load_textdomain( $locale = NULL ) {
116
-        if ( empty( $locale ) ) {
117
-            $locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
115
+    public function load_textdomain($locale = NULL) {
116
+        if (empty($locale)) {
117
+            $locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
118 118
         }
119 119
 
120
-        $locale = apply_filters( 'plugin_locale', $locale, 'invoicing' );
120
+        $locale = apply_filters('plugin_locale', $locale, 'invoicing');
121 121
         
122
-        unload_textdomain( 'invoicing' );
123
-        load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' );
124
-        load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' );
122
+        unload_textdomain('invoicing');
123
+        load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo');
124
+        load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages');
125 125
         
126 126
         /**
127 127
          * Define language constants.
128 128
          */
129
-        require_once( WPINV_PLUGIN_DIR . 'language.php' );
129
+        require_once(WPINV_PLUGIN_DIR . 'language.php');
130 130
     }
131 131
         
132 132
     public function includes() {
133 133
         global $wpinv_options;
134 134
         
135
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' );
135
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php');
136 136
         $wpinv_options = wpinv_get_settings();
137 137
         
138
-        require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' );
139
-        require_once( WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php' );
140
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' );
141
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' );
142
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' );
143
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' );
144
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' );
145
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' );
146
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php' );
147
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' );
148
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' );
149
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' );
150
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' );
151
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' );
152
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php' );
153
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php' );
154
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php' );
155
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php' );
156
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php' );
157
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php' );
158
-        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' );
159
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' );
160
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' );
161
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' );
162
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php' );
163
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' );
164
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' );
165
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
166
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' );
167
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php' );
168
-        require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' );
169
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php' );
170
-        require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' );
171
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
172
-        require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
173
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
174
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
175
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
176
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
177
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
178
-	    require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
179
-        require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
180
-        require_once( WPINV_PLUGIN_DIR . 'widgets/payment-form.php' );
181
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php' );
182
-
183
-        if ( !class_exists( 'WPInv_EUVat' ) ) {
184
-            require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' );
138
+        require_once(WPINV_PLUGIN_DIR . 'vendor/autoload.php');
139
+        require_once(WPINV_PLUGIN_DIR . 'includes/libraries/action-scheduler/action-scheduler.php');
140
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php');
141
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php');
142
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php');
143
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php');
144
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php');
145
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php');
146
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-invoice-functions.php');
147
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php');
148
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php');
149
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php');
150
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php');
151
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php');
152
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-error-functions.php');
153
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-post-types.php');
154
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-invoice.php');
155
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-discount.php');
156
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-item.php');
157
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-notes.php');
158
+        require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php');
159
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php');
160
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php');
161
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php');
162
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-reports.php');
163
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php');
164
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php');
165
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php');
166
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php');
167
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions.php');
168
+        require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php');
169
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-subscriptions-list-table.php');
170
+        require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php');
171
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php');
172
+        require_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php');
173
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php');
174
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/checkout.php');
175
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-history.php');
176
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php');
177
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php');
178
+	    require_once(WPINV_PLUGIN_DIR . 'widgets/subscriptions.php');
179
+        require_once(WPINV_PLUGIN_DIR . 'widgets/buy-item.php');
180
+        require_once(WPINV_PLUGIN_DIR . 'widgets/payment-form.php');
181
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-payment-form-elements.php');
182
+
183
+        if (!class_exists('WPInv_EUVat')) {
184
+            require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php');
185 185
         }
186 186
         
187
-        $gateways = array_keys( wpinv_get_enabled_payment_gateways() );
188
-        if ( !empty( $gateways ) ) {
189
-            foreach ( $gateways as $gateway ) {
190
-                if ( $gateway == 'manual' ) {
187
+        $gateways = array_keys(wpinv_get_enabled_payment_gateways());
188
+        if (!empty($gateways)) {
189
+            foreach ($gateways as $gateway) {
190
+                if ($gateway == 'manual') {
191 191
                     continue;
192 192
                 }
193 193
                 
194 194
                 $gateway_file = WPINV_PLUGIN_DIR . 'includes/gateways/' . $gateway . '.php';
195 195
                 
196
-                if ( file_exists( $gateway_file ) ) {
197
-                    require_once( $gateway_file );
196
+                if (file_exists($gateway_file)) {
197
+                    require_once($gateway_file);
198 198
                 }
199 199
             }
200 200
         }
201
-        require_once( WPINV_PLUGIN_DIR . 'includes/gateways/manual.php' );
201
+        require_once(WPINV_PLUGIN_DIR . 'includes/gateways/manual.php');
202 202
         
203
-        if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
204
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' );
205
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' );
206
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php' );
203
+        if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
204
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php');
205
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php');
206
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-meta-boxes.php');
207 207
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-recurring-admin.php' );
208
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php' );
209
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php' );
210
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' );
211
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' );
212
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php' );
213
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' );
214
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' );
215
-            require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' );
208
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-details.php');
209
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-items.php');
210
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php');
211
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php');
212
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-address.php');
213
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php');
214
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php');
215
+            require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php');
216 216
             //require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
217 217
             // load the user class only on the users.php page
218 218
             global $pagenow;
219
-            if($pagenow=='users.php'){
219
+            if ($pagenow == 'users.php') {
220 220
                 new WPInv_Admin_Users();
221 221
             }
222 222
         }
223 223
 
224 224
         // Register cli commands
225
-        if ( defined( 'WP_CLI' ) && WP_CLI ) {
226
-            require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' );
227
-            WP_CLI::add_command( 'invoicing', 'WPInv_CLI' );
225
+        if (defined('WP_CLI') && WP_CLI) {
226
+            require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php');
227
+            WP_CLI::add_command('invoicing', 'WPInv_CLI');
228 228
         }
229 229
         
230 230
         // include css inliner
231
-        if ( ! class_exists( 'Emogrifier' ) && class_exists( 'DOMDocument' ) ) {
232
-            include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' );
231
+        if (!class_exists('Emogrifier') && class_exists('DOMDocument')) {
232
+            include_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php');
233 233
         }
234 234
         
235
-        require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' );
235
+        require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php');
236 236
     }
237 237
     
238 238
     public function init() {
239 239
     }
240 240
     
241 241
     public function admin_init() {
242
-        add_action( 'admin_print_scripts-edit.php', array( &$this, 'admin_print_scripts_edit_php' ) );
242
+        add_action('admin_print_scripts-edit.php', array(&$this, 'admin_print_scripts_edit_php'));
243 243
     }
244 244
 
245 245
     public function activation_redirect() {
246 246
         // Bail if no activation redirect
247
-        if ( !get_transient( '_wpinv_activation_redirect' ) ) {
247
+        if (!get_transient('_wpinv_activation_redirect')) {
248 248
             return;
249 249
         }
250 250
 
251 251
         // Delete the redirect transient
252
-        delete_transient( '_wpinv_activation_redirect' );
252
+        delete_transient('_wpinv_activation_redirect');
253 253
 
254 254
         // Bail if activating from network, or bulk
255
-        if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
255
+        if (is_network_admin() || isset($_GET['activate-multi'])) {
256 256
             return;
257 257
         }
258 258
 
259
-        wp_safe_redirect( admin_url( 'admin.php?page=wpinv-settings&tab=general' ) );
259
+        wp_safe_redirect(admin_url('admin.php?page=wpinv-settings&tab=general'));
260 260
         exit;
261 261
     }
262 262
     
263 263
     public function enqueue_scripts() {
264
-        $suffix       = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
264
+        $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
265 265
         
266
-        wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION );
267
-        wp_enqueue_style( 'wpinv_front_style' );
266
+        wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), WPINV_VERSION);
267
+        wp_enqueue_style('wpinv_front_style');
268 268
                
269 269
         // Register scripts
270
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
271
-        wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array( 'jquery' ),  filemtime( WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js' ) );
270
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
271
+        wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array('jquery'), filemtime(WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js'));
272 272
 
273 273
         $localize                         = array();
274
-        $localize['ajax_url']             = admin_url( 'admin-ajax.php' );
275
-        $localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
274
+        $localize['ajax_url']             = admin_url('admin-ajax.php');
275
+        $localize['nonce']                = wp_create_nonce('wpinv-nonce');
276 276
         $localize['currency_symbol']      = wpinv_currency_symbol();
277 277
         $localize['currency_pos']         = wpinv_currency_position();
278 278
         $localize['thousand_sep']         = wpinv_thousands_separator();
279 279
         $localize['decimal_sep']          = wpinv_decimal_separator();
280 280
         $localize['decimals']             = wpinv_decimals();
281
-        $localize['txtComplete']          = __( 'Complete', 'invoicing' );
281
+        $localize['txtComplete']          = __('Complete', 'invoicing');
282 282
         $localize['UseTaxes']             = wpinv_use_taxes();
283
-        $localize['checkoutNonce']        = wp_create_nonce( 'wpinv_checkout_nonce' );
283
+        $localize['checkoutNonce']        = wp_create_nonce('wpinv_checkout_nonce');
284 284
 
285
-        $localize = apply_filters( 'wpinv_front_js_localize', $localize );
285
+        $localize = apply_filters('wpinv_front_js_localize', $localize);
286 286
         
287
-        wp_enqueue_script( 'jquery-blockui' );
287
+        wp_enqueue_script('jquery-blockui');
288 288
         $autofill_api = wpinv_get_option('address_autofill_api');
289 289
         $autofill_active = wpinv_get_option('address_autofill_active');
290
-        if ( isset( $autofill_active ) && 1 == $autofill_active && !empty( $autofill_api ) && wpinv_is_checkout() ) {
291
-            if ( wp_script_is( 'google-maps-api', 'enqueued' ) ) {
292
-                wp_dequeue_script( 'google-maps-api' );
290
+        if (isset($autofill_active) && 1 == $autofill_active && !empty($autofill_api) && wpinv_is_checkout()) {
291
+            if (wp_script_is('google-maps-api', 'enqueued')) {
292
+                wp_dequeue_script('google-maps-api');
293 293
             }
294
-            wp_enqueue_script( 'google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array( 'jquery' ), '', false );
295
-            wp_enqueue_script( 'google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array( 'jquery', 'google-maps-api' ), '', true );
294
+            wp_enqueue_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=' . $autofill_api . '&libraries=places', array('jquery'), '', false);
295
+            wp_enqueue_script('google-maps-init', WPINV_PLUGIN_URL . 'assets/js/gaaf.js', array('jquery', 'google-maps-api'), '', true);
296 296
         }
297 297
 
298
-        wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' );
299
-        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION );
298
+        wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all');
299
+        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION);
300 300
 
301
-        wp_enqueue_script( 'wpinv-front-script' );
302
-        wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
301
+        wp_enqueue_script('wpinv-front-script');
302
+        wp_localize_script('wpinv-front-script', 'WPInv', $localize);
303 303
 
304
-        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' );
305
-        wp_enqueue_script( 'wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'wpinv-front-script' ),  $version, true );
304
+        $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js');
305
+        wp_enqueue_script('wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array('wpinv-front-script'), $version, true);
306 306
     }
307 307
 
308
-    public function admin_enqueue_scripts( $hook ) {
308
+    public function admin_enqueue_scripts($hook) {
309 309
         global $post, $pagenow;
310 310
         
311 311
         $post_type  = wpinv_admin_post_type();
312
-        $suffix     = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
313
-        $page       = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : '';
312
+        $suffix     = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
313
+        $page       = isset($_GET['page']) ? strtolower($_GET['page']) : '';
314 314
 
315 315
         $jquery_ui_css = false;
316
-        if ( ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount' ) && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) ) {
316
+        if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $post_type == 'wpi_discount') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
317 317
             $jquery_ui_css = true;
318
-        } else if ( $page == 'wpinv-settings' || $page == 'wpinv-reports' ) {
318
+        } else if ($page == 'wpinv-settings' || $page == 'wpinv-reports') {
319 319
             $jquery_ui_css = true;
320 320
         }
321
-        if ( $jquery_ui_css ) {
322
-            wp_register_style( 'jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16' );
323
-            wp_enqueue_style( 'jquery-ui-css' );
321
+        if ($jquery_ui_css) {
322
+            wp_register_style('jquery-ui-css', WPINV_PLUGIN_URL . 'assets/css/jquery-ui' . $suffix . '.css', array(), '1.8.16');
323
+            wp_enqueue_style('jquery-ui-css');
324 324
         }
325 325
 
326
-        wp_register_style( 'wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION );
327
-        wp_enqueue_style( 'wpinv_meta_box_style' );
326
+        wp_register_style('wpinv_meta_box_style', WPINV_PLUGIN_URL . 'assets/css/meta-box.css', array(), WPINV_VERSION);
327
+        wp_enqueue_style('wpinv_meta_box_style');
328 328
         
329
-        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' );
330
-        wp_register_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version );
331
-        wp_enqueue_style( 'wpinv_admin_style' );
329
+        $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css');
330
+        wp_register_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array(), $version);
331
+        wp_enqueue_style('wpinv_admin_style');
332 332
 
333
-        $enqueue = ( $post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) );
334
-        if ( $page == 'wpinv-subscriptions' ) {
335
-            wp_enqueue_script( 'jquery-ui-datepicker' );
333
+        $enqueue = ($post_type == 'wpi_discount' || $post_type == 'wpi_invoice' && ($pagenow == 'post-new.php' || $pagenow == 'post.php'));
334
+        if ($page == 'wpinv-subscriptions') {
335
+            wp_enqueue_script('jquery-ui-datepicker');
336 336
         }
337 337
         
338
-        if ( $enqueue_datepicker = apply_filters( 'wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue ) ) {
339
-            wp_enqueue_script( 'jquery-ui-datepicker' );
338
+        if ($enqueue_datepicker = apply_filters('wpinv_admin_enqueue_jquery_ui_datepicker', $enqueue)) {
339
+            wp_enqueue_script('jquery-ui-datepicker');
340 340
         }
341 341
 
342
-        wp_enqueue_style( 'wp-color-picker' );
343
-        wp_enqueue_script( 'wp-color-picker' );
342
+        wp_enqueue_style('wp-color-picker');
343
+        wp_enqueue_script('wp-color-picker');
344 344
         
345
-        wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
345
+        wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
346 346
 
347 347
         if (($post_type == 'wpi_invoice' || $post_type == 'wpi_quote') && ($pagenow == 'post-new.php' || $pagenow == 'post.php')) {
348 348
             $autofill_api = wpinv_get_option('address_autofill_api');
@@ -353,20 +353,20 @@  discard block
 block discarded – undo
353 353
             }
354 354
         }
355 355
 
356
-        wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all' );
357
-        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION );
356
+        wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.css', array(), WPINV_VERSION, 'all');
357
+        wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION);
358 358
 
359
-        wp_register_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'jquery-blockui','jquery-ui-tooltip' ),  WPINV_VERSION );
360
-        wp_enqueue_script( 'wpinv-admin-script' );
359
+        wp_register_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'jquery-blockui', 'jquery-ui-tooltip'), WPINV_VERSION);
360
+        wp_enqueue_script('wpinv-admin-script');
361 361
         
362 362
         $localize                               = array();
363
-        $localize['ajax_url']                   = admin_url( 'admin-ajax.php' );
364
-        $localize['post_ID']                    = isset( $post->ID ) ? $post->ID : '';
365
-        $localize['wpinv_nonce']                = wp_create_nonce( 'wpinv-nonce' );
366
-        $localize['add_invoice_note_nonce']     = wp_create_nonce( 'add-invoice-note' );
367
-        $localize['delete_invoice_note_nonce']  = wp_create_nonce( 'delete-invoice-note' );
368
-        $localize['invoice_item_nonce']         = wp_create_nonce( 'invoice-item' );
369
-        $localize['billing_details_nonce']      = wp_create_nonce( 'get-billing-details' );
363
+        $localize['ajax_url']                   = admin_url('admin-ajax.php');
364
+        $localize['post_ID']                    = isset($post->ID) ? $post->ID : '';
365
+        $localize['wpinv_nonce']                = wp_create_nonce('wpinv-nonce');
366
+        $localize['add_invoice_note_nonce']     = wp_create_nonce('add-invoice-note');
367
+        $localize['delete_invoice_note_nonce']  = wp_create_nonce('delete-invoice-note');
368
+        $localize['invoice_item_nonce']         = wp_create_nonce('invoice-item');
369
+        $localize['billing_details_nonce']      = wp_create_nonce('get-billing-details');
370 370
         $localize['tax']                        = wpinv_tax_amount();
371 371
         $localize['discount']                   = wpinv_discount_amount();
372 372
         $localize['currency_symbol']            = wpinv_currency_symbol();
@@ -374,95 +374,95 @@  discard block
 block discarded – undo
374 374
         $localize['thousand_sep']               = wpinv_thousands_separator();
375 375
         $localize['decimal_sep']                = wpinv_decimal_separator();
376 376
         $localize['decimals']                   = wpinv_decimals();
377
-        $localize['save_invoice']               = __( 'Save Invoice', 'invoicing' );
378
-        $localize['status_publish']             = wpinv_status_nicename( 'publish' );
379
-        $localize['status_pending']             = wpinv_status_nicename( 'wpi-pending' );
380
-        $localize['delete_tax_rate']            = __( 'Are you sure you wish to delete this tax rate?', 'invoicing' );
381
-        $localize['OneItemMin']                 = __( 'Invoice must contain at least one item', 'invoicing' );
382
-        $localize['DeleteInvoiceItem']          = __( 'Are you sure you wish to delete this item?', 'invoicing' );
383
-        $localize['FillBillingDetails']         = __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' );
384
-        $localize['confirmCalcTotals']          = __( 'Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing' );
385
-        $localize['AreYouSure']                 = __( 'Are you sure?', 'invoicing' );
386
-        $localize['emptyInvoice']               = __( 'Add at least one item to save invoice!', 'invoicing' );
387
-        $localize['errDeleteItem']              = __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' );
388
-        $localize['delete_subscription']        = __( 'Are you sure you want to delete this subscription?', 'invoicing' );
389
-        $localize['action_edit']                = __( 'Edit', 'invoicing' );
390
-        $localize['action_cancel']              = __( 'Cancel', 'invoicing' );
391
-
392
-        $localize = apply_filters( 'wpinv_admin_js_localize', $localize );
393
-
394
-        wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', $localize );
377
+        $localize['save_invoice']               = __('Save Invoice', 'invoicing');
378
+        $localize['status_publish']             = wpinv_status_nicename('publish');
379
+        $localize['status_pending']             = wpinv_status_nicename('wpi-pending');
380
+        $localize['delete_tax_rate']            = __('Are you sure you wish to delete this tax rate?', 'invoicing');
381
+        $localize['OneItemMin']                 = __('Invoice must contain at least one item', 'invoicing');
382
+        $localize['DeleteInvoiceItem']          = __('Are you sure you wish to delete this item?', 'invoicing');
383
+        $localize['FillBillingDetails']         = __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing');
384
+        $localize['confirmCalcTotals']          = __('Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing');
385
+        $localize['AreYouSure']                 = __('Are you sure?', 'invoicing');
386
+        $localize['emptyInvoice']               = __('Add at least one item to save invoice!', 'invoicing');
387
+        $localize['errDeleteItem']              = __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing');
388
+        $localize['delete_subscription']        = __('Are you sure you want to delete this subscription?', 'invoicing');
389
+        $localize['action_edit']                = __('Edit', 'invoicing');
390
+        $localize['action_cancel']              = __('Cancel', 'invoicing');
391
+
392
+        $localize = apply_filters('wpinv_admin_js_localize', $localize);
393
+
394
+        wp_localize_script('wpinv-admin-script', 'WPInv_Admin', $localize);
395 395
 
396 396
         // Load payment form scripts on our admin pages only.
397
-        if ( ( $hook == 'post-new.php' || $hook == 'post.php' ) && 'wpi_payment_form' === $post->post_type ) {
397
+        if (($hook == 'post-new.php' || $hook == 'post.php') && 'wpi_payment_form' === $post->post_type) {
398 398
 
399
-            wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION );
400
-            wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
401
-            wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
399
+            wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.js', array(), WPINV_VERSION);
400
+            wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION);
401
+            wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION);
402 402
 
403
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js' );
404
-            wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array( 'wpinv-admin-script', 'vue_draggable' ),  $version );
403
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin-payment-forms.js');
404
+            wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.js', array('wpinv-admin-script', 'vue_draggable'), $version);
405 405
         
406
-            wp_localize_script( 'wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array(
406
+            wp_localize_script('wpinv-admin-payment-form-script', 'wpinvPaymentFormAdmin', array(
407 407
                 'elements'      => $this->form_elements->get_elements(),
408
-                'form_elements' => $this->form_elements->get_form_elements( $post->ID ),
408
+                'form_elements' => $this->form_elements->get_form_elements($post->ID),
409 409
                 'all_items'     => $this->form_elements->get_published_items(),
410 410
                 'currency'      => wpinv_currency_symbol(),
411 411
                 'position'      => wpinv_currency_position(),
412 412
                 'decimals'      => (int) wpinv_decimals(),
413 413
                 'thousands_sep' => wpinv_thousands_separator(),
414 414
                 'decimals_sep'  => wpinv_decimal_separator(),
415
-                'form_items'    => $this->form_elements->get_form_items( $post->ID ),
416
-            ) );
415
+                'form_items'    => $this->form_elements->get_form_items($post->ID),
416
+            ));
417 417
 
418
-            wp_enqueue_script( 'wpinv-admin-payment-form-script' );
418
+            wp_enqueue_script('wpinv-admin-payment-form-script');
419 419
         }
420 420
 
421
-        if ( $page == 'wpinv-subscriptions' ) {
422
-            wp_register_script( 'wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array( 'wpinv-admin-script' ),  WPINV_VERSION );
423
-            wp_enqueue_script( 'wpinv-sub-admin-script' );
421
+        if ($page == 'wpinv-subscriptions') {
422
+            wp_register_script('wpinv-sub-admin-script', WPINV_PLUGIN_URL . 'assets/js/subscriptions.js', array('wpinv-admin-script'), WPINV_VERSION);
423
+            wp_enqueue_script('wpinv-sub-admin-script');
424 424
         }
425 425
 
426 426
     }
427 427
     
428
-    public function admin_body_class( $classes ) {
428
+    public function admin_body_class($classes) {
429 429
         global $pagenow, $post, $current_screen;
430 430
         
431
-        if ( !empty( $current_screen->post_type ) && ( $current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_payment_form' || $current_screen->post_type == 'wpi_quote' ) ) {
431
+        if (!empty($current_screen->post_type) && ($current_screen->post_type == 'wpi_invoice' || $current_screen->post_type == 'wpi_payment_form' || $current_screen->post_type == 'wpi_quote')) {
432 432
             $classes .= ' wpinv-cpt';
433 433
         }
434 434
         
435
-        $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
435
+        $page = isset($_GET['page']) ? strtolower($_GET['page']) : false;
436 436
 
437
-        $add_class = $page && $pagenow == 'admin.php' && strpos( $page, 'wpinv-' ) === 0 ? true : false;
438
-        if ( $add_class ) {
439
-            $classes .= ' wpi-' . wpinv_sanitize_key( $page );
437
+        $add_class = $page && $pagenow == 'admin.php' && strpos($page, 'wpinv-') === 0 ? true : false;
438
+        if ($add_class) {
439
+            $classes .= ' wpi-' . wpinv_sanitize_key($page);
440 440
         }
441 441
         
442 442
         $settings_class = array();
443
-        if ( $page == 'wpinv-settings' ) {
444
-            if ( !empty( $_REQUEST['tab'] ) ) {
445
-                $settings_class[] = sanitize_text_field( $_REQUEST['tab'] );
443
+        if ($page == 'wpinv-settings') {
444
+            if (!empty($_REQUEST['tab'])) {
445
+                $settings_class[] = sanitize_text_field($_REQUEST['tab']);
446 446
             }
447 447
             
448
-            if ( !empty( $_REQUEST['section'] ) ) {
449
-                $settings_class[] = sanitize_text_field( $_REQUEST['section'] );
448
+            if (!empty($_REQUEST['section'])) {
449
+                $settings_class[] = sanitize_text_field($_REQUEST['section']);
450 450
             }
451 451
             
452
-            $settings_class[] = isset( $_REQUEST['wpi_sub'] ) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field( $_REQUEST['wpi_sub'] ) : 'main';
452
+            $settings_class[] = isset($_REQUEST['wpi_sub']) && $_REQUEST['wpi_sub'] !== '' ? sanitize_text_field($_REQUEST['wpi_sub']) : 'main';
453 453
         }
454 454
         
455
-        if ( !empty( $settings_class ) ) {
456
-            $classes .= ' wpi-' . wpinv_sanitize_key( implode( $settings_class, '-' ) );
455
+        if (!empty($settings_class)) {
456
+            $classes .= ' wpi-' . wpinv_sanitize_key(implode($settings_class, '-'));
457 457
         }
458 458
         
459 459
         $post_type = wpinv_admin_post_type();
460 460
 
461
-        if ( $post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false ) {
461
+        if ($post_type == 'wpi_invoice' || $post_type == 'wpi_quote' || $add_class !== false) {
462 462
             return $classes .= ' wpinv';
463 463
         }
464 464
         
465
-        if ( $pagenow == 'post.php' && $post_type == 'wpi_item' && !empty( $post ) && !wpinv_item_is_editable( $post ) ) {
465
+        if ($pagenow == 'post.php' && $post_type == 'wpi_item' && !empty($post) && !wpinv_item_is_editable($post)) {
466 466
             $classes .= ' wpi-editable-n';
467 467
         }
468 468
 
@@ -474,21 +474,21 @@  discard block
 block discarded – undo
474 474
     }
475 475
     
476 476
     public function wpinv_actions() {
477
-        if ( isset( $_REQUEST['wpi_action'] ) ) {
478
-            do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
477
+        if (isset($_REQUEST['wpi_action'])) {
478
+            do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST);
479 479
         }
480 480
     }
481 481
     
482
-    public function pre_get_posts( $wp_query ) {
483
-        if ( !empty( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) {
484
-            $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses() );
482
+    public function pre_get_posts($wp_query) {
483
+        if (!empty($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'wpi_invoice' && is_user_logged_in() && is_single() && $wp_query->is_main_query()) {
484
+            $wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses());
485 485
         }
486 486
         
487 487
         return $wp_query;
488 488
     }
489 489
     
490 490
     public function bp_invoicing_init() {
491
-        require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
491
+        require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php');
492 492
     }
493 493
 
494 494
 	/**
@@ -496,13 +496,13 @@  discard block
 block discarded – undo
496 496
 	 *
497 497
 	 */
498 498
 	public function register_widgets() {
499
-		register_widget( "WPInv_Checkout_Widget" );
500
-		register_widget( "WPInv_History_Widget" );
501
-		register_widget( "WPInv_Receipt_Widget" );
502
-		register_widget( "WPInv_Subscriptions_Widget" );
503
-		register_widget( "WPInv_Buy_Item_Widget" );
504
-        register_widget( "WPInv_Messages_Widget" );
505
-        register_widget( 'WPInv_Payment_Form_Widget' );
499
+		register_widget("WPInv_Checkout_Widget");
500
+		register_widget("WPInv_History_Widget");
501
+		register_widget("WPInv_Receipt_Widget");
502
+		register_widget("WPInv_Subscriptions_Widget");
503
+		register_widget("WPInv_Buy_Item_Widget");
504
+        register_widget("WPInv_Messages_Widget");
505
+        register_widget('WPInv_Payment_Form_Widget');
506 506
 	}
507 507
     
508 508
     /**
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
      * @since 1.0.19
512 512
      * @param int[] $excluded_posts_ids
513 513
      */
514
-    function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){
514
+    function wpseo_exclude_from_sitemap_by_post_ids($excluded_posts_ids) {
515 515
 
516 516
         // Ensure that we have an array.
517
-        if ( ! is_array( $excluded_posts_ids ) ) {
517
+        if (!is_array($excluded_posts_ids)) {
518 518
             $excluded_posts_ids = array();
519 519
         }
520 520
 
@@ -522,24 +522,24 @@  discard block
 block discarded – undo
522 522
         $our_pages = array();
523 523
     
524 524
         // Checkout page.
525
-        $our_pages[] = wpinv_get_option( 'checkout_page', false );
525
+        $our_pages[] = wpinv_get_option('checkout_page', false);
526 526
 
527 527
         // Success page.
528
-        $our_pages[] = wpinv_get_option( 'success_page', false );
528
+        $our_pages[] = wpinv_get_option('success_page', false);
529 529
 
530 530
         // Failure page.
531
-        $our_pages[] = wpinv_get_option( 'failure_page', false );
531
+        $our_pages[] = wpinv_get_option('failure_page', false);
532 532
 
533 533
         // History page.
534
-        $our_pages[] = wpinv_get_option( 'invoice_history_page', false );
534
+        $our_pages[] = wpinv_get_option('invoice_history_page', false);
535 535
 
536 536
         // Subscriptions page.
537
-        $our_pages[] = wpinv_get_option( 'invoice_subscription_page', false );
537
+        $our_pages[] = wpinv_get_option('invoice_subscription_page', false);
538 538
 
539
-        $our_pages   = array_map( 'intval', array_filter( $our_pages ) );
539
+        $our_pages   = array_map('intval', array_filter($our_pages));
540 540
 
541 541
         $excluded_posts_ids = $excluded_posts_ids + $our_pages;
542
-        return array_unique( $excluded_posts_ids );
542
+        return array_unique($excluded_posts_ids);
543 543
 
544 544
     }
545 545
 }
Please login to merge, or discard this patch.
includes/admin/admin-meta-boxes.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
         add_meta_box( 'wpinv-invoice-payment-form-details', __( 'Payment Form Details', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output_details', 'wpi_invoice', 'side', 'high' );
37 37
     }
38 38
 
39
-	remove_meta_box('wpseo_meta', 'wpi_invoice', 'normal');
39
+    remove_meta_box('wpseo_meta', 'wpi_invoice', 'normal');
40 40
 }
41 41
 add_action( 'add_meta_boxes', 'wpinv_add_meta_boxes', 30, 2 );
42 42
 
Please login to merge, or discard this patch.
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -1,74 +1,74 @@  discard block
 block discarded – undo
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-payment-form-design', __( 'Payment Form', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output', 'wpi_payment_form', 'normal' );
29
-    add_meta_box( 'wpinv-payment-form-shortcode', __( 'Shortcode', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output_shortcode', 'wpi_payment_form', 'side' );
28
+    add_meta_box('wpinv-payment-form-design', __('Payment Form', 'invoicing'), 'WPInv_Meta_Box_Payment_Form::output', 'wpi_payment_form', 'normal');
29
+    add_meta_box('wpinv-payment-form-shortcode', __('Shortcode', 'invoicing'), 'WPInv_Meta_Box_Payment_Form::output_shortcode', 'wpi_payment_form', 'side');
30 30
    
31
-    add_meta_box( 'wpinv-address', __( 'Billing Details', 'invoicing' ), 'WPInv_Meta_Box_Billing_Details::output', 'wpi_invoice', 'normal', 'high' );
32
-    add_meta_box( 'wpinv-items', __( 'Invoice Items', 'invoicing' ), 'WPInv_Meta_Box_Items::output', 'wpi_invoice', 'normal', 'high' );
33
-    add_meta_box( 'wpinv-notes', __( 'Invoice Notes', 'invoicing' ), 'WPInv_Meta_Box_Notes::output', 'wpi_invoice', 'normal', 'high' );
31
+    add_meta_box('wpinv-address', __('Billing Details', 'invoicing'), 'WPInv_Meta_Box_Billing_Details::output', 'wpi_invoice', 'normal', 'high');
32
+    add_meta_box('wpinv-items', __('Invoice Items', 'invoicing'), 'WPInv_Meta_Box_Items::output', 'wpi_invoice', 'normal', 'high');
33
+    add_meta_box('wpinv-notes', __('Invoice Notes', 'invoicing'), 'WPInv_Meta_Box_Notes::output', 'wpi_invoice', 'normal', 'high');
34 34
     
35
-    if ( ! empty( $post->ID ) && get_post_meta( $post->ID, 'payment_form_data', true ) ) {
36
-        add_meta_box( 'wpinv-invoice-payment-form-details', __( 'Payment Form Details', 'invoicing' ), 'WPInv_Meta_Box_Payment_Form::output_details', 'wpi_invoice', 'side', 'high' );
35
+    if (!empty($post->ID) && get_post_meta($post->ID, 'payment_form_data', true)) {
36
+        add_meta_box('wpinv-invoice-payment-form-details', __('Payment Form Details', 'invoicing'), 'WPInv_Meta_Box_Payment_Form::output_details', 'wpi_invoice', 'side', 'high');
37 37
     }
38 38
 
39 39
 	remove_meta_box('wpseo_meta', 'wpi_invoice', 'normal');
40 40
 }
41
-add_action( 'add_meta_boxes', 'wpinv_add_meta_boxes', 30, 2 );
41
+add_action('add_meta_boxes', 'wpinv_add_meta_boxes', 30, 2);
42 42
 
43
-function wpinv_save_meta_boxes( $post_id, $post, $update = false ) {
44
-    remove_action( 'save_post', __FUNCTION__ );
43
+function wpinv_save_meta_boxes($post_id, $post, $update = false) {
44
+    remove_action('save_post', __FUNCTION__);
45 45
     
46 46
     // $post_id and $post are required
47
-    if ( empty( $post_id ) || empty( $post ) ) {
47
+    if (empty($post_id) || empty($post)) {
48 48
         return;
49 49
     }
50 50
         
51
-    if ( !current_user_can( 'edit_post', $post_id ) || empty( $post->post_type ) ) {
51
+    if (!current_user_can('edit_post', $post_id) || empty($post->post_type)) {
52 52
         return;
53 53
     }
54 54
     
55 55
     // Dont' save meta boxes for revisions or autosaves
56
-    if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
56
+    if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
57 57
         return;
58 58
     }
59 59
         
60
-    if ( $post->post_type == 'wpi_invoice' or $post->post_type == 'wpi_quote' ) {
61
-        if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) {
60
+    if ($post->post_type == 'wpi_invoice' or $post->post_type == 'wpi_quote') {
61
+        if ((defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) {
62 62
             return;
63 63
         }
64 64
     
65
-        if ( isset( $_POST['wpinv_save_invoice'] ) && wp_verify_nonce( $_POST['wpinv_save_invoice'], 'wpinv_save_invoice' ) ) {
66
-            WPInv_Meta_Box_Items::save( $post_id, $_POST, $post );
65
+        if (isset($_POST['wpinv_save_invoice']) && wp_verify_nonce($_POST['wpinv_save_invoice'], 'wpinv_save_invoice')) {
66
+            WPInv_Meta_Box_Items::save($post_id, $_POST, $post);
67 67
         }
68
-    } else if ( $post->post_type == 'wpi_item' ) {
68
+    } else if ($post->post_type == 'wpi_item') {
69 69
         // verify nonce
70
-        if ( isset( $_POST['wpinv_vat_meta_box_nonce'] ) && wp_verify_nonce( $_POST['wpinv_vat_meta_box_nonce'], 'wpinv_item_meta_box_save' ) ) {
71
-            $fields                                 = array();
70
+        if (isset($_POST['wpinv_vat_meta_box_nonce']) && wp_verify_nonce($_POST['wpinv_vat_meta_box_nonce'], 'wpinv_item_meta_box_save')) {
71
+            $fields = array();
72 72
             $fields['_wpinv_price']              = 'wpinv_item_price';
73 73
             $fields['_wpinv_vat_class']          = 'wpinv_vat_class';
74 74
             $fields['_wpinv_vat_rule']           = 'wpinv_vat_rules';
@@ -83,96 +83,96 @@  discard block
 block discarded – undo
83 83
             $fields['_wpinv_dynamic_pricing']    = 'wpinv_name_your_price';
84 84
             $fields['_minimum_price']            = 'wpinv_minimum_price';
85 85
             
86
-            if ( !isset( $_POST['wpinv_is_recurring'] ) ) {
86
+            if (!isset($_POST['wpinv_is_recurring'])) {
87 87
                 $_POST['wpinv_is_recurring'] = 0;
88 88
             }
89 89
 
90
-            if ( !isset( $_POST['wpinv_name_your_price'] ) ) {
90
+            if (!isset($_POST['wpinv_name_your_price'])) {
91 91
                 $_POST['wpinv_name_your_price'] = 0;
92 92
             }
93 93
             
94
-            if ( !isset( $_POST['wpinv_free_trial'] ) || empty( $_POST['wpinv_is_recurring'] ) ) {
94
+            if (!isset($_POST['wpinv_free_trial']) || empty($_POST['wpinv_is_recurring'])) {
95 95
                 $_POST['wpinv_free_trial'] = 0;
96 96
             }
97 97
             
98
-            foreach ( $fields as $field => $name ) {
99
-                if ( isset( $_POST[ $name ] ) ) {
100
-                    $allowed = apply_filters( 'wpinv_item_allowed_save_meta_value', true, $field, $post_id );
98
+            foreach ($fields as $field => $name) {
99
+                if (isset($_POST[$name])) {
100
+                    $allowed = apply_filters('wpinv_item_allowed_save_meta_value', true, $field, $post_id);
101 101
 
102
-                    if ( !$allowed ) {
102
+                    if (!$allowed) {
103 103
                         continue;
104 104
                     }
105 105
 
106
-                    if ( $field == '_wpinv_price' ) {
107
-                        $value = wpinv_sanitize_amount( $_POST[ $name ] );
106
+                    if ($field == '_wpinv_price') {
107
+                        $value = wpinv_sanitize_amount($_POST[$name]);
108 108
                     } else {
109
-                        $value = is_string( $_POST[ $name ] ) ? sanitize_text_field( $_POST[ $name ] ) : $_POST[ $name ];
109
+                        $value = is_string($_POST[$name]) ? sanitize_text_field($_POST[$name]) : $_POST[$name];
110 110
                     }
111 111
                     
112
-                    $value = apply_filters( 'wpinv_item_metabox_save_' . $field, $value, $name );
113
-                    update_post_meta( $post_id, $field, $value );
112
+                    $value = apply_filters('wpinv_item_metabox_save_' . $field, $value, $name);
113
+                    update_post_meta($post_id, $field, $value);
114 114
                 }
115 115
             }
116 116
             
117
-            if ( !get_post_meta( $post_id, '_wpinv_custom_id', true ) ) {
118
-                update_post_meta( $post_id, '_wpinv_custom_id', $post_id );
117
+            if (!get_post_meta($post_id, '_wpinv_custom_id', true)) {
118
+                update_post_meta($post_id, '_wpinv_custom_id', $post_id);
119 119
             }
120 120
         }
121 121
     }
122 122
 }
123
-add_action( 'save_post', 'wpinv_save_meta_boxes', 10, 3 );
123
+add_action('save_post', 'wpinv_save_meta_boxes', 10, 3);
124 124
 
125 125
 function wpinv_register_item_meta_boxes() {    
126 126
     global $wpinv_euvat;
127 127
     
128
-    add_meta_box( 'wpinv_field_prices', __( 'Item Price', 'invoicing' ), 'WPInv_Meta_Box_Items::prices', 'wpi_item', 'normal', 'high' );
128
+    add_meta_box('wpinv_field_prices', __('Item Price', 'invoicing'), 'WPInv_Meta_Box_Items::prices', 'wpi_item', 'normal', 'high');
129 129
 
130
-    if ( $wpinv_euvat->allow_vat_rules() ) {
131
-        add_meta_box( 'wpinv_field_vat_rules', __( 'VAT rules type to use', 'invoicing' ), 'WPInv_Meta_Box_Items::vat_rules', 'wpi_item', 'normal', 'high' );
130
+    if ($wpinv_euvat->allow_vat_rules()) {
131
+        add_meta_box('wpinv_field_vat_rules', __('VAT rules type to use', 'invoicing'), 'WPInv_Meta_Box_Items::vat_rules', 'wpi_item', 'normal', 'high');
132 132
     }
133 133
     
134
-    if ( $wpinv_euvat->allow_vat_classes() ) {
135
-        add_meta_box( 'wpinv_field_vat_classes', __( 'VAT rates class to use', 'invoicing' ), 'WPInv_Meta_Box_Items::vat_classes', 'wpi_item', 'normal', 'high' );
134
+    if ($wpinv_euvat->allow_vat_classes()) {
135
+        add_meta_box('wpinv_field_vat_classes', __('VAT rates class to use', 'invoicing'), 'WPInv_Meta_Box_Items::vat_classes', 'wpi_item', 'normal', 'high');
136 136
     }
137 137
     
138
-    add_meta_box( 'wpinv_field_item_info', __( 'Item info', 'invoicing' ), 'WPInv_Meta_Box_Items::item_info', 'wpi_item', 'side', 'core' );
139
-    add_meta_box( 'wpinv_field_meta_values', __( 'Item Meta Values', 'invoicing' ), 'WPInv_Meta_Box_Items::meta_values', 'wpi_item', 'side', 'core' );
138
+    add_meta_box('wpinv_field_item_info', __('Item info', 'invoicing'), 'WPInv_Meta_Box_Items::item_info', 'wpi_item', 'side', 'core');
139
+    add_meta_box('wpinv_field_meta_values', __('Item Meta Values', 'invoicing'), 'WPInv_Meta_Box_Items::meta_values', 'wpi_item', 'side', 'core');
140 140
 }
141 141
 
142 142
 function wpinv_register_discount_meta_boxes() {
143
-    add_meta_box( 'wpinv_discount_fields', __( 'Discount Details', 'invoicing' ), 'wpinv_discount_metabox_details', 'wpi_discount', 'normal', 'high' );
143
+    add_meta_box('wpinv_discount_fields', __('Discount Details', 'invoicing'), 'wpinv_discount_metabox_details', 'wpi_discount', 'normal', 'high');
144 144
 }
145 145
 
146
-function wpinv_discount_metabox_details( $post ) {
146
+function wpinv_discount_metabox_details($post) {
147 147
     $discount_id    = $post->ID;
148
-    $discount       = wpinv_get_discount( $discount_id );
148
+    $discount       = wpinv_get_discount($discount_id);
149 149
     
150
-    $type               = wpinv_get_discount_type( $discount_id );
151
-    $item_reqs          = wpinv_get_discount_item_reqs( $discount_id );
152
-    $excluded_items     = wpinv_get_discount_excluded_items( $discount_id );
153
-    $min_total          = wpinv_get_discount_min_total( $discount_id );
154
-    $max_total          = wpinv_get_discount_max_total( $discount_id );
155
-    $max_uses           = wpinv_get_discount_max_uses( $discount_id );
156
-    $single_use         = wpinv_discount_is_single_use( $discount_id );
157
-    $recurring          = (bool)wpinv_discount_is_recurring( $discount_id );
158
-    $start_date         = wpinv_get_discount_start_date( $discount_id );
159
-    $expiration_date    = wpinv_get_discount_expiration( $discount_id );
150
+    $type               = wpinv_get_discount_type($discount_id);
151
+    $item_reqs          = wpinv_get_discount_item_reqs($discount_id);
152
+    $excluded_items     = wpinv_get_discount_excluded_items($discount_id);
153
+    $min_total          = wpinv_get_discount_min_total($discount_id);
154
+    $max_total          = wpinv_get_discount_max_total($discount_id);
155
+    $max_uses           = wpinv_get_discount_max_uses($discount_id);
156
+    $single_use         = wpinv_discount_is_single_use($discount_id);
157
+    $recurring          = (bool) wpinv_discount_is_recurring($discount_id);
158
+    $start_date         = wpinv_get_discount_start_date($discount_id);
159
+    $expiration_date    = wpinv_get_discount_expiration($discount_id);
160 160
     
161
-    if ( ! empty( $start_date ) && strpos( $start_date, '0000' ) === false ) {
162
-        $start_time         = strtotime( $start_date );
163
-        $start_h            = date_i18n( 'H', $start_time );
164
-        $start_m            = date_i18n( 'i', $start_time );
165
-        $start_date         = date_i18n( 'Y-m-d', $start_time );
161
+    if (!empty($start_date) && strpos($start_date, '0000') === false) {
162
+        $start_time         = strtotime($start_date);
163
+        $start_h            = date_i18n('H', $start_time);
164
+        $start_m            = date_i18n('i', $start_time);
165
+        $start_date         = date_i18n('Y-m-d', $start_time);
166 166
     } else {
167 167
         $start_h            = '00';
168 168
         $start_m            = '00';
169 169
     }
170 170
 
171
-    if ( ! empty( $expiration_date ) && strpos( $expiration_date, '0000' ) === false ) {
172
-        $expiration_time    = strtotime( $expiration_date );
173
-        $expiration_h       = date_i18n( 'H', $expiration_time );
174
-        $expiration_m       = date_i18n( 'i', $expiration_time );
175
-        $expiration_date    = date_i18n( 'Y-m-d', $expiration_time );
171
+    if (!empty($expiration_date) && strpos($expiration_date, '0000') === false) {
172
+        $expiration_time    = strtotime($expiration_date);
173
+        $expiration_h       = date_i18n('H', $expiration_time);
174
+        $expiration_m       = date_i18n('i', $expiration_time);
175
+        $expiration_date    = date_i18n('Y-m-d', $expiration_time);
176 176
     } else {
177 177
         $expiration_h       = '23';
178 178
         $expiration_m       = '59';
@@ -182,207 +182,207 @@  discard block
 block discarded – undo
182 182
     $max_total          = $max_total > 0 ? $max_total : '';
183 183
     $max_uses           = $max_uses > 0 ? $max_uses : '';
184 184
 ?>
185
-<?php do_action( 'wpinv_discount_form_top', $post ); ?>
186
-<?php wp_nonce_field( 'wpinv_discount_metabox_nonce', 'wpinv_discount_metabox_nonce' ); ;?>
185
+<?php do_action('wpinv_discount_form_top', $post); ?>
186
+<?php wp_nonce_field('wpinv_discount_metabox_nonce', 'wpinv_discount_metabox_nonce'); ;?>
187 187
 <table class="form-table wpi-form-table">
188 188
     <tbody>
189
-        <?php do_action( 'wpinv_discount_form_first', $post ); ?>
190
-        <?php do_action( 'wpinv_discount_form_before_code', $post ); ?>
189
+        <?php do_action('wpinv_discount_form_first', $post); ?>
190
+        <?php do_action('wpinv_discount_form_before_code', $post); ?>
191 191
         <tr>
192 192
             <th valign="top" scope="row">
193
-                <label for="wpinv_discount_code"><?php _e( 'Discount Code', 'invoicing' ); ?></label>
193
+                <label for="wpinv_discount_code"><?php _e('Discount Code', 'invoicing'); ?></label>
194 194
             </th>
195 195
             <td>
196
-                <input type="text" name="code" id="wpinv_discount_code" class="medium-text" value="<?php echo esc_attr( wpinv_get_discount_code( $discount_id ) ); ?>" required>
197
-                <p class="description"><?php _e( 'Enter a code for this discount, such as 10OFF', 'invoicing' ); ?></p>
196
+                <input type="text" name="code" id="wpinv_discount_code" class="medium-text" value="<?php echo esc_attr(wpinv_get_discount_code($discount_id)); ?>" required>
197
+                <p class="description"><?php _e('Enter a code for this discount, such as 10OFF', 'invoicing'); ?></p>
198 198
             </td>
199 199
         </tr>
200
-        <?php do_action( 'wpinv_discount_form_before_type', $post ); ?>
200
+        <?php do_action('wpinv_discount_form_before_type', $post); ?>
201 201
         <tr>
202 202
             <th valign="top" scope="row">
203
-                <label for="wpinv_discount_type"><?php _e( 'Discount Type', 'invoicing' ); ?></label>
203
+                <label for="wpinv_discount_type"><?php _e('Discount Type', 'invoicing'); ?></label>
204 204
             </th>
205 205
             <td>
206 206
                 <select id="wpinv_discount_type" name="type" class="medium-text wpi_select2">
207
-                    <?php foreach ( wpinv_get_discount_types() as $value => $label ) { ?>
208
-                    <option value="<?php echo $value ;?>" <?php selected( $type, $value ); ?>><?php echo $label; ?></option>
207
+                    <?php foreach (wpinv_get_discount_types() as $value => $label) { ?>
208
+                    <option value="<?php echo $value; ?>" <?php selected($type, $value); ?>><?php echo $label; ?></option>
209 209
                     <?php } ?>
210 210
                 </select>
211
-                <p class="description"><?php _e( 'The kind of discount to apply for this discount.', 'invoicing' ); ?></p>
211
+                <p class="description"><?php _e('The kind of discount to apply for this discount.', 'invoicing'); ?></p>
212 212
             </td>
213 213
         </tr>
214
-        <?php do_action( 'wpinv_discount_form_before_amount', $post ); ?>
214
+        <?php do_action('wpinv_discount_form_before_amount', $post); ?>
215 215
         <tr>
216 216
             <th valign="top" scope="row">
217
-                <label for="wpinv_discount_amount"><?php _e( 'Amount', 'invoicing' ); ?></label>
217
+                <label for="wpinv_discount_amount"><?php _e('Amount', 'invoicing'); ?></label>
218 218
             </th>
219 219
             <td>
220
-                <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>
221
-                <p style="display:none;" class="description"><?php _e( 'Enter the discount amount in USD', 'invoicing' ); ?></p>
222
-                <p class="description"><?php _e( 'Enter the discount value. Ex: 10', 'invoicing' ); ?></p>
220
+                <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>
221
+                <p style="display:none;" class="description"><?php _e('Enter the discount amount in USD', 'invoicing'); ?></p>
222
+                <p class="description"><?php _e('Enter the discount value. Ex: 10', 'invoicing'); ?></p>
223 223
             </td>
224 224
         </tr>
225
-        <?php do_action( 'wpinv_discount_form_before_items', $post ); ?>
225
+        <?php do_action('wpinv_discount_form_before_items', $post); ?>
226 226
         <tr>
227 227
             <th valign="top" scope="row">
228
-                <label for="wpinv_discount_items"><?php _e( 'Items', 'invoicing' ); ?></label>
228
+                <label for="wpinv_discount_items"><?php _e('Items', 'invoicing'); ?></label>
229 229
             </th>
230 230
             <td>
231
-                <p><?php echo wpinv_item_dropdown( array(
231
+                <p><?php echo wpinv_item_dropdown(array(
232 232
                         'name'              => 'items[]',
233 233
                         'id'                => 'items',
234 234
                         'selected'          => $item_reqs,
235 235
                         'multiple'          => true,
236 236
                         'class'             => 'medium-text wpi_select2',
237
-                        'placeholder'       => __( 'Select one or more Items', 'invoicing' ),
237
+                        'placeholder'       => __('Select one or more Items', 'invoicing'),
238 238
                         'show_recurring'    => true,
239
-                    ) ); ?>
239
+                    )); ?>
240 240
                 </p>
241
-                <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>
241
+                <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>
242 242
             </td>
243 243
         </tr>
244
-        <?php do_action( 'wpinv_discount_form_before_excluded_items', $post ); ?>
244
+        <?php do_action('wpinv_discount_form_before_excluded_items', $post); ?>
245 245
         <tr>
246 246
             <th valign="top" scope="row">
247
-                <label for="wpinv_discount_excluded_items"><?php _e( 'Excluded Items', 'invoicing' ); ?></label>
247
+                <label for="wpinv_discount_excluded_items"><?php _e('Excluded Items', 'invoicing'); ?></label>
248 248
             </th>
249 249
             <td>
250
-                <p><?php echo wpinv_item_dropdown( array(
250
+                <p><?php echo wpinv_item_dropdown(array(
251 251
                         'name'              => 'excluded_items[]',
252 252
                         'id'                => 'excluded_items',
253 253
                         'selected'          => $excluded_items,
254 254
                         'multiple'          => true,
255 255
                         'class'             => 'medium-text wpi_select2',
256
-                        'placeholder'       => __( 'Select one or more Items', 'invoicing' ),
256
+                        'placeholder'       => __('Select one or more Items', 'invoicing'),
257 257
                         'show_recurring'    => true,
258
-                    ) ); ?>
258
+                    )); ?>
259 259
                 </p>
260
-                <p class="description"><?php _e( 'Items which are NOT allowed to use this discount.', 'invoicing' ); ?></p>
260
+                <p class="description"><?php _e('Items which are NOT allowed to use this discount.', 'invoicing'); ?></p>
261 261
             </td>
262 262
         </tr>
263
-        <?php do_action( 'wpinv_discount_form_before_start', $post ); ?>
263
+        <?php do_action('wpinv_discount_form_before_start', $post); ?>
264 264
         <tr>
265 265
             <th valign="top" scope="row">
266
-                <label for="wpinv_discount_start"><?php _e( 'Start Date', 'invoicing' ); ?></label>
266
+                <label for="wpinv_discount_start"><?php _e('Start Date', 'invoicing'); ?></label>
267 267
             </th>
268 268
             <td>
269
-                <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">
270
-                    <?php for ( $i = 0; $i <= 23; $i++ ) { $value = str_pad( $i, 2, '0', STR_PAD_LEFT ); ?>
271
-                    <option value="<?php echo $value;?>" <?php selected( $value, $start_h ); ?>><?php echo $value;?></option>
269
+                <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">
270
+                    <?php for ($i = 0; $i <= 23; $i++) { $value = str_pad($i, 2, '0', STR_PAD_LEFT); ?>
271
+                    <option value="<?php echo $value; ?>" <?php selected($value, $start_h); ?>><?php echo $value; ?></option>
272 272
                     <?php } ?>
273 273
                 </select> : <select id="wpinv_discount_start_m" name="start_m">
274
-                    <?php for ( $i = 0; $i <= 59; $i++ ) { $value = str_pad( $i, 2, '0', STR_PAD_LEFT ); ?>
275
-                    <option value="<?php echo $value;?>" <?php selected( $value, $start_m ); ?>><?php echo $value;?></option>
274
+                    <?php for ($i = 0; $i <= 59; $i++) { $value = str_pad($i, 2, '0', STR_PAD_LEFT); ?>
275
+                    <option value="<?php echo $value; ?>" <?php selected($value, $start_m); ?>><?php echo $value; ?></option>
276 276
                     <?php } ?>
277 277
                 </select>
278
-                <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>
278
+                <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>
279 279
             </td>
280 280
         </tr>
281
-        <?php do_action( 'wpinv_discount_form_before_expiration', $post ); ?>
281
+        <?php do_action('wpinv_discount_form_before_expiration', $post); ?>
282 282
         <tr>
283 283
             <th valign="top" scope="row">
284
-                <label for="wpinv_discount_expiration"><?php _e( 'Expiration Date', 'invoicing' ); ?></label>
284
+                <label for="wpinv_discount_expiration"><?php _e('Expiration Date', 'invoicing'); ?></label>
285 285
             </th>
286 286
             <td>
287
-                <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">
288
-                    <?php for ( $i = 0; $i <= 23; $i++ ) { $value = str_pad( $i, 2, '0', STR_PAD_LEFT ); ?>
289
-                    <option value="<?php echo $value;?>" <?php selected( $value, $expiration_h ); ?>><?php echo $value;?></option>
287
+                <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">
288
+                    <?php for ($i = 0; $i <= 23; $i++) { $value = str_pad($i, 2, '0', STR_PAD_LEFT); ?>
289
+                    <option value="<?php echo $value; ?>" <?php selected($value, $expiration_h); ?>><?php echo $value; ?></option>
290 290
                     <?php } ?>
291 291
                 </select> : <select id="wpinv_discount_expiration_m" name="expiration_m">
292
-                    <?php for ( $i = 0; $i <= 59; $i++ ) { $value = str_pad( $i, 2, '0', STR_PAD_LEFT ); ?>
293
-                    <option value="<?php echo $value;?>" <?php selected( $value, $expiration_m ); ?>><?php echo $value;?></option>
292
+                    <?php for ($i = 0; $i <= 59; $i++) { $value = str_pad($i, 2, '0', STR_PAD_LEFT); ?>
293
+                    <option value="<?php echo $value; ?>" <?php selected($value, $expiration_m); ?>><?php echo $value; ?></option>
294 294
                     <?php } ?>
295 295
                 </select>
296
-                <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>
296
+                <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>
297 297
             </td>
298 298
         </tr>
299
-        <?php do_action( 'wpinv_discount_form_before_min_total', $post ); ?>
299
+        <?php do_action('wpinv_discount_form_before_min_total', $post); ?>
300 300
         <tr>
301 301
             <th valign="top" scope="row">
302
-                <label for="wpinv_discount_min_total"><?php _e( 'Minimum Amount', 'invoicing' ); ?></label>
302
+                <label for="wpinv_discount_min_total"><?php _e('Minimum Amount', 'invoicing'); ?></label>
303 303
             </th>
304 304
             <td>
305 305
                 <input type="text" name="min_total" id="wpinv_discount_min_total" class="wpi-field-price wpi-price" value="<?php echo $min_total; ?>">
306
-                <p class="description"><?php _e( 'This allows you to set the minimum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing' ); ?></p>
306
+                <p class="description"><?php _e('This allows you to set the minimum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing'); ?></p>
307 307
             </td>
308 308
         </tr>
309
-        <?php do_action( 'wpinv_discount_form_before_max_total', $post ); ?>
309
+        <?php do_action('wpinv_discount_form_before_max_total', $post); ?>
310 310
         <tr>
311 311
             <th valign="top" scope="row">
312
-                <label for="wpinv_discount_max_total"><?php _e( 'Maximum Amount', 'invoicing' ); ?></label>
312
+                <label for="wpinv_discount_max_total"><?php _e('Maximum Amount', 'invoicing'); ?></label>
313 313
             </th>
314 314
             <td>
315 315
                 <input type="text" name="max_total" id="wpinv_discount_max_total" class="wpi-field-price wpi-price" value="<?php echo $max_total; ?>">
316
-                <p class="description"><?php _e( 'This allows you to set the maximum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing' ); ?></p>
316
+                <p class="description"><?php _e('This allows you to set the maximum amount (subtotal, including taxes) allowed when using the discount.', 'invoicing'); ?></p>
317 317
             </td>
318 318
         </tr>
319
-        <?php do_action( 'wpinv_discount_form_before_recurring', $post ); ?>
319
+        <?php do_action('wpinv_discount_form_before_recurring', $post); ?>
320 320
         <tr>
321 321
             <th valign="top" scope="row">
322
-                <label for="wpinv_discount_recurring"><?php _e( 'For recurring apply to', 'invoicing' ); ?></label>
322
+                <label for="wpinv_discount_recurring"><?php _e('For recurring apply to', 'invoicing'); ?></label>
323 323
             </th>
324 324
             <td>
325 325
                 <select id="wpinv_discount_recurring" name="recurring" class="medium-text wpi_select2">
326
-                    <option value="0" <?php selected( false, $recurring ); ?>><?php _e( 'First payment only', 'invoicing' ); ?></option>
327
-                    <option value="1" <?php selected( true, $recurring ); ?>><?php _e( 'All payments', 'invoicing' ); ?></option>
326
+                    <option value="0" <?php selected(false, $recurring); ?>><?php _e('First payment only', 'invoicing'); ?></option>
327
+                    <option value="1" <?php selected(true, $recurring); ?>><?php _e('All payments', 'invoicing'); ?></option>
328 328
                 </select>
329
-                <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>
329
+                <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>
330 330
             </td>
331 331
         </tr>
332
-        <?php do_action( 'wpinv_discount_form_before_max_uses', $post ); ?>
332
+        <?php do_action('wpinv_discount_form_before_max_uses', $post); ?>
333 333
         <tr>
334 334
             <th valign="top" scope="row">
335
-                <label for="wpinv_discount_max_uses"><?php _e( 'Max Uses', 'invoicing' ); ?></label>
335
+                <label for="wpinv_discount_max_uses"><?php _e('Max Uses', 'invoicing'); ?></label>
336 336
             </th>
337 337
             <td>
338 338
                 <input type="number" min="0" step="1" id="wpinv_discount_max_uses" name="max_uses" class="medium-text" value="<?php echo $max_uses; ?>">
339
-                <p class="description"><?php _e( 'The maximum number of times this discount can be used. Leave blank for unlimited.', 'invoicing' ); ?></p>
339
+                <p class="description"><?php _e('The maximum number of times this discount can be used. Leave blank for unlimited.', 'invoicing'); ?></p>
340 340
             </td>
341 341
         </tr>
342
-        <?php do_action( 'wpinv_discount_form_before_single_use', $post ); ?>
342
+        <?php do_action('wpinv_discount_form_before_single_use', $post); ?>
343 343
         <tr>
344 344
             <th valign="top" scope="row">
345
-                <label for="wpinv_discount_single_use"><?php _e( 'Use Once Per User', 'invoicing' ); ?></label>
345
+                <label for="wpinv_discount_single_use"><?php _e('Use Once Per User', 'invoicing'); ?></label>
346 346
             </th>
347 347
             <td>
348
-                <input type="checkbox" value="1" name="single_use" id="wpinv_discount_single_use" <?php checked( true, $single_use ); ?>>
349
-                <span class="description"><?php _e( 'Limit this discount to a single use per user?', 'invoicing' ); ?></span>
348
+                <input type="checkbox" value="1" name="single_use" id="wpinv_discount_single_use" <?php checked(true, $single_use); ?>>
349
+                <span class="description"><?php _e('Limit this discount to a single use per user?', 'invoicing'); ?></span>
350 350
             </td>
351 351
         </tr>
352
-        <?php do_action( 'wpinv_discount_form_last', $post ); ?>
352
+        <?php do_action('wpinv_discount_form_last', $post); ?>
353 353
     </tbody>
354 354
 </table>
355
-<?php do_action( 'wpinv_discount_form_bottom', $post ); ?>
355
+<?php do_action('wpinv_discount_form_bottom', $post); ?>
356 356
     <?php
357 357
 }
358 358
 
359
-function wpinv_discount_metabox_save( $post_id, $post, $update = false ) {
360
-    $post_type = !empty( $post ) ? $post->post_type : '';
359
+function wpinv_discount_metabox_save($post_id, $post, $update = false) {
360
+    $post_type = !empty($post) ? $post->post_type : '';
361 361
     
362
-    if ( $post_type != 'wpi_discount' ) {
362
+    if ($post_type != 'wpi_discount') {
363 363
         return;
364 364
     }
365 365
     
366
-    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' ) ) ) {
366
+    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'))) {
367 367
         return;
368 368
     }
369 369
     
370
-    if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) {
370
+    if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) {
371 371
         return;
372 372
     }
373 373
     
374
-    if ( !current_user_can( wpinv_get_capability(), $post_id ) ) {
374
+    if (!current_user_can(wpinv_get_capability(), $post_id)) {
375 375
         return;
376 376
     }
377 377
     
378
-    if ( !empty( $_POST['start'] ) && isset( $_POST['start_h'] ) && isset( $_POST['start_m'] ) && $_POST['start_h'] !== '' && $_POST['start_m'] !== '' ) {
378
+    if (!empty($_POST['start']) && isset($_POST['start_h']) && isset($_POST['start_m']) && $_POST['start_h'] !== '' && $_POST['start_m'] !== '') {
379 379
         $_POST['start'] = $_POST['start'] . ' ' . $_POST['start_h'] . ':' . $_POST['start_m'];
380 380
     }
381 381
 
382
-    if ( !empty( $_POST['expiration'] ) && isset( $_POST['expiration_h'] ) && isset( $_POST['expiration_m'] ) ) {
382
+    if (!empty($_POST['expiration']) && isset($_POST['expiration_h']) && isset($_POST['expiration_m'])) {
383 383
         $_POST['expiration'] = $_POST['expiration'] . ' ' . $_POST['expiration_h'] . ':' . $_POST['expiration_m'];
384 384
     }
385 385
     
386
-    return /** @scrutinizer ignore-call */ wpinv_store_discount( $post_id, $_POST, $post, $update );
386
+    return /** @scrutinizer ignore-call */ wpinv_store_discount($post_id, $_POST, $post, $update);
387 387
 }
388
-add_action( 'save_post', 'wpinv_discount_metabox_save', 10, 3 );
389 388
\ No newline at end of file
389
+add_action('save_post', 'wpinv_discount_metabox_save', 10, 3);
390 390
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-mb-payment-form.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // MUST have WordPress.
3
-if ( !defined( 'WPINC' ) ) {
4
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
3
+if (!defined('WPINC')) {
4
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
5 5
 }
6 6
 
7 7
 class WPInv_Meta_Box_Payment_Form {
@@ -11,23 +11,23 @@  discard block
 block discarded – undo
11 11
      *
12 12
      * @param WP_Post $post
13 13
      */
14
-    public static function output_details( $post ) {
15
-        $details = get_post_meta( $post->ID, 'payment_form_data', true );
14
+    public static function output_details($post) {
15
+        $details = get_post_meta($post->ID, 'payment_form_data', true);
16 16
 
17
-        if ( ! is_array( $details ) ) {
17
+        if (!is_array($details)) {
18 18
             return;
19 19
         }
20 20
 
21 21
         echo '<div class="gdmbx2-wrap form-table"> <div class="gdmbx2-metabox gdmbx-field-list">';
22 22
 
23
-        foreach ( $details as $key => $value ) {
24
-            $key = sanitize_text_field( $key );
23
+        foreach ($details as $key => $value) {
24
+            $key = sanitize_text_field($key);
25 25
 
26
-            if ( is_array( $value ) ) {
27
-                $value = implode( ',', $value );
26
+            if (is_array($value)) {
27
+                $value = implode(',', $value);
28 28
             }
29 29
 
30
-            $value = esc_html( $value );
30
+            $value = esc_html($value);
31 31
 
32 32
             echo "<div class='gdmbx-row gdmbx-type-select'>";
33 33
             echo "<div class='gdmbx-th'><label>$key:</label></div>";
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @param WP_Post $post
45 45
      */
46
-    public static function output_shortcode( $post ) {
46
+    public static function output_shortcode($post) {
47 47
 
48
-        if ( ! is_numeric( $post ) ) {
48
+        if (!is_numeric($post)) {
49 49
             $post = $post->ID;
50 50
         }
51 51
 
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @param WP_Post $post
59 59
      */
60
-    public static function output ( $post ) {
61
-        $success_page        = get_post_meta( $post->ID, 'wpinv_success_page', true );
62
-        $success_page        = empty( $success_page ) ? wpinv_get_success_page_uri() : $success_page
60
+    public static function output($post) {
61
+        $success_page        = get_post_meta($post->ID, 'wpinv_success_page', true);
62
+        $success_page        = empty($success_page) ? wpinv_get_success_page_uri() : $success_page
63 63
         ?>
64 64
 
65 65
         <div id="wpinv-form-builder" style="display: flex; flex-flow: wrap;">
@@ -67,20 +67,20 @@  discard block
 block discarded – undo
67 67
             <div class="wpinv-form-builder-left bsui" style="flex: 0 0 320px;">
68 68
                 <ul class="wpinv-form-builder-tabs  nav nav-tabs">
69 69
                     <li class='nav-item' v-if="active_tab!='new_item'">
70
-                        <a @click.prevent="active_tab='new_item'" class="nav-link p-3" :class="{ 'active': active_tab=='new_item' }" href="#"><?php _e( 'Add new element', 'invoicing' ); ?></a>
70
+                        <a @click.prevent="active_tab='new_item'" class="nav-link p-3" :class="{ 'active': active_tab=='new_item' }" href="#"><?php _e('Add new element', 'invoicing'); ?></a>
71 71
                     </li>
72 72
                     <li class='nav-item' v-if='false'>
73
-                        <a @click.prevent="active_tab='edit_item'" class="nav-link p-3" :class="{ 'active': active_tab=='edit_item' }" href="#"><?php _e( 'Edit element', 'invoicing' ); ?></a>
73
+                        <a @click.prevent="active_tab='edit_item'" class="nav-link p-3" :class="{ 'active': active_tab=='edit_item' }" href="#"><?php _e('Edit element', 'invoicing'); ?></a>
74 74
                     </li>
75 75
                     <li class='nav-item' v-if='false'>
76
-                        <a @click.prevent="active_tab='settings'" class="nav-link p-3" :class="{ 'active': active_tab=='settings' }" href="#"><?php _e( 'Settings', 'invoicing' ); ?></a>
76
+                        <a @click.prevent="active_tab='settings'" class="nav-link p-3" :class="{ 'active': active_tab=='settings' }" href="#"><?php _e('Settings', 'invoicing'); ?></a>
77 77
                     </li>
78 78
                 </ul>
79 79
 
80 80
                 <div class="wpinv-form-builder-tab-content bsui" style="margin-top: 16px;">
81 81
                     <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='new_item'">
82 82
                         <div class="wpinv-form-builder-add-field-types">
83
-                            <small class='form-text text-muted'><?php _e( 'Add an element by dragging it to the payment form.', 'invoicing' ); ?></small>
83
+                            <small class='form-text text-muted'><?php _e('Add an element by dragging it to the payment form.', 'invoicing'); ?></small>
84 84
                             <draggable class="section mt-2" style="display: flex; flex-flow: wrap; justify-content: space-between;" v-model="elements" :group="{ name: 'fields', pull: 'clone', put: false }" :sort="false" :clone="addDraggedField" tag="ul" filter=".wpinv-undraggable">
85 85
                                 <li v-for="element in elements" style="width: 49%; background-color: #fafafa; margin-bottom: 9px; cursor: move; border: 1px solid #eeeeee;" @click.prevent="addField(element)" :class="{ 'd-none': element.defaults.premade }">
86 86
                                     <button class="button btn" style="width: 100%; cursor: move;">
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 
96 96
                     <div class="wpinv-form-builder-tab-pane bsui" v-if="active_tab=='edit_item'" style="font-size: 16px;">
97 97
                         <div class="wpinv-form-builder-edit-field-wrapper">
98
-                            <?php do_action( 'wpinv_payment_form_edit_element_template', 'active_form_element', $post ); ?>
98
+                            <?php do_action('wpinv_payment_form_edit_element_template', 'active_form_element', $post); ?>
99 99
                             <div>
100
-                                <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php _e( 'Delete Field', 'invoicing' ); ?></button>
100
+                                <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php _e('Delete Field', 'invoicing'); ?></button>
101 101
                             </div>
102 102
                         </div>
103 103
                     </div>
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
                         <div class="wpinv-form-builder-settings-wrapper">
107 107
                         
108 108
                             <div class='form-group'>
109
-                                <label for="wpi-success-page"><?php _e( 'Success Page', 'invoicing' ); ?></label>
110
-                                <input  placeholder="https://" id='wpi-success-page' value="<?php echo esc_url( $success_page ); ?>" class='form-control' type='text'>
111
-                                <small class='form-text text-muted'><?php _e( 'Where should we redirect users after successfuly completing their payment?', 'invoicing' ); ?></small>
109
+                                <label for="wpi-success-page"><?php _e('Success Page', 'invoicing'); ?></label>
110
+                                <input  placeholder="https://" id='wpi-success-page' value="<?php echo esc_url($success_page); ?>" class='form-control' type='text'>
111
+                                <small class='form-text text-muted'><?php _e('Where should we redirect users after successfuly completing their payment?', 'invoicing'); ?></small>
112 112
                             </div>
113 113
 
114 114
                         </div>
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
 
120 120
             <div class="wpinv-form-builder-right" style="flex: 1; padding-top: 40px;border-left: 1px solid #ddd;padding-left: 20px;min-height: 520px;margin-left: 10px;">
121 121
 
122
-                <small class='form-text text-muted' v-if='form_elements.length'><?php _e( 'Click on any element to edit or delete it.', 'invoicing' ); ?></small>
123
-                <p class='form-text text-muted' v-if='! form_elements.length'><?php _e( 'This form is empty. Add new elements by dragging them from the right.', 'invoicing' ); ?></p>
122
+                <small class='form-text text-muted' v-if='form_elements.length'><?php _e('Click on any element to edit or delete it.', 'invoicing'); ?></small>
123
+                <p class='form-text text-muted' v-if='! form_elements.length'><?php _e('This form is empty. Add new elements by dragging them from the right.', 'invoicing'); ?></p>
124 124
 
125 125
                 <draggable class="section bsui" v-model="form_elements" @add="highlightLastDroppedField" group="fields" tag="div" style="min-height: 100%; font-size: 16px;">
126 126
                     <div v-for="form_element in form_elements" class="wpinv-form-builder-element-preview" :class="{ active: active_form_element==form_element &&  active_tab=='edit_item' }" @click="active_tab = 'edit_item'; active_form_element = form_element">
127
-                        <?php do_action( 'wpinv_payment_form_render_element_template', 'form_element', $post ); ?>
127
+                        <?php do_action('wpinv_payment_form_render_element_template', 'form_element', $post); ?>
128 128
                     </div>
129 129
                 </draggable>
130 130
             </div>
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             <textarea style="display:none;" name="wpinv_form_items" v-model="itemString"></textarea>
134 134
         </div>
135 135
         
136
-        <?php wp_nonce_field( 'wpinv_save_payment_form', 'wpinv_save_payment_form' ) ;?>
136
+        <?php wp_nonce_field('wpinv_save_payment_form', 'wpinv_save_payment_form'); ?>
137 137
 
138 138
         <?php
139 139
     }
@@ -141,83 +141,83 @@  discard block
 block discarded – undo
141 141
     /**
142 142
      * Saves our payment forms.
143 143
      */
144
-    public static function save( $post_id, $post ) {
144
+    public static function save($post_id, $post) {
145 145
 
146
-        remove_action( 'save_post', 'WPInv_Meta_Box_Payment_Form::save' );
146
+        remove_action('save_post', 'WPInv_Meta_Box_Payment_Form::save');
147 147
 
148 148
         // $post_id and $post are required.
149
-        if ( empty( $post_id ) || empty( $post ) ) {
149
+        if (empty($post_id) || empty($post)) {
150 150
             return;
151 151
         }
152 152
         
153 153
         // Ensure that this user can edit the post.
154
-        if ( ! current_user_can( 'edit_post', $post_id ) ) {
154
+        if (!current_user_can('edit_post', $post_id)) {
155 155
             return;
156 156
         }
157 157
 
158 158
         // Dont' save meta boxes for revisions or autosaves
159
-        if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
159
+        if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
160 160
             return;
161 161
         }
162 162
 
163 163
         // Do not save for ajax requests.
164
-        if ( ( defined( 'DOING_AJAX') && DOING_AJAX ) || isset( $_REQUEST['bulk_edit'] ) ) {
164
+        if ((defined('DOING_AJAX') && DOING_AJAX) || isset($_REQUEST['bulk_edit'])) {
165 165
             return;
166 166
         }
167 167
 
168 168
         // Confirm the security nonce.
169
-        if ( empty( $_POST['wpinv_save_payment_form'] ) || ! wp_verify_nonce( $_POST['wpinv_save_payment_form'], 'wpinv_save_payment_form' ) ) {
169
+        if (empty($_POST['wpinv_save_payment_form']) || !wp_verify_nonce($_POST['wpinv_save_payment_form'], 'wpinv_save_payment_form')) {
170 170
             return;
171 171
         }
172 172
 
173 173
         // Save form items.
174
-        $form_items = json_decode( wp_unslash( $_POST['wpinv_form_items'] ), true );
174
+        $form_items = json_decode(wp_unslash($_POST['wpinv_form_items']), true);
175 175
 
176
-        if ( empty( $form_items ) ) {
176
+        if (empty($form_items)) {
177 177
             $form_items = array();
178 178
         }
179 179
 
180
-        update_post_meta( $post_id, 'wpinv_form_items', self::maybe_save_items( $form_items ) );
180
+        update_post_meta($post_id, 'wpinv_form_items', self::maybe_save_items($form_items));
181 181
 
182 182
         // Save form elements.
183
-        $wpinv_form_elements = json_decode( wp_unslash( $_POST['wpinv_form_elements'] ), true );
184
-        if ( empty( $wpinv_form_elements ) ) {
183
+        $wpinv_form_elements = json_decode(wp_unslash($_POST['wpinv_form_elements']), true);
184
+        if (empty($wpinv_form_elements)) {
185 185
             $wpinv_form_elements = array();
186 186
         }
187 187
 
188
-        update_post_meta( $post_id, 'wpinv_form_elements', $wpinv_form_elements );
188
+        update_post_meta($post_id, 'wpinv_form_elements', $wpinv_form_elements);
189 189
     }
190 190
 
191 191
     /**
192 192
      * Saves unsaved form items.
193 193
      */
194
-    public static function maybe_save_items( $items ) {
194
+    public static function maybe_save_items($items) {
195 195
 
196 196
         $saved = array();
197 197
 
198
-        foreach( $items as $item ) {
198
+        foreach ($items as $item) {
199 199
 
200
-            if ( is_numeric( $item['id'] ) ) {
200
+            if (is_numeric($item['id'])) {
201 201
                 $saved[] = $item;
202 202
                 continue;
203 203
             }
204 204
 
205 205
             $data = array(
206
-                'post_title'   => sanitize_text_field( $item['title'] ),
207
-                'post_excerpt' => wp_kses_post( $item['description'] ),
206
+                'post_title'   => sanitize_text_field($item['title']),
207
+                'post_excerpt' => wp_kses_post($item['description']),
208 208
                 'post_status'  => 'publish',
209 209
                 'meta'         => array(
210 210
                     'type'      => 'custom',
211
-                    'price'     => wpinv_sanitize_amount( $item['price'] ),
211
+                    'price'     => wpinv_sanitize_amount($item['price']),
212 212
                     'vat_rule'  => 'digital',
213 213
                     'vat_class' => '_standard',
214 214
                 )
215 215
             );
216 216
             
217
-            $new_item  = new WPInv_Item();
218
-            $new_item->create( $data );
217
+            $new_item = new WPInv_Item();
218
+            $new_item->create($data);
219 219
     
220
-            if ( ! empty( $new_item ) ) {
220
+            if (!empty($new_item)) {
221 221
                 $item['id'] = $new_item->ID;
222 222
                 $saved[] = $item;
223 223
             }
@@ -230,5 +230,5 @@  discard block
 block discarded – undo
230 230
 
231 231
 }
232 232
 
233
-add_action( 'save_post_wpi_payment_form', 'WPInv_Meta_Box_Payment_Form::save', 10, 2 );
233
+add_action('save_post_wpi_payment_form', 'WPInv_Meta_Box_Payment_Form::save', 10, 2);
234 234
 
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-mb-invoice-details.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // MUST have WordPress.
3
-if ( !defined( 'WPINC' ) ) {
4
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
3
+if (!defined('WPINC')) {
4
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
5 5
 }
6 6
 
7 7
 class WPInv_Meta_Box_Details {
8
-    public static function output( $post ) {
8
+    public static function output($post) {
9 9
         $currency_symbol    = wpinv_currency_symbol();
10
-        $statuses           = wpinv_get_invoice_statuses( true );
10
+        $statuses           = wpinv_get_invoice_statuses(true);
11 11
         
12
-        $post_id            = !empty( $post->ID ) ? $post->ID : 0;
13
-        $invoice            = new WPInv_Invoice( $post_id );
14
-        $status             = $invoice->get_status( false ); // Current status    
12
+        $post_id            = !empty($post->ID) ? $post->ID : 0;
13
+        $invoice            = new WPInv_Invoice($post_id);
14
+        $status             = $invoice->get_status(false); // Current status    
15 15
         $discount           = $invoice->get_discount();
16 16
         $discount_code      = $discount > 0 ? $invoice->get_discount_code() : '';
17 17
         $invoice_number     = $invoice->get_number();
18 18
         
19 19
         $date_created       = $invoice->get_created_date();
20
-        $datetime_created   = strtotime( $date_created );
21
-        $date_created       = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $datetime_created ) : '';
20
+        $datetime_created   = strtotime($date_created);
21
+        $date_created       = $date_created != '' && $date_created != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $datetime_created) : '';
22 22
         $date_completed     = $invoice->get_completed_date();
23
-        $date_completed     = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $date_completed ) ) : 'n/a';
24
-        $title['status'] = __( 'Invoice Status:', 'invoicing' );
25
-        $title['number'] = __( 'Invoice Number:', 'invoicing' );
26
-        $mail_notice = esc_attr__( 'After saving invoice, this will send a copy of the invoice to the user&#8217;s email address.', 'invoicing' );
23
+        $date_completed     = $date_completed != '' && $date_completed != '0000-00-00 00:00:00' ? date_i18n(get_option('date_format') . ' ' . get_option('time_format'), strtotime($date_completed)) : 'n/a';
24
+        $title['status'] = __('Invoice Status:', 'invoicing');
25
+        $title['number'] = __('Invoice Number:', 'invoicing');
26
+        $mail_notice = esc_attr__('After saving invoice, this will send a copy of the invoice to the user&#8217;s email address.', 'invoicing');
27 27
         
28 28
         $title = apply_filters('wpinv_details_metabox_titles', $title, $invoice);
29 29
         $statuses = apply_filters('wpinv_invoice_statuses', $statuses, $invoice);
@@ -33,36 +33,36 @@  discard block
 block discarded – undo
33 33
 <div class="gdmbx2-wrap form-table">
34 34
     <div class="gdmbx2-metabox gdmbx-field-list" id="gdmbx2-metabox-wpinv_details">
35 35
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-created">
36
-            <div class="gdmbx-th"><label><?php _e( 'Date Created:', 'invoicing' );?></label></div>
37
-            <div class="gdmbx-td"><?php echo $date_created;?></div>
36
+            <div class="gdmbx-th"><label><?php _e('Date Created:', 'invoicing'); ?></label></div>
37
+            <div class="gdmbx-td"><?php echo $date_created; ?></div>
38 38
         </div>
39
-        <?php if ( $invoice->post_type == 'wpi_invoice' && wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->has_status( array( 'auto-draft', 'draft' ) ) ) ) { ?>
39
+        <?php if ($invoice->post_type == 'wpi_invoice' && wpinv_get_option('overdue_active') && ($invoice->needs_payment() || $invoice->has_status(array('auto-draft', 'draft')))) { ?>
40 40
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-overdue">
41
-            <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e( 'Due Date:', 'invoicing' );?></label></div>
41
+            <div class="gdmbx-th"><label for="wpinv_due_date"><?php _e('Due Date:', 'invoicing'); ?></label></div>
42 42
             <div class="gdmbx-td">
43
-                <input type="text" placeholder="<?php esc_attr_e( 'Y-m-d', 'invoicing' );?>" value="<?php echo esc_attr( $invoice->get_due_date() );?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr( date_i18n( 'Y-m-d', $datetime_created ) );?>" data-dateFormat="yy-mm-dd">
44
-                <p class="wpi-meta-row wpi-meta-desc"><?php _e( 'Leave blank to disable sending auto reminder for this invoice.', 'invoicing' );?></p>
43
+                <input type="text" placeholder="<?php esc_attr_e('Y-m-d', 'invoicing'); ?>" value="<?php echo esc_attr($invoice->get_due_date()); ?>" id="wpinv_due_date" name="wpinv_due_date" class="regular-text wpiDatepicker" data-minDate="<?php echo esc_attr(date_i18n('Y-m-d', $datetime_created)); ?>" data-dateFormat="yy-mm-dd">
44
+                <p class="wpi-meta-row wpi-meta-desc"><?php _e('Leave blank to disable sending auto reminder for this invoice.', 'invoicing'); ?></p>
45 45
             </div>
46 46
         </div>
47 47
         <?php } ?>
48
-        <?php do_action( 'wpinv_meta_box_details_after_due_date', $post_id ); ?>
49
-        <?php if ( $date_completed && $date_completed != 'n/a' ) { ?>
48
+        <?php do_action('wpinv_meta_box_details_after_due_date', $post_id); ?>
49
+        <?php if ($date_completed && $date_completed != 'n/a') { ?>
50 50
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-date-completed">
51
-            <div class="gdmbx-th"><label><?php _e( 'Payment Date:', 'invoicing' );?></label></div>
52
-            <div class="gdmbx-td"><?php echo $date_completed;?></div>
51
+            <div class="gdmbx-th"><label><?php _e('Payment Date:', 'invoicing'); ?></label></div>
52
+            <div class="gdmbx-td"><?php echo $date_completed; ?></div>
53 53
         </div>
54 54
         <?php } ?>
55
-        <?php $is_viewed = wpinv_is_invoice_viewed( $post_id ); ?>
55
+        <?php $is_viewed = wpinv_is_invoice_viewed($post_id); ?>
56 56
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-customer-viewed">
57
-            <div class="gdmbx-th"><label><?php _e( 'Viewed by Customer:', 'invoicing' );?></label></div>
58
-            <div class="gdmbx-td"><?php ( 1 == $is_viewed ) ? _e( 'Yes', 'invoicing' ) : _e( 'No', 'invoicing' ); ?></div>
57
+            <div class="gdmbx-th"><label><?php _e('Viewed by Customer:', 'invoicing'); ?></label></div>
58
+            <div class="gdmbx-td"><?php (1 == $is_viewed) ? _e('Yes', 'invoicing') : _e('No', 'invoicing'); ?></div>
59 59
         </div>
60 60
         <div class="gdmbx-row gdmbx-type-select gdmbx2-id-wpinv-status">
61 61
             <div class="gdmbx-th"><label for="wpinv_status"><?php echo $title['status']; ?></label></div>
62 62
             <div class="gdmbx-td">
63 63
                 <select required="required" id="wpinv_status" name="wpinv_status" class="gdmbx2_select wpi_select2">
64
-                    <?php foreach ( $statuses as $value => $label ) { ?>
65
-                    <option value="<?php echo $value;?>" <?php selected( $status, $value );?>><?php echo $label;?></option>
64
+                    <?php foreach ($statuses as $value => $label) { ?>
65
+                    <option value="<?php echo $value; ?>" <?php selected($status, $value); ?>><?php echo $label; ?></option>
66 66
                     <?php } ?>
67 67
                 </select>
68 68
             </div>
@@ -70,117 +70,117 @@  discard block
 block discarded – undo
70 70
         <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-number table-layout">
71 71
             <div class="gdmbx-th"><label for="wpinv_number"><?php echo $title['number']; ?></label></div>
72 72
             <div class="gdmbx-td">
73
-                <input type="text" value="<?php echo esc_attr( $invoice_number );?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly>
73
+                <input type="text" value="<?php echo esc_attr($invoice_number); ?>" id="wpinv_number" name="wpinv_number" class="regular-text" readonly>
74 74
             </div>
75 75
         </div>
76
-        <?php do_action( 'wpinv_meta_box_details_inner', $post_id );
76
+        <?php do_action('wpinv_meta_box_details_inner', $post_id);
77 77
         $disable_discount = apply_filters('wpinv_disable_apply_discount', false, $invoice, $post_id);
78 78
         ?>
79
-        <?php if ( !( $is_paid = ( $invoice->is_paid() || $invoice->is_refunded() ) ) && !$disable_discount || $discount_code ) { ?>
79
+        <?php if (!($is_paid = ($invoice->is_paid() || $invoice->is_refunded())) && !$disable_discount || $discount_code) { ?>
80 80
         <div class="gdmbx-row gdmbx-type-text gdmbx2-id-wpinv-discount-code table-layout">
81
-            <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e( 'Discount Code:', 'invoicing' );?></label></div>
81
+            <div class="gdmbx-th"><label for="wpinv_discount_code"><?php _e('Discount Code:', 'invoicing'); ?></label></div>
82 82
             <div class="gdmbx-td">
83
-                <input type="text" value="<?php echo esc_attr( $discount_code ); ?>" id="wpinv_discount" class="medium-text" <?php echo ( $discount_code ? 'readonly' : '' ); ?> /><?php if ( !$is_paid && !$disable_discount ) { ?><input value="<?php echo esc_attr_e( 'Apply', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-hide' : 'wpi-inlineb' ); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e( 'Remove', 'invoicing' ); ?>" class="button button-small button-primary <?php echo ( $discount_code ? 'wpi-inlineb' : 'wpi-hide' ); ?>" id="wpinv-remove-code" type="button" /><?php } ?>
83
+                <input type="text" value="<?php echo esc_attr($discount_code); ?>" id="wpinv_discount" class="medium-text" <?php echo ($discount_code ? 'readonly' : ''); ?> /><?php if (!$is_paid && !$disable_discount) { ?><input value="<?php echo esc_attr_e('Apply', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-hide' : 'wpi-inlineb'); ?>" id="wpinv-apply-code" type="button" /><input value="<?php echo esc_attr_e('Remove', 'invoicing'); ?>" class="button button-small button-primary <?php echo ($discount_code ? 'wpi-inlineb' : 'wpi-hide'); ?>" id="wpinv-remove-code" type="button" /><?php } ?>
84 84
             </div>
85 85
         </div>
86 86
         <?php } ?>
87 87
     </div>
88 88
 </div>
89 89
 <div class="gdmbx-row gdmbx-type-text gdmbx-wpinv-save-send table-layout">
90
-    <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__( 'Send %s:', 'invoicing' ),$post_obj->labels->singular_name) ; ?></label>
90
+    <p class="wpi-meta-row wpi-save-send"><label for="wpi_save_send"><?php echo sprintf(__('Send %s:', 'invoicing'), $post_obj->labels->singular_name); ?></label>
91 91
         <select id="wpi_save_send" name="wpi_save_send" class="wpi_select2">
92
-            <option value="1"><?php _e( 'Yes', 'invoicing' ); ?></option>
93
-            <option value="" selected="selected"><?php _e( 'No', 'invoicing' ); ?></option>
92
+            <option value="1"><?php _e('Yes', 'invoicing'); ?></option>
93
+            <option value="" selected="selected"><?php _e('No', 'invoicing'); ?></option>
94 94
         </select>
95 95
     </p>
96 96
     <p class="wpi-meta-row wpi-send-info"><?php echo $mail_notice; ?></p>
97 97
 </div>
98
-<?php wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ;?>
98
+<?php wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); ?>
99 99
         <?php
100 100
     }
101 101
     
102
-    public static function resend_invoice( $post ) {
102
+    public static function resend_invoice($post) {
103 103
         global $wpi_mb_invoice;
104 104
         
105
-        if ( empty( $wpi_mb_invoice ) ) {
105
+        if (empty($wpi_mb_invoice)) {
106 106
             return;
107 107
         }
108 108
         
109 109
         $text = array(
110
-            'message'       => esc_attr__( 'This will send a copy of the invoice to the customer&#8217;s email address.', 'invoicing' ),
111
-            'button_text'   =>  __( 'Resend Invoice', 'invoicing' ),
110
+            'message'       => esc_attr__('This will send a copy of the invoice to the customer&#8217;s email address.', 'invoicing'),
111
+            'button_text'   =>  __('Resend Invoice', 'invoicing'),
112 112
         );
113 113
             
114 114
         $text = apply_filters('wpinv_resend_invoice_metabox_text', $text);
115
-        do_action( 'wpinv_metabox_resend_invoice_before', $wpi_mb_invoice );
115
+        do_action('wpinv_metabox_resend_invoice_before', $wpi_mb_invoice);
116 116
         
117
-        if ( $email = $wpi_mb_invoice->get_email() ) {
117
+        if ($email = $wpi_mb_invoice->get_email()) {
118 118
             $email_actions = array();
119
-            $email_actions['email_url']      = remove_query_arg( 'wpinv-message', add_query_arg( array( 'wpi_action' => 'send_invoice', 'invoice_id' => $post->ID ) ) );
120
-            $email_actions['reminder_url']   = add_query_arg( array( 'wpi_action' => 'send_reminder', 'invoice_id' => $post->ID ) );
119
+            $email_actions['email_url']      = remove_query_arg('wpinv-message', add_query_arg(array('wpi_action' => 'send_invoice', 'invoice_id' => $post->ID)));
120
+            $email_actions['reminder_url']   = add_query_arg(array('wpi_action' => 'send_reminder', 'invoice_id' => $post->ID));
121 121
             
122
-            $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions );
122
+            $email_actions = apply_filters('wpinv_resend_invoice_email_actions', $email_actions);
123 123
         ?>
124 124
         <p class="wpi-meta-row wpi-resend-info"><?php echo $text['message']; ?></p>
125
-        <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url( $email_actions['email_url'] ); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p>
126
-        <?php if ( wpinv_get_option( 'overdue_active' ) && "wpi_invoice" === $wpi_mb_invoice->post_type && $wpi_mb_invoice->needs_payment() && ( $due_date = $wpi_mb_invoice->get_due_date() ) ) { ?>
127
-        <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e( 'Send overdue reminder notification to customer', 'invoicing' ); ?>" href="<?php echo esc_url( $email_actions['reminder_url'] ); ?>" class="button button-secondary"><?php esc_attr_e( 'Send Reminder', 'invoicing' ); ?></a></p>
125
+        <p class="wpi-meta-row wpi-resend-email"><a href="<?php echo esc_url($email_actions['email_url']); ?>" class="button button-secondary"><?php echo $text['button_text']; ?></a></p>
126
+        <?php if (wpinv_get_option('overdue_active') && "wpi_invoice" === $wpi_mb_invoice->post_type && $wpi_mb_invoice->needs_payment() && ($due_date = $wpi_mb_invoice->get_due_date())) { ?>
127
+        <p class="wpi-meta-row wpi-send-reminder"><a title="<?php esc_attr_e('Send overdue reminder notification to customer', 'invoicing'); ?>" href="<?php echo esc_url($email_actions['reminder_url']); ?>" class="button button-secondary"><?php esc_attr_e('Send Reminder', 'invoicing'); ?></a></p>
128 128
         <?php } ?>
129 129
         <?php
130 130
         }
131 131
         
132
-        do_action( 'wpinv_metabox_resend_invoice_after', $wpi_mb_invoice );
132
+        do_action('wpinv_metabox_resend_invoice_after', $wpi_mb_invoice);
133 133
     }
134 134
     
135
-    public static function subscriptions( $post ) {
136
-        $invoice = wpinv_get_invoice( $post->ID );
135
+    public static function subscriptions($post) {
136
+        $invoice = wpinv_get_invoice($post->ID);
137 137
 
138
-        if ( ! empty( $invoice ) && $invoice->is_recurring() && $invoice->is_parent() ) {
139
-            $subscription = wpinv_get_subscription( $invoice );
138
+        if (!empty($invoice) && $invoice->is_recurring() && $invoice->is_parent()) {
139
+            $subscription = wpinv_get_subscription($invoice);
140 140
 
141
-            if ( empty( $subscription ) ) {
141
+            if (empty($subscription)) {
142 142
                 ?>
143
-                <p class="wpi-meta-row"><?php echo wp_sprintf( __( 'New Subscription will be created when customer will checkout and pay the invoice. Go to: %sSubscriptions%s', 'invoicing' ), '<a href="' . admin_url( 'admin.php?page=wpinv-subscriptions' ).'">', '</a>' ); ?></p>
143
+                <p class="wpi-meta-row"><?php echo wp_sprintf(__('New Subscription will be created when customer will checkout and pay the invoice. Go to: %sSubscriptions%s', 'invoicing'), '<a href="' . admin_url('admin.php?page=wpinv-subscriptions') . '">', '</a>'); ?></p>
144 144
                 <?php
145 145
                 return;
146 146
             }
147
-            $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency( $subscription->period, $subscription->frequency );
148
-            $billing = wpinv_price(wpinv_format_amount( $subscription->recurring_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) ) . ' / ' . $frequency;
149
-            $initial = wpinv_price(wpinv_format_amount( $subscription->initial_amount ), wpinv_get_invoice_currency_code( $subscription->parent_payment_id ) );
147
+            $frequency = WPInv_Subscriptions::wpinv_get_pretty_subscription_frequency($subscription->period, $subscription->frequency);
148
+            $billing = wpinv_price(wpinv_format_amount($subscription->recurring_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id)) . ' / ' . $frequency;
149
+            $initial = wpinv_price(wpinv_format_amount($subscription->initial_amount), wpinv_get_invoice_currency_code($subscription->parent_payment_id));
150 150
             $payments = $subscription->get_child_payments();
151 151
             ?>
152 152
             <p class="wpi-meta-row wpi-sub-label <?php echo 'status-' . $subscription->status; ?>"><?php _e('Recurring Payment', 'invoicing'); ?></p>
153
-            <?php if ( ! empty( $subscription ) && ! empty( $subscription->id ) ) { ?>
153
+            <?php if (!empty($subscription) && !empty($subscription->id)) { ?>
154 154
                 <p class="wpi-meta-row wpi-sub-id">
155
-                    <label><?php _e( 'Subscription ID:', 'invoicing' ); ?> </label><a href="<?php echo esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . $subscription->id ) ); ?>" title="<?php esc_attr_e( 'View or edit subscription', 'invoicing' ); ?>" target="_blank"><?php echo $subscription->id; ?></a></p>
155
+                    <label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . $subscription->id)); ?>" title="<?php esc_attr_e('View or edit subscription', 'invoicing'); ?>" target="_blank"><?php echo $subscription->id; ?></a></p>
156 156
             <?php } ?>
157 157
             <p class="wpi-meta-row wpi-bill-cycle">
158
-                <label><?php _e( 'Billing Cycle:', 'invoicing'); ?> </label><?php printf( _x( '%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing' ), $initial, $billing ); ?>
158
+                <label><?php _e('Billing Cycle:', 'invoicing'); ?> </label><?php printf(_x('%s then %s', 'Initial subscription amount then billing cycle and amount', 'invoicing'), $initial, $billing); ?>
159 159
             </p>
160 160
             <p class="wpi-meta-row wpi-billed-times">
161
-                <label><?php _e( 'Times Billed:', 'invoicing' ); ?> </label><?php echo $subscription->get_times_billed() . ' / ' . ( ( $subscription->bill_times == 0 ) ? 'Until Cancelled' : $subscription->bill_times ); ?>
161
+                <label><?php _e('Times Billed:', 'invoicing'); ?> </label><?php echo $subscription->get_times_billed() . ' / ' . (($subscription->bill_times == 0) ? 'Until Cancelled' : $subscription->bill_times); ?>
162 162
             </p>
163 163
             <p class="wpi-meta-row wpi-start-date">
164
-                <label><?php _e( 'Start Date:', 'invoicing' ); ?> </label><?php echo date_i18n( get_option( 'date_format' ), strtotime( $subscription->created, current_time( 'timestamp' ) ) ); ?>
164
+                <label><?php _e('Start Date:', 'invoicing'); ?> </label><?php echo date_i18n(get_option('date_format'), strtotime($subscription->created, current_time('timestamp'))); ?>
165 165
             </p>
166 166
             <p class="wpi-meta-row wpi-end-date">
167
-                <label><?php echo ( 'trialling' == $subscription->status ? __( 'Trialling Until:', 'invoicing' ) : __( 'Expiration Date:', 'invoicing' ) ); ?> </label><?php echo date_i18n( get_option( 'date_format' ), strtotime( $subscription->expiration, current_time( 'timestamp' ) ) ); ?>
167
+                <label><?php echo ('trialling' == $subscription->status ? __('Trialling Until:', 'invoicing') : __('Expiration Date:', 'invoicing')); ?> </label><?php echo date_i18n(get_option('date_format'), strtotime($subscription->expiration, current_time('timestamp'))); ?>
168 168
             </p>
169
-            <?php if ( $subscription->status ) { ?>
169
+            <?php if ($subscription->status) { ?>
170 170
                 <p class="wpi-meta-row wpi-sub-status">
171
-                    <label><?php _e( 'Subscription Status:', 'invoicing'); ?> </label><?php echo $subscription->get_status_label(); ?>
171
+                    <label><?php _e('Subscription Status:', 'invoicing'); ?> </label><?php echo $subscription->get_status_label(); ?>
172 172
                 </p>
173 173
             <?php } ?>
174
-            <?php if ( !empty( $payments ) ) { ?>
175
-                <p><strong><?php _e( 'Renewal Payments:', 'invoicing' ); ?></strong></p>
174
+            <?php if (!empty($payments)) { ?>
175
+                <p><strong><?php _e('Renewal Payments:', 'invoicing'); ?></strong></p>
176 176
                 <ul id="wpi-sub-payments">
177
-                <?php foreach ( $payments as $payment ) {
177
+                <?php foreach ($payments as $payment) {
178 178
                     $invoice_id = $payment->ID;
179 179
                     ?>
180 180
                     <li>
181
-                        <a href="<?php echo esc_url( get_edit_post_link( $invoice_id ) ); ?>"><?php echo wpinv_get_invoice_number( $invoice_id ); ?></a>&nbsp;&ndash;&nbsp;
182
-                        <span><?php echo wpinv_get_invoice_date( $invoice_id ); ?>&nbsp;&ndash;&nbsp;</span>
183
-                        <span><?php echo wpinv_payment_total( $invoice_id, true ); ?></span>
181
+                        <a href="<?php echo esc_url(get_edit_post_link($invoice_id)); ?>"><?php echo wpinv_get_invoice_number($invoice_id); ?></a>&nbsp;&ndash;&nbsp;
182
+                        <span><?php echo wpinv_get_invoice_date($invoice_id); ?>&nbsp;&ndash;&nbsp;</span>
183
+                        <span><?php echo wpinv_payment_total($invoice_id, true); ?></span>
184 184
                     </li>
185 185
                 <?php } ?>
186 186
                 </ul>
@@ -188,16 +188,16 @@  discard block
 block discarded – undo
188 188
         }
189 189
     }
190 190
     
191
-    public static function renewals( $post ) {
192
-        $invoice = wpinv_get_invoice( $post->ID );
191
+    public static function renewals($post) {
192
+        $invoice = wpinv_get_invoice($post->ID);
193 193
         
194
-        if ( wpinv_is_subscription_payment( $invoice ) ) {
195
-            $parent_url = get_edit_post_link( $invoice->parent_invoice );
196
-            $parent_id  = wpinv_get_invoice_number( $invoice->parent_invoice );
197
-            $subscription = wpinv_get_subscription( $invoice );
194
+        if (wpinv_is_subscription_payment($invoice)) {
195
+            $parent_url = get_edit_post_link($invoice->parent_invoice);
196
+            $parent_id  = wpinv_get_invoice_number($invoice->parent_invoice);
197
+            $subscription = wpinv_get_subscription($invoice);
198 198
         ?>
199
-        <?php if ( ! empty( $subscription ) ) { ?><p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . $subscription->id ) ); ?>" title="<?php esc_attr_e( 'View or edit subscription', 'invoicing' ); ?>" target="_blank"><?php echo $subscription->id; ?></a></p><?php } ?>
200
-        <p class="wpi-meta-row wpi-parent-id"><label><?php _e( 'Parent Invoice:', 'invoicing' );?> </label><a href="<?php echo esc_url( $parent_url ); ?>"><?php echo $parent_id; ?></a></p>
199
+        <?php if (!empty($subscription)) { ?><p class="wpi-meta-row wpi-sub-id"><label><?php _e('Subscription ID:', 'invoicing'); ?> </label><a href="<?php echo esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . $subscription->id)); ?>" title="<?php esc_attr_e('View or edit subscription', 'invoicing'); ?>" target="_blank"><?php echo $subscription->id; ?></a></p><?php } ?>
200
+        <p class="wpi-meta-row wpi-parent-id"><label><?php _e('Parent Invoice:', 'invoicing'); ?> </label><a href="<?php echo esc_url($parent_url); ?>"><?php echo $parent_id; ?></a></p>
201 201
         <?php
202 202
         }
203 203
     }
@@ -205,47 +205,47 @@  discard block
 block discarded – undo
205 205
     /**
206 206
      * Renders a metabox to edit a payment form.
207 207
      */
208
-    public static function payment_form( $post ) {
209
-        WPInv_Meta_Box_Form_Items::output_options( $post );
208
+    public static function payment_form($post) {
209
+        WPInv_Meta_Box_Form_Items::output_options($post);
210 210
     }
211 211
 
212 212
     /**
213 213
      * Renders a metabox to select items.
214 214
      */
215
-    public static function payment_form_items( $post ) {
216
-        WPInv_Meta_Box_Form_Items::output( $post );
215
+    public static function payment_form_items($post) {
216
+        WPInv_Meta_Box_Form_Items::output($post);
217 217
     }
218 218
     
219
-    public static function payment_meta( $post ) {
219
+    public static function payment_meta($post) {
220 220
         global $wpi_mb_invoice;
221 221
 
222
-        $set_dateway = empty( $wpi_mb_invoice->gateway ) ? true : false;
223
-        if ( !$set_dateway && !$wpi_mb_invoice->get_meta( '_wpinv_checkout', true ) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded() ) {
222
+        $set_dateway = empty($wpi_mb_invoice->gateway) ? true : false;
223
+        if (!$set_dateway && !$wpi_mb_invoice->get_meta('_wpinv_checkout', true) && !$wpi_mb_invoice->is_paid() && !$wpi_mb_invoice->is_refunded()) {
224 224
             $set_dateway = true;
225 225
         }
226 226
         
227 227
         ?>
228 228
         <p class="wpi-meta-row">
229
-        <?php if ( $set_dateway ) { $gateways = wpinv_get_enabled_payment_gateways( true ); ?>
230
-            <label for="wpinv_gateway"><?php _e( 'Gateway:', 'invoicing' ) ; ?></label>
229
+        <?php if ($set_dateway) { $gateways = wpinv_get_enabled_payment_gateways(true); ?>
230
+            <label for="wpinv_gateway"><?php _e('Gateway:', 'invoicing'); ?></label>
231 231
             <select required="required" id="wpinv_gateway" class="wpi_select2" name="wpinv_gateway">
232
-                <?php foreach ( $gateways as $name => $gateway ) {
233
-                    if ( $wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription( $name ) ) {
232
+                <?php foreach ($gateways as $name => $gateway) {
233
+                    if ($wpi_mb_invoice->is_recurring() && !wpinv_gateway_support_subscription($name)) {
234 234
                         continue;
235 235
                     }
236 236
                     ?>
237
-                <option value="<?php echo $name;?>" <?php selected( $wpi_mb_invoice->gateway, $name );?>><?php echo !empty( $gateway['admin_label'] ) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option>
237
+                <option value="<?php echo $name; ?>" <?php selected($wpi_mb_invoice->gateway, $name); ?>><?php echo !empty($gateway['admin_label']) ? $gateway['admin_label'] : $gateway['checkout_label']; ?></option>
238 238
                 <?php } ?>
239 239
             </select>
240 240
         <?php } else { 
241
-            echo wp_sprintf( __( '<label>Gateway:</label> %s', 'invoicing' ), wpinv_get_gateway_admin_label( $wpi_mb_invoice->gateway ) );
241
+            echo wp_sprintf(__('<label>Gateway:</label> %s', 'invoicing'), wpinv_get_gateway_admin_label($wpi_mb_invoice->gateway));
242 242
         } ?>
243 243
         </p>
244
-        <?php if ( $key = $wpi_mb_invoice->get_key() ) { ?>
245
-        <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Key:</label> %s', 'invoicing' ), $key ); ?></p>
244
+        <?php if ($key = $wpi_mb_invoice->get_key()) { ?>
245
+        <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Key:</label> %s', 'invoicing'), $key); ?></p>
246 246
         <?php } ?>
247
-        <?php if ( $wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded() ) { ?>
248
-        <p class="wpi-meta-row"><?php echo wp_sprintf( __( '<label>Transaction ID:</label> %s', 'invoicing' ), wpinv_payment_link_transaction_id( $wpi_mb_invoice ) ); ?></p>
247
+        <?php if ($wpi_mb_invoice->is_paid() || $wpi_mb_invoice->is_refunded()) { ?>
248
+        <p class="wpi-meta-row"><?php echo wp_sprintf(__('<label>Transaction ID:</label> %s', 'invoicing'), wpinv_payment_link_transaction_id($wpi_mb_invoice)); ?></p>
249 249
         <?php } ?>
250 250
         <?php
251 251
     }
Please login to merge, or discard this patch.
includes/class-wpinv-payment-form-elements.php 1 patch
Spacing   +474 added lines, -474 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
     exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
 
14 14
     public function __construct() {
15 15
 
16
-        foreach( $this->get_elements() as $element ) {
16
+        foreach ($this->get_elements() as $element) {
17 17
             $element = $element['type'];
18 18
 
19
-            if ( method_exists( $this, "render_{$element}_template" ) ) {
20
-                add_action( 'wpinv_payment_form_render_element_template', array( $this, "render_{$element}_template" ), 10, 2 );
19
+            if (method_exists($this, "render_{$element}_template")) {
20
+                add_action('wpinv_payment_form_render_element_template', array($this, "render_{$element}_template"), 10, 2);
21 21
             }
22 22
 
23
-            if ( method_exists( $this, "edit_{$element}_template" ) ) {
24
-                add_action( 'wpinv_payment_form_edit_element_template', array( $this, "edit_{$element}_template" ), 10, 2 );
23
+            if (method_exists($this, "edit_{$element}_template")) {
24
+                add_action('wpinv_payment_form_edit_element_template', array($this, "edit_{$element}_template"), 10, 2);
25 25
             }
26 26
 
27
-            if ( method_exists( $this, "frontend_render_{$element}_template" ) ) {
28
-                add_action( "wpinv_frontend_render_payment_form_$element", array( $this, "frontend_render_{$element}_template" ), 10, 3 );
27
+            if (method_exists($this, "frontend_render_{$element}_template")) {
28
+                add_action("wpinv_frontend_render_payment_form_$element", array($this, "frontend_render_{$element}_template"), 10, 3);
29 29
             }
30 30
 
31 31
         }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function get_elements() {
39 39
 
40
-        if ( ! empty( $this->elements ) ) {
40
+        if (!empty($this->elements)) {
41 41
             return $this->elements;
42 42
         }
43 43
 
@@ -45,28 +45,28 @@  discard block
 block discarded – undo
45 45
 
46 46
             array(
47 47
                 'type'     => 'heading',
48
-                'name'     => __( 'Heading', 'invoicing' ),
48
+                'name'     => __('Heading', 'invoicing'),
49 49
                 'defaults' => array(
50 50
                     'level' => 'h2',
51
-                    'text'  => __( 'Heading', 'invoicing' ),
51
+                    'text'  => __('Heading', 'invoicing'),
52 52
                 )
53 53
             ),
54 54
 
55 55
             array(
56 56
                 'type' => 'paragraph',
57
-                'name' => __( 'Paragraph', 'invoicing' ),
57
+                'name' => __('Paragraph', 'invoicing'),
58 58
                 'defaults'  => array(
59
-                    'text'  => __( 'Paragraph text', 'invoicing' ),
59
+                    'text'  => __('Paragraph text', 'invoicing'),
60 60
                 )
61 61
             ),
62 62
 
63 63
             array( 
64 64
                 'type' => 'alert',
65
-                'name' => __( 'Alert', 'invoicing' ),
65
+                'name' => __('Alert', 'invoicing'),
66 66
                 'defaults'  => array(
67 67
                     'value'        => '',
68 68
                     'class'        => 'alert-warning',
69
-                    'text'         => __( 'Alert', 'invoicing' ),
69
+                    'text'         => __('Alert', 'invoicing'),
70 70
                     'dismissible'  => false,
71 71
                 )
72 72
             ),
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
 
83 83
             array(
84 84
                 'type' => 'text',
85
-                'name' => __( 'Text Input', 'invoicing' ),
85
+                'name' => __('Text Input', 'invoicing'),
86 86
                 'defaults'  => array(
87
-                    'placeholder'  => __( 'Enter some text', 'invoicing' ),
87
+                    'placeholder'  => __('Enter some text', 'invoicing'),
88 88
                     'value'        => '',
89
-                    'label'        => __( 'Field Label', 'invoicing' ),
89
+                    'label'        => __('Field Label', 'invoicing'),
90 90
                     'description'  => '',
91 91
                     'required'     => false,
92 92
                 )
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 
95 95
             array(
96 96
                 'type' => 'textarea',
97
-                'name' => __( 'Textarea', 'invoicing' ),
97
+                'name' => __('Textarea', 'invoicing'),
98 98
                 'defaults'         => array(
99
-                    'placeholder'  => __( 'Enter your text hear', 'invoicing' ),
99
+                    'placeholder'  => __('Enter your text hear', 'invoicing'),
100 100
                     'value'        => '',
101
-                    'label'        => __( 'Textarea Label', 'invoicing' ),
101
+                    'label'        => __('Textarea Label', 'invoicing'),
102 102
                     'description'  => '',
103 103
                     'required'     => false,
104 104
                 )
@@ -106,27 +106,27 @@  discard block
 block discarded – undo
106 106
 
107 107
             array(
108 108
                 'type' => 'select',
109
-                'name' => __( 'Dropdown', 'invoicing' ),
109
+                'name' => __('Dropdown', 'invoicing'),
110 110
                 'defaults'         => array(
111
-                    'placeholder'  => __( 'Select a value', 'invoicing' ),
111
+                    'placeholder'  => __('Select a value', 'invoicing'),
112 112
                     'value'        => '',
113
-                    'label'        => __( 'Dropdown Label', 'invoicing' ),
113
+                    'label'        => __('Dropdown Label', 'invoicing'),
114 114
                     'description'  => '',
115 115
                     'required'     => false,
116 116
                     'options'      => array(
117
-                        esc_attr__( 'Option One', 'invoicing' ),
118
-                        esc_attr__( 'Option Two', 'invoicing' ),
119
-                        esc_attr__( 'Option Three', 'invoicing' )
117
+                        esc_attr__('Option One', 'invoicing'),
118
+                        esc_attr__('Option Two', 'invoicing'),
119
+                        esc_attr__('Option Three', 'invoicing')
120 120
                     ),
121 121
                 )
122 122
             ),
123 123
 
124 124
             array(
125 125
                 'type' => 'checkbox',
126
-                'name' => __( 'Checkbox', 'invoicing' ),
126
+                'name' => __('Checkbox', 'invoicing'),
127 127
                 'defaults'         => array(
128 128
                     'value'        => '',
129
-                    'label'        => __( 'Checkbox Label', 'invoicing' ),
129
+                    'label'        => __('Checkbox Label', 'invoicing'),
130 130
                     'description'  => '',
131 131
                     'required'     => false,
132 132
                 )
@@ -134,24 +134,24 @@  discard block
 block discarded – undo
134 134
 
135 135
             array( 
136 136
                 'type' => 'radio',
137
-                'name' => __( 'Multiple Choice', 'invoicing' ),
137
+                'name' => __('Multiple Choice', 'invoicing'),
138 138
                 'defaults'     => array(
139
-                    'label'    => __( 'Select one choice', 'invoicing' ),
139
+                    'label'    => __('Select one choice', 'invoicing'),
140 140
                     'options'  => array(
141
-                        esc_attr__( 'Choice One', 'invoicing' ),
142
-                        esc_attr__( 'Choice Two', 'invoicing' ),
143
-                        esc_attr__( 'Choice Three', 'invoicing' )
141
+                        esc_attr__('Choice One', 'invoicing'),
142
+                        esc_attr__('Choice Two', 'invoicing'),
143
+                        esc_attr__('Choice Three', 'invoicing')
144 144
                     ),
145 145
                 )
146 146
             ),
147 147
 
148 148
             array( 
149 149
                 'type' => 'date',
150
-                'name' => __( 'Date', 'invoicing' ),
150
+                'name' => __('Date', 'invoicing'),
151 151
                 'defaults' => array(
152 152
                     'placeholder'  => '',
153 153
                     'value'        => '',
154
-                    'label'        => __( 'Date', 'invoicing' ),
154
+                    'label'        => __('Date', 'invoicing'),
155 155
                     'description'  => '',
156 156
                     'required'     => false,
157 157
                 )
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 
160 160
             array( 
161 161
                 'type' => 'time',
162
-                'name' => __( 'Time', 'invoicing' ),
162
+                'name' => __('Time', 'invoicing'),
163 163
                 'defaults' => array(
164 164
                     'placeholder'  => '',
165 165
                     'value'        => '',
166
-                    'label'        => __( 'Time', 'invoicing' ),
166
+                    'label'        => __('Time', 'invoicing'),
167 167
                     'description'  => '',
168 168
                     'required'     => false,
169 169
                 )
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 
172 172
             array( 
173 173
                 'type' => 'number',
174
-                'name' => __( 'Number', 'invoicing' ),
174
+                'name' => __('Number', 'invoicing'),
175 175
                 'defaults' => array(
176 176
                     'placeholder'  => '',
177 177
                     'value'        => '',
178
-                    'label'        => __( 'Number', 'invoicing' ),
178
+                    'label'        => __('Number', 'invoicing'),
179 179
                     'description'  => '',
180 180
                     'required'     => false,
181 181
                 )
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 
184 184
             array( 
185 185
                 'type' => 'website',
186
-                'name' => __( 'Website', 'invoicing' ),
186
+                'name' => __('Website', 'invoicing'),
187 187
                 'defaults' => array(
188 188
                     'placeholder'  => 'http://example.com',
189 189
                     'value'        => '',
190
-                    'label'        => __( 'Website', 'invoicing' ),
190
+                    'label'        => __('Website', 'invoicing'),
191 191
                     'description'  => '',
192 192
                     'required'     => false,
193 193
                 )
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 
196 196
             array( 
197 197
                 'type' => 'email',
198
-                'name' => __( 'Email', 'invoicing' ),
198
+                'name' => __('Email', 'invoicing'),
199 199
                 'defaults'  => array(
200 200
                     'placeholder'  => '[email protected]',
201 201
                     'value'        => '',
202
-                    'label'        => __( 'Email Address', 'invoicing' ),
202
+                    'label'        => __('Email Address', 'invoicing'),
203 203
                     'description'  => '',
204 204
                     'required'     => false,
205 205
                 )
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
 
208 208
             array( 
209 209
                 'type' => 'billing_email',
210
-                'name' => __( 'Billing Email', 'invoicing' ),
210
+                'name' => __('Billing Email', 'invoicing'),
211 211
                 'defaults'  => array(
212 212
                     'placeholder'  => '[email protected]',
213 213
                     'value'        => '',
214
-                    'label'        => __( 'Billing Email', 'invoicing' ),
214
+                    'label'        => __('Billing Email', 'invoicing'),
215 215
                     'description'  => '',
216 216
                     'premade'      => true,
217 217
                 )
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
             array( 
232 232
                 'type' => 'items',
233
-                'name' => __( 'Items', 'invoicing' ),
233
+                'name' => __('Items', 'invoicing'),
234 234
                 'defaults'  => array(
235 235
                     'value'        => '',
236 236
                     'items_type'   => 'total',
@@ -241,25 +241,25 @@  discard block
 block discarded – undo
241 241
 
242 242
             array( 
243 243
                 'type'       => 'pay_button',
244
-                'name'       => __( 'Payment Button', 'invoicing' ),
244
+                'name'       => __('Payment Button', 'invoicing'),
245 245
                 'defaults'   => array(
246 246
                     'value'        => '',
247 247
                     'class'        => 'btn-primary',
248
-                    'label'        => __( 'Pay Now »', 'invoicing' ),
249
-                    'description'  => __( 'By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
248
+                    'label'        => __('Pay Now »', 'invoicing'),
249
+                    'description'  => __('By continuing with our payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
250 250
                     'premade'      => true,
251 251
                 )
252 252
             )
253 253
         );
254 254
 
255
-        $this->elements = apply_filters( 'wpinv_filter_core_payment_form_elements', $this->elements );
255
+        $this->elements = apply_filters('wpinv_filter_core_payment_form_elements', $this->elements);
256 256
         return $this->elements;
257 257
     }
258 258
 
259 259
     /**
260 260
      * Returns the restrict markup.
261 261
      */
262
-    public function get_restrict_markup( $field, $field_type ) {
262
+    public function get_restrict_markup($field, $field_type) {
263 263
         $restrict = "$field.type=='$field_type'";
264 264
         return "v-if=\"$restrict\"";
265 265
     }
@@ -267,15 +267,15 @@  discard block
 block discarded – undo
267 267
     /**
268 268
      * Renders the title element template.
269 269
      */
270
-    public function render_heading_template( $field ) {
271
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
270
+    public function render_heading_template($field) {
271
+        $restrict = $this->get_restrict_markup($field, 'heading');
272 272
         echo "<component :is='$field.level' $restrict v-html='$field.text'></component>";
273 273
     }
274 274
 
275 275
     /**
276 276
      * Renders the title element on the frontend.
277 277
      */
278
-    public function frontend_render_heading_template( $field ) {
278
+    public function frontend_render_heading_template($field) {
279 279
         $tag = $field['level'];
280 280
         echo "<$tag>{$field['text']}</$tag>";
281 281
     }
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
     /**
284 284
      * Renders the edit title element template.
285 285
      */
286
-    public function edit_heading_template( $field ) {
287
-        $restrict = $this->get_restrict_markup( $field, 'heading' );
288
-        $label    = __( 'Heading', 'invoicing' );
289
-        $label2   = __( 'Select Heading Level', 'invoicing' );
286
+    public function edit_heading_template($field) {
287
+        $restrict = $this->get_restrict_markup($field, 'heading');
288
+        $label    = __('Heading', 'invoicing');
289
+        $label2   = __('Select Heading Level', 'invoicing');
290 290
         $id       = $field . '.id + "_edit"';
291 291
         $id2      = $field . '.id + "_edit2"';
292 292
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
     /**
319 319
      * Renders a paragraph element template.
320 320
      */
321
-    public function render_paragraph_template( $field ) {
322
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
321
+    public function render_paragraph_template($field) {
322
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
323 323
         $label    = "$field.text";
324 324
         echo "<p $restrict v-html='$label' style='font-size: 16px;'></p>";
325 325
     }
@@ -327,16 +327,16 @@  discard block
 block discarded – undo
327 327
     /**
328 328
      * Renders the paragraph element on the frontend.
329 329
      */
330
-    public function frontend_render_paragraph_template( $field ) {
330
+    public function frontend_render_paragraph_template($field) {
331 331
         echo "<p>{$field['text']}</p>";
332 332
     }
333 333
 
334 334
     /**
335 335
      * Renders the edit paragraph element template.
336 336
      */
337
-    public function edit_paragraph_template( $field ) {
338
-        $restrict = $this->get_restrict_markup( $field, 'paragraph' );
339
-        $label    = __( 'Enter your text', 'invoicing' );
337
+    public function edit_paragraph_template($field) {
338
+        $restrict = $this->get_restrict_markup($field, 'paragraph');
339
+        $label    = __('Enter your text', 'invoicing');
340 340
         $id       = $field . '.id + "_edit"';
341 341
         echo "
342 342
             <div $restrict>
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
     /**
353 353
      * Renders the text element template.
354 354
      */
355
-    public function render_text_template( $field ) {
356
-        $restrict = $this->get_restrict_markup( $field, 'text' );
355
+    public function render_text_template($field) {
356
+        $restrict = $this->get_restrict_markup($field, 'text');
357 357
         $label    = "$field.label";
358 358
         echo "
359 359
             <div $restrict>
@@ -367,23 +367,23 @@  discard block
 block discarded – undo
367 367
     /**
368 368
      * Renders the text element on the frontend.
369 369
      */
370
-    public function frontend_render_text_template( $field ) {
370
+    public function frontend_render_text_template($field) {
371 371
         
372 372
         echo "<div class='form-group'>";
373 373
 
374 374
         echo aui()->input(
375 375
             array(
376
-                'name'       => esc_attr( $field['id'] ),
377
-                'id'         => esc_attr( $field['id'] ),
378
-                'placeholder'=> esc_attr( $field['placeholder'] ),
376
+                'name'       => esc_attr($field['id']),
377
+                'id'         => esc_attr($field['id']),
378
+                'placeholder'=> esc_attr($field['placeholder']),
379 379
                 'required'   => (bool) $field['required'],
380
-                'label'      => wp_kses_post( $field['label'] ),
380
+                'label'      => wp_kses_post($field['label']),
381 381
                 'no_wrap'    => true,
382 382
             )
383 383
         );
384 384
 
385
-        if ( ! empty( $field['description'] ) ) {
386
-            $description = wp_kses_post( $field['description'] );
385
+        if (!empty($field['description'])) {
386
+            $description = wp_kses_post($field['description']);
387 387
             echo "<small class='form-text text-muted'>$description</small>";
388 388
         }
389 389
 
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
     /**
395 395
      * Renders the edit text element template.
396 396
      */
397
-    public function edit_text_template( $field ) {
398
-        $restrict = $this->get_restrict_markup( $field, 'text' );
399
-        $label    = __( 'Field Label', 'invoicing' );
397
+    public function edit_text_template($field) {
398
+        $restrict = $this->get_restrict_markup($field, 'text');
399
+        $label    = __('Field Label', 'invoicing');
400 400
         $id       = $field . '.id + "_edit"';
401
-        $label2   = __( 'Placeholder text', 'invoicing' );
401
+        $label2   = __('Placeholder text', 'invoicing');
402 402
         $id2      = $field . '.id + "_edit2"';
403
-        $label3   = __( 'Help text', 'invoicing' );
404
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
403
+        $label3   = __('Help text', 'invoicing');
404
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
405 405
         $id3      = $field . '.id + "_edit3"';
406
-        $label5   = __( 'Is this field required?', 'invoicing' );
406
+        $label5   = __('Is this field required?', 'invoicing');
407 407
         $id4      = $field . '.id + "_edit4"';
408 408
         echo "
409 409
             <div $restrict>
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
     /**
432 432
      * Renders the textarea element template.
433 433
      */
434
-    public function render_textarea_template( $field ) {
435
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
434
+    public function render_textarea_template($field) {
435
+        $restrict = $this->get_restrict_markup($field, 'textarea');
436 436
         $label    = "$field.label";
437 437
         echo "
438 438
             <div $restrict>
@@ -446,24 +446,24 @@  discard block
 block discarded – undo
446 446
     /**
447 447
      * Renders the textarea element on the frontend.
448 448
      */
449
-    public function frontend_render_textarea_template( $field ) {
449
+    public function frontend_render_textarea_template($field) {
450 450
         
451 451
         echo "<div class='form-group'>";
452 452
 
453 453
         echo aui()->textarea(
454 454
             array(
455
-                'name'       => esc_attr( $field['id'] ),
456
-                'id'         => esc_attr( $field['id'] ),
457
-                'placeholder'=> esc_attr( $field['placeholder'] ),
455
+                'name'       => esc_attr($field['id']),
456
+                'id'         => esc_attr($field['id']),
457
+                'placeholder'=> esc_attr($field['placeholder']),
458 458
                 'required'   => (bool) $field['required'],
459
-                'label'      => wp_kses_post( $field['label'] ),
459
+                'label'      => wp_kses_post($field['label']),
460 460
                 'no_wrap'    => true,
461 461
                 'rows'       => 3,
462 462
             )
463 463
         );
464 464
 
465
-        if ( ! empty( $field['description'] ) ) {
466
-            $description = wp_kses_post( $field['description'] );
465
+        if (!empty($field['description'])) {
466
+            $description = wp_kses_post($field['description']);
467 467
             echo "<small class='form-text text-muted'>$description</small>";
468 468
         }
469 469
 
@@ -474,16 +474,16 @@  discard block
 block discarded – undo
474 474
     /**
475 475
      * Renders the edit textarea element template.
476 476
      */
477
-    public function edit_textarea_template( $field ) {
478
-        $restrict = $this->get_restrict_markup( $field, 'textarea' );
479
-        $label    = __( 'Field Label', 'invoicing' );
477
+    public function edit_textarea_template($field) {
478
+        $restrict = $this->get_restrict_markup($field, 'textarea');
479
+        $label    = __('Field Label', 'invoicing');
480 480
         $id       = $field . '.id + "_edit"';
481
-        $label2   = __( 'Placeholder text', 'invoicing' );
481
+        $label2   = __('Placeholder text', 'invoicing');
482 482
         $id2      = $field . '.id + "_edit2"';
483
-        $label3   = __( 'Help text', 'invoicing' );
484
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
483
+        $label3   = __('Help text', 'invoicing');
484
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
485 485
         $id3      = $field . '.id + "_edit3"';
486
-        $label5   = __( 'Is this field required?', 'invoicing' );
486
+        $label5   = __('Is this field required?', 'invoicing');
487 487
         $id4      = $field . '.id + "_edit4"';
488 488
         echo "
489 489
             <div $restrict>
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
     /**
512 512
      * Renders the select element template.
513 513
      */
514
-    public function render_select_template( $field ) {
515
-        $restrict    = $this->get_restrict_markup( $field, 'select' );
514
+    public function render_select_template($field) {
515
+        $restrict    = $this->get_restrict_markup($field, 'select');
516 516
         $label       = "$field.label";
517 517
         $placeholder = "$field.placeholder";
518 518
         $id          = $field . '.id';
@@ -531,24 +531,24 @@  discard block
 block discarded – undo
531 531
     /**
532 532
      * Renders the select element on the frontend.
533 533
      */
534
-    public function frontend_render_select_template( $field ) {
534
+    public function frontend_render_select_template($field) {
535 535
         
536 536
         echo "<div class='form-group'>";
537 537
 
538 538
         echo aui()->select(
539 539
             array(
540
-                'name'       => esc_attr( $field['id'] ),
541
-                'id'         => esc_attr( $field['id'] ),
542
-                'placeholder'=> esc_attr( $field['placeholder'] ),
540
+                'name'       => esc_attr($field['id']),
541
+                'id'         => esc_attr($field['id']),
542
+                'placeholder'=> esc_attr($field['placeholder']),
543 543
                 'required'   => (bool) $field['required'],
544
-                'label'      => wp_kses_post( $field['label'] ),
544
+                'label'      => wp_kses_post($field['label']),
545 545
                 'no_wrap'    => true,
546
-                'options'    => array_combine( $field['options'], $field['options'] ),
546
+                'options'    => array_combine($field['options'], $field['options']),
547 547
             )
548 548
         );
549 549
 
550
-        if ( ! empty( $field['description'] ) ) {
551
-            $description = wp_kses_post( $field['description'] );
550
+        if (!empty($field['description'])) {
551
+            $description = wp_kses_post($field['description']);
552 552
             echo "<small class='form-text text-muted'>$description</small>";
553 553
         }
554 554
 
@@ -559,18 +559,18 @@  discard block
 block discarded – undo
559 559
     /**
560 560
      * Renders the edit select element template.
561 561
      */
562
-    public function edit_select_template( $field ) {
563
-        $restrict = $this->get_restrict_markup( $field, 'select' );
564
-        $label    = __( 'Field Label', 'invoicing' );
562
+    public function edit_select_template($field) {
563
+        $restrict = $this->get_restrict_markup($field, 'select');
564
+        $label    = __('Field Label', 'invoicing');
565 565
         $id       = $field . '.id + "_edit"';
566
-        $label2   = __( 'Placeholder text', 'invoicing' );
566
+        $label2   = __('Placeholder text', 'invoicing');
567 567
         $id2      = $field . '.id + "_edit2"';
568
-        $label3   = __( 'Help text', 'invoicing' );
569
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
568
+        $label3   = __('Help text', 'invoicing');
569
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
570 570
         $id3      = $field . '.id + "_edit3"';
571
-        $label5   = __( 'Is this field required?', 'invoicing' );
571
+        $label5   = __('Is this field required?', 'invoicing');
572 572
         $id4      = $field . '.id + "_edit4"';
573
-        $label6   = __( 'Available Options', 'invoicing' );
573
+        $label6   = __('Available Options', 'invoicing');
574 574
         echo "
575 575
             <div $restrict>
576 576
                 <div class='form-group'>
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
     /**
609 609
      * Renders the checkbox element template.
610 610
      */
611
-    public function render_checkbox_template( $field ) {
612
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
611
+    public function render_checkbox_template($field) {
612
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
613 613
         $label    = "$field.label";
614 614
         echo "
615 615
             <div class='form-check' $restrict>
@@ -623,24 +623,24 @@  discard block
 block discarded – undo
623 623
     /**
624 624
      * Renders the checkbox element on the frontend.
625 625
      */
626
-    public function frontend_render_checkbox_template( $field ) {
626
+    public function frontend_render_checkbox_template($field) {
627 627
         
628 628
         echo "<div class='form-group'>";
629 629
 
630 630
         echo aui()->input(
631 631
             array(
632
-                'name'       => esc_attr( $field['id'] ),
633
-                'id'         => esc_attr( $field['id'] ),
632
+                'name'       => esc_attr($field['id']),
633
+                'id'         => esc_attr($field['id']),
634 634
                 'required'   => (bool) $field['required'],
635
-                'label'      => wp_kses_post( $field['label'] ),
635
+                'label'      => wp_kses_post($field['label']),
636 636
                 'no_wrap'    => true,
637
-                'value'      => esc_attr__( 'Yes', 'invoicing' ),
637
+                'value'      => esc_attr__('Yes', 'invoicing'),
638 638
                 'type'       => 'checkbox',
639 639
             )
640 640
         );
641 641
 
642
-        if ( ! empty( $field['description'] ) ) {
643
-            $description = wp_kses_post( $field['description'] );
642
+        if (!empty($field['description'])) {
643
+            $description = wp_kses_post($field['description']);
644 644
             echo "<small class='form-text text-muted'>$description</small>";
645 645
         }
646 646
 
@@ -651,14 +651,14 @@  discard block
 block discarded – undo
651 651
     /**
652 652
      * Renders the edit checkbox element template.
653 653
      */
654
-    public function edit_checkbox_template( $field ) {
655
-        $restrict = $this->get_restrict_markup( $field, 'checkbox' );
656
-        $label    = __( 'Field Label', 'invoicing' );
654
+    public function edit_checkbox_template($field) {
655
+        $restrict = $this->get_restrict_markup($field, 'checkbox');
656
+        $label    = __('Field Label', 'invoicing');
657 657
         $id       = $field . '.id + "_edit"';
658
-        $label2   = __( 'Help text', 'invoicing' );
659
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
658
+        $label2   = __('Help text', 'invoicing');
659
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
660 660
         $id2      = $field . '.id + "_edit2"';
661
-        $label4   = __( 'Is this field required?', 'invoicing' );
661
+        $label4   = __('Is this field required?', 'invoicing');
662 662
         $id3      = $field . '.id + "_edit3"';
663 663
         echo "
664 664
             <div $restrict>
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
     /**
683 683
      * Renders the radio element template.
684 684
      */
685
-    public function render_radio_template( $field ) {
686
-        $restrict    = $this->get_restrict_markup( $field, 'radio' );
685
+    public function render_radio_template($field) {
686
+        $restrict    = $this->get_restrict_markup($field, 'radio');
687 687
         $label       = "$field.label";
688 688
         $id          = $field . '.id';
689 689
         echo "
@@ -701,20 +701,20 @@  discard block
 block discarded – undo
701 701
     /**
702 702
      * Renders the radio element on the frontend.
703 703
      */
704
-    public function frontend_render_radio_template( $field ) {
704
+    public function frontend_render_radio_template($field) {
705 705
         
706 706
         echo "<div class='form-group'>";
707 707
 
708
-        if ( ! empty( $field['label'] ) ) {
709
-            $label = wp_kses_post( $field['label'] );
708
+        if (!empty($field['label'])) {
709
+            $label = wp_kses_post($field['label']);
710 710
             echo "<legend class='col-form-label'>$label</legend>";
711 711
         }
712 712
 
713
-        foreach( $field['options'] as $index => $option ) {
713
+        foreach ($field['options'] as $index => $option) {
714 714
             $id    = $field['id'] . $index;
715 715
             $name  = $field['id'];
716
-            $value = esc_attr( $option );
717
-            $label = wp_kses_post( $option );
716
+            $value = esc_attr($option);
717
+            $label = wp_kses_post($option);
718 718
 
719 719
             echo "
720 720
                 <div class='form-check'>
@@ -724,8 +724,8 @@  discard block
 block discarded – undo
724 724
             ";
725 725
         }
726 726
 
727
-        if ( ! empty( $field['description'] ) ) {
728
-            $description = wp_kses_post( $field['description'] );
727
+        if (!empty($field['description'])) {
728
+            $description = wp_kses_post($field['description']);
729 729
             echo "<small class='form-text text-muted'>$description</small>";
730 730
         }
731 731
 
@@ -736,16 +736,16 @@  discard block
 block discarded – undo
736 736
     /**
737 737
      * Renders the edit radio element template.
738 738
      */
739
-    public function edit_radio_template( $field ) {
740
-        $restrict = $this->get_restrict_markup( $field, 'radio' );
741
-        $label    = __( 'Field Label', 'invoicing' );
739
+    public function edit_radio_template($field) {
740
+        $restrict = $this->get_restrict_markup($field, 'radio');
741
+        $label    = __('Field Label', 'invoicing');
742 742
         $id       = $field . '.id + "_edit"';
743
-        $label2   = __( 'Help text', 'invoicing' );
744
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
743
+        $label2   = __('Help text', 'invoicing');
744
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
745 745
         $id2      = $field . '.id + "_edit3"';
746
-        $label4   = __( 'Is this field required?', 'invoicing' );
746
+        $label4   = __('Is this field required?', 'invoicing');
747 747
         $id3      = $field . '.id + "_edit4"';
748
-        $label5   = __( 'Available Options', 'invoicing' );
748
+        $label5   = __('Available Options', 'invoicing');
749 749
         echo "
750 750
             <div $restrict>
751 751
                 <div class='form-group'>
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
     /**
780 780
      * Renders the email element template.
781 781
      */
782
-    public function render_email_template( $field ) {
783
-        $restrict = $this->get_restrict_markup( $field, 'email' );
782
+    public function render_email_template($field) {
783
+        $restrict = $this->get_restrict_markup($field, 'email');
784 784
         $label    = "$field.label";
785 785
         echo "
786 786
             <div $restrict>
@@ -794,8 +794,8 @@  discard block
 block discarded – undo
794 794
     /**
795 795
      * Renders the billing_email element template.
796 796
      */
797
-    public function render_billing_email_template( $field ) {
798
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
797
+    public function render_billing_email_template($field) {
798
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
799 799
         $label    = "$field.label";
800 800
         echo "
801 801
             <div $restrict>
@@ -809,24 +809,24 @@  discard block
 block discarded – undo
809 809
     /**
810 810
      * Renders the email element on the frontend.
811 811
      */
812
-    public function frontend_render_email_template( $field ) {
812
+    public function frontend_render_email_template($field) {
813 813
         
814 814
         echo "<div class='form-group'>";
815 815
 
816 816
         echo aui()->input(
817 817
             array(
818
-                'name'       => esc_attr( $field['id'] ),
819
-                'id'         => esc_attr( $field['id'] ),
818
+                'name'       => esc_attr($field['id']),
819
+                'id'         => esc_attr($field['id']),
820 820
                 'required'   => (bool) $field['required'],
821
-                'label'      => wp_kses_post( $field['label'] ),
821
+                'label'      => wp_kses_post($field['label']),
822 822
                 'no_wrap'    => true,
823
-                'placeholder' => esc_attr( $field['placeholder'] ),
823
+                'placeholder' => esc_attr($field['placeholder']),
824 824
                 'type'       => 'email',
825 825
             )
826 826
         );
827 827
 
828
-        if ( ! empty( $field['description'] ) ) {
829
-            $description = wp_kses_post( $field['description'] );
828
+        if (!empty($field['description'])) {
829
+            $description = wp_kses_post($field['description']);
830 830
             echo "<small class='form-text text-muted'>$description</small>";
831 831
         }
832 832
 
@@ -837,30 +837,30 @@  discard block
 block discarded – undo
837 837
     /**
838 838
      * Renders the billing email element on the frontend.
839 839
      */
840
-    public function frontend_render_billing_email_template( $field ) {
840
+    public function frontend_render_billing_email_template($field) {
841 841
         
842 842
         echo "<div class='form-group'>";
843 843
         $value = '';
844 844
 
845
-        if ( is_user_logged_in() ) {
845
+        if (is_user_logged_in()) {
846 846
             $user  = wp_get_current_user();
847
-            $value = sanitize_email( $user->user_email );
847
+            $value = sanitize_email($user->user_email);
848 848
         }
849 849
         echo aui()->input(
850 850
             array(
851 851
                 'name'       => 'billing_email',
852 852
                 'value'      => $value,
853
-                'id'         => esc_attr( $field['id'] ),
853
+                'id'         => esc_attr($field['id']),
854 854
                 'required'   => true,
855
-                'label'      => wp_kses_post( $field['label'] ),
855
+                'label'      => wp_kses_post($field['label']),
856 856
                 'no_wrap'    => true,
857
-                'placeholder' => esc_attr( $field['placeholder'] ),
857
+                'placeholder' => esc_attr($field['placeholder']),
858 858
                 'type'       => 'email',
859 859
             )
860 860
         );
861 861
 
862
-        if ( ! empty( $field['description'] ) ) {
863
-            $description = wp_kses_post( $field['description'] );
862
+        if (!empty($field['description'])) {
863
+            $description = wp_kses_post($field['description']);
864 864
             echo "<small class='form-text text-muted'>$description</small>";
865 865
         }
866 866
 
@@ -871,16 +871,16 @@  discard block
 block discarded – undo
871 871
     /**
872 872
      * Renders the edit email element template.
873 873
      */
874
-    public function edit_email_template( $field ) {
875
-        $restrict = $this->get_restrict_markup( $field, 'email' );
876
-        $label    = __( 'Field Label', 'invoicing' );
874
+    public function edit_email_template($field) {
875
+        $restrict = $this->get_restrict_markup($field, 'email');
876
+        $label    = __('Field Label', 'invoicing');
877 877
         $id       = $field . '.id + "_edit"';
878
-        $label2   = __( 'Placeholder text', 'invoicing' );
878
+        $label2   = __('Placeholder text', 'invoicing');
879 879
         $id2      = $field . '.id + "_edit2"';
880
-        $label3   = __( 'Help text', 'invoicing' );
881
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
880
+        $label3   = __('Help text', 'invoicing');
881
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
882 882
         $id3      = $field . '.id + "_edit3"';
883
-        $label5   = __( 'Is this field required?', 'invoicing' );
883
+        $label5   = __('Is this field required?', 'invoicing');
884 884
         $id4      = $field . '.id + "_edit4"';
885 885
         echo "
886 886
             <div $restrict>
@@ -908,16 +908,16 @@  discard block
 block discarded – undo
908 908
     /**
909 909
      * Renders the edit billing_email element template.
910 910
      */
911
-    public function edit_billing_email_template( $field ) {
912
-        $restrict = $this->get_restrict_markup( $field, 'billing_email' );
913
-        $label    = __( 'Field Label', 'invoicing' );
911
+    public function edit_billing_email_template($field) {
912
+        $restrict = $this->get_restrict_markup($field, 'billing_email');
913
+        $label    = __('Field Label', 'invoicing');
914 914
         $id       = $field . '.id + "_edit"';
915
-        $label2   = __( 'Placeholder text', 'invoicing' );
915
+        $label2   = __('Placeholder text', 'invoicing');
916 916
         $id2      = $field . '.id + "_edit2"';
917
-        $label3   = __( 'Help text', 'invoicing' );
918
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
917
+        $label3   = __('Help text', 'invoicing');
918
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
919 919
         $id3      = $field . '.id + "_edit3"';
920
-        $label5   = __( 'Is this field required?', 'invoicing' );
920
+        $label5   = __('Is this field required?', 'invoicing');
921 921
         $id4      = $field . '.id + "_edit4"';
922 922
         echo "
923 923
             <div $restrict>
@@ -941,8 +941,8 @@  discard block
 block discarded – undo
941 941
     /**
942 942
      * Renders the website element template.
943 943
      */
944
-    public function render_website_template( $field ) {
945
-        $restrict = $this->get_restrict_markup( $field, 'website' );
944
+    public function render_website_template($field) {
945
+        $restrict = $this->get_restrict_markup($field, 'website');
946 946
         $label    = "$field.label";
947 947
         echo "
948 948
             <div $restrict>
@@ -956,24 +956,24 @@  discard block
 block discarded – undo
956 956
     /**
957 957
      * Renders the website element on the frontend.
958 958
      */
959
-    public function frontend_render_website_template( $field ) {
959
+    public function frontend_render_website_template($field) {
960 960
         
961 961
         echo "<div class='form-group'>";
962 962
 
963 963
         echo aui()->input(
964 964
             array(
965
-                'name'       => esc_attr( $field['id'] ),
966
-                'id'         => esc_attr( $field['id'] ),
965
+                'name'       => esc_attr($field['id']),
966
+                'id'         => esc_attr($field['id']),
967 967
                 'required'   => (bool) $field['required'],
968
-                'label'      => wp_kses_post( $field['label'] ),
968
+                'label'      => wp_kses_post($field['label']),
969 969
                 'no_wrap'    => true,
970
-                'placeholder' => esc_attr( $field['placeholder'] ),
970
+                'placeholder' => esc_attr($field['placeholder']),
971 971
                 'type'       => 'url',
972 972
             )
973 973
         );
974 974
 
975
-        if ( ! empty( $field['description'] ) ) {
976
-            $description = wp_kses_post( $field['description'] );
975
+        if (!empty($field['description'])) {
976
+            $description = wp_kses_post($field['description']);
977 977
             echo "<small class='form-text text-muted'>$description</small>";
978 978
         }
979 979
 
@@ -984,16 +984,16 @@  discard block
 block discarded – undo
984 984
     /**
985 985
      * Renders the edit website element template.
986 986
      */
987
-    public function edit_website_template( $field ) {
988
-        $restrict = $this->get_restrict_markup( $field, 'website' );
989
-        $label    = __( 'Field Label', 'invoicing' );
987
+    public function edit_website_template($field) {
988
+        $restrict = $this->get_restrict_markup($field, 'website');
989
+        $label    = __('Field Label', 'invoicing');
990 990
         $id       = $field . '.id + "_edit"';
991
-        $label2   = __( 'Placeholder text', 'invoicing' );
991
+        $label2   = __('Placeholder text', 'invoicing');
992 992
         $id2      = $field . '.id + "_edit2"';
993
-        $label3   = __( 'Help text', 'invoicing' );
994
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
993
+        $label3   = __('Help text', 'invoicing');
994
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
995 995
         $id3      = $field . '.id + "_edit3"';
996
-        $label5   = __( 'Is this field required?', 'invoicing' );
996
+        $label5   = __('Is this field required?', 'invoicing');
997 997
         $id4      = $field . '.id + "_edit4"';
998 998
         echo "
999 999
             <div $restrict>
@@ -1021,8 +1021,8 @@  discard block
 block discarded – undo
1021 1021
     /**
1022 1022
      * Renders the date element template.
1023 1023
      */
1024
-    public function render_date_template( $field ) {
1025
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1024
+    public function render_date_template($field) {
1025
+        $restrict = $this->get_restrict_markup($field, 'date');
1026 1026
         $label    = "$field.label";
1027 1027
         echo "
1028 1028
             <div $restrict>
@@ -1036,24 +1036,24 @@  discard block
 block discarded – undo
1036 1036
     /**
1037 1037
      * Renders the date element on the frontend.
1038 1038
      */
1039
-    public function frontend_render_date_template( $field ) {
1039
+    public function frontend_render_date_template($field) {
1040 1040
         
1041 1041
         echo "<div class='form-group'>";
1042 1042
 
1043 1043
         echo aui()->input(
1044 1044
             array(
1045
-                'name'       => esc_attr( $field['id'] ),
1046
-                'id'         => esc_attr( $field['id'] ),
1045
+                'name'       => esc_attr($field['id']),
1046
+                'id'         => esc_attr($field['id']),
1047 1047
                 'required'   => (bool) $field['required'],
1048
-                'label'      => wp_kses_post( $field['label'] ),
1049
-                'placeholder' => esc_attr( $field['placeholder'] ),
1048
+                'label'      => wp_kses_post($field['label']),
1049
+                'placeholder' => esc_attr($field['placeholder']),
1050 1050
                 'no_wrap'    => true,
1051 1051
                 'type'       => 'date',
1052 1052
             )
1053 1053
         );
1054 1054
 
1055
-        if ( ! empty( $field['description'] ) ) {
1056
-            $description = wp_kses_post( $field['description'] );
1055
+        if (!empty($field['description'])) {
1056
+            $description = wp_kses_post($field['description']);
1057 1057
             echo "<small class='form-text text-muted'>$description</small>";
1058 1058
         }
1059 1059
 
@@ -1064,16 +1064,16 @@  discard block
 block discarded – undo
1064 1064
     /**
1065 1065
      * Renders the edit date element template.
1066 1066
      */
1067
-    public function edit_date_template( $field ) {
1068
-        $restrict = $this->get_restrict_markup( $field, 'date' );
1069
-        $label    = __( 'Field Label', 'invoicing' );
1067
+    public function edit_date_template($field) {
1068
+        $restrict = $this->get_restrict_markup($field, 'date');
1069
+        $label    = __('Field Label', 'invoicing');
1070 1070
         $id       = $field . '.id + "_edit"';
1071
-        $label2   = __( 'Placeholder text', 'invoicing' );
1071
+        $label2   = __('Placeholder text', 'invoicing');
1072 1072
         $id2      = $field . '.id + "_edit2"';
1073
-        $label3   = __( 'Help text', 'invoicing' );
1074
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1073
+        $label3   = __('Help text', 'invoicing');
1074
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1075 1075
         $id3      = $field . '.id + "_edit3"';
1076
-        $label5   = __( 'Is this field required?', 'invoicing' );
1076
+        $label5   = __('Is this field required?', 'invoicing');
1077 1077
         $id4      = $field . '.id + "_edit4"';
1078 1078
         echo "
1079 1079
             <div $restrict>
@@ -1101,8 +1101,8 @@  discard block
 block discarded – undo
1101 1101
     /**
1102 1102
      * Renders the time element template.
1103 1103
      */
1104
-    public function render_time_template( $field ) {
1105
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1104
+    public function render_time_template($field) {
1105
+        $restrict = $this->get_restrict_markup($field, 'time');
1106 1106
         $label    = "$field.label";
1107 1107
         echo "
1108 1108
             <div $restrict>
@@ -1116,24 +1116,24 @@  discard block
 block discarded – undo
1116 1116
     /**
1117 1117
      * Renders the time element on the frontend.
1118 1118
      */
1119
-    public function frontend_render_time_template( $field ) {
1119
+    public function frontend_render_time_template($field) {
1120 1120
         
1121 1121
         echo "<div class='form-group'>";
1122 1122
 
1123 1123
         echo aui()->input(
1124 1124
             array(
1125
-                'name'       => esc_attr( $field['id'] ),
1126
-                'id'         => esc_attr( $field['id'] ),
1125
+                'name'       => esc_attr($field['id']),
1126
+                'id'         => esc_attr($field['id']),
1127 1127
                 'required'   => (bool) $field['required'],
1128
-                'label'      => wp_kses_post( $field['label'] ),
1128
+                'label'      => wp_kses_post($field['label']),
1129 1129
                 'no_wrap'    => true,
1130
-                'placeholder' => esc_attr( $field['placeholder'] ),
1130
+                'placeholder' => esc_attr($field['placeholder']),
1131 1131
                 'type'       => 'time',
1132 1132
             )
1133 1133
         );
1134 1134
 
1135
-        if ( ! empty( $field['description'] ) ) {
1136
-            $description = wp_kses_post( $field['description'] );
1135
+        if (!empty($field['description'])) {
1136
+            $description = wp_kses_post($field['description']);
1137 1137
             echo "<small class='form-text text-muted'>$description</small>";
1138 1138
         }
1139 1139
 
@@ -1144,16 +1144,16 @@  discard block
 block discarded – undo
1144 1144
     /**
1145 1145
      * Renders the edit time element template.
1146 1146
      */
1147
-    public function edit_time_template( $field ) {
1148
-        $restrict = $this->get_restrict_markup( $field, 'time' );
1149
-        $label    = __( 'Field Label', 'invoicing' );
1147
+    public function edit_time_template($field) {
1148
+        $restrict = $this->get_restrict_markup($field, 'time');
1149
+        $label    = __('Field Label', 'invoicing');
1150 1150
         $id       = $field . '.id + "_edit"';
1151
-        $label2   = __( 'Placeholder text', 'invoicing' );
1151
+        $label2   = __('Placeholder text', 'invoicing');
1152 1152
         $id2      = $field . '.id + "_edit2"';
1153
-        $label3   = __( 'Help text', 'invoicing' );
1154
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1153
+        $label3   = __('Help text', 'invoicing');
1154
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1155 1155
         $id3      = $field . '.id + "_edit3"';
1156
-        $label5   = __( 'Is this field required?', 'invoicing' );
1156
+        $label5   = __('Is this field required?', 'invoicing');
1157 1157
         $id4      = $field . '.id + "_edit4"';
1158 1158
         echo "
1159 1159
             <div $restrict>
@@ -1181,8 +1181,8 @@  discard block
 block discarded – undo
1181 1181
     /**
1182 1182
      * Renders the number element template.
1183 1183
      */
1184
-    public function render_number_template( $field ) {
1185
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1184
+    public function render_number_template($field) {
1185
+        $restrict = $this->get_restrict_markup($field, 'number');
1186 1186
         $label    = "$field.label";
1187 1187
         echo "
1188 1188
             <div $restrict>
@@ -1196,24 +1196,24 @@  discard block
 block discarded – undo
1196 1196
     /**
1197 1197
      * Renders the number element on the frontend.
1198 1198
      */
1199
-    public function frontend_render_number_template( $field ) {
1199
+    public function frontend_render_number_template($field) {
1200 1200
         
1201 1201
         echo "<div class='form-group'>";
1202 1202
 
1203 1203
         echo aui()->input(
1204 1204
             array(
1205
-                'name'       => esc_attr( $field['id'] ),
1206
-                'id'         => esc_attr( $field['id'] ),
1205
+                'name'       => esc_attr($field['id']),
1206
+                'id'         => esc_attr($field['id']),
1207 1207
                 'required'   => (bool) $field['required'],
1208
-                'label'      => wp_kses_post( $field['label'] ),
1209
-                'placeholder' => esc_attr( $field['placeholder'] ),
1208
+                'label'      => wp_kses_post($field['label']),
1209
+                'placeholder' => esc_attr($field['placeholder']),
1210 1210
                 'no_wrap'    => true,
1211 1211
                 'type'       => 'number',
1212 1212
             )
1213 1213
         );
1214 1214
 
1215
-        if ( ! empty( $field['description'] ) ) {
1216
-            $description = wp_kses_post( $field['description'] );
1215
+        if (!empty($field['description'])) {
1216
+            $description = wp_kses_post($field['description']);
1217 1217
             echo "<small class='form-text text-muted'>$description</small>";
1218 1218
         }
1219 1219
 
@@ -1224,16 +1224,16 @@  discard block
 block discarded – undo
1224 1224
     /**
1225 1225
      * Renders the edit number element template.
1226 1226
      */
1227
-    public function edit_number_template( $field ) {
1228
-        $restrict = $this->get_restrict_markup( $field, 'number' );
1229
-        $label    = __( 'Field Label', 'invoicing' );
1227
+    public function edit_number_template($field) {
1228
+        $restrict = $this->get_restrict_markup($field, 'number');
1229
+        $label    = __('Field Label', 'invoicing');
1230 1230
         $id       = $field . '.id + "_edit"';
1231
-        $label2   = __( 'Placeholder text', 'invoicing' );
1231
+        $label2   = __('Placeholder text', 'invoicing');
1232 1232
         $id2      = $field . '.id + "_edit2"';
1233
-        $label3   = __( 'Help text', 'invoicing' );
1234
-        $label4   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1233
+        $label3   = __('Help text', 'invoicing');
1234
+        $label4   = esc_attr__('Add some help text for this field', 'invoicing');
1235 1235
         $id3      = $field . '.id + "_edit3"';
1236
-        $label5   = __( 'Is this field required?', 'invoicing' );
1236
+        $label5   = __('Is this field required?', 'invoicing');
1237 1237
         $id4      = $field . '.id + "_edit4"';
1238 1238
         echo "
1239 1239
             <div $restrict>
@@ -1261,23 +1261,23 @@  discard block
 block discarded – undo
1261 1261
     /**
1262 1262
      * Renders the separator element template.
1263 1263
      */
1264
-    public function render_separator_template( $field ) {
1265
-        $restrict = $this->get_restrict_markup( $field, 'separator' );
1264
+    public function render_separator_template($field) {
1265
+        $restrict = $this->get_restrict_markup($field, 'separator');
1266 1266
         echo "<hr class='featurette-divider mt-0 mb-2' $restrict>";
1267 1267
     }
1268 1268
 
1269 1269
     /**
1270 1270
      * Renders the separator element on the frontend.
1271 1271
      */
1272
-    public function frontend_render_separator_template( $field ) {
1272
+    public function frontend_render_separator_template($field) {
1273 1273
         echo '<hr class="featurette-divider mt-0 mb-2" />';
1274 1274
     }
1275 1275
 
1276 1276
     /**
1277 1277
      * Renders the pay button element template.
1278 1278
      */
1279
-    public function render_pay_button_template( $field ) {
1280
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1279
+    public function render_pay_button_template($field) {
1280
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1281 1281
         $label    = "$field.label";
1282 1282
         echo "
1283 1283
             <div $restrict>
@@ -1290,24 +1290,24 @@  discard block
 block discarded – undo
1290 1290
     /**
1291 1291
      * Renders the pay_button element on the frontend.
1292 1292
      */
1293
-    public function frontend_render_pay_button_template( $field ) {
1293
+    public function frontend_render_pay_button_template($field) {
1294 1294
         
1295 1295
         echo "<div class='form-group'>";
1296 1296
 
1297
-        $class = 'btn btn-block submit-button ' . sanitize_html_class( $field['class'] );
1297
+        $class = 'btn btn-block submit-button ' . sanitize_html_class($field['class']);
1298 1298
         echo aui()->input(
1299 1299
             array(
1300
-                'name'       => esc_attr( $field['id'] ),
1301
-                'id'         => esc_attr( $field['id'] ),
1302
-                'value'      => esc_attr( $field['label'] ),
1300
+                'name'       => esc_attr($field['id']),
1301
+                'id'         => esc_attr($field['id']),
1302
+                'value'      => esc_attr($field['label']),
1303 1303
                 'no_wrap'    => true,
1304 1304
                 'type'       => 'submit',
1305 1305
                 'class'      => $class,
1306 1306
             )
1307 1307
         );
1308 1308
 
1309
-        if ( ! empty( $field['description'] ) ) {
1310
-            $description = wp_kses_post( $field['description'] );
1309
+        if (!empty($field['description'])) {
1310
+            $description = wp_kses_post($field['description']);
1311 1311
             echo "<small class='form-text text-muted'>$description</small>";
1312 1312
         }
1313 1313
 
@@ -1318,14 +1318,14 @@  discard block
 block discarded – undo
1318 1318
     /**
1319 1319
      * Renders the pay button element template.
1320 1320
      */
1321
-    public function edit_pay_button_template( $field ) {
1322
-        $restrict = $this->get_restrict_markup( $field, 'pay_button' );
1323
-        $label    = __( 'Button Text', 'invoicing' );
1321
+    public function edit_pay_button_template($field) {
1322
+        $restrict = $this->get_restrict_markup($field, 'pay_button');
1323
+        $label    = __('Button Text', 'invoicing');
1324 1324
         $id       = $field . '.id + "_edit"';
1325
-        $label2   = __( 'Help text', 'invoicing' );
1326
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1325
+        $label2   = __('Help text', 'invoicing');
1326
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1327 1327
         $id2      = $field . '.id + "_edit2"';
1328
-        $label4   = esc_attr__( 'Button Type', 'invoicing' );
1328
+        $label4   = esc_attr__('Button Type', 'invoicing');
1329 1329
         $id3      = $field . '.id + "_edit3"';
1330 1330
         echo "
1331 1331
             <div $restrict>
@@ -1341,15 +1341,15 @@  discard block
 block discarded – undo
1341 1341
                     <label :for='$id3'>$label4</label>
1342 1342
 
1343 1343
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1344
-                        <option value='btn-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1345
-                        <option value='btn-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1346
-                        <option value='btn-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1347
-                        <option value='btn-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1348
-                        <option value='btn-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1349
-                        <option value='btn-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1350
-                        <option value='btn-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1351
-                        <option value='btn-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1352
-                        <option value='btn-link'>"      . __( 'Link', 'invoicing' ) ."</option>
1344
+                        <option value='btn-primary'>" . __('Primary', 'invoicing') . "</option>
1345
+                        <option value='btn-secondary'>" . __('Secondary', 'invoicing') . "</option>
1346
+                        <option value='btn-success'>"   . __('Success', 'invoicing') . "</option>
1347
+                        <option value='btn-danger'>"    . __('Danger', 'invoicing') . "</option>
1348
+                        <option value='btn-warning'>"   . __('Warning', 'invoicing') . "</option>
1349
+                        <option value='btn-info'>"      . __('Info', 'invoicing') . "</option>
1350
+                        <option value='btn-light'>"     . __('Light', 'invoicing') . "</option>
1351
+                        <option value='btn-dark'>"      . __('Dark', 'invoicing') . "</option>
1352
+                        <option value='btn-link'>"      . __('Link', 'invoicing') . "</option>
1353 1353
                     </select>
1354 1354
                 </div>
1355 1355
             </div>
@@ -1360,8 +1360,8 @@  discard block
 block discarded – undo
1360 1360
     /**
1361 1361
      * Renders the alert element template.
1362 1362
      */
1363
-    public function render_alert_template( $field ) {
1364
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1363
+    public function render_alert_template($field) {
1364
+        $restrict = $this->get_restrict_markup($field, 'alert');
1365 1365
         $text     = "$field.text";
1366 1366
         echo "
1367 1367
             <div $restrict class='alert' :class='$field.class' role='alert'>
@@ -1376,15 +1376,15 @@  discard block
 block discarded – undo
1376 1376
     /**
1377 1377
      * Renders the alert element on the frontend.
1378 1378
      */
1379
-    public function frontend_render_alert_template( $field ) {
1379
+    public function frontend_render_alert_template($field) {
1380 1380
         
1381 1381
         echo "<div class='form-group'>";
1382 1382
 
1383 1383
         echo aui()->alert(
1384 1384
             array(
1385
-                'content'     => wp_kses_post( $field['text'] ),
1385
+                'content'     => wp_kses_post($field['text']),
1386 1386
                 'dismissible' => $field['dismissible'],
1387
-                'type'        => str_replace( 'alert-', '', $field['class'] ),
1387
+                'type'        => str_replace('alert-', '', $field['class']),
1388 1388
             )
1389 1389
         );
1390 1390
 
@@ -1395,14 +1395,14 @@  discard block
 block discarded – undo
1395 1395
     /**
1396 1396
      * Renders the alert element template.
1397 1397
      */
1398
-    public function edit_alert_template( $field ) {
1399
-        $restrict = $this->get_restrict_markup( $field, 'alert' );
1400
-        $label    = __( 'Alert Text', 'invoicing' );
1401
-        $label2   = esc_attr__( 'Enter your alert text here', 'invoicing' );
1398
+    public function edit_alert_template($field) {
1399
+        $restrict = $this->get_restrict_markup($field, 'alert');
1400
+        $label    = __('Alert Text', 'invoicing');
1401
+        $label2   = esc_attr__('Enter your alert text here', 'invoicing');
1402 1402
         $id       = $field . '.id + "_edit"';
1403
-        $label3   = __( 'Is Dismissible?', 'invoicing' );
1403
+        $label3   = __('Is Dismissible?', 'invoicing');
1404 1404
         $id2      = $field . '.id + "_edit2"';
1405
-        $label4   = esc_attr__( 'Alert Type', 'invoicing' );
1405
+        $label4   = esc_attr__('Alert Type', 'invoicing');
1406 1406
         $id3      = $field . '.id + "_edit3"';
1407 1407
         echo "
1408 1408
             <div $restrict>
@@ -1418,14 +1418,14 @@  discard block
 block discarded – undo
1418 1418
                     <label :for='$id3'>$label4</label>
1419 1419
 
1420 1420
                     <select class='form-control custom-select' :id='$id3' v-model='$field.class'>
1421
-                        <option value='alert-primary'>"   . __( 'Primary', 'invoicing' ) ."</option>
1422
-                        <option value='alert-secondary'>" . __( 'Secondary', 'invoicing' ) ."</option>
1423
-                        <option value='alert-success'>"   . __( 'Success', 'invoicing' ) ."</option>
1424
-                        <option value='alert-danger'>"    . __( 'Danger', 'invoicing' ) ."</option>
1425
-                        <option value='alert-warning'>"   . __( 'Warning', 'invoicing' ) ."</option>
1426
-                        <option value='alert-info'>"      . __( 'Info', 'invoicing' ) ."</option>
1427
-                        <option value='alert-light'>"     . __( 'Light', 'invoicing' ) ."</option>
1428
-                        <option value='alert-dark'>"      . __( 'Dark', 'invoicing' ) ."</option>
1421
+                        <option value='alert-primary'>" . __('Primary', 'invoicing') . "</option>
1422
+                        <option value='alert-secondary'>" . __('Secondary', 'invoicing') . "</option>
1423
+                        <option value='alert-success'>"   . __('Success', 'invoicing') . "</option>
1424
+                        <option value='alert-danger'>"    . __('Danger', 'invoicing') . "</option>
1425
+                        <option value='alert-warning'>"   . __('Warning', 'invoicing') . "</option>
1426
+                        <option value='alert-info'>"      . __('Info', 'invoicing') . "</option>
1427
+                        <option value='alert-light'>"     . __('Light', 'invoicing') . "</option>
1428
+                        <option value='alert-dark'>"      . __('Dark', 'invoicing') . "</option>
1429 1429
                     </select>
1430 1430
                 </div>
1431 1431
             </div>
@@ -1436,8 +1436,8 @@  discard block
 block discarded – undo
1436 1436
     /**
1437 1437
      * Renders the discount element template.
1438 1438
      */
1439
-    public function render_discount_template( $field ) {
1440
-        $restrict  = $this->get_restrict_markup( $field, 'discount' );
1439
+    public function render_discount_template($field) {
1440
+        $restrict = $this->get_restrict_markup($field, 'discount');
1441 1441
         ?>
1442 1442
 
1443 1443
             <div <?php echo $restrict; ?> class="discount_field  border rounded p-3">
@@ -1454,13 +1454,13 @@  discard block
 block discarded – undo
1454 1454
     /**
1455 1455
      * Renders the discount element on the frontend.
1456 1456
      */
1457
-    public function frontend_render_discount_template( $field ) {
1457
+    public function frontend_render_discount_template($field) {
1458 1458
         
1459
-        $placeholder = esc_attr( $field['input_label'] );
1460
-        $label       = sanitize_text_field( $field['button_label'] );
1459
+        $placeholder = esc_attr($field['input_label']);
1460
+        $label       = sanitize_text_field($field['button_label']);
1461 1461
         $description = '';
1462 1462
 
1463
-        if ( ! empty( $field['description'] ) ) {
1463
+        if (!empty($field['description'])) {
1464 1464
             $description = "<small class='form-text text-muted'>{$field['description']}</small>";
1465 1465
         }
1466 1466
 ?>
@@ -1481,12 +1481,12 @@  discard block
 block discarded – undo
1481 1481
     /**
1482 1482
      * Renders the discount element template.
1483 1483
      */
1484
-    public function edit_discount_template( $field ) {
1485
-        $restrict = $this->get_restrict_markup( $field, 'discount' );
1486
-        $label    = __( 'Discount Input Placeholder', 'invoicing' );
1487
-        $label2   = __( 'Help Text', 'invoicing' );
1488
-        $label3   = esc_attr__( 'Add some help text for this field', 'invoicing' );
1489
-        $label4   = __( 'Button Text', 'invoicing' );
1484
+    public function edit_discount_template($field) {
1485
+        $restrict = $this->get_restrict_markup($field, 'discount');
1486
+        $label    = __('Discount Input Placeholder', 'invoicing');
1487
+        $label2   = __('Help Text', 'invoicing');
1488
+        $label3   = esc_attr__('Add some help text for this field', 'invoicing');
1489
+        $label4   = __('Button Text', 'invoicing');
1490 1490
         $id       = $field . '.id + "_edit"';
1491 1491
         $id2      = $field . '.id + "_edit2"';
1492 1492
         $id3      = $field . '.id + "_edit3"';
@@ -1515,48 +1515,48 @@  discard block
 block discarded – undo
1515 1515
     /**
1516 1516
      * Renders the items element template.
1517 1517
      */
1518
-    public function render_items_template( $field ) {
1519
-        $restrict  = $this->get_restrict_markup( $field, 'items' );
1520
-        $label     = __( 'Item totals placeholder. Item totals will appear here. Click to set items.', 'invoicing' );
1518
+    public function render_items_template($field) {
1519
+        $restrict  = $this->get_restrict_markup($field, 'items');
1520
+        $label     = __('Item totals placeholder. Item totals will appear here. Click to set items.', 'invoicing');
1521 1521
         echo "<div $restrict class='item_totals p-4 bg-warning'>$label</div>";
1522 1522
     }
1523 1523
 
1524 1524
     /**
1525 1525
      * Renders the items element on the frontend.
1526 1526
      */
1527
-    public function frontend_render_items_template( $field, $items ) {
1527
+    public function frontend_render_items_template($field, $items) {
1528 1528
         
1529 1529
         echo "<div class='form-group item_totals'>";
1530 1530
         
1531
-        $id = esc_attr( $field['id'] );
1532
-        if ( 'total' == $field[ 'items_type' ] ) {
1531
+        $id = esc_attr($field['id']);
1532
+        if ('total' == $field['items_type']) {
1533 1533
             $total = 0;
1534 1534
 
1535 1535
             ?>
1536 1536
             <div class="border item_totals_type_total">
1537 1537
 
1538 1538
                 <?php
1539
-                    foreach( $items as $item ) {
1540
-                        $total = $total + floatval( $item['price'] );
1539
+                    foreach ($items as $item) {
1540
+                        $total = $total + floatval($item['price']);
1541 1541
 
1542 1542
                         $class  = 'col-8';
1543 1543
                         $class2 = '';
1544 1544
 
1545
-                        if ( ! empty( $item['allow_quantities'] ) ) {
1545
+                        if (!empty($item['allow_quantities'])) {
1546 1546
                             $class = 'col-6 pt-2';
1547 1547
                             $class2 = 'pt-2';
1548 1548
                         }
1549 1549
 
1550
-                        if ( ! empty( $item['custom_price'] ) ) {
1550
+                        if (!empty($item['custom_price'])) {
1551 1551
                             $class .= ' pt-2';
1552 1552
                         }
1553 1553
             
1554 1554
                 ?>
1555 1555
                     <div  class="item_totals_item">
1556 1556
                         <div class='row pl-2 pr-2 pt-2'>
1557
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
1557
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
1558 1558
 
1559
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
1559
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
1560 1560
 
1561 1561
                                 <div class='col-2'>
1562 1562
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -1564,11 +1564,11 @@  discard block
 block discarded – undo
1564 1564
 
1565 1565
                             <?php } else { ?>
1566 1566
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
1567
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
1567
+                            <?php } if (empty($item['custom_price'])) { ?>
1568 1568
 
1569 1569
                                 <div class='col-4 <?php echo $class2; ?>'>
1570
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
1571
-                                    <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
1570
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
1571
+                                    <input name='wpinv-items[<?php echo (int) $item['id']; ?>]' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
1572 1572
                                 </div>
1573 1573
 
1574 1574
                             <?php } else {?>
@@ -1576,15 +1576,15 @@  discard block
 block discarded – undo
1576 1576
                                 <div class='col-4'>
1577 1577
                                     <div class='input-group'>
1578 1578
 
1579
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
1579
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
1580 1580
                                             <div class='input-group-prepend'>
1581 1581
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1582 1582
                                             </div>
1583 1583
                                         <?php } ?>
1584 1584
 
1585
-                                        <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
1585
+                                        <input type='number' name='wpinv-items[<?php echo (int) $item['id']; ?>]' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
1586 1586
                                     
1587
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
1587
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
1588 1588
                                             <div class='input-group-append'>
1589 1589
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1590 1590
                                             </div>
@@ -1595,38 +1595,38 @@  discard block
 block discarded – undo
1595 1595
                             <?php } ?>
1596 1596
 
1597 1597
                         </div>
1598
-                        <?php if ( ! empty( $item['description'] )) { ?>
1599
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1598
+                        <?php if (!empty($item['description'])) { ?>
1599
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1600 1600
                         <?php } ?>
1601 1601
                     </div>
1602 1602
                 <?php } ?>
1603 1603
 
1604 1604
                 <div class='mt-4 border-top item_totals_total'>
1605 1605
                     <div class='row p-2'>
1606
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
1607
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
1606
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
1607
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
1608 1608
                     </div>
1609 1609
                 </div>
1610 1610
 
1611 1611
             </div>
1612 1612
         <?php } ?>
1613 1613
 
1614
-        <?php if ( 'radio' == $field[ 'items_type' ] ) { ?>
1614
+        <?php if ('radio' == $field['items_type']) { ?>
1615 1615
             <div class="item_totals_type_radio">
1616 1616
 
1617 1617
                 <?php
1618
-                    foreach( $items as $index => $item ) {
1618
+                    foreach ($items as $index => $item) {
1619 1619
                 
1620
-                        if ( ! empty( $item['required'] ) ) {
1620
+                        if (!empty($item['required'])) {
1621 1621
                             continue;
1622 1622
                         }
1623 1623
                 ?>
1624 1624
                     <div  class="form-check">
1625
-                        <input class='form-check-input wpinv-items-selector' <?php checked( ! isset( $selected_radio_item ) ); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'>
1626
-                        <label class='form-check-label' for='<?php echo $id . $index; ?>'><?php echo sanitize_text_field( $item['title'] ); ?>&nbsp;<strong><?php echo wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) ); ?></strong></label>
1625
+                        <input class='form-check-input wpinv-items-selector' <?php checked(!isset($selected_radio_item)); $selected_radio_item = 1; ?> type='radio' value='<?php echo $item['id']; ?>' id='<?php echo $id . $index; ?>' name='wpinv-payment-form-selected-item'>
1626
+                        <label class='form-check-label' for='<?php echo $id . $index; ?>'><?php echo sanitize_text_field($item['title']); ?>&nbsp;<strong><?php echo wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price']))); ?></strong></label>
1627 1627
                     </div>
1628
-                    <?php if ( ! empty( $item['description'] )) { ?>
1629
-                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1628
+                    <?php if (!empty($item['description'])) { ?>
1629
+                        <small class='form-text text-muted pl-4 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1630 1630
                     <?php } ?>
1631 1631
                 <?php } ?>
1632 1632
 
@@ -1636,29 +1636,29 @@  discard block
 block discarded – undo
1636 1636
 
1637 1637
                         $total = 0;
1638 1638
 
1639
-                        foreach ( $items as $item ) {
1639
+                        foreach ($items as $item) {
1640 1640
 
1641 1641
                             $class  = 'col-8';
1642 1642
                             $class2 = '';
1643 1643
 
1644
-                            if ( ! empty( $item['allow_quantities'] ) ) {
1644
+                            if (!empty($item['allow_quantities'])) {
1645 1645
                                 $class = 'col-6 pt-2';
1646 1646
                                 $class2 = 'pt-2';
1647 1647
                             }
1648 1648
 
1649
-                            if ( ! empty( $item['custom_price'] ) ) {
1649
+                            if (!empty($item['custom_price'])) {
1650 1650
                                 $class .= ' pt-2';
1651 1651
                             }
1652 1652
 
1653 1653
                             $class3 = 'd-none';
1654 1654
                             $name   = '';
1655
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_radio_item ) ) {
1655
+                            if (!empty($item['required']) || !isset($totals_selected_radio_item)) {
1656 1656
 
1657
-                                $total = $total + floatval( $item['price'] );
1657
+                                $total = $total + floatval($item['price']);
1658 1658
                                 $class3 = '';
1659 1659
                                 $name   = "wpinv-items[{$item['id']}]";
1660 1660
 
1661
-                                if ( empty( $item['required'] ) ) {
1661
+                                if (empty($item['required'])) {
1662 1662
                                     $totals_selected_radio_item = 1;
1663 1663
                                 }
1664 1664
 
@@ -1670,9 +1670,9 @@  discard block
 block discarded – undo
1670 1670
 
1671 1671
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
1672 1672
                         <div class='row pl-2 pr-2 pt-2'>
1673
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
1673
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
1674 1674
 
1675
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
1675
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
1676 1676
 
1677 1677
                                 <div class='col-2'>
1678 1678
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -1680,11 +1680,11 @@  discard block
 block discarded – undo
1680 1680
 
1681 1681
                             <?php } else { ?>
1682 1682
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
1683
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
1683
+                            <?php } if (empty($item['custom_price'])) { ?>
1684 1684
 
1685 1685
                                 <div class='col-4 <?php echo $class2; ?>'>
1686
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
1687
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
1686
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
1687
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
1688 1688
                                 </div>
1689 1689
 
1690 1690
                             <?php } else {?>
@@ -1692,15 +1692,15 @@  discard block
 block discarded – undo
1692 1692
                                 <div class='col-4'>
1693 1693
                                     <div class='input-group'>
1694 1694
 
1695
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
1695
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
1696 1696
                                             <div class='input-group-prepend'>
1697 1697
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1698 1698
                                             </div>
1699 1699
                                         <?php } ?>
1700 1700
 
1701
-                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
1701
+                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
1702 1702
                                     
1703
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
1703
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
1704 1704
                                             <div class='input-group-append'>
1705 1705
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1706 1706
                                             </div>
@@ -1711,16 +1711,16 @@  discard block
 block discarded – undo
1711 1711
                             <?php } ?>
1712 1712
 
1713 1713
                         </div>
1714
-                        <?php if ( ! empty( $item['description'] )) { ?>
1715
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1714
+                        <?php if (!empty($item['description'])) { ?>
1715
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1716 1716
                         <?php } ?>
1717 1717
                     </div>
1718 1718
                 <?php } ?>
1719 1719
 
1720 1720
                 <div class='mt-4 border-top item_totals_total'>
1721 1721
                     <div class='row p-2'>
1722
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
1723
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
1722
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
1723
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
1724 1724
                     </div>
1725 1725
                 </div>
1726 1726
 
@@ -1728,22 +1728,22 @@  discard block
 block discarded – undo
1728 1728
             </div>
1729 1729
         <?php } ?>
1730 1730
 
1731
-        <?php if ( 'checkbox' == $field[ 'items_type' ] ) { ?>
1731
+        <?php if ('checkbox' == $field['items_type']) { ?>
1732 1732
 
1733 1733
             <div class="item_totals_type_checkbox">
1734 1734
 
1735 1735
                 <?php
1736
-                    foreach ( $items as $index => $item ) {
1736
+                    foreach ($items as $index => $item) {
1737 1737
 
1738
-                        if ( ! empty( $item['required'] ) ) {
1738
+                        if (!empty($item['required'])) {
1739 1739
                             continue;
1740 1740
                         }
1741 1741
 
1742
-                        $title = sanitize_text_field(  $item['title'] );
1743
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
1744
-                        $item_id    = esc_attr( $id . "_$index" );
1745
-                        $value = esc_attr( $item['id'] );
1746
-                        $checked = checked( ! isset( $selected_checkbox_item ), true, false );
1742
+                        $title = sanitize_text_field($item['title']);
1743
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
1744
+                        $item_id = esc_attr($id . "_$index");
1745
+                        $value = esc_attr($item['id']);
1746
+                        $checked = checked(!isset($selected_checkbox_item), true, false);
1747 1747
                         $selected_checkbox_item = 1;
1748 1748
 
1749 1749
                         echo "
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
                                 <label for='$item_id' class='custom-control-label'>$title &nbsp; ($price)</label>
1753 1753
                             </div>";
1754 1754
 
1755
-                        if ( ! empty( $item['description'] ) ) {
1755
+                        if (!empty($item['description'])) {
1756 1756
                             echo "<small class='form-text text-muted'>{$item['description']}</small>";
1757 1757
                         }
1758 1758
                     }
@@ -1764,29 +1764,29 @@  discard block
 block discarded – undo
1764 1764
 
1765 1765
                         $total = 0;
1766 1766
 
1767
-                        foreach ( $items as $item ) {
1767
+                        foreach ($items as $item) {
1768 1768
 
1769 1769
                             $class  = 'col-8';
1770 1770
                             $class2 = '';
1771 1771
 
1772
-                            if ( ! empty( $item['allow_quantities'] ) ) {
1772
+                            if (!empty($item['allow_quantities'])) {
1773 1773
                                 $class = 'col-6 pt-2';
1774 1774
                                 $class2 = 'pt-2';
1775 1775
                             }
1776 1776
 
1777
-                            if ( ! empty( $item['custom_price'] ) ) {
1777
+                            if (!empty($item['custom_price'])) {
1778 1778
                                 $class .= ' pt-2';
1779 1779
                             }
1780 1780
 
1781 1781
                             $class3 = 'd-none';
1782
-                            $name  = '';
1783
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_checkbox_item ) ) {
1782
+                            $name = '';
1783
+                            if (!empty($item['required']) || !isset($totals_selected_checkbox_item)) {
1784 1784
 
1785
-                                $total = $total + floatval( $item['price'] );
1785
+                                $total = $total + floatval($item['price']);
1786 1786
                                 $class3 = '';
1787 1787
                                 $name  = "wpinv-items[{$item['id']}]";
1788 1788
 
1789
-                                if ( empty( $item['required'] ) ) {
1789
+                                if (empty($item['required'])) {
1790 1790
                                     $totals_selected_checkbox_item = 1;
1791 1791
                                 }
1792 1792
 
@@ -1798,9 +1798,9 @@  discard block
 block discarded – undo
1798 1798
 
1799 1799
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
1800 1800
                         <div class='row pl-2 pr-2 pt-2'>
1801
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
1801
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
1802 1802
 
1803
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
1803
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
1804 1804
 
1805 1805
                                 <div class='col-2'>
1806 1806
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -1808,11 +1808,11 @@  discard block
 block discarded – undo
1808 1808
 
1809 1809
                             <?php } else { ?>
1810 1810
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
1811
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
1811
+                            <?php } if (empty($item['custom_price'])) { ?>
1812 1812
 
1813 1813
                                 <div class='col-4 <?php echo $class2; ?>'>
1814
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
1815
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
1814
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
1815
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
1816 1816
                                 </div>
1817 1817
 
1818 1818
                             <?php } else {?>
@@ -1820,15 +1820,15 @@  discard block
 block discarded – undo
1820 1820
                                 <div class='col-4'>
1821 1821
                                     <div class='input-group'>
1822 1822
 
1823
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
1823
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
1824 1824
                                             <div class='input-group-prepend'>
1825 1825
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1826 1826
                                             </div>
1827 1827
                                         <?php } ?>
1828 1828
 
1829
-                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
1829
+                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
1830 1830
                                     
1831
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
1831
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
1832 1832
                                             <div class='input-group-append'>
1833 1833
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1834 1834
                                             </div>
@@ -1839,23 +1839,23 @@  discard block
 block discarded – undo
1839 1839
                             <?php } ?>
1840 1840
 
1841 1841
                         </div>
1842
-                        <?php if ( ! empty( $item['description'] )) { ?>
1843
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1842
+                        <?php if (!empty($item['description'])) { ?>
1843
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1844 1844
                         <?php } ?>
1845 1845
                     </div>
1846 1846
                 <?php } ?>
1847 1847
 
1848 1848
                 <div class='mt-4 border-top item_totals_total'>
1849 1849
                     <div class='row p-2'>
1850
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
1851
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
1850
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
1851
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
1852 1852
                     </div>
1853 1853
                 </div>
1854 1854
             </div>
1855 1855
             </div>
1856 1856
         <?php } ?>
1857 1857
 
1858
-        <?php if ( 'select' == $field[ 'items_type' ] ) { ?>
1858
+        <?php if ('select' == $field['items_type']) { ?>
1859 1859
 
1860 1860
             <div class="item_totals_type_select">
1861 1861
 
@@ -1863,17 +1863,17 @@  discard block
 block discarded – undo
1863 1863
 
1864 1864
                     $options  = array();
1865 1865
                     $selected = '';
1866
-                    foreach ( $items as $index => $item ) {
1866
+                    foreach ($items as $index => $item) {
1867 1867
 
1868
-                        if ( ! empty( $item['required'] ) ) {
1868
+                        if (!empty($item['required'])) {
1869 1869
                             continue;
1870 1870
                         }
1871 1871
 
1872
-                        $title = sanitize_text_field(  $item['title'] );
1873
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
1874
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
1872
+                        $title = sanitize_text_field($item['title']);
1873
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
1874
+                        $options[$item['id']] = "$title &nbsp; ($price)";
1875 1875
 
1876
-                        if ( ! isset( $selected_item ) ) {
1876
+                        if (!isset($selected_item)) {
1877 1877
                             $selected = $item['id'];
1878 1878
                             $selected_item = 1;
1879 1879
                         }
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
                         array(
1885 1885
                                 'name'        => 'payment-form-items',
1886 1886
                                 'id'          => $id,
1887
-                                'placeholder' => __( 'Select an item', 'invoicing' ),
1887
+                                'placeholder' => __('Select an item', 'invoicing'),
1888 1888
                                 'no_wrap'     => true,
1889 1889
                                 'options'     => $options,
1890 1890
                                 'class'       => 'wpi_select2 wpinv-items-select-selector',
@@ -1899,29 +1899,29 @@  discard block
 block discarded – undo
1899 1899
 
1900 1900
                         $total = 0;
1901 1901
 
1902
-                        foreach ( $items as $item ) {
1902
+                        foreach ($items as $item) {
1903 1903
 
1904 1904
                             $class  = 'col-8';
1905 1905
                             $class2 = '';
1906 1906
 
1907
-                            if ( ! empty( $item['allow_quantities'] ) ) {
1907
+                            if (!empty($item['allow_quantities'])) {
1908 1908
                                 $class = 'col-6 pt-2';
1909 1909
                                 $class2 = 'pt-2';
1910 1910
                             }
1911 1911
 
1912
-                            if ( ! empty( $item['custom_price'] ) ) {
1912
+                            if (!empty($item['custom_price'])) {
1913 1913
                                 $class .= ' pt-2';
1914 1914
                             }
1915 1915
 
1916 1916
                             $class3 = 'd-none';
1917
-                            $name  = '';
1918
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) {
1917
+                            $name = '';
1918
+                            if (!empty($item['required']) || !isset($totals_selected_select_item)) {
1919 1919
 
1920
-                                $total = $total + floatval( $item['price'] );
1920
+                                $total = $total + floatval($item['price']);
1921 1921
                                 $class3 = '';
1922 1922
                                 $name  = "wpinv-items[{$item['id']}]";
1923 1923
 
1924
-                                if ( empty( $item['required'] ) ) {
1924
+                                if (empty($item['required'])) {
1925 1925
                                     $totals_selected_select_item = 1;
1926 1926
                                 }
1927 1927
 
@@ -1933,9 +1933,9 @@  discard block
 block discarded – undo
1933 1933
 
1934 1934
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
1935 1935
                         <div class='row pl-2 pr-2 pt-2'>
1936
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
1936
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
1937 1937
 
1938
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
1938
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
1939 1939
 
1940 1940
                                 <div class='col-2'>
1941 1941
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -1943,11 +1943,11 @@  discard block
 block discarded – undo
1943 1943
 
1944 1944
                             <?php } else { ?>
1945 1945
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
1946
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
1946
+                            <?php } if (empty($item['custom_price'])) { ?>
1947 1947
 
1948 1948
                                 <div class='col-4 <?php echo $class2; ?>'>
1949
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
1950
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
1949
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
1950
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
1951 1951
                                 </div>
1952 1952
 
1953 1953
                             <?php } else {?>
@@ -1955,15 +1955,15 @@  discard block
 block discarded – undo
1955 1955
                                 <div class='col-4'>
1956 1956
                                     <div class='input-group'>
1957 1957
 
1958
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
1958
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
1959 1959
                                             <div class='input-group-prepend'>
1960 1960
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1961 1961
                                             </div>
1962 1962
                                         <?php } ?>
1963 1963
 
1964
-                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
1964
+                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
1965 1965
                                     
1966
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
1966
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
1967 1967
                                             <div class='input-group-append'>
1968 1968
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
1969 1969
                                             </div>
@@ -1974,23 +1974,23 @@  discard block
 block discarded – undo
1974 1974
                             <?php } ?>
1975 1975
 
1976 1976
                         </div>
1977
-                        <?php if ( ! empty( $item['description'] )) { ?>
1978
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
1977
+                        <?php if (!empty($item['description'])) { ?>
1978
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
1979 1979
                         <?php } ?>
1980 1980
                     </div>
1981 1981
                 <?php } ?>
1982 1982
 
1983 1983
                 <div class='mt-4 border-top item_totals_total'>
1984 1984
                     <div class='row p-2'>
1985
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
1986
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
1985
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
1986
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
1987 1987
                     </div>
1988 1988
                 </div>
1989 1989
 
1990 1990
             </div>
1991 1991
         <?php } ?>
1992 1992
 
1993
-        <?php if ( 'multi_select' == $field[ 'items_type' ] ) { ?>
1993
+        <?php if ('multi_select' == $field['items_type']) { ?>
1994 1994
 
1995 1995
             <div class="item_totals_type_multi_select">
1996 1996
 
@@ -1999,18 +1999,18 @@  discard block
 block discarded – undo
1999 1999
                     $options  = array();
2000 2000
                     $selected = array();
2001 2001
 
2002
-                    foreach ( $items as $index => $item ) {
2002
+                    foreach ($items as $index => $item) {
2003 2003
 
2004
-                        if ( ! empty( $item['required'] ) ) {
2004
+                        if (!empty($item['required'])) {
2005 2005
                             continue;
2006 2006
                         }
2007 2007
                     
2008
-                        $title = sanitize_text_field(  $item['title'] );
2009
-                        $price = wpinv_price( wpinv_format_amount( (float) sanitize_text_field(  $item['price'] ) ) );
2010
-                        $options[ $item['id'] ] = "$title &nbsp; ($price)";
2008
+                        $title = sanitize_text_field($item['title']);
2009
+                        $price = wpinv_price(wpinv_format_amount((float) sanitize_text_field($item['price'])));
2010
+                        $options[$item['id']] = "$title &nbsp; ($price)";
2011 2011
 
2012
-                        if ( ! isset( $selected_item ) ) {
2013
-                            $selected = array( $item['id'] );
2012
+                        if (!isset($selected_item)) {
2013
+                            $selected = array($item['id']);
2014 2014
                             $selected_item = 1;
2015 2015
                         }
2016 2016
 
@@ -2035,29 +2035,29 @@  discard block
 block discarded – undo
2035 2035
 
2036 2036
                         $total = 0;
2037 2037
 
2038
-                        foreach ( $items as $item ) {
2038
+                        foreach ($items as $item) {
2039 2039
 
2040 2040
                             $class  = 'col-8';
2041 2041
                             $class2 = '';
2042 2042
 
2043
-                            if ( ! empty( $item['allow_quantities'] ) ) {
2043
+                            if (!empty($item['allow_quantities'])) {
2044 2044
                                 $class = 'col-6 pt-2';
2045 2045
                                 $class2 = 'pt-2';
2046 2046
                             }
2047 2047
 
2048
-                            if ( ! empty( $item['custom_price'] ) ) {
2048
+                            if (!empty($item['custom_price'])) {
2049 2049
                                 $class .= ' pt-2';
2050 2050
                             }
2051 2051
 
2052 2052
                             $class3 = 'd-none';
2053
-                            $name  = '';
2054
-                            if ( ! empty( $item['required'] ) || ! isset( $totals_selected_select_item ) ) {
2053
+                            $name = '';
2054
+                            if (!empty($item['required']) || !isset($totals_selected_select_item)) {
2055 2055
 
2056
-                                $total = $total + floatval( $item['price'] );
2056
+                                $total = $total + floatval($item['price']);
2057 2057
                                 $class3 = '';
2058 2058
                                 $name  = "wpinv-items[{$item['id']}]";
2059 2059
 
2060
-                                if ( empty( $item['required'] ) ) {
2060
+                                if (empty($item['required'])) {
2061 2061
                                     $totals_selected_select_item = 1;
2062 2062
                                 }
2063 2063
 
@@ -2069,9 +2069,9 @@  discard block
 block discarded – undo
2069 2069
 
2070 2070
                     <div  class="item_totals_item <?php echo $class3; ?>" data-id="<?php echo (int) $item['id']; ?>">
2071 2071
                         <div class='row pl-2 pr-2 pt-2'>
2072
-                            <div class='<?php echo $class; ?>'><?php echo esc_html( $item['title'] ) ?></div>
2072
+                            <div class='<?php echo $class; ?>'><?php echo esc_html($item['title']) ?></div>
2073 2073
 
2074
-                            <?php  if ( ! empty( $item['allow_quantities'] ) ) { ?>
2074
+                            <?php  if (!empty($item['allow_quantities'])) { ?>
2075 2075
 
2076 2076
                                 <div class='col-2'>
2077 2077
                                     <input name='wpinv-item-<?php echo (int) $item['id']; ?>-quantity' type='number' class='form-control wpinv-item-quantity-input pr-1' value='1' min='1' required>
@@ -2079,11 +2079,11 @@  discard block
 block discarded – undo
2079 2079
 
2080 2080
                             <?php } else { ?>
2081 2081
                                 <input type='hidden' class='wpinv-item-quantity-input' value='1'>
2082
-                            <?php } if ( empty( $item['custom_price'] ) ) { ?>
2082
+                            <?php } if (empty($item['custom_price'])) { ?>
2083 2083
 
2084 2084
                                 <div class='col-4 <?php echo $class2; ?>'>
2085
-                                    <?php echo wpinv_price( wpinv_format_amount( $item['price'] ) ) ?>
2086
-                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval( $item['price'] ); ?>'>
2085
+                                    <?php echo wpinv_price(wpinv_format_amount($item['price'])) ?>
2086
+                                    <input name='<?php echo $name; ?>' type='hidden' class='wpinv-item-price-input' value='<?php echo floatval($item['price']); ?>'>
2087 2087
                                 </div>
2088 2088
 
2089 2089
                             <?php } else {?>
@@ -2091,15 +2091,15 @@  discard block
 block discarded – undo
2091 2091
                                 <div class='col-4'>
2092 2092
                                     <div class='input-group'>
2093 2093
 
2094
-                                        <?php if ( 'left' == wpinv_currency_position() ) { ?>
2094
+                                        <?php if ('left' == wpinv_currency_position()) { ?>
2095 2095
                                             <div class='input-group-prepend'>
2096 2096
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2097 2097
                                             </div>
2098 2098
                                         <?php } ?>
2099 2099
 
2100
-                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval( $item['price'] ); ?>' value='<?php echo floatval( $item['price'] ); ?>' min='<?php echo intval( $item['minimum_price'] ); ?>'>
2100
+                                        <input type='number' name='<?php echo $name; ?>' class='form-control wpinv-item-price-input' placeholder='<?php echo floatval($item['price']); ?>' value='<?php echo floatval($item['price']); ?>' min='<?php echo intval($item['minimum_price']); ?>'>
2101 2101
                                     
2102
-                                        <?php if ( 'left' != wpinv_currency_position() ) { ?>
2102
+                                        <?php if ('left' != wpinv_currency_position()) { ?>
2103 2103
                                             <div class='input-group-append'>
2104 2104
                                                 <span class='input-group-text'><?php echo wpinv_currency_symbol(); ?></span>
2105 2105
                                             </div>
@@ -2110,23 +2110,23 @@  discard block
 block discarded – undo
2110 2110
                             <?php } ?>
2111 2111
 
2112 2112
                         </div>
2113
-                        <?php if ( ! empty( $item['description'] )) { ?>
2114
-                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post( $item['description'] ); ?></small>
2113
+                        <?php if (!empty($item['description'])) { ?>
2114
+                            <small class='form-text text-muted pl-2 pr-2 m-0'><?php echo wp_kses_post($item['description']); ?></small>
2115 2115
                         <?php } ?>
2116 2116
                     </div>
2117 2117
                 <?php } ?>
2118 2118
 
2119 2119
                 <div class='mt-4 border-top item_totals_total'>
2120 2120
                     <div class='row p-2'>
2121
-                        <div class='col-8'><strong class='mr-5'><?php _e( 'Total', 'invoicing' ); ?></strong></div>
2122
-                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price( wpinv_format_amount( $total ) ) ?></strong></div>
2121
+                        <div class='col-8'><strong class='mr-5'><?php _e('Total', 'invoicing'); ?></strong></div>
2122
+                        <div class='col-4'><strong class='wpinv-items-total' data-currency='<?php echo wpinv_currency_symbol(); ?>' data-currency-position='<?php echo wpinv_currency_position(); ?>'><?php echo wpinv_price(wpinv_format_amount($total)) ?></strong></div>
2123 2123
                     </div>
2124 2124
                 </div>
2125 2125
 
2126 2126
             </div>
2127 2127
         <?php } ?>
2128
-        <?php if ( ! empty( $field[ 'description' ] ) ) { ?>
2129
-            <small class='form-text text-muted'><?php echo wp_kses_post( $field[ 'description' ] ); ?></small>
2128
+        <?php if (!empty($field['description'])) { ?>
2129
+            <small class='form-text text-muted'><?php echo wp_kses_post($field['description']); ?></small>
2130 2130
         <?php } ?>
2131 2131
         </div>
2132 2132
         <?php
@@ -2135,20 +2135,20 @@  discard block
 block discarded – undo
2135 2135
     /**
2136 2136
      * Renders the items element template.
2137 2137
      */
2138
-    public function edit_items_template( $field ) {
2139
-        $restrict = $this->get_restrict_markup( $field, 'items' );
2140
-        $label    = __( 'Let customers...', 'invoicing' );
2141
-        $label2   = __( 'Available Items', 'invoicing' );
2142
-        $label3   = esc_attr__( 'Add some help text for this element', 'invoicing' );
2138
+    public function edit_items_template($field) {
2139
+        $restrict = $this->get_restrict_markup($field, 'items');
2140
+        $label    = __('Let customers...', 'invoicing');
2141
+        $label2   = __('Available Items', 'invoicing');
2142
+        $label3   = esc_attr__('Add some help text for this element', 'invoicing');
2143 2143
         $id       = $field . '.id + "_edit"';
2144 2144
         $id2      = $field . '.id + "_edit2"';
2145 2145
         $id3      = $field . '.id + "_edit3"';
2146 2146
         $id4      = $field . '.id + "_edit4"';
2147
-        $label4   = esc_attr__( 'This will be shown to the customer as the recommended price', 'invoicing' );
2148
-        $label5   = esc_attr__( 'Allow users to pay what they want', 'invoicing' );
2149
-        $label6   = esc_attr__( 'Enter the minimum price that a user can pay', 'invoicing' );
2150
-        $label7   = esc_attr__( 'Allow users to buy several quantities', 'invoicing' );
2151
-        $label8   = esc_attr__( 'This item is required', 'invoicing' );
2147
+        $label4   = esc_attr__('This will be shown to the customer as the recommended price', 'invoicing');
2148
+        $label5   = esc_attr__('Allow users to pay what they want', 'invoicing');
2149
+        $label6   = esc_attr__('Enter the minimum price that a user can pay', 'invoicing');
2150
+        $label7   = esc_attr__('Allow users to buy several quantities', 'invoicing');
2151
+        $label8   = esc_attr__('This item is required', 'invoicing');
2152 2152
         echo "<div $restrict>
2153 2153
 
2154 2154
                 <label>$label2</label>
@@ -2218,7 +2218,7 @@  discard block
 block discarded – undo
2218 2218
                 <div class='form-group mt-2'>
2219 2219
 
2220 2220
                     <select class='form-control custom-select' v-model='selected_item'>
2221
-                        <option value=''>"        . __( 'Add an existing item to the form', 'invoicing' ) ."</option>
2221
+                        <option value=''>" . __('Add an existing item to the form', 'invoicing') . "</option>
2222 2222
                         <option v-for='(item, index) in all_items' :value='index'>{{item.title}}</option>
2223 2223
                     </select>
2224 2224
 
@@ -2233,11 +2233,11 @@  discard block
 block discarded – undo
2233 2233
                     <label :for='$id2'>$label</label>
2234 2234
 
2235 2235
                     <select class='form-control custom-select' :id='$id2' v-model='$field.items_type'>
2236
-                        <option value='total'>"        . __( 'Buy all items on the list', 'invoicing' ) ."</option>
2237
-                        <option value='radio'>"        . __( 'Select a single item from the list', 'invoicing' ) ."</option>
2238
-                        <option value='checkbox'>"     . __( 'Select one or more items on the list', 'invoicing' ) ."</option>
2239
-                        <option value='select'>"       . __( 'Select a single item from a dropdown', 'invoicing' ) ."</option>
2240
-                        <option value='multi_select'>" . __( 'Select a one or more items from a dropdown', 'invoicing' ) ."</option>
2236
+                        <option value='total'>" . __('Buy all items on the list', 'invoicing') . "</option>
2237
+                        <option value='radio'>"        . __('Select a single item from the list', 'invoicing') . "</option>
2238
+                        <option value='checkbox'>"     . __('Select one or more items on the list', 'invoicing') . "</option>
2239
+                        <option value='select'>"       . __('Select a single item from a dropdown', 'invoicing') . "</option>
2240
+                        <option value='multi_select'>" . __('Select a one or more items from a dropdown', 'invoicing') . "</option>
2241 2241
                     </select>
2242 2242
 
2243 2243
                 </div>
@@ -2262,27 +2262,27 @@  discard block
 block discarded – undo
2262 2262
             'orderby'        => 'title',
2263 2263
             'order'          => 'ASC',
2264 2264
             'posts_per_page' => -1,
2265
-            'post_status'    => array( 'publish' ),
2265
+            'post_status'    => array('publish'),
2266 2266
         );
2267 2267
     
2268
-        $items      = get_posts( apply_filters( 'wpinv_item_dropdown_query_args', $item_args ) );
2268
+        $items = get_posts(apply_filters('wpinv_item_dropdown_query_args', $item_args));
2269 2269
 
2270
-        if ( empty( $items ) ) {
2270
+        if (empty($items)) {
2271 2271
             return array();
2272 2272
         }
2273 2273
 
2274
-        $options    = array();
2275
-        foreach ( $items as $item ) {
2276
-            $title            = esc_html( $item->post_title );
2277
-            $title           .= wpinv_get_item_suffix( $item->ID, false );
2278
-            $id               = absint( $item->ID );
2279
-            $price            = wpinv_sanitize_amount( get_post_meta( $id, '_wpinv_price', true ) );
2280
-            $recurring        = (bool) get_post_meta( $id, '_wpinv_is_recurring', true );
2274
+        $options = array();
2275
+        foreach ($items as $item) {
2276
+            $title            = esc_html($item->post_title);
2277
+            $title           .= wpinv_get_item_suffix($item->ID, false);
2278
+            $id               = absint($item->ID);
2279
+            $price            = wpinv_sanitize_amount(get_post_meta($id, '_wpinv_price', true));
2280
+            $recurring        = (bool) get_post_meta($id, '_wpinv_is_recurring', true);
2281 2281
             $description      = $item->post_excerpt;
2282
-            $custom_price     = (bool) get_post_meta( $id, '_wpinv_dynamic_pricing', true );
2283
-            $minimum_price    = (float) get_post_meta( $id, '_minimum_price', true );
2282
+            $custom_price     = (bool) get_post_meta($id, '_wpinv_dynamic_pricing', true);
2283
+            $minimum_price    = (float) get_post_meta($id, '_minimum_price', true);
2284 2284
             $allow_quantities = false;
2285
-            $options[]        = compact( 'title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities' );
2285
+            $options[]        = compact('title', 'id', 'price', 'recurring', 'description', 'custom_price', 'minimum_price', 'allow_quantities');
2286 2286
 
2287 2287
         }
2288 2288
         return $options;
@@ -2292,38 +2292,38 @@  discard block
 block discarded – undo
2292 2292
     /**
2293 2293
      * Returns an array of items for the currently being edited form.
2294 2294
      */
2295
-    public function get_form_items( $id = false ) {
2295
+    public function get_form_items($id = false) {
2296 2296
         
2297
-        if ( empty( $id ) ) {
2298
-            return wpinv_get_data( 'sample-payment-form-items' );
2297
+        if (empty($id)) {
2298
+            return wpinv_get_data('sample-payment-form-items');
2299 2299
         }
2300 2300
         
2301
-        $form_elements = get_post_meta( $id, 'wpinv_form_items', true );
2301
+        $form_elements = get_post_meta($id, 'wpinv_form_items', true);
2302 2302
 
2303
-        if ( is_array( $form_elements ) ) {
2303
+        if (is_array($form_elements)) {
2304 2304
             return $form_elements;
2305 2305
         }
2306 2306
 
2307
-        return wpinv_get_data( 'sample-payment-form-items' );
2307
+        return wpinv_get_data('sample-payment-form-items');
2308 2308
 
2309 2309
     }
2310 2310
 
2311 2311
     /**
2312 2312
      * Returns an array of elements for the currently being edited form.
2313 2313
      */
2314
-    public function get_form_elements( $id = false ) {
2314
+    public function get_form_elements($id = false) {
2315 2315
 
2316
-        if ( empty( $id ) ) {
2317
-            return wpinv_get_data( 'sample-payment-form' );
2316
+        if (empty($id)) {
2317
+            return wpinv_get_data('sample-payment-form');
2318 2318
         }
2319 2319
         
2320
-        $form_elements = get_post_meta( $id, 'wpinv_form_elements', true );
2320
+        $form_elements = get_post_meta($id, 'wpinv_form_elements', true);
2321 2321
 
2322
-        if ( is_array( $form_elements ) ) {
2322
+        if (is_array($form_elements)) {
2323 2323
             return $form_elements;
2324 2324
         }
2325 2325
 
2326
-        return wpinv_get_data( 'sample-payment-form' );
2326
+        return wpinv_get_data('sample-payment-form');
2327 2327
     }
2328 2328
 
2329 2329
 }
Please login to merge, or discard this patch.