Passed
Push — master ( c6d0db...756836 )
by Brian
04:55 queued 28s
created
includes/wpinv-template-functions.php 1 patch
Spacing   +466 added lines, -466 removed lines patch added patch discarded remove patch
@@ -4,99 +4,99 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Displays an invoice.
11 11
  * 
12 12
  * @param WPInv_Invoice $invoice.
13 13
  */
14
-function getpaid_invoice( $invoice ) {
15
-    if ( ! empty( $invoice ) ) {
16
-        wpinv_get_template( 'invoice/invoice.php', compact( 'invoice' ) );
14
+function getpaid_invoice($invoice) {
15
+    if (!empty($invoice)) {
16
+        wpinv_get_template('invoice/invoice.php', compact('invoice'));
17 17
     }
18 18
 }
19
-add_action( 'getpaid_invoice', 'getpaid_invoice', 10 );
19
+add_action('getpaid_invoice', 'getpaid_invoice', 10);
20 20
 
21 21
 /**
22 22
  * Displays the invoice footer.
23 23
  */
24
-function getpaid_invoice_footer( $invoice ) {
25
-    if ( ! empty( $invoice ) ) {
26
-        wpinv_get_template( 'invoice/footer.php', compact( 'invoice' ) );
24
+function getpaid_invoice_footer($invoice) {
25
+    if (!empty($invoice)) {
26
+        wpinv_get_template('invoice/footer.php', compact('invoice'));
27 27
     }
28 28
 }
29
-add_action( 'getpaid_invoice_footer', 'getpaid_invoice_footer', 10 );
29
+add_action('getpaid_invoice_footer', 'getpaid_invoice_footer', 10);
30 30
 
31 31
 /**
32 32
  * Displays the invoice top bar.
33 33
  */
34
-function getpaid_invoice_header( $invoice ) {
35
-    if ( ! empty( $invoice ) ) {
36
-        wpinv_get_template( 'invoice/header.php', compact( 'invoice' ) );
34
+function getpaid_invoice_header($invoice) {
35
+    if (!empty($invoice)) {
36
+        wpinv_get_template('invoice/header.php', compact('invoice'));
37 37
     }
38 38
 }
39
-add_action( 'getpaid_invoice_header', 'getpaid_invoice_header', 10 );
39
+add_action('getpaid_invoice_header', 'getpaid_invoice_header', 10);
40 40
 
41 41
 /**
42 42
  * Displays actions on the left side of the header.
43 43
  */
44
-function getpaid_invoice_header_left_actions( $invoice ) {
45
-    if ( ! empty( $invoice ) ) {
46
-        wpinv_get_template( 'invoice/header-left-actions.php', compact( 'invoice' ) );
44
+function getpaid_invoice_header_left_actions($invoice) {
45
+    if (!empty($invoice)) {
46
+        wpinv_get_template('invoice/header-left-actions.php', compact('invoice'));
47 47
     }
48 48
 }
49
-add_action( 'getpaid_invoice_header_left', 'getpaid_invoice_header_left_actions', 10 );
49
+add_action('getpaid_invoice_header_left', 'getpaid_invoice_header_left_actions', 10);
50 50
 
51 51
 /**
52 52
  * Displays actions on the right side of the invoice top bar.
53 53
  */
54
-function getpaid_invoice_header_right_actions( $invoice ) {
55
-    if ( ! empty( $invoice ) ) {
56
-        wpinv_get_template( 'invoice/header-right-actions.php', compact( 'invoice' ) );
54
+function getpaid_invoice_header_right_actions($invoice) {
55
+    if (!empty($invoice)) {
56
+        wpinv_get_template('invoice/header-right-actions.php', compact('invoice'));
57 57
     }
58 58
 }
59
-add_action( 'getpaid_invoice_header_right', 'getpaid_invoice_header_right_actions', 10 );
59
+add_action('getpaid_invoice_header_right', 'getpaid_invoice_header_right_actions', 10);
60 60
 
61 61
 /**
62 62
  * Displays the invoice title, watermark, logo etc.
63 63
  */
64
-function getpaid_invoice_details_top( $invoice ) {
65
-    if ( ! empty( $invoice ) ) {
66
-        wpinv_get_template( 'invoice/details-top.php', compact( 'invoice' ) );
64
+function getpaid_invoice_details_top($invoice) {
65
+    if (!empty($invoice)) {
66
+        wpinv_get_template('invoice/details-top.php', compact('invoice'));
67 67
     }
68 68
 }
69
-add_action( 'getpaid_invoice_details', 'getpaid_invoice_details_top', 10 );
69
+add_action('getpaid_invoice_details', 'getpaid_invoice_details_top', 10);
70 70
 
71 71
 /**
72 72
  * Displays the company logo.
73 73
  */
74
-function getpaid_invoice_logo( $invoice ) {
75
-    if ( ! empty( $invoice ) ) {
76
-        wpinv_get_template( 'invoice/invoice-logo.php', compact( 'invoice' ) );
74
+function getpaid_invoice_logo($invoice) {
75
+    if (!empty($invoice)) {
76
+        wpinv_get_template('invoice/invoice-logo.php', compact('invoice'));
77 77
     }
78 78
 }
79
-add_action( 'getpaid_invoice_details_top_left', 'getpaid_invoice_logo' );
79
+add_action('getpaid_invoice_details_top_left', 'getpaid_invoice_logo');
80 80
 
81 81
 /**
82 82
  * Displays the type of invoice.
83 83
  */
84
-function getpaid_invoice_type( $invoice ) {
85
-    if ( ! empty( $invoice ) ) {
86
-        wpinv_get_template( 'invoice/invoice-type.php', compact( 'invoice' ) );
84
+function getpaid_invoice_type($invoice) {
85
+    if (!empty($invoice)) {
86
+        wpinv_get_template('invoice/invoice-type.php', compact('invoice'));
87 87
     }
88 88
 }
89
-add_action( 'getpaid_invoice_details_top_right', 'getpaid_invoice_type' );
89
+add_action('getpaid_invoice_details_top_right', 'getpaid_invoice_type');
90 90
 
91 91
 /**
92 92
  * Displays the invoice details.
93 93
  */
94
-function getpaid_invoice_details_main( $invoice ) {
95
-    if ( ! empty( $invoice ) ) {
96
-        wpinv_get_template( 'invoice/details.php', compact( 'invoice' ) );
94
+function getpaid_invoice_details_main($invoice) {
95
+    if (!empty($invoice)) {
96
+        wpinv_get_template('invoice/details.php', compact('invoice'));
97 97
     }
98 98
 }
99
-add_action( 'getpaid_invoice_details', 'getpaid_invoice_details_main', 50 );
99
+add_action('getpaid_invoice_details', 'getpaid_invoice_details_main', 50);
100 100
 
101 101
 /**
102 102
  * Returns a path to the templates directory.
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
  * @param string $template_path The templates directory relative to the theme's root dir. Defaults to 'invoicing'.
126 126
  * @param string $default_path The root path to the default template. Defaults to invoicing/templates
127 127
  */
128
-function wpinv_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
129
-    return getpaid_template()->display_template( $template_name, $args, $template_path, $default_path );
128
+function wpinv_get_template($template_name, $args = array(), $template_path = '', $default_path = '') {
129
+    return getpaid_template()->display_template($template_name, $args, $template_path, $default_path);
130 130
 }
131 131
 
132 132
 /**
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
  * @param string $template_path The templates directory relative to the theme's root dir. Defaults to 'invoicing'.
140 140
  * @param string $default_path The root path to the default template. Defaults to invoicing/templates
141 141
  */
142
-function wpinv_get_template_html( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
143
-	return getpaid_template()->get_template( $template_name, $args, $template_path, $default_path );
142
+function wpinv_get_template_html($template_name, $args = array(), $template_path = '', $default_path = '') {
143
+	return getpaid_template()->get_template($template_name, $args, $template_path, $default_path);
144 144
 }
145 145
 
146 146
 /**
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
  * @return string
150 150
  */
151 151
 function wpinv_template_path() {
152
-    return apply_filters( 'wpinv_template_path', wpinv_get_theme_template_dir_name() );
152
+    return apply_filters('wpinv_template_path', wpinv_get_theme_template_dir_name());
153 153
 }
154 154
 
155 155
 /**
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
  * @return string
159 159
  */
160 160
 function wpinv_get_theme_template_dir_name() {
161
-	return trailingslashit( apply_filters( 'wpinv_templates_dir', 'invoicing' ) );
161
+	return trailingslashit(apply_filters('wpinv_templates_dir', 'invoicing'));
162 162
 }
163 163
 
164 164
 /**
@@ -170,56 +170,56 @@  discard block
 block discarded – undo
170 170
  * @param string $template_path The template path relative to the theme's root dir. Defaults to 'invoicing'.
171 171
  * @param string $default_path The root path to the default template. Defaults to invoicing/templates
172 172
  */
173
-function wpinv_locate_template( $template_name, $template_path = '', $default_path = '' ) {
174
-    return getpaid_template()->locate_template( $template_name, $template_path, $default_path );
173
+function wpinv_locate_template($template_name, $template_path = '', $default_path = '') {
174
+    return getpaid_template()->locate_template($template_name, $template_path, $default_path);
175 175
 }
176 176
 
177
-function wpinv_get_template_part( $slug, $name = null, $load = true ) {
178
-	do_action( 'get_template_part_' . $slug, $slug, $name );
177
+function wpinv_get_template_part($slug, $name = null, $load = true) {
178
+	do_action('get_template_part_' . $slug, $slug, $name);
179 179
 
180 180
 	// Setup possible parts
181 181
 	$templates = array();
182
-	if ( isset( $name ) )
182
+	if (isset($name))
183 183
 		$templates[] = $slug . '-' . $name . '.php';
184 184
 	$templates[] = $slug . '.php';
185 185
 
186 186
 	// Allow template parts to be filtered
187
-	$templates = apply_filters( 'wpinv_get_template_part', $templates, $slug, $name );
187
+	$templates = apply_filters('wpinv_get_template_part', $templates, $slug, $name);
188 188
 
189 189
 	// Return the part that is found
190
-	return wpinv_locate_tmpl( $templates, $load, false );
190
+	return wpinv_locate_tmpl($templates, $load, false);
191 191
 }
192 192
 
193
-function wpinv_locate_tmpl( $template_names, $load = false, $require_once = true ) {
193
+function wpinv_locate_tmpl($template_names, $load = false, $require_once = true) {
194 194
 	// No file found yet
195 195
 	$located = false;
196 196
 
197 197
 	// Try to find a template file
198
-	foreach ( (array)$template_names as $template_name ) {
198
+	foreach ((array) $template_names as $template_name) {
199 199
 
200 200
 		// Continue if template is empty
201
-		if ( empty( $template_name ) )
201
+		if (empty($template_name))
202 202
 			continue;
203 203
 
204 204
 		// Trim off any slashes from the template name
205
-		$template_name = ltrim( $template_name, '/' );
205
+		$template_name = ltrim($template_name, '/');
206 206
 
207 207
 		// try locating this template file by looping through the template paths
208
-		foreach( wpinv_get_theme_template_paths() as $template_path ) {
208
+		foreach (wpinv_get_theme_template_paths() as $template_path) {
209 209
 
210
-			if( file_exists( $template_path . $template_name ) ) {
210
+			if (file_exists($template_path . $template_name)) {
211 211
 				$located = $template_path . $template_name;
212 212
 				break;
213 213
 			}
214 214
 		}
215 215
 
216
-		if( !empty( $located ) ) {
216
+		if (!empty($located)) {
217 217
 			break;
218 218
 		}
219 219
 	}
220 220
 
221
-	if ( ( true == $load ) && ! empty( $located ) )
222
-		load_template( $located, $require_once );
221
+	if ((true == $load) && !empty($located))
222
+		load_template($located, $require_once);
223 223
 
224 224
 	return $located;
225 225
 }
@@ -228,155 +228,155 @@  discard block
 block discarded – undo
228 228
 	$template_dir = wpinv_get_theme_template_dir_name();
229 229
 
230 230
 	$file_paths = array(
231
-		1 => trailingslashit( get_stylesheet_directory() ) . $template_dir,
232
-		10 => trailingslashit( get_template_directory() ) . $template_dir,
231
+		1 => trailingslashit(get_stylesheet_directory()) . $template_dir,
232
+		10 => trailingslashit(get_template_directory()) . $template_dir,
233 233
 		100 => wpinv_get_templates_dir()
234 234
 	);
235 235
 
236
-	$file_paths = apply_filters( 'wpinv_template_paths', $file_paths );
236
+	$file_paths = apply_filters('wpinv_template_paths', $file_paths);
237 237
 
238 238
 	// sort the file paths based on priority
239
-	ksort( $file_paths, SORT_NUMERIC );
239
+	ksort($file_paths, SORT_NUMERIC);
240 240
 
241
-	return array_map( 'trailingslashit', $file_paths );
241
+	return array_map('trailingslashit', $file_paths);
242 242
 }
243 243
 
244 244
 function wpinv_checkout_meta_tags() {
245 245
 
246 246
 	$pages   = array();
247
-	$pages[] = wpinv_get_option( 'success_page' );
248
-	$pages[] = wpinv_get_option( 'failure_page' );
249
-	$pages[] = wpinv_get_option( 'invoice_history_page' );
250
-	$pages[] = wpinv_get_option( 'invoice_subscription_page' );
247
+	$pages[] = wpinv_get_option('success_page');
248
+	$pages[] = wpinv_get_option('failure_page');
249
+	$pages[] = wpinv_get_option('invoice_history_page');
250
+	$pages[] = wpinv_get_option('invoice_subscription_page');
251 251
 
252
-	if( !wpinv_is_checkout() && !is_page( $pages ) ) {
252
+	if (!wpinv_is_checkout() && !is_page($pages)) {
253 253
 		return;
254 254
 	}
255 255
 
256 256
 	echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
257 257
 }
258
-add_action( 'wp_head', 'wpinv_checkout_meta_tags' );
258
+add_action('wp_head', 'wpinv_checkout_meta_tags');
259 259
 
260
-function wpinv_add_body_classes( $class ) {
261
-	$classes = (array)$class;
260
+function wpinv_add_body_classes($class) {
261
+	$classes = (array) $class;
262 262
 
263
-	if( wpinv_is_checkout() ) {
263
+	if (wpinv_is_checkout()) {
264 264
 		$classes[] = 'wpinv-checkout';
265 265
 		$classes[] = 'wpinv-page';
266 266
 	}
267 267
 
268
-	if( wpinv_is_success_page() ) {
268
+	if (wpinv_is_success_page()) {
269 269
 		$classes[] = 'wpinv-success';
270 270
 		$classes[] = 'wpinv-page';
271 271
 	}
272 272
 
273
-	if( wpinv_is_failed_transaction_page() ) {
273
+	if (wpinv_is_failed_transaction_page()) {
274 274
 		$classes[] = 'wpinv-failed-transaction';
275 275
 		$classes[] = 'wpinv-page';
276 276
 	}
277 277
 
278
-	if( wpinv_is_invoice_history_page() ) {
278
+	if (wpinv_is_invoice_history_page()) {
279 279
 		$classes[] = 'wpinv-history';
280 280
 		$classes[] = 'wpinv-page';
281 281
 	}
282 282
 
283
-	if( wpinv_is_subscriptions_history_page() ) {
283
+	if (wpinv_is_subscriptions_history_page()) {
284 284
 		$classes[] = 'wpinv-subscription';
285 285
 		$classes[] = 'wpinv-page';
286 286
 	}
287 287
 
288
-	if( wpinv_is_test_mode() ) {
288
+	if (wpinv_is_test_mode()) {
289 289
 		$classes[] = 'wpinv-test-mode';
290 290
 		$classes[] = 'wpinv-page';
291 291
 	}
292 292
 
293
-	return array_unique( $classes );
293
+	return array_unique($classes);
294 294
 }
295
-add_filter( 'body_class', 'wpinv_add_body_classes' );
295
+add_filter('body_class', 'wpinv_add_body_classes');
296 296
 
297
-function wpinv_html_dropdown( $name = 'wpinv_discounts', $selected = 0, $status = '' ) {
298
-    $args = array( 'nopaging' => true );
297
+function wpinv_html_dropdown($name = 'wpinv_discounts', $selected = 0, $status = '') {
298
+    $args = array('nopaging' => true);
299 299
 
300
-    if ( ! empty( $status ) )
300
+    if (!empty($status))
301 301
         $args['post_status'] = $status;
302 302
 
303
-    $discounts = wpinv_get_discounts( $args );
303
+    $discounts = wpinv_get_discounts($args);
304 304
     $options   = array();
305 305
 
306
-    if ( $discounts ) {
307
-        foreach ( $discounts as $discount ) {
308
-            $options[ absint( $discount->ID ) ] = esc_html( get_the_title( $discount->ID ) );
306
+    if ($discounts) {
307
+        foreach ($discounts as $discount) {
308
+            $options[absint($discount->ID)] = esc_html(get_the_title($discount->ID));
309 309
         }
310 310
     } else {
311
-        $options[0] = __( 'No discounts found', 'invoicing' );
311
+        $options[0] = __('No discounts found', 'invoicing');
312 312
     }
313 313
 
314
-    $output = wpinv_html_select( array(
314
+    $output = wpinv_html_select(array(
315 315
         'name'             => $name,
316 316
         'selected'         => $selected,
317 317
         'options'          => $options,
318 318
         'show_option_all'  => false,
319 319
         'show_option_none' => false,
320
-    ) );
320
+    ));
321 321
 
322 322
     return $output;
323 323
 }
324 324
 
325
-function wpinv_html_year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
326
-    $current     = date( 'Y' );
327
-    $start_year  = $current - absint( $years_before );
328
-    $end_year    = $current + absint( $years_after );
329
-    $selected    = empty( $selected ) ? date( 'Y' ) : $selected;
325
+function wpinv_html_year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
326
+    $current     = date('Y');
327
+    $start_year  = $current - absint($years_before);
328
+    $end_year    = $current + absint($years_after);
329
+    $selected    = empty($selected) ? date('Y') : $selected;
330 330
     $options     = array();
331 331
 
332
-    while ( $start_year <= $end_year ) {
333
-        $options[ absint( $start_year ) ] = $start_year;
332
+    while ($start_year <= $end_year) {
333
+        $options[absint($start_year)] = $start_year;
334 334
         $start_year++;
335 335
     }
336 336
 
337
-    $output = wpinv_html_select( array(
337
+    $output = wpinv_html_select(array(
338 338
         'name'             => $name,
339 339
         'selected'         => $selected,
340 340
         'options'          => $options,
341 341
         'show_option_all'  => false,
342 342
         'show_option_none' => false
343
-    ) );
343
+    ));
344 344
 
345 345
     return $output;
346 346
 }
347 347
 
348
-function wpinv_html_month_dropdown( $name = 'month', $selected = 0 ) {
348
+function wpinv_html_month_dropdown($name = 'month', $selected = 0) {
349 349
 
350 350
     $options = array(
351
-        '1'  => __( 'January', 'invoicing' ),
352
-        '2'  => __( 'February', 'invoicing' ),
353
-        '3'  => __( 'March', 'invoicing' ),
354
-        '4'  => __( 'April', 'invoicing' ),
355
-        '5'  => __( 'May', 'invoicing' ),
356
-        '6'  => __( 'June', 'invoicing' ),
357
-        '7'  => __( 'July', 'invoicing' ),
358
-        '8'  => __( 'August', 'invoicing' ),
359
-        '9'  => __( 'September', 'invoicing' ),
360
-        '10' => __( 'October', 'invoicing' ),
361
-        '11' => __( 'November', 'invoicing' ),
362
-        '12' => __( 'December', 'invoicing' ),
351
+        '1'  => __('January', 'invoicing'),
352
+        '2'  => __('February', 'invoicing'),
353
+        '3'  => __('March', 'invoicing'),
354
+        '4'  => __('April', 'invoicing'),
355
+        '5'  => __('May', 'invoicing'),
356
+        '6'  => __('June', 'invoicing'),
357
+        '7'  => __('July', 'invoicing'),
358
+        '8'  => __('August', 'invoicing'),
359
+        '9'  => __('September', 'invoicing'),
360
+        '10' => __('October', 'invoicing'),
361
+        '11' => __('November', 'invoicing'),
362
+        '12' => __('December', 'invoicing'),
363 363
     );
364 364
 
365 365
     // If no month is selected, default to the current month
366
-    $selected = empty( $selected ) ? date( 'n' ) : $selected;
366
+    $selected = empty($selected) ? date('n') : $selected;
367 367
 
368
-    $output = wpinv_html_select( array(
368
+    $output = wpinv_html_select(array(
369 369
         'name'             => $name,
370 370
         'selected'         => $selected,
371 371
         'options'          => $options,
372 372
         'show_option_all'  => false,
373 373
         'show_option_none' => false
374
-    ) );
374
+    ));
375 375
 
376 376
     return $output;
377 377
 }
378 378
 
379
-function wpinv_html_select( $args = array() ) {
379
+function wpinv_html_select($args = array()) {
380 380
     $defaults = array(
381 381
         'options'          => array(),
382 382
         'name'             => null,
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
         'selected'         => 0,
386 386
         'placeholder'      => null,
387 387
         'multiple'         => false,
388
-        'show_option_all'  => _x( 'All', 'all dropdown items', 'invoicing' ),
389
-        'show_option_none' => _x( 'None', 'no dropdown items', 'invoicing' ),
388
+        'show_option_all'  => _x('All', 'all dropdown items', 'invoicing'),
389
+        'show_option_none' => _x('None', 'no dropdown items', 'invoicing'),
390 390
         'data'             => array(),
391 391
         'onchange'         => null,
392 392
         'required'         => false,
@@ -394,74 +394,74 @@  discard block
 block discarded – undo
394 394
         'readonly'         => false,
395 395
     );
396 396
 
397
-    $args = wp_parse_args( $args, $defaults );
397
+    $args = wp_parse_args($args, $defaults);
398 398
 
399 399
     $data_elements = '';
400
-    foreach ( $args['data'] as $key => $value ) {
401
-        $data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
400
+    foreach ($args['data'] as $key => $value) {
401
+        $data_elements .= ' data-' . esc_attr($key) . '="' . esc_attr($value) . '"';
402 402
     }
403 403
 
404
-    if( $args['multiple'] ) {
404
+    if ($args['multiple']) {
405 405
         $multiple = ' MULTIPLE';
406 406
     } else {
407 407
         $multiple = '';
408 408
     }
409 409
 
410
-    if( $args['placeholder'] ) {
410
+    if ($args['placeholder']) {
411 411
         $placeholder = $args['placeholder'];
412 412
     } else {
413 413
         $placeholder = '';
414 414
     }
415 415
     
416 416
     $options = '';
417
-    if( !empty( $args['onchange'] ) ) {
418
-        $options .= ' onchange="' . esc_attr( $args['onchange'] ) . '"';
417
+    if (!empty($args['onchange'])) {
418
+        $options .= ' onchange="' . esc_attr($args['onchange']) . '"';
419 419
     }
420 420
     
421
-    if( !empty( $args['required'] ) ) {
421
+    if (!empty($args['required'])) {
422 422
         $options .= ' required="required"';
423 423
     }
424 424
     
425
-    if( !empty( $args['disabled'] ) ) {
425
+    if (!empty($args['disabled'])) {
426 426
         $options .= ' disabled';
427 427
     }
428 428
     
429
-    if( !empty( $args['readonly'] ) ) {
429
+    if (!empty($args['readonly'])) {
430 430
         $options .= ' readonly';
431 431
     }
432 432
 
433
-    $class  = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
434
-    $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['id'] ) . '" class="wpinv-select ' . $class . '"' . $multiple . ' data-placeholder="' . $placeholder . '" ' . trim( $options ) . $data_elements . '>';
433
+    $class  = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
434
+    $output = '<select name="' . esc_attr($args['name']) . '" id="' . esc_attr($args['id']) . '" class="wpinv-select ' . $class . '"' . $multiple . ' data-placeholder="' . $placeholder . '" ' . trim($options) . $data_elements . '>';
435 435
 
436
-    if ( $args['show_option_all'] ) {
437
-        if( $args['multiple'] ) {
438
-            $selected = selected( true, in_array( 0, $args['selected'] ), false );
436
+    if ($args['show_option_all']) {
437
+        if ($args['multiple']) {
438
+            $selected = selected(true, in_array(0, $args['selected']), false);
439 439
         } else {
440
-            $selected = selected( $args['selected'], 0, false );
440
+            $selected = selected($args['selected'], 0, false);
441 441
         }
442
-        $output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
442
+        $output .= '<option value="all"' . $selected . '>' . esc_html($args['show_option_all']) . '</option>';
443 443
     }
444 444
 
445
-    if ( !empty( $args['options'] ) ) {
445
+    if (!empty($args['options'])) {
446 446
 
447
-        if ( $args['show_option_none'] ) {
448
-            if( $args['multiple'] ) {
449
-                $selected = selected( true, in_array( "", $args['selected'] ), false );
447
+        if ($args['show_option_none']) {
448
+            if ($args['multiple']) {
449
+                $selected = selected(true, in_array("", $args['selected']), false);
450 450
             } else {
451
-                $selected = selected( $args['selected'] === "", true, false );
451
+                $selected = selected($args['selected'] === "", true, false);
452 452
             }
453
-            $output .= '<option value=""' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
453
+            $output .= '<option value=""' . $selected . '>' . esc_html($args['show_option_none']) . '</option>';
454 454
         }
455 455
 
456
-        foreach( $args['options'] as $key => $option ) {
456
+        foreach ($args['options'] as $key => $option) {
457 457
 
458
-            if( $args['multiple'] && is_array( $args['selected'] ) ) {
459
-                $selected = selected( true, (bool)in_array( $key, $args['selected'] ), false );
458
+            if ($args['multiple'] && is_array($args['selected'])) {
459
+                $selected = selected(true, (bool) in_array($key, $args['selected']), false);
460 460
             } else {
461
-                $selected = selected( $args['selected'], $key, false );
461
+                $selected = selected($args['selected'], $key, false);
462 462
             }
463 463
 
464
-            $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
464
+            $output .= '<option value="' . esc_attr($key) . '"' . $selected . '>' . esc_html($option) . '</option>';
465 465
         }
466 466
     }
467 467
 
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
     return $output;
471 471
 }
472 472
 
473
-function wpinv_item_dropdown( $args = array() ) {
473
+function wpinv_item_dropdown($args = array()) {
474 474
     $defaults = array(
475 475
         'name'              => 'wpi_item',
476 476
         'id'                => 'wpi_item',
@@ -478,14 +478,14 @@  discard block
 block discarded – undo
478 478
         'multiple'          => false,
479 479
         'selected'          => 0,
480 480
         'number'            => 100,
481
-        'placeholder'       => __( 'Choose a item', 'invoicing' ),
482
-        'data'              => array( 'search-type' => 'item' ),
481
+        'placeholder'       => __('Choose a item', 'invoicing'),
482
+        'data'              => array('search-type' => 'item'),
483 483
         'show_option_all'   => false,
484 484
         'show_option_none'  => false,
485 485
         'show_recurring'    => false,
486 486
     );
487 487
 
488
-    $args = wp_parse_args( $args, $defaults );
488
+    $args = wp_parse_args($args, $defaults);
489 489
 
490 490
     $item_args = array(
491 491
         'post_type'      => 'wpi_item',
@@ -494,44 +494,44 @@  discard block
 block discarded – undo
494 494
         'posts_per_page' => $args['number']
495 495
     );
496 496
 
497
-    $item_args  = apply_filters( 'wpinv_item_dropdown_query_args', $item_args, $args, $defaults );
497
+    $item_args  = apply_filters('wpinv_item_dropdown_query_args', $item_args, $args, $defaults);
498 498
 
499
-    $items      = get_posts( $item_args );
499
+    $items      = get_posts($item_args);
500 500
     $options    = array();
501
-    if ( $items ) {
502
-        foreach ( $items as $item ) {
503
-            $title = esc_html( $item->post_title );
501
+    if ($items) {
502
+        foreach ($items as $item) {
503
+            $title = esc_html($item->post_title);
504 504
             
505
-            if ( !empty( $args['show_recurring'] ) ) {
506
-                $title .= wpinv_get_item_suffix( $item->ID, false );
505
+            if (!empty($args['show_recurring'])) {
506
+                $title .= wpinv_get_item_suffix($item->ID, false);
507 507
             }
508 508
             
509
-            $options[ absint( $item->ID ) ] = $title;
509
+            $options[absint($item->ID)] = $title;
510 510
         }
511 511
     }
512 512
 
513 513
     // This ensures that any selected items are included in the drop down
514
-    if( is_array( $args['selected'] ) ) {
515
-        foreach( $args['selected'] as $item ) {
516
-            if( ! in_array( $item, $options ) ) {
517
-                $title = get_the_title( $item );
518
-                if ( !empty( $args['show_recurring'] ) ) {
519
-                    $title .= wpinv_get_item_suffix( $item, false );
514
+    if (is_array($args['selected'])) {
515
+        foreach ($args['selected'] as $item) {
516
+            if (!in_array($item, $options)) {
517
+                $title = get_the_title($item);
518
+                if (!empty($args['show_recurring'])) {
519
+                    $title .= wpinv_get_item_suffix($item, false);
520 520
                 }
521 521
                 $options[$item] = $title;
522 522
             }
523 523
         }
524
-    } elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) {
525
-        if ( ! in_array( $args['selected'], $options ) ) {
526
-            $title = get_the_title( $args['selected'] );
527
-            if ( !empty( $args['show_recurring'] ) ) {
528
-                $title .= wpinv_get_item_suffix( $args['selected'], false );
524
+    } elseif (is_numeric($args['selected']) && $args['selected'] !== 0) {
525
+        if (!in_array($args['selected'], $options)) {
526
+            $title = get_the_title($args['selected']);
527
+            if (!empty($args['show_recurring'])) {
528
+                $title .= wpinv_get_item_suffix($args['selected'], false);
529 529
             }
530
-            $options[$args['selected']] = get_the_title( $args['selected'] );
530
+            $options[$args['selected']] = get_the_title($args['selected']);
531 531
         }
532 532
     }
533 533
 
534
-    $output = wpinv_html_select( array(
534
+    $output = wpinv_html_select(array(
535 535
         'name'             => $args['name'],
536 536
         'selected'         => $args['selected'],
537 537
         'id'               => $args['id'],
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
         'show_option_all'  => $args['show_option_all'],
543 543
         'show_option_none' => $args['show_option_none'],
544 544
         'data'             => $args['data'],
545
-    ) );
545
+    ));
546 546
 
547 547
     return $output;
548 548
 }
@@ -562,16 +562,16 @@  discard block
 block discarded – undo
562 562
     );
563 563
 
564 564
     $options = array();
565
-    if ( $items ) {
566
-        foreach ( $items as $item ) {
567
-            $options[ $item->ID ] = esc_html( $item->post_title ) . wpinv_get_item_suffix( $item->ID, false );
565
+    if ($items) {
566
+        foreach ($items as $item) {
567
+            $options[$item->ID] = esc_html($item->post_title) . wpinv_get_item_suffix($item->ID, false);
568 568
         }
569 569
     }
570 570
 
571 571
     return $options;
572 572
 }
573 573
 
574
-function wpinv_html_checkbox( $args = array() ) {
574
+function wpinv_html_checkbox($args = array()) {
575 575
     $defaults = array(
576 576
         'name'     => null,
577 577
         'current'  => null,
@@ -582,17 +582,17 @@  discard block
 block discarded – undo
582 582
         )
583 583
     );
584 584
 
585
-    $args = wp_parse_args( $args, $defaults );
585
+    $args = wp_parse_args($args, $defaults);
586 586
 
587
-    $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
587
+    $class = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
588 588
     $options = '';
589
-    if ( ! empty( $args['options']['disabled'] ) ) {
589
+    if (!empty($args['options']['disabled'])) {
590 590
         $options .= ' disabled="disabled"';
591
-    } elseif ( ! empty( $args['options']['readonly'] ) ) {
591
+    } elseif (!empty($args['options']['readonly'])) {
592 592
         $options .= ' readonly';
593 593
     }
594 594
 
595
-    $output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $class . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
595
+    $output = '<input type="checkbox"' . $options . ' name="' . esc_attr($args['name']) . '" id="' . esc_attr($args['name']) . '" class="' . $class . ' ' . esc_attr($args['name']) . '" ' . checked(1, $args['current'], false) . ' />';
596 596
 
597 597
     return $output;
598 598
 }
@@ -600,30 +600,30 @@  discard block
 block discarded – undo
600 600
 /**
601 601
  * Displays a hidden field.
602 602
  */
603
-function getpaid_hidden_field( $name, $value ) {
604
-    $name  = sanitize_text_field( $name );
605
-    $value = esc_attr( $value );
603
+function getpaid_hidden_field($name, $value) {
604
+    $name  = sanitize_text_field($name);
605
+    $value = esc_attr($value);
606 606
 
607 607
     echo "<input type='hidden' name='$name' value='$value' />";
608 608
 }
609 609
 
610
-function wpinv_html_text( $args = array() ) {
610
+function wpinv_html_text($args = array()) {
611 611
     // Backwards compatibility
612
-    if ( func_num_args() > 1 ) {
612
+    if (func_num_args() > 1) {
613 613
         $args = func_get_args();
614 614
 
615 615
         $name  = $args[0];
616
-        $value = isset( $args[1] ) ? $args[1] : '';
617
-        $label = isset( $args[2] ) ? $args[2] : '';
618
-        $desc  = isset( $args[3] ) ? $args[3] : '';
616
+        $value = isset($args[1]) ? $args[1] : '';
617
+        $label = isset($args[2]) ? $args[2] : '';
618
+        $desc  = isset($args[3]) ? $args[3] : '';
619 619
     }
620 620
 
621 621
     $defaults = array(
622 622
         'id'           => '',
623
-        'name'         => isset( $name )  ? $name  : 'text',
624
-        'value'        => isset( $value ) ? $value : null,
625
-        'label'        => isset( $label ) ? $label : null,
626
-        'desc'         => isset( $desc )  ? $desc  : null,
623
+        'name'         => isset($name) ? $name : 'text',
624
+        'value'        => isset($value) ? $value : null,
625
+        'label'        => isset($label) ? $label : null,
626
+        'desc'         => isset($desc) ? $desc : null,
627 627
         'placeholder'  => '',
628 628
         'class'        => 'regular-text',
629 629
         'disabled'     => false,
@@ -633,51 +633,51 @@  discard block
 block discarded – undo
633 633
         'data'         => false
634 634
     );
635 635
 
636
-    $args = wp_parse_args( $args, $defaults );
636
+    $args = wp_parse_args($args, $defaults);
637 637
 
638
-    $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
638
+    $class = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
639 639
     $options = '';
640
-    if( $args['required'] ) {
640
+    if ($args['required']) {
641 641
         $options .= ' required="required"';
642 642
     }
643
-    if( $args['readonly'] ) {
643
+    if ($args['readonly']) {
644 644
         $options .= ' readonly';
645 645
     }
646
-    if( $args['readonly'] ) {
646
+    if ($args['readonly']) {
647 647
         $options .= ' readonly';
648 648
     }
649 649
 
650 650
     $data = '';
651
-    if ( !empty( $args['data'] ) ) {
652
-        foreach ( $args['data'] as $key => $value ) {
653
-            $data .= 'data-' . wpinv_sanitize_key( $key ) . '="' . esc_attr( $value ) . '" ';
651
+    if (!empty($args['data'])) {
652
+        foreach ($args['data'] as $key => $value) {
653
+            $data .= 'data-' . wpinv_sanitize_key($key) . '="' . esc_attr($value) . '" ';
654 654
         }
655 655
     }
656 656
 
657
-    $output = '<span id="wpinv-' . wpinv_sanitize_key( $args['name'] ) . '-wrap">';
658
-    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key( $args['id'] ) . '">' . esc_html( $args['label'] ) . '</label>';
659
-    if ( ! empty( $args['desc'] ) ) {
660
-        $output .= '<span class="wpinv-description">' . esc_html( $args['desc'] ) . '</span>';
657
+    $output = '<span id="wpinv-' . wpinv_sanitize_key($args['name']) . '-wrap">';
658
+    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key($args['id']) . '">' . esc_html($args['label']) . '</label>';
659
+    if (!empty($args['desc'])) {
660
+        $output .= '<span class="wpinv-description">' . esc_html($args['desc']) . '</span>';
661 661
     }
662 662
 
663
-    $output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['id'] )  . '" autocomplete="' . esc_attr( $args['autocomplete'] )  . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $class . '" ' . $data . ' ' . trim( $options ) . '/>';
663
+    $output .= '<input type="text" name="' . esc_attr($args['name']) . '" id="' . esc_attr($args['id']) . '" autocomplete="' . esc_attr($args['autocomplete']) . '" value="' . esc_attr($args['value']) . '" placeholder="' . esc_attr($args['placeholder']) . '" class="' . $class . '" ' . $data . ' ' . trim($options) . '/>';
664 664
 
665 665
     $output .= '</span>';
666 666
 
667 667
     return $output;
668 668
 }
669 669
 
670
-function wpinv_html_date_field( $args = array() ) {
671
-    if( empty( $args['class'] ) ) {
670
+function wpinv_html_date_field($args = array()) {
671
+    if (empty($args['class'])) {
672 672
         $args['class'] = 'wpiDatepicker';
673
-    } elseif( ! strpos( $args['class'], 'wpiDatepicker' ) ) {
673
+    } elseif (!strpos($args['class'], 'wpiDatepicker')) {
674 674
         $args['class'] .= ' wpiDatepicker';
675 675
     }
676 676
 
677
-    return wpinv_html_text( $args );
677
+    return wpinv_html_text($args);
678 678
 }
679 679
 
680
-function wpinv_html_textarea( $args = array() ) {
680
+function wpinv_html_textarea($args = array()) {
681 681
     $defaults = array(
682 682
         'name'        => 'textarea',
683 683
         'value'       => null,
@@ -688,31 +688,31 @@  discard block
 block discarded – undo
688 688
         'placeholder' => '',
689 689
     );
690 690
 
691
-    $args = wp_parse_args( $args, $defaults );
691
+    $args = wp_parse_args($args, $defaults);
692 692
 
693
-    $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
693
+    $class = implode(' ', array_map('sanitize_html_class', explode(' ', $args['class'])));
694 694
     $disabled = '';
695
-    if( $args['disabled'] ) {
695
+    if ($args['disabled']) {
696 696
         $disabled = ' disabled="disabled"';
697 697
     }
698 698
 
699
-    $output = '<span id="wpinv-' . wpinv_sanitize_key( $args['name'] ) . '-wrap">';
700
-    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
701
-    $output .= '<textarea name="' . esc_attr( $args['name'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" id="' . wpinv_sanitize_key( $args['name'] ) . '" class="' . $class . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
699
+    $output = '<span id="wpinv-' . wpinv_sanitize_key($args['name']) . '-wrap">';
700
+    $output .= '<label class="wpinv-label" for="' . wpinv_sanitize_key($args['name']) . '">' . esc_html($args['label']) . '</label>';
701
+    $output .= '<textarea name="' . esc_attr($args['name']) . '" placeholder="' . esc_attr($args['placeholder']) . '" id="' . wpinv_sanitize_key($args['name']) . '" class="' . $class . '"' . $disabled . '>' . esc_attr($args['value']) . '</textarea>';
702 702
 
703
-    if ( ! empty( $args['desc'] ) ) {
704
-        $output .= '<span class="wpinv-description">' . esc_html( $args['desc'] ) . '</span>';
703
+    if (!empty($args['desc'])) {
704
+        $output .= '<span class="wpinv-description">' . esc_html($args['desc']) . '</span>';
705 705
     }
706 706
     $output .= '</span>';
707 707
 
708 708
     return $output;
709 709
 }
710 710
 
711
-function wpinv_html_ajax_user_search( $args = array() ) {
711
+function wpinv_html_ajax_user_search($args = array()) {
712 712
     $defaults = array(
713 713
         'name'        => 'user_id',
714 714
         'value'       => null,
715
-        'placeholder' => __( 'Enter username', 'invoicing' ),
715
+        'placeholder' => __('Enter username', 'invoicing'),
716 716
         'label'       => null,
717 717
         'desc'        => null,
718 718
         'class'       => '',
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
         'data'        => false
722 722
     );
723 723
 
724
-    $args = wp_parse_args( $args, $defaults );
724
+    $args = wp_parse_args($args, $defaults);
725 725
 
726 726
     $args['class'] = 'wpinv-ajax-user-search ' . $args['class'];
727 727
 
728 728
     $output  = '<span class="wpinv_user_search_wrap">';
729
-        $output .= wpinv_html_text( $args );
730
-        $output .= '<span class="wpinv_user_search_results hidden"><a class="wpinv-ajax-user-cancel" title="' . __( 'Cancel', 'invoicing' ) . '" aria-label="' . __( 'Cancel', 'invoicing' ) . '" href="#">x</a><span></span></span>';
729
+        $output .= wpinv_html_text($args);
730
+        $output .= '<span class="wpinv_user_search_results hidden"><a class="wpinv-ajax-user-cancel" title="' . __('Cancel', 'invoicing') . '" aria-label="' . __('Cancel', 'invoicing') . '" href="#">x</a><span></span></span>';
731 731
     $output .= '</span>';
732 732
 
733 733
     return $output;
@@ -743,20 +743,20 @@  discard block
 block discarded – undo
743 743
  * 
744 744
  * @param string $template the template that is currently being used.
745 745
  */
746
-function wpinv_template( $template ) {
746
+function wpinv_template($template) {
747 747
     global $post;
748 748
 
749
-    if ( ! is_admin() && ( is_single() || is_404() ) && ! empty( $post->ID ) && getpaid_is_invoice_post_type( get_post_type( $post->ID ) ) ) {
749
+    if (!is_admin() && (is_single() || is_404()) && !empty($post->ID) && getpaid_is_invoice_post_type(get_post_type($post->ID))) {
750 750
 
751 751
         // If the user can view this invoice, display it.
752
-        if ( wpinv_user_can_view_invoice( $post->ID ) ) {
752
+        if (wpinv_user_can_view_invoice($post->ID)) {
753 753
 
754
-            return wpinv_get_template_part( 'wpinv-invoice-print', false, false );
754
+            return wpinv_get_template_part('wpinv-invoice-print', false, false);
755 755
 
756 756
         // Else display an error message.
757 757
         } else {
758 758
 
759
-            return wpinv_get_template_part( 'wpinv-invalid-access', false, false );
759
+            return wpinv_get_template_part('wpinv-invalid-access', false, false);
760 760
 
761 761
         }
762 762
 
@@ -764,46 +764,46 @@  discard block
 block discarded – undo
764 764
 
765 765
     return $template;
766 766
 }
767
-add_filter( 'template_include', 'wpinv_template', 10, 1 );
767
+add_filter('template_include', 'wpinv_template', 10, 1);
768 768
 
769 769
 function wpinv_get_business_address() {
770 770
     $business_address   = wpinv_store_address();
771
-    $business_address   = !empty( $business_address ) ? wpautop( wp_kses_post( $business_address ) ) : '';
771
+    $business_address   = !empty($business_address) ? wpautop(wp_kses_post($business_address)) : '';
772 772
     
773 773
     $business_address = $business_address ? '<div class="address">' . $business_address . '</div>' : '';
774 774
     
775
-    return apply_filters( 'wpinv_get_business_address', $business_address );
775
+    return apply_filters('wpinv_get_business_address', $business_address);
776 776
 }
777 777
 
778 778
 /**
779 779
  * Displays the company address.
780 780
  */
781 781
 function wpinv_display_from_address() {
782
-    wpinv_get_template( 'invoice/company-address.php' );
782
+    wpinv_get_template('invoice/company-address.php');
783 783
 }
784
-add_action( 'getpaid_invoice_details_left', 'wpinv_display_from_address', 10 );
784
+add_action('getpaid_invoice_details_left', 'wpinv_display_from_address', 10);
785 785
 
786
-function wpinv_watermark( $id = 0 ) {
787
-    $output = wpinv_get_watermark( $id );
788
-    return apply_filters( 'wpinv_get_watermark', $output, $id );
786
+function wpinv_watermark($id = 0) {
787
+    $output = wpinv_get_watermark($id);
788
+    return apply_filters('wpinv_get_watermark', $output, $id);
789 789
 }
790 790
 
791
-function wpinv_get_watermark( $id ) {
792
-    if ( !$id > 0 ) {
791
+function wpinv_get_watermark($id) {
792
+    if (!$id > 0) {
793 793
         return NULL;
794 794
     }
795 795
 
796
-    $invoice = wpinv_get_invoice( $id );
796
+    $invoice = wpinv_get_invoice($id);
797 797
     
798
-    if ( !empty( $invoice ) && "wpi_invoice" === $invoice->post_type ) {
799
-        if ( $invoice->is_paid() ) {
800
-            return __( 'Paid', 'invoicing' );
798
+    if (!empty($invoice) && "wpi_invoice" === $invoice->post_type) {
799
+        if ($invoice->is_paid()) {
800
+            return __('Paid', 'invoicing');
801 801
         }
802
-        if ( $invoice->is_refunded() ) {
803
-            return __( 'Refunded', 'invoicing' );
802
+        if ($invoice->is_refunded()) {
803
+            return __('Refunded', 'invoicing');
804 804
         }
805
-        if ( $invoice->has_status( array( 'wpi-cancelled' ) ) ) {
806
-            return __( 'Cancelled', 'invoicing' );
805
+        if ($invoice->has_status(array('wpi-cancelled'))) {
806
+            return __('Cancelled', 'invoicing');
807 807
         }
808 808
     }
809 809
     
@@ -813,30 +813,30 @@  discard block
 block discarded – undo
813 813
 /**
814 814
  * @deprecated
815 815
  */
816
-function wpinv_display_invoice_details( $invoice ) {
817
-    return getpaid_invoice_meta( $invoice );
816
+function wpinv_display_invoice_details($invoice) {
817
+    return getpaid_invoice_meta($invoice);
818 818
 }
819 819
 
820 820
 /**
821 821
  * Displays invoice meta.
822 822
  */
823
-function getpaid_invoice_meta( $invoice ) {
823
+function getpaid_invoice_meta($invoice) {
824 824
 
825
-    $invoice = new WPInv_Invoice( $invoice );
825
+    $invoice = new WPInv_Invoice($invoice);
826 826
 
827 827
     // Ensure that we have an invoice.
828
-    if ( 0 == $invoice->get_id() ) {
828
+    if (0 == $invoice->get_id()) {
829 829
         return;
830 830
     }
831 831
 
832 832
     // Get the invoice meta.
833
-    $meta = getpaid_get_invoice_meta( $invoice );
833
+    $meta = getpaid_get_invoice_meta($invoice);
834 834
 
835 835
     // Display the meta.
836
-    wpinv_get_template( 'invoice/invoice-meta.php', compact( 'invoice', 'meta' ) );
836
+    wpinv_get_template('invoice/invoice-meta.php', compact('invoice', 'meta'));
837 837
 
838 838
 }
839
-add_action( 'getpaid_invoice_details_right', 'getpaid_invoice_meta', 10 );
839
+add_action('getpaid_invoice_details_right', 'getpaid_invoice_meta', 10);
840 840
 
841 841
 /**
842 842
  * Retrieves the address markup to use on Invoices.
@@ -848,29 +848,29 @@  discard block
 block discarded – undo
848 848
  * @param  string $separator How to separate address lines.
849 849
  * @return string
850 850
  */
851
-function wpinv_get_invoice_address_markup( $billing_details, $separator = '<br/>' ) {
851
+function wpinv_get_invoice_address_markup($billing_details, $separator = '<br/>') {
852 852
 
853 853
     // Retrieve the address markup...
854
-    $country= empty( $billing_details['country'] ) ? '' : $billing_details['country'];
855
-    $format = wpinv_get_full_address_format( $country );
854
+    $country = empty($billing_details['country']) ? '' : $billing_details['country'];
855
+    $format = wpinv_get_full_address_format($country);
856 856
 
857 857
     // ... and the replacements.
858
-    $replacements = wpinv_get_invoice_address_replacements( $billing_details );
858
+    $replacements = wpinv_get_invoice_address_replacements($billing_details);
859 859
 
860
-    $formatted_address = str_ireplace( array_keys( $replacements ), $replacements, $format );
860
+    $formatted_address = str_ireplace(array_keys($replacements), $replacements, $format);
861 861
     
862 862
 	// Remove unavailable tags.
863
-    $formatted_address = preg_replace( "/\{\{\w+\}\}/", '', $formatted_address );
863
+    $formatted_address = preg_replace("/\{\{\w+\}\}/", '', $formatted_address);
864 864
 
865 865
     // Clean up white space.
866
-	$formatted_address = preg_replace( '/  +/', ' ', trim( $formatted_address ) );
867
-    $formatted_address = preg_replace( '/\n\n+/', "\n", $formatted_address );
866
+	$formatted_address = preg_replace('/  +/', ' ', trim($formatted_address));
867
+    $formatted_address = preg_replace('/\n\n+/', "\n", $formatted_address);
868 868
     
869 869
     // Break newlines apart and remove empty lines/trim commas and white space.
870
-	$formatted_address = array_filter( array_map( 'wpinv_trim_formatted_address_line', explode( "\n", $formatted_address ) ) );
870
+	$formatted_address = array_filter(array_map('wpinv_trim_formatted_address_line', explode("\n", $formatted_address)));
871 871
 
872 872
     // Add html breaks.
873
-	$formatted_address = implode( $separator, $formatted_address );
873
+	$formatted_address = implode($separator, $formatted_address);
874 874
 
875 875
 	// We're done!
876 876
 	return $formatted_address;
@@ -882,88 +882,88 @@  discard block
 block discarded – undo
882 882
  * 
883 883
  * @param WPInv_Invoice $invoice
884 884
  */
885
-function wpinv_display_to_address( $invoice = 0 ) {
886
-    if ( ! empty( $invoice ) ) {
887
-        wpinv_get_template( 'invoice/billing-address.php', compact( 'invoice' ) );
885
+function wpinv_display_to_address($invoice = 0) {
886
+    if (!empty($invoice)) {
887
+        wpinv_get_template('invoice/billing-address.php', compact('invoice'));
888 888
     }
889 889
 }
890
-add_action( 'getpaid_invoice_details_left', 'wpinv_display_to_address', 40 );
890
+add_action('getpaid_invoice_details_left', 'wpinv_display_to_address', 40);
891 891
 
892 892
 
893 893
 /**
894 894
  * Displays invoice line items.
895 895
  */
896
-function wpinv_display_line_items( $invoice_id = 0 ) {
896
+function wpinv_display_line_items($invoice_id = 0) {
897 897
 
898 898
     // Prepare the invoice.
899
-    $invoice = new WPInv_Invoice( $invoice_id );
899
+    $invoice = new WPInv_Invoice($invoice_id);
900 900
 
901 901
     // Abort if there is no invoice.
902
-    if ( 0 == $invoice->get_id() ) {
902
+    if (0 == $invoice->get_id()) {
903 903
         return;
904 904
     }
905 905
 
906 906
     // Line item columns.
907
-    $columns = getpaid_invoice_item_columns( $invoice );
908
-    $columns = apply_filters( 'getpaid_invoice_line_items_table_columns', $columns, $invoice );
907
+    $columns = getpaid_invoice_item_columns($invoice);
908
+    $columns = apply_filters('getpaid_invoice_line_items_table_columns', $columns, $invoice);
909 909
 
910
-    wpinv_get_template( 'invoice/line-items.php', compact( 'invoice', 'columns' ) );
910
+    wpinv_get_template('invoice/line-items.php', compact('invoice', 'columns'));
911 911
 }
912
-add_action( 'getpaid_invoice_line_items', 'wpinv_display_line_items', 10 );
912
+add_action('getpaid_invoice_line_items', 'wpinv_display_line_items', 10);
913 913
 
914 914
 /**
915 915
  * Displays invoice notices on invoices.
916 916
  */
917 917
 function wpinv_display_invoice_notice() {
918 918
 
919
-    $label  = wpinv_get_option( 'vat_invoice_notice_label' );
920
-    $notice = wpinv_get_option( 'vat_invoice_notice' );
919
+    $label  = wpinv_get_option('vat_invoice_notice_label');
920
+    $notice = wpinv_get_option('vat_invoice_notice');
921 921
 
922
-    if ( empty( $label ) && empty( $notice ) ) {
922
+    if (empty($label) && empty($notice)) {
923 923
         return;
924 924
     }
925 925
 
926 926
     echo '<div class="mt-4 mb-4 wpinv-vat-notice">';
927 927
 
928
-    if ( ! empty( $label ) ) {
929
-        $label = sanitize_text_field( $label );
928
+    if (!empty($label)) {
929
+        $label = sanitize_text_field($label);
930 930
         echo "<h5>$label</h5>";
931 931
     }
932 932
 
933
-    if ( ! empty( $notice ) ) {
934
-        echo '<small class="form-text text-muted">' . wpautop( wptexturize( $notice ) ) . '</small>';
933
+    if (!empty($notice)) {
934
+        echo '<small class="form-text text-muted">' . wpautop(wptexturize($notice)) . '</small>';
935 935
     }
936 936
 
937 937
     echo '</div>';
938 938
 }
939
-add_action( 'getpaid_invoice_line_items', 'wpinv_display_invoice_notice', 100 );
939
+add_action('getpaid_invoice_line_items', 'wpinv_display_invoice_notice', 100);
940 940
 
941 941
 /**
942 942
  * @param WPInv_Invoice $invoice
943 943
  */
944
-function wpinv_display_invoice_notes( $invoice ) {
944
+function wpinv_display_invoice_notes($invoice) {
945 945
 
946 946
     // Retrieve the notes.
947
-    $notes = wpinv_get_invoice_notes( $invoice->get_id(), 'customer' );
947
+    $notes = wpinv_get_invoice_notes($invoice->get_id(), 'customer');
948 948
 
949 949
     // Abort if we have non.
950
-    if ( empty( $notes ) ) {
950
+    if (empty($notes)) {
951 951
         return;
952 952
     }
953 953
 
954 954
     // Echo the note.
955 955
     echo '<div class="getpaid-invoice-notes-wrapper border position-relative w-100 mb-4 p-0">';
956
-    echo '<h3 class="getpaid-invoice-notes-title text-dark bg-light border-bottom m-0 d-block">' . __( 'Notes', 'invoicing' ) .'</h3>';
956
+    echo '<h3 class="getpaid-invoice-notes-title text-dark bg-light border-bottom m-0 d-block">' . __('Notes', 'invoicing') . '</h3>';
957 957
     echo '<ul class="getpaid-invoice-notes mt-4 p-0">';
958 958
 
959
-    foreach( $notes as $note ) {
960
-        wpinv_get_invoice_note_line_item( $note );
959
+    foreach ($notes as $note) {
960
+        wpinv_get_invoice_note_line_item($note);
961 961
     }
962 962
 
963 963
     echo '</ul>';
964 964
     echo '</div>';
965 965
 }
966
-add_action( 'getpaid_invoice_line_items', 'wpinv_display_invoice_notes', 60 );
966
+add_action('getpaid_invoice_line_items', 'wpinv_display_invoice_notes', 60);
967 967
 
968 968
 /**
969 969
  * Loads scripts on our invoice templates.
@@ -971,32 +971,32 @@  discard block
 block discarded – undo
971 971
 function wpinv_display_style() {
972 972
 
973 973
     // Make sure that all scripts have been loaded.
974
-    if ( ! did_action( 'wp_enqueue_scripts' ) ) {
975
-        do_action( 'wp_enqueue_scripts' );
974
+    if (!did_action('wp_enqueue_scripts')) {
975
+        do_action('wp_enqueue_scripts');
976 976
     }
977 977
 
978 978
     // Register the invoices style.
979
-    wp_register_style( 'wpinv-single-style', WPINV_PLUGIN_URL . 'assets/css/invoice.css', array(), filemtime( WPINV_PLUGIN_DIR . 'assets/css/invoice.css' ) );
979
+    wp_register_style('wpinv-single-style', WPINV_PLUGIN_URL . 'assets/css/invoice.css', array(), filemtime(WPINV_PLUGIN_DIR . 'assets/css/invoice.css'));
980 980
 
981 981
     // Load required styles
982
-    wp_print_styles( 'open-sans' );
983
-    wp_print_styles( 'wpinv-single-style' );
984
-    wp_print_styles( 'ayecode-ui' );
982
+    wp_print_styles('open-sans');
983
+    wp_print_styles('wpinv-single-style');
984
+    wp_print_styles('ayecode-ui');
985 985
 
986 986
     // Maybe load custom css.
987
-    $custom_css = wpinv_get_option( 'template_custom_css' );
987
+    $custom_css = wpinv_get_option('template_custom_css');
988 988
 
989
-    if ( isset( $custom_css ) && ! empty( $custom_css ) ) {
990
-        $custom_css     = wp_kses( $custom_css, array( '\'', '\"' ) );
991
-        $custom_css     = str_replace( '&gt;', '>', $custom_css );
989
+    if (isset($custom_css) && !empty($custom_css)) {
990
+        $custom_css     = wp_kses($custom_css, array('\'', '\"'));
991
+        $custom_css     = str_replace('&gt;', '>', $custom_css);
992 992
         echo '<style type="text/css">';
993 993
         echo $custom_css;
994 994
         echo '</style>';
995 995
     }
996 996
 
997 997
 }
998
-add_action( 'wpinv_invoice_print_head', 'wpinv_display_style' );
999
-add_action( 'wpinv_invalid_invoice_head', 'wpinv_display_style' );
998
+add_action('wpinv_invoice_print_head', 'wpinv_display_style');
999
+add_action('wpinv_invalid_invoice_head', 'wpinv_display_style');
1000 1000
 
1001 1001
 
1002 1002
 /**
@@ -1008,41 +1008,41 @@  discard block
 block discarded – undo
1008 1008
     // Retrieve the current invoice.
1009 1009
     $invoice_id = getpaid_get_current_invoice_id();
1010 1010
 
1011
-    if ( empty( $invoice_id ) ) {
1011
+    if (empty($invoice_id)) {
1012 1012
 
1013 1013
         return aui()->alert(
1014 1014
             array(
1015 1015
                 'type'    => 'warning',
1016
-                'content' => __( 'Invalid invoice', 'invoicing' ),
1016
+                'content' => __('Invalid invoice', 'invoicing'),
1017 1017
             )
1018 1018
         );
1019 1019
 
1020 1020
     }
1021 1021
 
1022 1022
     // Can the user view this invoice?
1023
-    if ( ! wpinv_user_can_view_invoice( $invoice_id ) ) {
1023
+    if (!wpinv_user_can_view_invoice($invoice_id)) {
1024 1024
 
1025 1025
         return aui()->alert(
1026 1026
             array(
1027 1027
                 'type'    => 'warning',
1028
-                'content' => __( 'You are not allowed to view this invoice', 'invoicing' ),
1028
+                'content' => __('You are not allowed to view this invoice', 'invoicing'),
1029 1029
             )
1030 1030
         );
1031 1031
 
1032 1032
     }
1033 1033
 
1034 1034
     // Ensure that it is not yet paid for.
1035
-    $invoice = new WPInv_Invoice( $invoice_id );
1035
+    $invoice = new WPInv_Invoice($invoice_id);
1036 1036
 
1037 1037
     // Maybe mark it as viewed.
1038
-    getpaid_maybe_mark_invoice_as_viewed( $invoice );
1038
+    getpaid_maybe_mark_invoice_as_viewed($invoice);
1039 1039
 
1040
-    if ( $invoice->is_paid() ) {
1040
+    if ($invoice->is_paid()) {
1041 1041
 
1042 1042
         return aui()->alert(
1043 1043
             array(
1044 1044
                 'type'    => 'success',
1045
-                'content' => __( 'This invoice has already been paid.', 'invoicing' ),
1045
+                'content' => __('This invoice has already been paid.', 'invoicing'),
1046 1046
             )
1047 1047
         );
1048 1048
 
@@ -1052,14 +1052,14 @@  discard block
 block discarded – undo
1052 1052
     $wpi_checkout_id = $invoice_id;
1053 1053
 
1054 1054
     // We'll display this invoice via the default form.
1055
-    $form = new GetPaid_Payment_Form( wpinv_get_default_payment_form() );
1055
+    $form = new GetPaid_Payment_Form(wpinv_get_default_payment_form());
1056 1056
 
1057
-    if ( 0 == $form->get_id() ) {
1057
+    if (0 == $form->get_id()) {
1058 1058
 
1059 1059
         return aui()->alert(
1060 1060
             array(
1061 1061
                 'type'    => 'warning',
1062
-                'content' => __( 'Error loading the payment form', 'invoicing' ),
1062
+                'content' => __('Error loading the payment form', 'invoicing'),
1063 1063
             )
1064 1064
         );
1065 1065
 
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 
1068 1068
     // Set the invoice.
1069 1069
     $form->invoice = $invoice;
1070
-    $form->set_items( $invoice->get_items() );
1070
+    $form->set_items($invoice->get_items());
1071 1071
 
1072 1072
     // Generate the html.
1073 1073
     return $form->get_html();
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
 }
1076 1076
 
1077 1077
 function wpinv_empty_cart_message() {
1078
-	return apply_filters( 'wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __( 'Your cart is empty.', 'invoicing' ) . '</span>' );
1078
+	return apply_filters('wpinv_empty_cart_message', '<span class="wpinv_empty_cart">' . __('Your cart is empty.', 'invoicing') . '</span>');
1079 1079
 }
1080 1080
 
1081 1081
 /**
@@ -1092,38 +1092,38 @@  discard block
 block discarded – undo
1092 1092
         )
1093 1093
     );
1094 1094
 }
1095
-add_action( 'wpinv_cart_empty', 'wpinv_empty_checkout_cart' );
1095
+add_action('wpinv_cart_empty', 'wpinv_empty_checkout_cart');
1096 1096
 
1097
-function wpinv_receipt_billing_address( $invoice_id = 0 ) {
1098
-    $invoice = wpinv_get_invoice( $invoice_id );
1097
+function wpinv_receipt_billing_address($invoice_id = 0) {
1098
+    $invoice = wpinv_get_invoice($invoice_id);
1099 1099
 
1100
-    if ( empty( $invoice ) ) {
1100
+    if (empty($invoice)) {
1101 1101
         return NULL;
1102 1102
     }
1103 1103
 
1104 1104
     $billing_details = $invoice->get_user_info();
1105
-    $address_row = wpinv_get_invoice_address_markup( $billing_details );
1105
+    $address_row = wpinv_get_invoice_address_markup($billing_details);
1106 1106
 
1107 1107
     ob_start();
1108 1108
     ?>
1109 1109
     <table class="table table-bordered table-sm wpi-billing-details">
1110 1110
         <tbody>
1111 1111
             <tr class="wpi-receipt-name">
1112
-                <th class="text-left"><?php _e( 'Name', 'invoicing' ); ?></th>
1113
-                <td><?php echo esc_html( trim( $billing_details['first_name'] . ' ' . $billing_details['last_name'] ) ) ;?></td>
1112
+                <th class="text-left"><?php _e('Name', 'invoicing'); ?></th>
1113
+                <td><?php echo esc_html(trim($billing_details['first_name'] . ' ' . $billing_details['last_name'])); ?></td>
1114 1114
             </tr>
1115 1115
             <tr class="wpi-receipt-email">
1116
-                <th class="text-left"><?php _e( 'Email', 'invoicing' ); ?></th>
1117
-                <td><?php echo $billing_details['email'] ;?></td>
1116
+                <th class="text-left"><?php _e('Email', 'invoicing'); ?></th>
1117
+                <td><?php echo $billing_details['email']; ?></td>
1118 1118
             </tr>
1119 1119
             <tr class="wpi-receipt-address">
1120
-                <th class="text-left"><?php _e( 'Address', 'invoicing' ); ?></th>
1121
-                <td><?php echo $address_row ;?></td>
1120
+                <th class="text-left"><?php _e('Address', 'invoicing'); ?></th>
1121
+                <td><?php echo $address_row; ?></td>
1122 1122
             </tr>
1123
-            <?php if ( $billing_details['phone'] ) { ?>
1123
+            <?php if ($billing_details['phone']) { ?>
1124 1124
             <tr class="wpi-receipt-phone">
1125
-                <th class="text-left"><?php _e( 'Phone', 'invoicing' ); ?></th>
1126
-                <td><?php echo esc_html( $billing_details['phone'] ) ;?></td>
1125
+                <th class="text-left"><?php _e('Phone', 'invoicing'); ?></th>
1126
+                <td><?php echo esc_html($billing_details['phone']); ?></td>
1127 1127
             </tr>
1128 1128
             <?php } ?>
1129 1129
         </tbody>
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
     <?php
1132 1132
     $output = ob_get_clean();
1133 1133
     
1134
-    $output = apply_filters( 'wpinv_receipt_billing_address', $output, $invoice_id );
1134
+    $output = apply_filters('wpinv_receipt_billing_address', $output, $invoice_id);
1135 1135
 
1136 1136
     echo $output;
1137 1137
 }
@@ -1139,66 +1139,66 @@  discard block
 block discarded – undo
1139 1139
 /**
1140 1140
  * Filters the receipt page.
1141 1141
  */
1142
-function wpinv_filter_success_page_content( $content ) {
1142
+function wpinv_filter_success_page_content($content) {
1143 1143
 
1144 1144
     // Ensure this is our page.
1145
-    if ( isset( $_GET['payment-confirm'] ) && wpinv_is_success_page() ) {
1145
+    if (isset($_GET['payment-confirm']) && wpinv_is_success_page()) {
1146 1146
 
1147
-        $gateway = sanitize_text_field( $_GET['payment-confirm'] );
1148
-        return apply_filters( "wpinv_payment_confirm_$gateway", $content );
1147
+        $gateway = sanitize_text_field($_GET['payment-confirm']);
1148
+        return apply_filters("wpinv_payment_confirm_$gateway", $content);
1149 1149
 
1150 1150
     }
1151 1151
 
1152 1152
     return $content;
1153 1153
 }
1154
-add_filter( 'the_content', 'wpinv_filter_success_page_content', 99999 );
1154
+add_filter('the_content', 'wpinv_filter_success_page_content', 99999);
1155 1155
 
1156
-function wpinv_invoice_link( $invoice_id ) {
1157
-    $invoice = wpinv_get_invoice( $invoice_id );
1156
+function wpinv_invoice_link($invoice_id) {
1157
+    $invoice = wpinv_get_invoice($invoice_id);
1158 1158
 
1159
-    if ( empty( $invoice ) ) {
1159
+    if (empty($invoice)) {
1160 1160
         return NULL;
1161 1161
     }
1162 1162
 
1163
-    $invoice_link = '<a href="' . esc_url( $invoice->get_view_url() ) . '">' . $invoice->get_number() . '</a>';
1163
+    $invoice_link = '<a href="' . esc_url($invoice->get_view_url()) . '">' . $invoice->get_number() . '</a>';
1164 1164
 
1165
-    return apply_filters( 'wpinv_get_invoice_link', $invoice_link, $invoice );
1165
+    return apply_filters('wpinv_get_invoice_link', $invoice_link, $invoice);
1166 1166
 }
1167 1167
 
1168
-function wpinv_get_invoice_note_line_item( $note, $echo = true ) {
1169
-    if ( empty( $note ) ) {
1168
+function wpinv_get_invoice_note_line_item($note, $echo = true) {
1169
+    if (empty($note)) {
1170 1170
         return NULL;
1171 1171
     }
1172 1172
 
1173
-    if ( is_int( $note ) ) {
1174
-        $note = get_comment( $note );
1173
+    if (is_int($note)) {
1174
+        $note = get_comment($note);
1175 1175
     }
1176 1176
 
1177
-    if ( !( is_object( $note ) && is_a( $note, 'WP_Comment' ) ) ) {
1177
+    if (!(is_object($note) && is_a($note, 'WP_Comment'))) {
1178 1178
         return NULL;
1179 1179
     }
1180 1180
 
1181
-    $note_classes   = array( 'note' );
1182
-    $note_classes[] = get_comment_meta( $note->comment_ID, '_wpi_customer_note', true ) ? 'customer-note' : '';
1181
+    $note_classes   = array('note');
1182
+    $note_classes[] = get_comment_meta($note->comment_ID, '_wpi_customer_note', true) ? 'customer-note' : '';
1183 1183
     $note_classes[] = $note->comment_author === 'System' ? 'system-note' : '';
1184
-    $note_classes   = apply_filters( 'wpinv_invoice_note_class', array_filter( $note_classes ), $note );
1185
-    $note_classes   = !empty( $note_classes ) ? implode( ' ', $note_classes ) : '';
1184
+    $note_classes   = apply_filters('wpinv_invoice_note_class', array_filter($note_classes), $note);
1185
+    $note_classes   = !empty($note_classes) ? implode(' ', $note_classes) : '';
1186 1186
 
1187 1187
     ob_start();
1188 1188
     ?>
1189
-    <li rel="<?php echo absint( $note->comment_ID ) ; ?>" class="<?php echo esc_attr( $note_classes ); ?> mt-4 pl-3 pr-3">
1189
+    <li rel="<?php echo absint($note->comment_ID); ?>" class="<?php echo esc_attr($note_classes); ?> mt-4 pl-3 pr-3">
1190 1190
         <div class="note_content bg-light border position-relative p-4">
1191 1191
 
1192
-            <?php echo wpautop( wptexturize( wp_kses_post( $note->comment_content ) ) ); ?>
1192
+            <?php echo wpautop(wptexturize(wp_kses_post($note->comment_content))); ?>
1193 1193
 
1194
-            <?php if ( ! is_admin() ) : ?>
1194
+            <?php if (!is_admin()) : ?>
1195 1195
                 <em class="meta position-absolute form-text">
1196 1196
                     <?php
1197 1197
                         printf(
1198
-                            __( '%1$s - %2$s at %3$s', 'invoicing' ),
1198
+                            __('%1$s - %2$s at %3$s', 'invoicing'),
1199 1199
                             $note->comment_author,
1200
-                            getpaid_format_date_value( $note->comment_date ),
1201
-                            date_i18n( get_option( 'time_format' ), strtotime( $note->comment_date ) )
1200
+                            getpaid_format_date_value($note->comment_date),
1201
+                            date_i18n(get_option('time_format'), strtotime($note->comment_date))
1202 1202
                         );
1203 1203
                     ?>
1204 1204
                 </em>
@@ -1206,21 +1206,21 @@  discard block
 block discarded – undo
1206 1206
 
1207 1207
         </div>
1208 1208
 
1209
-        <?php if ( is_admin() ) : ?>
1209
+        <?php if (is_admin()) : ?>
1210 1210
 
1211 1211
             <p class="meta px-4 py-2">
1212
-                <abbr class="exact-date" title="<?php echo esc_attr( $note->comment_date ); ?>">
1212
+                <abbr class="exact-date" title="<?php echo esc_attr($note->comment_date); ?>">
1213 1213
                     <?php
1214 1214
                         printf(
1215
-                            __( '%1$s - %2$s at %3$s', 'invoicing' ),
1215
+                            __('%1$s - %2$s at %3$s', 'invoicing'),
1216 1216
                             $note->comment_author,
1217
-                            getpaid_format_date_value( $note->comment_date ),
1218
-                            date_i18n( get_option( 'time_format' ), strtotime( $note->comment_date ) )
1217
+                            getpaid_format_date_value($note->comment_date),
1218
+                            date_i18n(get_option('time_format'), strtotime($note->comment_date))
1219 1219
                         );
1220 1220
                     ?>
1221 1221
                 </abbr>&nbsp;&nbsp;
1222
-                <?php if ( $note->comment_author !== 'System' && wpinv_current_user_can_manage_invoicing() ) { ?>
1223
-                    <a href="#" class="delete_note"><?php _e( 'Delete note', 'invoicing' ); ?></a>
1222
+                <?php if ($note->comment_author !== 'System' && wpinv_current_user_can_manage_invoicing()) { ?>
1223
+                    <a href="#" class="delete_note"><?php _e('Delete note', 'invoicing'); ?></a>
1224 1224
                 <?php } ?>
1225 1225
             </p>
1226 1226
 
@@ -1229,9 +1229,9 @@  discard block
 block discarded – undo
1229 1229
     </li>
1230 1230
     <?php
1231 1231
     $note_content = ob_get_clean();
1232
-    $note_content = apply_filters( 'wpinv_get_invoice_note_line_item', $note_content, $note, $echo );
1232
+    $note_content = apply_filters('wpinv_get_invoice_note_line_item', $note_content, $note, $echo);
1233 1233
 
1234
-    if ( $echo ) {
1234
+    if ($echo) {
1235 1235
         echo $note_content;
1236 1236
     } else {
1237 1237
         return $note_content;
@@ -1241,36 +1241,36 @@  discard block
 block discarded – undo
1241 1241
 function wpinv_invalid_invoice_content() {
1242 1242
     global $post;
1243 1243
 
1244
-    $invoice = wpinv_get_invoice( $post->ID );
1244
+    $invoice = wpinv_get_invoice($post->ID);
1245 1245
 
1246
-    $error = __( 'This invoice is only viewable by clicking on the invoice link that was sent to you via email.', 'invoicing' );
1247
-    if ( !empty( $invoice->get_id() ) && $invoice->has_status( array_keys( wpinv_get_invoice_statuses() ) ) ) {
1248
-        if ( is_user_logged_in() ) {
1249
-            if ( wpinv_require_login_to_checkout() ) {
1250
-                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
1251
-                    $error = __( 'You are not allowed to view this invoice.', 'invoicing' );
1246
+    $error = __('This invoice is only viewable by clicking on the invoice link that was sent to you via email.', 'invoicing');
1247
+    if (!empty($invoice->get_id()) && $invoice->has_status(array_keys(wpinv_get_invoice_statuses()))) {
1248
+        if (is_user_logged_in()) {
1249
+            if (wpinv_require_login_to_checkout()) {
1250
+                if (isset($_GET['invoice_key']) && $_GET['invoice_key'] === $invoice->get_key()) {
1251
+                    $error = __('You are not allowed to view this invoice.', 'invoicing');
1252 1252
                 }
1253 1253
             }
1254 1254
         } else {
1255
-            if ( wpinv_require_login_to_checkout() ) {
1256
-                if ( isset( $_GET['invoice_key'] ) && $_GET['invoice_key'] === $invoice->get_key() ) {
1257
-                    $error = __( 'You must be logged in to view this invoice.', 'invoicing' );
1255
+            if (wpinv_require_login_to_checkout()) {
1256
+                if (isset($_GET['invoice_key']) && $_GET['invoice_key'] === $invoice->get_key()) {
1257
+                    $error = __('You must be logged in to view this invoice.', 'invoicing');
1258 1258
                 }
1259 1259
             }
1260 1260
         }
1261 1261
     } else {
1262
-        $error = __( 'This invoice is deleted or does not exist.', 'invoicing' );
1262
+        $error = __('This invoice is deleted or does not exist.', 'invoicing');
1263 1263
     }
1264 1264
     ?>
1265 1265
     <div class="row wpinv-row-invalid">
1266 1266
         <div class="col-md-6 col-md-offset-3 wpinv-message error">
1267
-            <h3><?php _e( 'Access Denied', 'invoicing' ); ?></h3>
1267
+            <h3><?php _e('Access Denied', 'invoicing'); ?></h3>
1268 1268
             <p class="wpinv-msg-text"><?php echo $error; ?></p>
1269 1269
         </div>
1270 1270
     </div>
1271 1271
     <?php
1272 1272
 }
1273
-add_action( 'wpinv_invalid_invoice_content', 'wpinv_invalid_invoice_content' );
1273
+add_action('wpinv_invalid_invoice_content', 'wpinv_invalid_invoice_content');
1274 1274
 
1275 1275
 /**
1276 1276
  * Function to get privacy policy text.
@@ -1279,21 +1279,21 @@  discard block
 block discarded – undo
1279 1279
  * @return string
1280 1280
  */
1281 1281
 function wpinv_get_policy_text() {
1282
-    $privacy_page_id = get_option( 'wp_page_for_privacy_policy', 0 );
1282
+    $privacy_page_id = get_option('wp_page_for_privacy_policy', 0);
1283 1283
 
1284
-    $text = wpinv_get_option('invoicing_privacy_checkout_message', sprintf( __( 'Your personal data will be used to process your invoice, payment and for other purposes described in our %s.', 'invoicing' ), '[wpinv_privacy_policy]' ));
1284
+    $text = wpinv_get_option('invoicing_privacy_checkout_message', sprintf(__('Your personal data will be used to process your invoice, payment and for other purposes described in our %s.', 'invoicing'), '[wpinv_privacy_policy]'));
1285 1285
 
1286
-    if(!$privacy_page_id){
1287
-        $privacy_page_id = wpinv_get_option( 'privacy_page', 0 );
1286
+    if (!$privacy_page_id) {
1287
+        $privacy_page_id = wpinv_get_option('privacy_page', 0);
1288 1288
     }
1289 1289
 
1290
-    $privacy_link    = $privacy_page_id ? '<a href="' . esc_url( get_permalink( $privacy_page_id ) ) . '" class="wpinv-privacy-policy-link" target="_blank">' . __( 'privacy policy', 'invoicing' ) . '</a>' : __( 'privacy policy', 'invoicing' );
1290
+    $privacy_link = $privacy_page_id ? '<a href="' . esc_url(get_permalink($privacy_page_id)) . '" class="wpinv-privacy-policy-link" target="_blank">' . __('privacy policy', 'invoicing') . '</a>' : __('privacy policy', 'invoicing');
1291 1291
 
1292 1292
     $find_replace = array(
1293 1293
         '[wpinv_privacy_policy]' => $privacy_link,
1294 1294
     );
1295 1295
 
1296
-    $privacy_text = str_replace( array_keys( $find_replace ), array_values( $find_replace ), $text );
1296
+    $privacy_text = str_replace(array_keys($find_replace), array_values($find_replace), $text);
1297 1297
 
1298 1298
     return wp_kses_post(wpautop($privacy_text));
1299 1299
 }
@@ -1301,21 +1301,21 @@  discard block
 block discarded – undo
1301 1301
 function wpinv_oxygen_fix_conflict() {
1302 1302
     global $ct_ignore_post_types;
1303 1303
 
1304
-    if ( ! is_array( $ct_ignore_post_types ) ) {
1304
+    if (!is_array($ct_ignore_post_types)) {
1305 1305
         $ct_ignore_post_types = array();
1306 1306
     }
1307 1307
 
1308
-    $post_types = array( 'wpi_discount', 'wpi_invoice', 'wpi_item' );
1308
+    $post_types = array('wpi_discount', 'wpi_invoice', 'wpi_item');
1309 1309
 
1310
-    foreach ( $post_types as $post_type ) {
1310
+    foreach ($post_types as $post_type) {
1311 1311
         $ct_ignore_post_types[] = $post_type;
1312 1312
 
1313 1313
         // Ignore post type
1314
-        add_filter( 'pre_option_oxygen_vsb_ignore_post_type_' . $post_type, '__return_true', 999 );
1314
+        add_filter('pre_option_oxygen_vsb_ignore_post_type_' . $post_type, '__return_true', 999);
1315 1315
     }
1316 1316
 
1317
-    remove_filter( 'template_include', 'wpinv_template', 10, 1 );
1318
-    add_filter( 'template_include', 'wpinv_template', 999, 1 );
1317
+    remove_filter('template_include', 'wpinv_template', 10, 1);
1318
+    add_filter('template_include', 'wpinv_template', 999, 1);
1319 1319
 }
1320 1320
 
1321 1321
 /**
@@ -1323,10 +1323,10 @@  discard block
 block discarded – undo
1323 1323
  * 
1324 1324
  * @param GetPaid_Payment_Form $form
1325 1325
  */
1326
-function getpaid_display_payment_form( $form ) {
1326
+function getpaid_display_payment_form($form) {
1327 1327
 
1328
-    if ( is_numeric( $form ) ) {
1329
-        $form = new GetPaid_Payment_Form( $form );
1328
+    if (is_numeric($form)) {
1329
+        $form = new GetPaid_Payment_Form($form);
1330 1330
     }
1331 1331
 
1332 1332
     $form->display();
@@ -1336,55 +1336,55 @@  discard block
 block discarded – undo
1336 1336
 /**
1337 1337
  * Helper function to display a item payment form on the frontend.
1338 1338
  */
1339
-function getpaid_display_item_payment_form( $items ) {
1339
+function getpaid_display_item_payment_form($items) {
1340 1340
 
1341
-    $form = new GetPaid_Payment_Form( wpinv_get_default_payment_form() );
1342
-    $form->set_items( $items );
1341
+    $form = new GetPaid_Payment_Form(wpinv_get_default_payment_form());
1342
+    $form->set_items($items);
1343 1343
 
1344
-    if ( 0 == count( $form->get_items() ) ) {
1344
+    if (0 == count($form->get_items())) {
1345 1345
         echo aui()->alert(
1346 1346
 			array(
1347 1347
 				'type'    => 'warning',
1348
-				'content' => __( 'No published items found', 'invoicing' ),
1348
+				'content' => __('No published items found', 'invoicing'),
1349 1349
 			)
1350 1350
         );
1351 1351
         return;
1352 1352
     }
1353 1353
 
1354
-    $form_items = esc_attr( getpaid_convert_items_to_string( $items ) );
1354
+    $form_items = esc_attr(getpaid_convert_items_to_string($items));
1355 1355
     $form_items = "<input type='hidden' name='getpaid-form-items' value='$form_items' />";
1356
-    $form->display( $form_items );
1356
+    $form->display($form_items);
1357 1357
 }
1358 1358
 
1359 1359
 /**
1360 1360
  * Helper function to display an invoice payment form on the frontend.
1361 1361
  */
1362
-function getpaid_display_invoice_payment_form( $invoice_id ) {
1362
+function getpaid_display_invoice_payment_form($invoice_id) {
1363 1363
 
1364
-    $invoice = wpinv_get_invoice( $invoice_id );
1364
+    $invoice = wpinv_get_invoice($invoice_id);
1365 1365
 
1366
-    if ( empty( $invoice ) ) {
1366
+    if (empty($invoice)) {
1367 1367
 		echo aui()->alert(
1368 1368
 			array(
1369 1369
 				'type'    => 'warning',
1370
-				'content' => __( 'Invoice not found', 'invoicing' ),
1370
+				'content' => __('Invoice not found', 'invoicing'),
1371 1371
 			)
1372 1372
         );
1373 1373
         return;
1374 1374
     }
1375 1375
 
1376
-    if ( $invoice->is_paid() ) {
1376
+    if ($invoice->is_paid()) {
1377 1377
 		echo aui()->alert(
1378 1378
 			array(
1379 1379
 				'type'    => 'warning',
1380
-				'content' => __( 'Invoice has already been paid', 'invoicing' ),
1380
+				'content' => __('Invoice has already been paid', 'invoicing'),
1381 1381
 			)
1382 1382
         );
1383 1383
         return;
1384 1384
     }
1385 1385
 
1386
-    $form = new GetPaid_Payment_Form( wpinv_get_default_payment_form() );
1387
-    $form->set_items( $invoice->get_items() );
1386
+    $form = new GetPaid_Payment_Form(wpinv_get_default_payment_form());
1387
+    $form->set_items($invoice->get_items());
1388 1388
 
1389 1389
     $form->display();
1390 1390
 }
@@ -1392,23 +1392,23 @@  discard block
 block discarded – undo
1392 1392
 /**
1393 1393
  * Helper function to convert item string to array.
1394 1394
  */
1395
-function getpaid_convert_items_to_array( $items ) {
1396
-    $items    = array_filter( array_map( 'trim', explode( ',', $items ) ) );
1395
+function getpaid_convert_items_to_array($items) {
1396
+    $items    = array_filter(array_map('trim', explode(',', $items)));
1397 1397
     $prepared = array();
1398 1398
 
1399
-    foreach ( $items as $item ) {
1400
-        $data = array_map( 'trim', explode( '|', $item ) );
1399
+    foreach ($items as $item) {
1400
+        $data = array_map('trim', explode('|', $item));
1401 1401
 
1402
-        if ( empty( $data[0] ) || ! is_numeric( $data[0] ) ) {
1402
+        if (empty($data[0]) || !is_numeric($data[0])) {
1403 1403
             continue;
1404 1404
         }
1405 1405
 
1406 1406
         $quantity = 1;
1407
-        if ( isset( $data[1] ) && is_numeric( $data[1] ) ) {
1407
+        if (isset($data[1]) && is_numeric($data[1])) {
1408 1408
             $quantity = (int) $data[1];
1409 1409
         }
1410 1410
 
1411
-        $prepared[ $data[0] ] = $quantity;
1411
+        $prepared[$data[0]] = $quantity;
1412 1412
 
1413 1413
     }
1414 1414
 
@@ -1418,13 +1418,13 @@  discard block
 block discarded – undo
1418 1418
 /**
1419 1419
  * Helper function to convert item array to string.
1420 1420
  */
1421
-function getpaid_convert_items_to_string( $items ) {
1421
+function getpaid_convert_items_to_string($items) {
1422 1422
     $prepared = array();
1423 1423
 
1424
-    foreach ( $items as $item => $quantity ) {
1424
+    foreach ($items as $item => $quantity) {
1425 1425
         $prepared[] = "$item|$quantity";
1426 1426
     }
1427
-    return implode( ',', $prepared );
1427
+    return implode(',', $prepared);
1428 1428
 }
1429 1429
 
1430 1430
 /**
@@ -1432,22 +1432,22 @@  discard block
 block discarded – undo
1432 1432
  * 
1433 1433
  * Provide a label and one of $form, $items or $invoice.
1434 1434
  */
1435
-function getpaid_get_payment_button( $label, $form = null, $items = null, $invoice = null ) {
1436
-    $label = sanitize_text_field( $label );
1435
+function getpaid_get_payment_button($label, $form = null, $items = null, $invoice = null) {
1436
+    $label = sanitize_text_field($label);
1437 1437
     $nonce = wp_create_nonce('getpaid_ajax_form');
1438 1438
 
1439
-    if ( ! empty( $form ) ) {
1440
-        $form  = esc_attr( $form );
1439
+    if (!empty($form)) {
1440
+        $form = esc_attr($form);
1441 1441
         return "<button class='btn btn-primary getpaid-payment-button' type='button' data-nonce='$nonce' data-form='$form'>$label</button>"; 
1442 1442
     }
1443 1443
 	
1444
-	if ( ! empty( $items ) ) {
1445
-        $items  = esc_attr( $items );
1444
+	if (!empty($items)) {
1445
+        $items = esc_attr($items);
1446 1446
         return "<button class='btn btn-primary getpaid-payment-button' type='button' data-nonce='$nonce' data-item='$items'>$label</button>"; 
1447 1447
     }
1448 1448
     
1449
-    if ( ! empty( $invoice ) ) {
1450
-        $invoice  = esc_attr( $invoice );
1449
+    if (!empty($invoice)) {
1450
+        $invoice = esc_attr($invoice);
1451 1451
         return "<button class='btn btn-primary getpaid-payment-button' type='button' data-nonce='$nonce' data-invoice='$invoice'>$label</button>"; 
1452 1452
     }
1453 1453
 
@@ -1458,17 +1458,17 @@  discard block
 block discarded – undo
1458 1458
  *
1459 1459
  * @param WPInv_Invoice $invoice
1460 1460
  */
1461
-function getpaid_the_invoice_description( $invoice ) {
1461
+function getpaid_the_invoice_description($invoice) {
1462 1462
     $description = $invoice->get_description();
1463 1463
 
1464
-    if ( empty( $description ) ) {
1464
+    if (empty($description)) {
1465 1465
         return;
1466 1466
     }
1467 1467
 
1468
-    $description = wp_kses_post( $description );
1468
+    $description = wp_kses_post($description);
1469 1469
     echo "<small class='getpaid-invoice-description text-dark p-2 form-text'><em>$description</em></small>";
1470 1470
 }
1471
-add_action( 'getpaid_invoice_line_items', 'getpaid_the_invoice_description', 100 );
1471
+add_action('getpaid_invoice_line_items', 'getpaid_the_invoice_description', 100);
1472 1472
 
1473 1473
 /**
1474 1474
  * Render element on a form.
@@ -1476,60 +1476,60 @@  discard block
 block discarded – undo
1476 1476
  * @param array $element
1477 1477
  * @param GetPaid_Payment_Form $form
1478 1478
  */
1479
-function getpaid_payment_form_element( $element, $form ) {
1479
+function getpaid_payment_form_element($element, $form) {
1480 1480
 
1481 1481
     // Set up the args.
1482
-    $element_type    = trim( $element['type'] );
1482
+    $element_type    = trim($element['type']);
1483 1483
     $element['form'] = $form;
1484
-    extract( $element );
1484
+    extract($element);
1485 1485
 
1486 1486
     // Try to locate the appropriate template.
1487
-    $located = wpinv_locate_template( "payment-forms/elements/$element_type.php" );
1487
+    $located = wpinv_locate_template("payment-forms/elements/$element_type.php");
1488 1488
     
1489 1489
     // Abort if this is not our element.
1490
-    if ( empty( $located ) || ! file_exists( $located ) ) {
1490
+    if (empty($located) || !file_exists($located)) {
1491 1491
         return;
1492 1492
     }
1493 1493
 
1494 1494
     // Generate the class and id of the element.
1495
-    $wrapper_class = 'getpaid-payment-form-element-' . trim( esc_attr( $element_type ) );
1496
-    $id            = isset( $id ) ? $id : uniqid( 'gp' );
1495
+    $wrapper_class = 'getpaid-payment-form-element-' . trim(esc_attr($element_type));
1496
+    $id            = isset($id) ? $id : uniqid('gp');
1497 1497
 
1498 1498
     // Echo the opening wrapper.
1499 1499
     echo "<div class='getpaid-payment-form-element $wrapper_class'>";
1500 1500
 
1501 1501
     // Fires before displaying a given element type's content.
1502
-    do_action( "getpaid_before_payment_form_{$element_type}_element", $element, $form );
1502
+    do_action("getpaid_before_payment_form_{$element_type}_element", $element, $form);
1503 1503
 
1504 1504
     // Include the template for the element.
1505 1505
     include $located;
1506 1506
 
1507 1507
     // Fires after displaying a given element type's content.
1508
-    do_action( "getpaid_payment_form_{$element_type}_element", $element, $form );
1508
+    do_action("getpaid_payment_form_{$element_type}_element", $element, $form);
1509 1509
 
1510 1510
     // Echo the closing wrapper.
1511 1511
     echo '</div>';
1512 1512
 }
1513
-add_action( 'getpaid_payment_form_element', 'getpaid_payment_form_element', 10, 2 );
1513
+add_action('getpaid_payment_form_element', 'getpaid_payment_form_element', 10, 2);
1514 1514
 
1515 1515
 /**
1516 1516
  * Render an element's edit page.
1517 1517
  *
1518 1518
  * @param WP_Post $post
1519 1519
  */
1520
-function getpaid_payment_form_edit_element_template( $post ) {
1520
+function getpaid_payment_form_edit_element_template($post) {
1521 1521
 
1522 1522
     // Retrieve all elements.
1523
-    $all_elements = wp_list_pluck( wpinv_get_data( 'payment-form-elements' ), 'type' );
1523
+    $all_elements = wp_list_pluck(wpinv_get_data('payment-form-elements'), 'type');
1524 1524
 
1525
-    foreach ( $all_elements as $element ) {
1525
+    foreach ($all_elements as $element) {
1526 1526
 
1527 1527
         // Try to locate the appropriate template.
1528
-        $element = sanitize_key( $element );
1529
-        $located = wpinv_locate_template( "payment-forms-admin/edit/$element.php" );
1528
+        $element = sanitize_key($element);
1529
+        $located = wpinv_locate_template("payment-forms-admin/edit/$element.php");
1530 1530
 
1531 1531
         // Continue if this is not our element.
1532
-        if ( empty( $located ) || ! file_exists( $located ) ) {
1532
+        if (empty($located) || !file_exists($located)) {
1533 1533
             continue;
1534 1534
         }
1535 1535
 
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
     }
1541 1541
 
1542 1542
 }
1543
-add_action( 'getpaid_payment_form_edit_element_template', 'getpaid_payment_form_edit_element_template' );
1543
+add_action('getpaid_payment_form_edit_element_template', 'getpaid_payment_form_edit_element_template');
1544 1544
 
1545 1545
 /**
1546 1546
  * Render an element's preview.
@@ -1549,16 +1549,16 @@  discard block
 block discarded – undo
1549 1549
 function getpaid_payment_form_render_element_preview_template() {
1550 1550
 
1551 1551
     // Retrieve all elements.
1552
-    $all_elements = wp_list_pluck( wpinv_get_data( 'payment-form-elements' ), 'type' );
1552
+    $all_elements = wp_list_pluck(wpinv_get_data('payment-form-elements'), 'type');
1553 1553
 
1554
-    foreach ( $all_elements as $element ) {
1554
+    foreach ($all_elements as $element) {
1555 1555
 
1556 1556
         // Try to locate the appropriate template.
1557
-        $element = sanitize_key( $element );
1558
-        $located = wpinv_locate_template( "payment-forms-admin/previews/$element.php" );
1557
+        $element = sanitize_key($element);
1558
+        $located = wpinv_locate_template("payment-forms-admin/previews/$element.php");
1559 1559
 
1560 1560
         // Continue if this is not our element.
1561
-        if ( empty( $located ) || ! file_exists( $located ) ) {
1561
+        if (empty($located) || !file_exists($located)) {
1562 1562
             continue;
1563 1563
         }
1564 1564
 
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
     }
1570 1570
 
1571 1571
 }
1572
-add_action( 'wpinv_payment_form_render_element_template', 'getpaid_payment_form_render_element_preview_template' );
1572
+add_action('wpinv_payment_form_render_element_template', 'getpaid_payment_form_render_element_preview_template');
1573 1573
 
1574 1574
 /**
1575 1575
  * Shows a list of gateways that support recurring payments.
@@ -1577,17 +1577,17 @@  discard block
 block discarded – undo
1577 1577
 function wpinv_get_recurring_gateways_text() {
1578 1578
     $gateways = array();
1579 1579
 
1580
-    foreach ( wpinv_get_payment_gateways() as $key => $gateway ) {
1581
-        if ( wpinv_gateway_support_subscription( $key ) ) {
1582
-            $gateways[] = sanitize_text_field( $gateway['admin_label'] );
1580
+    foreach (wpinv_get_payment_gateways() as $key => $gateway) {
1581
+        if (wpinv_gateway_support_subscription($key)) {
1582
+            $gateways[] = sanitize_text_field($gateway['admin_label']);
1583 1583
         }
1584 1584
     }
1585 1585
 
1586
-    if ( empty( $gateways ) ) {
1587
-        return "<span class='form-text text-danger'>" . __( 'No active gateways support subscription payments.', 'invoicing' ) ."</span>";
1586
+    if (empty($gateways)) {
1587
+        return "<span class='form-text text-danger'>" . __('No active gateways support subscription payments.', 'invoicing') . "</span>";
1588 1588
     }
1589 1589
 
1590
-    return "<span class='form-text text-muted'>" . wp_sprintf( __( 'Subscription payments only supported by: %s', 'invoicing' ), implode( ', ', $gateways ) ) ."</span>";
1590
+    return "<span class='form-text text-muted'>" . wp_sprintf(__('Subscription payments only supported by: %s', 'invoicing'), implode(', ', $gateways)) . "</span>";
1591 1591
 
1592 1592
 }
1593 1593
 
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
  * @return GetPaid_Template
1598 1598
  */
1599 1599
 function getpaid_template() {
1600
-    return getpaid()->get( 'template' );
1600
+    return getpaid()->get('template');
1601 1601
 }
1602 1602
 
1603 1603
 /**
@@ -1606,23 +1606,23 @@  discard block
 block discarded – undo
1606 1606
  * @param array args
1607 1607
  * @return string
1608 1608
  */
1609
-function getpaid_paginate_links( $args ) {
1609
+function getpaid_paginate_links($args) {
1610 1610
 
1611 1611
     $args['type']     = 'array';
1612 1612
     $args['mid_size'] = 1;
1613
-    $pages        = paginate_links( $args );
1613
+    $pages = paginate_links($args);
1614 1614
 
1615
-    if ( ! is_array( $pages ) ) {
1615
+    if (!is_array($pages)) {
1616 1616
         return '';
1617 1617
     }
1618 1618
 
1619 1619
     $_pages = array();
1620
-    foreach ( $pages as $page ) {
1621
-        $_pages[] = str_replace( 'page-numbers', 'page-link text-decoration-none', $page );
1620
+    foreach ($pages as $page) {
1621
+        $_pages[] = str_replace('page-numbers', 'page-link text-decoration-none', $page);
1622 1622
     }
1623 1623
 
1624 1624
     $links  = "<nav>\n\t<ul class='pagination justify-content-end m-0'>\n\t\t<li class='page-item'>";
1625
-    $links .= join( "</li>\n\t\t<li class='page-item'>", $_pages );
1625
+    $links .= join("</li>\n\t\t<li class='page-item'>", $_pages);
1626 1626
     $links .= "</li>\n\t</ul>\n</nav>\n";
1627 1627
 
1628 1628
     return $links;
Please login to merge, or discard this patch.
templates/payment-forms/form.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,21 +7,21 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Make sure that the form is active.
13
-if ( ! $form->is_active() ) {
13
+if (!$form->is_active()) {
14 14
     echo aui()->alert(
15 15
         array(
16 16
             'type'    => 'warning',
17
-            'content' => __( 'This payment form is no longer active', 'invoicing' ),
17
+            'content' => __('This payment form is no longer active', 'invoicing'),
18 18
         )
19 19
     );
20 20
     return;
21 21
 }
22 22
 
23 23
 // Fires before displaying a payment form.
24
-do_action( 'getpaid_before_payment_form', $form );
24
+do_action('getpaid_before_payment_form', $form);
25 25
 ?>
26 26
 
27 27
 <form class='getpaid-payment-form bsui' method='POST' data-key='<?php echo uniqid('gpf'); ?>'>
@@ -30,44 +30,44 @@  discard block
 block discarded – undo
30 30
     <?php 
31 31
     
32 32
         // Fires when printing the top of a payment form.
33
-        do_action( 'getpaid_payment_form_top', $form );
33
+        do_action('getpaid_payment_form_top', $form);
34 34
 
35 35
         // Add the vat validation nonce.
36
-        wp_nonce_field( 'vat_validation', '_wpi_nonce' );
36
+        wp_nonce_field('vat_validation', '_wpi_nonce');
37 37
 
38 38
         // And the optional invoice id.
39
-        if ( ! empty( $form->invoice ) ) {
40
-            echo getpaid_hidden_field( 'invoice_id', $form->invoice->get_id() );
39
+        if (!empty($form->invoice)) {
40
+            echo getpaid_hidden_field('invoice_id', $form->invoice->get_id());
41 41
         }
42 42
 
43 43
         // We also want to include the form id.
44
-        echo getpaid_hidden_field( 'form_id', $form->get_id() );
44
+        echo getpaid_hidden_field('form_id', $form->get_id());
45 45
 
46 46
         // And an indication that this is a payment form submission.
47
-        echo getpaid_hidden_field( 'getpaid_payment_form_submission', '1' );
47
+        echo getpaid_hidden_field('getpaid_payment_form_submission', '1');
48 48
 
49 49
         // Fires before displaying payment form elements.
50
-        do_action( 'getpaid_payment_form_before_elements', $form );
50
+        do_action('getpaid_payment_form_before_elements', $form);
51 51
 
52 52
         // Display the elements.
53
-        foreach ( $form->get_elements() as $element ) {
54
-            if ( isset( $element['type'] ) ) {
55
-                do_action( 'getpaid_payment_form_element', $element, $form );
56
-                do_action( "getpaid_payment_form_element_{$element['type']}_template", $element, $form );
53
+        foreach ($form->get_elements() as $element) {
54
+            if (isset($element['type'])) {
55
+                do_action('getpaid_payment_form_element', $element, $form);
56
+                do_action("getpaid_payment_form_element_{$element['type']}_template", $element, $form);
57 57
             }
58 58
         }
59 59
 
60 60
         // Fires after displaying payment form elements.
61
-        do_action( 'getpaid_payment_form_after_elements', $form );
61
+        do_action('getpaid_payment_form_after_elements', $form);
62 62
 
63 63
         echo "<div class='getpaid-payment-form-errors alert alert-danger d-none'></div>";
64 64
 
65
-        if ( wpinv_current_user_can_manage_invoicing() ) {
65
+        if (wpinv_current_user_can_manage_invoicing()) {
66 66
 
67 67
             edit_post_link(
68
-                __( 'Edit this form.', 'invoicing' ),
68
+                __('Edit this form.', 'invoicing'),
69 69
                 '<small class="form-text text-muted">',
70
-                '&nbsp;' . __( 'This is only visible to website administators.', 'invoicing' ) . '</small>',
70
+                '&nbsp;' . __('This is only visible to website administators.', 'invoicing') . '</small>',
71 71
                 $form->get_id(),
72 72
                 'text-danger'
73 73
             );
@@ -82,4 +82,4 @@  discard block
 block discarded – undo
82 82
 <?php
83 83
 
84 84
 // Fires after displaying a payment form.
85
-do_action( 'getpaid_after_payment_form', $form );
85
+do_action('getpaid_after_payment_form', $form);
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-item-info.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if (!defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -21,20 +21,20 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param WP_Post $post
23 23
 	 */
24
-    public static function output( $post ) {
24
+    public static function output($post) {
25 25
 
26 26
         // Prepare the item.
27
-        $item = new WPInv_Item( $post );
27
+        $item = new WPInv_Item($post);
28 28
 
29 29
         ?>
30 30
 
31 31
         <div class='bsui' style='padding-top: 10px;'>
32
-            <?php do_action( 'wpinv_item_before_info_metabox', $item ); ?>
32
+            <?php do_action('wpinv_item_before_info_metabox', $item); ?>
33 33
 
34 34
             <div class="wpinv_item_type form-group row">
35 35
                 <label for="wpinv_item_type" class="col-sm-12 col-form-label">
36
-                    <?php _e( 'Item Type', 'invoicing' );?>
37
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php echo strip_tags( self::get_tooltip( $post ) ); ?>"></span>
36
+                    <?php _e('Item Type', 'invoicing'); ?>
37
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php echo strip_tags(self::get_tooltip($post)); ?>"></span>
38 38
                 </label>
39 39
 
40 40
                 <div class="col-sm-12">
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
                             array(
45 45
                                 'id'               => 'wpinv_item_type',
46 46
                                 'name'             => 'wpinv_item_type',
47
-                                'placeholder'      => __( 'Select item type', 'invoicing' ),
48
-                                'value'            => $item->get_type( 'edit' ),
47
+                                'placeholder'      => __('Select item type', 'invoicing'),
48
+                                'value'            => $item->get_type('edit'),
49 49
                                 'select2'          => true,
50 50
                                 'data-allow-clear' => 'false',
51 51
                                 'no_wrap'          => true,
@@ -59,38 +59,38 @@  discard block
 block discarded – undo
59 59
 
60 60
             <div class="wpinv_item_shortcode form-group row">
61 61
                 <label for="wpinv_item_shortcode" class="col-sm-12 col-form-label">
62
-                    <?php _e( 'Payment Form Shortcode', 'invoicing' );?>
63
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a payment form', 'invoicing' ); ?>"></span>
62
+                    <?php _e('Payment Form Shortcode', 'invoicing'); ?>
63
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a payment form', 'invoicing'); ?>"></span>
64 64
                 </label>
65 65
 
66 66
                 <div class="col-sm-12">
67
-                    <input  onClick="this.select()" type="text" id="wpinv_item_shortcode" value="[getpaid item=<?php echo esc_attr( $item->get_id() ); ?>]" style="width: 100%;" readonly/>
67
+                    <input  onClick="this.select()" type="text" id="wpinv_item_shortcode" value="[getpaid item=<?php echo esc_attr($item->get_id()); ?>]" style="width: 100%;" readonly/>
68 68
                 </div>
69 69
             </div>
70 70
 
71 71
             <div class="wpinv_item_buy_shortcode form-group row">
72 72
                 <label for="wpinv_item_button_shortcode" class="col-sm-12 col-form-label">
73
-                    <?php _e( 'Payment Button Shortcode', 'invoicing' );?>
74
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Displays a buy now button', 'invoicing' ); ?>"></span>
73
+                    <?php _e('Payment Button Shortcode', 'invoicing'); ?>
74
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Displays a buy now button', 'invoicing'); ?>"></span>
75 75
                 </label>
76 76
 
77 77
                 <div class="col-sm-12">
78
-                    <input onClick="this.select()" type="text" id="wpinv_item_button_shortcode" value="[getpaid item=<?php echo esc_attr( $item->get_id() ); ?> button='Buy Now']" style="width: 100%;" readonly/>
78
+                    <input onClick="this.select()" type="text" id="wpinv_item_button_shortcode" value="[getpaid item=<?php echo esc_attr($item->get_id()); ?> button='Buy Now']" style="width: 100%;" readonly/>
79 79
                 </div>
80 80
             </div>
81 81
 
82 82
             <div class="wpinv_item_custom_id form-group">
83
-                <?php _e( 'Custom ID', 'invoicing' );?> &mdash; <?php echo sanitize_text_field( $item->get_custom_id() ) ?>
83
+                <?php _e('Custom ID', 'invoicing'); ?> &mdash; <?php echo sanitize_text_field($item->get_custom_id()) ?>
84 84
             </div>
85 85
 
86
-            <?php do_action( 'wpinv_meta_values_metabox_before', $post ); ?>
87
-            <?php foreach ( apply_filters( 'wpinv_show_meta_values_for_keys', array() ) as $meta_key ) : ?>
86
+            <?php do_action('wpinv_meta_values_metabox_before', $post); ?>
87
+            <?php foreach (apply_filters('wpinv_show_meta_values_for_keys', array()) as $meta_key) : ?>
88 88
                 <div class="wpinv_item_custom_id form-group">
89
-                    <?php sanitize_text_field( $meta_key );?> &mdash; <?php echo sanitize_text_field( get_post_meta( $item->get_id(), '_wpinv_' . $meta_key, true ) ); ?>
89
+                    <?php sanitize_text_field($meta_key); ?> &mdash; <?php echo sanitize_text_field(get_post_meta($item->get_id(), '_wpinv_' . $meta_key, true)); ?>
90 90
                 </div>
91 91
             <?php endforeach; ?>
92
-            <?php do_action( 'wpinv_meta_values_metabox_after', $post ); ?>
93
-            <?php do_action( 'wpinv_item_info_metabox', $item ); ?>
92
+            <?php do_action('wpinv_meta_values_metabox_after', $post); ?>
93
+            <?php do_action('wpinv_item_info_metabox', $item); ?>
94 94
         </div>
95 95
         <?php
96 96
 
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
 	 * Returns item type tolltip.
101 101
 	 *
102 102
 	 */
103
-    public static function get_tooltip( $post ) {
103
+    public static function get_tooltip($post) {
104 104
 
105 105
         ob_start();
106 106
         ?>
107 107
 
108
-        <?php _e( 'Standard: Standard item type', 'invoicing' );?>
109
-        <?php _e( 'Fee: Like Registration Fee, Sign up Fee etc', 'invoicing' );?>
108
+        <?php _e('Standard: Standard item type', 'invoicing'); ?>
109
+        <?php _e('Fee: Like Registration Fee, Sign up Fee etc', 'invoicing'); ?>
110 110
 
111 111
         <?php
112
-        do_action( 'wpinv_item_info_metabox_after', $post );
112
+        do_action('wpinv_item_info_metabox_after', $post);
113 113
 
114 114
         return ob_get_clean();
115 115
 
Please login to merge, or discard this patch.
includes/wpinv-helper-functions.php 1 patch
Spacing   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
  
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Are we supporting item quantities?
@@ -21,25 +21,25 @@  discard block
 block discarded – undo
21 21
 function wpinv_get_ip() {
22 22
     $ip = $_SERVER['REMOTE_ADDR'];
23 23
 
24
-    if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
24
+    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
25 25
         //Check ip from share internet.
26 26
         $ip = $_SERVER['HTTP_CLIENT_IP'];
27
-    } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
27
+    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
28 28
         //Check ip is pass from proxy.
29 29
         $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
30 30
     }
31 31
 
32
-    return apply_filters( 'wpinv_get_ip', $ip );
32
+    return apply_filters('wpinv_get_ip', $ip);
33 33
 }
34 34
 
35 35
 function wpinv_get_user_agent() {
36
-    if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
37
-        $user_agent = sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] );
36
+    if (!empty($_SERVER['HTTP_USER_AGENT'])) {
37
+        $user_agent = sanitize_text_field($_SERVER['HTTP_USER_AGENT']);
38 38
     } else {
39 39
         $user_agent = '';
40 40
     }
41 41
 
42
-    return apply_filters( 'wpinv_get_user_agent', $user_agent );
42
+    return apply_filters('wpinv_get_user_agent', $user_agent);
43 43
 }
44 44
 
45 45
 /**
@@ -47,27 +47,27 @@  discard block
 block discarded – undo
47 47
  * 
48 48
  * @param string $amount The amount to sanitize.
49 49
  */
50
-function wpinv_sanitize_amount( $amount ) {
50
+function wpinv_sanitize_amount($amount) {
51 51
 
52 52
     // Format decimals.
53
-    $amount = str_replace( wpinv_decimal_separator(), '.', $amount );
53
+    $amount = str_replace(wpinv_decimal_separator(), '.', $amount);
54 54
 
55 55
     // Remove thousands.
56
-    $amount = str_replace( wpinv_thousands_separator(), '', $amount );
56
+    $amount = str_replace(wpinv_thousands_separator(), '', $amount);
57 57
 
58 58
     // Cast the remaining to a float.
59
-    return (float) preg_replace( '/[^0-9\.\-]/', '', $amount );
59
+    return (float) preg_replace('/[^0-9\.\-]/', '', $amount);
60 60
 
61 61
 }
62 62
 
63
-function wpinv_round_amount( $amount, $decimals = NULL ) {
64
-    if ( $decimals === NULL ) {
63
+function wpinv_round_amount($amount, $decimals = NULL) {
64
+    if ($decimals === NULL) {
65 65
         $decimals = wpinv_decimals();
66 66
     }
67 67
     
68
-    $amount = round( (double)$amount, wpinv_currency_decimal_filter( absint( $decimals ) ) );
68
+    $amount = round((double) $amount, wpinv_currency_decimal_filter(absint($decimals)));
69 69
 
70
-    return apply_filters( 'wpinv_round_amount', $amount, $decimals );
70
+    return apply_filters('wpinv_round_amount', $amount, $decimals);
71 71
 }
72 72
 
73 73
 /**
@@ -76,32 +76,32 @@  discard block
 block discarded – undo
76 76
  * @since 1.0.19
77 77
  * @return array
78 78
  */
79
-function wpinv_get_invoice_statuses( $draft = false, $trashed = false, $invoice = false ) {
79
+function wpinv_get_invoice_statuses($draft = false, $trashed = false, $invoice = false) {
80 80
 	$invoice_statuses = array(
81
-		'wpi-pending'    => _x( 'Pending payment', 'Invoice status', 'invoicing' ),
82
-        'publish'        => _x( 'Paid', 'Invoice status', 'invoicing' ),
83
-        'wpi-processing' => _x( 'Processing', 'Invoice status', 'invoicing' ),
84
-		'wpi-onhold'     => _x( 'On hold', 'Invoice status', 'invoicing' ),
85
-		'wpi-cancelled'  => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
86
-		'wpi-refunded'   => _x( 'Refunded', 'Invoice status', 'invoicing' ),
87
-        'wpi-failed'     => _x( 'Failed', 'Invoice status', 'invoicing' ),
88
-        'wpi-renewal'    => _x( 'Renewal Payment', 'Invoice status', 'invoicing' ),
81
+		'wpi-pending'    => _x('Pending payment', 'Invoice status', 'invoicing'),
82
+        'publish'        => _x('Paid', 'Invoice status', 'invoicing'),
83
+        'wpi-processing' => _x('Processing', 'Invoice status', 'invoicing'),
84
+		'wpi-onhold'     => _x('On hold', 'Invoice status', 'invoicing'),
85
+		'wpi-cancelled'  => _x('Cancelled', 'Invoice status', 'invoicing'),
86
+		'wpi-refunded'   => _x('Refunded', 'Invoice status', 'invoicing'),
87
+        'wpi-failed'     => _x('Failed', 'Invoice status', 'invoicing'),
88
+        'wpi-renewal'    => _x('Renewal Payment', 'Invoice status', 'invoicing'),
89 89
     );
90 90
 
91
-    if ( $draft ) {
92
-        $invoice_statuses['draft'] = __( 'Draft', 'invoicing' );
91
+    if ($draft) {
92
+        $invoice_statuses['draft'] = __('Draft', 'invoicing');
93 93
     }
94 94
 
95
-    if ( $trashed ) {
96
-        $invoice_statuses['trash'] = __( 'Trash', 'invoicing' );
95
+    if ($trashed) {
96
+        $invoice_statuses['trash'] = __('Trash', 'invoicing');
97 97
     }
98 98
 
99
-	return apply_filters( 'wpinv_statuses', $invoice_statuses, $invoice );
99
+	return apply_filters('wpinv_statuses', $invoice_statuses, $invoice);
100 100
 }
101 101
 
102
-function wpinv_status_nicename( $status ) {
103
-    $statuses = wpinv_get_invoice_statuses( true, true );
104
-    $status   = isset( $statuses[$status] ) ? $statuses[$status] : __( $status, 'invoicing' );
102
+function wpinv_status_nicename($status) {
103
+    $statuses = wpinv_get_invoice_statuses(true, true);
104
+    $status   = isset($statuses[$status]) ? $statuses[$status] : __($status, 'invoicing');
105 105
 
106 106
     return $status;
107 107
 }
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
  * 
112 112
  * @param string $current
113 113
  */
114
-function wpinv_get_currency( $current = '' ) {
114
+function wpinv_get_currency($current = '') {
115 115
 
116
-    if ( empty( $current ) ) {
117
-        $current = apply_filters( 'wpinv_currency', wpinv_get_option( 'currency', 'USD' ) );
116
+    if (empty($current)) {
117
+        $current = apply_filters('wpinv_currency', wpinv_get_option('currency', 'USD'));
118 118
     }
119 119
 
120
-    return trim( strtoupper( $current ) );
120
+    return trim(strtoupper($current));
121 121
 }
122 122
 
123 123
 /**
@@ -125,25 +125,25 @@  discard block
 block discarded – undo
125 125
  * 
126 126
  * @param string|null $currency The currency code. Defaults to the default currency.
127 127
  */
128
-function wpinv_currency_symbol( $currency = null ) {
128
+function wpinv_currency_symbol($currency = null) {
129 129
 
130 130
     // Prepare the currency.
131
-    $currency = empty( $currency ) ? wpinv_get_currency() : wpinv_clean( $currency );
131
+    $currency = empty($currency) ? wpinv_get_currency() : wpinv_clean($currency);
132 132
 
133 133
     // Fetch all symbols.
134 134
     $symbols = wpinv_get_currency_symbols();
135 135
 
136 136
     // Fetch this currencies symbol.
137
-    $currency_symbol = isset( $symbols[$currency] ) ? $symbols[$currency] : $currency;
137
+    $currency_symbol = isset($symbols[$currency]) ? $symbols[$currency] : $currency;
138 138
 
139 139
     // Filter the symbol.
140
-    return apply_filters( 'wpinv_currency_symbol', $currency_symbol, $currency );
140
+    return apply_filters('wpinv_currency_symbol', $currency_symbol, $currency);
141 141
 }
142 142
 
143 143
 function wpinv_currency_position() {
144
-    $position = wpinv_get_option( 'currency_position', 'left' );
144
+    $position = wpinv_get_option('currency_position', 'left');
145 145
     
146
-    return apply_filters( 'wpinv_currency_position', $position );
146
+    return apply_filters('wpinv_currency_position', $position);
147 147
 }
148 148
 
149 149
 /**
@@ -151,13 +151,13 @@  discard block
 block discarded – undo
151 151
  * 
152 152
  * @param $string|null $current
153 153
  */
154
-function wpinv_thousands_separator( $current = null ) {
154
+function wpinv_thousands_separator($current = null) {
155 155
 
156
-    if ( null == $current ) {
157
-        $current = wpinv_get_option( 'thousands_separator', '.' );
156
+    if (null == $current) {
157
+        $current = wpinv_get_option('thousands_separator', '.');
158 158
     }
159 159
 
160
-    return trim( $current );
160
+    return trim($current);
161 161
 }
162 162
 
163 163
 /**
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
  * 
166 166
  * @param $string|null $current
167 167
  */
168
-function wpinv_decimal_separator( $current = null ) {
168
+function wpinv_decimal_separator($current = null) {
169 169
 
170
-    if ( null == $current ) {
171
-        $current = wpinv_get_option( 'decimal_separator', '.' );
170
+    if (null == $current) {
171
+        $current = wpinv_get_option('decimal_separator', '.');
172 172
     }
173 173
     
174
-    return trim( $current );
174
+    return trim($current);
175 175
 }
176 176
 
177 177
 /**
@@ -179,27 +179,27 @@  discard block
 block discarded – undo
179 179
  * 
180 180
  * @param $string|null $current
181 181
  */
182
-function wpinv_decimals( $current = null ) {
182
+function wpinv_decimals($current = null) {
183 183
 
184
-    if ( null == $current ) {
185
-        $current = wpinv_get_option( 'decimals', 2 );
184
+    if (null == $current) {
185
+        $current = wpinv_get_option('decimals', 2);
186 186
     }
187 187
     
188
-    return absint( $current );
188
+    return absint($current);
189 189
 }
190 190
 
191 191
 /**
192 192
  * Retrieves a list of all supported currencies.
193 193
  */
194 194
 function wpinv_get_currencies() {
195
-    return apply_filters( 'wpinv_currencies', wpinv_get_data( 'currencies' ) );
195
+    return apply_filters('wpinv_currencies', wpinv_get_data('currencies'));
196 196
 }
197 197
 
198 198
 /**
199 199
  * Retrieves a list of all currency symbols.
200 200
  */
201 201
 function wpinv_get_currency_symbols() {
202
-    return apply_filters( 'wpinv_currency_symbols', wpinv_get_data( 'currency-symbols' ) );
202
+    return apply_filters('wpinv_currency_symbols', wpinv_get_data('currency-symbols'));
203 203
 }
204 204
 
205 205
 /**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	$currency_pos = wpinv_currency_position();
212 212
 	$format       = '%1$s%2$s';
213 213
 
214
-	switch ( $currency_pos ) {
214
+	switch ($currency_pos) {
215 215
 		case 'left':
216 216
 			$format = '%1$s%2$s';
217 217
 			break;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			break;
227 227
 	}
228 228
 
229
-	return apply_filters( 'getpaid_price_format', $format, $currency_pos );
229
+	return apply_filters('getpaid_price_format', $format, $currency_pos);
230 230
 }
231 231
 
232 232
 /**
@@ -236,25 +236,25 @@  discard block
 block discarded – undo
236 236
  * @param  string $currency Currency.
237 237
  * @return string
238 238
  */
239
-function wpinv_price( $amount = 0, $currency = '' ) {
239
+function wpinv_price($amount = 0, $currency = '') {
240 240
 
241 241
     // Backwards compatibility.
242
-    $amount             = floatval( wpinv_sanitize_amount( $amount ) );
242
+    $amount             = floatval(wpinv_sanitize_amount($amount));
243 243
 
244 244
     // Prepare variables.
245
-    $currency           = wpinv_get_currency( $currency );
245
+    $currency           = wpinv_get_currency($currency);
246 246
     $amount             = (float) $amount;
247 247
     $unformatted_amount = $amount;
248 248
     $negative           = $amount < 0;
249
-    $amount             = apply_filters( 'getpaid_raw_amount', floatval( $negative ? $amount * -1 : $amount ) );
250
-    $amount             = wpinv_format_amount( $amount );
249
+    $amount             = apply_filters('getpaid_raw_amount', floatval($negative ? $amount * -1 : $amount));
250
+    $amount             = wpinv_format_amount($amount);
251 251
 
252 252
     // Format the amount.
253 253
     $format             = getpaid_get_price_format();
254
-    $formatted_amount   = ( $negative ? '-' : '' ) . sprintf( $format, '<span class="getpaid-currency__symbol">' . wpinv_currency_symbol( $currency ) . '</span>', $amount );
254
+    $formatted_amount   = ($negative ? '-' : '') . sprintf($format, '<span class="getpaid-currency__symbol">' . wpinv_currency_symbol($currency) . '</span>', $amount);
255 255
 
256 256
     // Filter the formatting.
257
-    return apply_filters( 'wpinv_price', $formatted_amount, $amount, $currency, $unformatted_amount );
257
+    return apply_filters('wpinv_price', $formatted_amount, $amount, $currency, $unformatted_amount);
258 258
 }
259 259
 
260 260
 /**
@@ -265,33 +265,33 @@  discard block
 block discarded – undo
265 265
  * @param  bool     $calculate Whether or not to apply separators.
266 266
  * @return string
267 267
  */
268
-function wpinv_format_amount( $amount, $decimals = null, $calculate = false ) {
268
+function wpinv_format_amount($amount, $decimals = null, $calculate = false) {
269 269
     $thousands_sep = wpinv_thousands_separator();
270 270
     $decimal_sep   = wpinv_decimal_separator();
271
-    $decimals      = wpinv_decimals( $decimals );
271
+    $decimals      = wpinv_decimals($decimals);
272 272
 
273 273
     // Format decimals.
274
-    $amount = str_replace( $decimal_sep, '.', $amount );
274
+    $amount = str_replace($decimal_sep, '.', $amount);
275 275
 
276 276
     // Remove thousands.
277
-    $amount = str_replace( $thousands_sep, '', $amount );
277
+    $amount = str_replace($thousands_sep, '', $amount);
278 278
 
279 279
     // Cast the remaining to a float.
280
-    $amount = floatval( $amount );
280
+    $amount = floatval($amount);
281 281
 
282
-    if ( $calculate ) {
282
+    if ($calculate) {
283 283
         return $amount;
284 284
     }
285 285
 
286 286
     // Fomart the amount.
287
-    return number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
287
+    return number_format($amount, $decimals, $decimal_sep, $thousands_sep);
288 288
 }
289 289
 
290
-function wpinv_sanitize_key( $key ) {
290
+function wpinv_sanitize_key($key) {
291 291
     $raw_key = $key;
292
-    $key = preg_replace( '/[^a-zA-Z0-9_\-\.\:\/]/', '', $key );
292
+    $key = preg_replace('/[^a-zA-Z0-9_\-\.\:\/]/', '', $key);
293 293
 
294
-    return apply_filters( 'wpinv_sanitize_key', $key, $raw_key );
294
+    return apply_filters('wpinv_sanitize_key', $key, $raw_key);
295 295
 }
296 296
 
297 297
 /**
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
  * 
300 300
  * @param $str the file whose extension should be retrieved.
301 301
  */
302
-function wpinv_get_file_extension( $str ) {
303
-    $filetype = wp_check_filetype( $str );
302
+function wpinv_get_file_extension($str) {
303
+    $filetype = wp_check_filetype($str);
304 304
     return $filetype['ext'];
305 305
 }
306 306
 
@@ -309,16 +309,16 @@  discard block
 block discarded – undo
309 309
  * 
310 310
  * @param string $string
311 311
  */
312
-function wpinv_string_is_image_url( $string ) {
313
-    $extension = strtolower( wpinv_get_file_extension( $string ) );
314
-    return in_array( $extension, array( 'jpeg', 'jpg', 'png', 'gif', 'ico' ), true );
312
+function wpinv_string_is_image_url($string) {
313
+    $extension = strtolower(wpinv_get_file_extension($string));
314
+    return in_array($extension, array('jpeg', 'jpg', 'png', 'gif', 'ico'), true);
315 315
 }
316 316
 
317 317
 /**
318 318
  * Returns the current URL.
319 319
  */
320 320
 function wpinv_get_current_page_url() {
321
-    return ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
321
+    return (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
322 322
 }
323 323
 
324 324
 /**
@@ -328,46 +328,46 @@  discard block
 block discarded – undo
328 328
  * @param string $name  Constant name.
329 329
  * @param mixed  $value Value.
330 330
  */
331
-function getpaid_maybe_define_constant( $name, $value ) {
332
-	if ( ! defined( $name ) ) {
333
-		define( $name, $value );
331
+function getpaid_maybe_define_constant($name, $value) {
332
+	if (!defined($name)) {
333
+		define($name, $value);
334 334
 	}
335 335
 }
336 336
 
337 337
 function wpinv_get_php_arg_separator_output() {
338
-	return ini_get( 'arg_separator.output' );
338
+	return ini_get('arg_separator.output');
339 339
 }
340 340
 
341
-function wpinv_rgb_from_hex( $color ) {
342
-    $color = str_replace( '#', '', $color );
341
+function wpinv_rgb_from_hex($color) {
342
+    $color = str_replace('#', '', $color);
343 343
 
344 344
     // Convert shorthand colors to full format, e.g. "FFF" -> "FFFFFF"
345
-    $color = preg_replace( '~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color );
346
-    if ( empty( $color ) ) {
345
+    $color = preg_replace('~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color);
346
+    if (empty($color)) {
347 347
         return NULL;
348 348
     }
349 349
 
350
-    $color = str_split( $color );
350
+    $color = str_split($color);
351 351
 
352 352
     $rgb      = array();
353
-    $rgb['R'] = hexdec( $color[0] . $color[1] );
354
-    $rgb['G'] = hexdec( $color[2] . $color[3] );
355
-    $rgb['B'] = hexdec( $color[4] . $color[5] );
353
+    $rgb['R'] = hexdec($color[0] . $color[1]);
354
+    $rgb['G'] = hexdec($color[2] . $color[3]);
355
+    $rgb['B'] = hexdec($color[4] . $color[5]);
356 356
 
357 357
     return $rgb;
358 358
 }
359 359
 
360
-function wpinv_hex_darker( $color, $factor = 30 ) {
361
-    $base  = wpinv_rgb_from_hex( $color );
360
+function wpinv_hex_darker($color, $factor = 30) {
361
+    $base  = wpinv_rgb_from_hex($color);
362 362
     $color = '#';
363 363
 
364
-    foreach ( $base as $k => $v ) {
364
+    foreach ($base as $k => $v) {
365 365
         $amount      = $v / 100;
366
-        $amount      = round( $amount * $factor );
366
+        $amount      = round($amount * $factor);
367 367
         $new_decimal = $v - $amount;
368 368
 
369
-        $new_hex_component = dechex( $new_decimal );
370
-        if ( strlen( $new_hex_component ) < 2 ) {
369
+        $new_hex_component = dechex($new_decimal);
370
+        if (strlen($new_hex_component) < 2) {
371 371
             $new_hex_component = "0" . $new_hex_component;
372 372
         }
373 373
         $color .= $new_hex_component;
@@ -376,18 +376,18 @@  discard block
 block discarded – undo
376 376
     return $color;
377 377
 }
378 378
 
379
-function wpinv_hex_lighter( $color, $factor = 30 ) {
380
-    $base  = wpinv_rgb_from_hex( $color );
379
+function wpinv_hex_lighter($color, $factor = 30) {
380
+    $base  = wpinv_rgb_from_hex($color);
381 381
     $color = '#';
382 382
 
383
-    foreach ( $base as $k => $v ) {
383
+    foreach ($base as $k => $v) {
384 384
         $amount      = 255 - $v;
385 385
         $amount      = $amount / 100;
386
-        $amount      = round( $amount * $factor );
386
+        $amount      = round($amount * $factor);
387 387
         $new_decimal = $v + $amount;
388 388
 
389
-        $new_hex_component = dechex( $new_decimal );
390
-        if ( strlen( $new_hex_component ) < 2 ) {
389
+        $new_hex_component = dechex($new_decimal);
390
+        if (strlen($new_hex_component) < 2) {
391 391
             $new_hex_component = "0" . $new_hex_component;
392 392
         }
393 393
         $color .= $new_hex_component;
@@ -396,22 +396,22 @@  discard block
 block discarded – undo
396 396
     return $color;
397 397
 }
398 398
 
399
-function wpinv_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
400
-    $hex = str_replace( '#', '', $color );
399
+function wpinv_light_or_dark($color, $dark = '#000000', $light = '#FFFFFF') {
400
+    $hex = str_replace('#', '', $color);
401 401
 
402
-    $c_r = hexdec( substr( $hex, 0, 2 ) );
403
-    $c_g = hexdec( substr( $hex, 2, 2 ) );
404
-    $c_b = hexdec( substr( $hex, 4, 2 ) );
402
+    $c_r = hexdec(substr($hex, 0, 2));
403
+    $c_g = hexdec(substr($hex, 2, 2));
404
+    $c_b = hexdec(substr($hex, 4, 2));
405 405
 
406
-    $brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000;
406
+    $brightness = (($c_r * 299) + ($c_g * 587) + ($c_b * 114)) / 1000;
407 407
 
408 408
     return $brightness > 155 ? $dark : $light;
409 409
 }
410 410
 
411
-function wpinv_format_hex( $hex ) {
412
-    $hex = trim( str_replace( '#', '', $hex ) );
411
+function wpinv_format_hex($hex) {
412
+    $hex = trim(str_replace('#', '', $hex));
413 413
 
414
-    if ( strlen( $hex ) == 3 ) {
414
+    if (strlen($hex) == 3) {
415 415
         $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
416 416
     }
417 417
 
@@ -431,12 +431,12 @@  discard block
 block discarded – undo
431 431
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
432 432
  * @return string
433 433
  */
434
-function wpinv_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
435
-    if ( function_exists( 'mb_strimwidth' ) ) {
436
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
434
+function wpinv_utf8_strimwidth($str, $start, $width, $trimmaker = '', $encoding = 'UTF-8') {
435
+    if (function_exists('mb_strimwidth')) {
436
+        return mb_strimwidth($str, $start, $width, $trimmaker, $encoding);
437 437
     }
438 438
     
439
-    return wpinv_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
439
+    return wpinv_utf8_substr($str, $start, $width, $encoding) . $trimmaker;
440 440
 }
441 441
 
442 442
 /**
@@ -448,28 +448,28 @@  discard block
 block discarded – undo
448 448
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
449 449
  * @return int Returns the number of characters in string.
450 450
  */
451
-function wpinv_utf8_strlen( $str, $encoding = 'UTF-8' ) {
452
-    if ( function_exists( 'mb_strlen' ) ) {
453
-        return mb_strlen( $str, $encoding );
451
+function wpinv_utf8_strlen($str, $encoding = 'UTF-8') {
452
+    if (function_exists('mb_strlen')) {
453
+        return mb_strlen($str, $encoding);
454 454
     }
455 455
         
456
-    return strlen( $str );
456
+    return strlen($str);
457 457
 }
458 458
 
459
-function wpinv_utf8_strtolower( $str, $encoding = 'UTF-8' ) {
460
-    if ( function_exists( 'mb_strtolower' ) ) {
461
-        return mb_strtolower( $str, $encoding );
459
+function wpinv_utf8_strtolower($str, $encoding = 'UTF-8') {
460
+    if (function_exists('mb_strtolower')) {
461
+        return mb_strtolower($str, $encoding);
462 462
     }
463 463
     
464
-    return strtolower( $str );
464
+    return strtolower($str);
465 465
 }
466 466
 
467
-function wpinv_utf8_strtoupper( $str, $encoding = 'UTF-8' ) {
468
-    if ( function_exists( 'mb_strtoupper' ) ) {
469
-        return mb_strtoupper( $str, $encoding );
467
+function wpinv_utf8_strtoupper($str, $encoding = 'UTF-8') {
468
+    if (function_exists('mb_strtoupper')) {
469
+        return mb_strtoupper($str, $encoding);
470 470
     }
471 471
     
472
-    return strtoupper( $str );
472
+    return strtoupper($str);
473 473
 }
474 474
 
475 475
 /**
@@ -483,12 +483,12 @@  discard block
 block discarded – undo
483 483
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
484 484
  * @return int Returns the position of the first occurrence of search in the string.
485 485
  */
486
-function wpinv_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
487
-    if ( function_exists( 'mb_strpos' ) ) {
488
-        return mb_strpos( $str, $find, $offset, $encoding );
486
+function wpinv_utf8_strpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
487
+    if (function_exists('mb_strpos')) {
488
+        return mb_strpos($str, $find, $offset, $encoding);
489 489
     }
490 490
         
491
-    return strpos( $str, $find, $offset );
491
+    return strpos($str, $find, $offset);
492 492
 }
493 493
 
494 494
 /**
@@ -502,12 +502,12 @@  discard block
 block discarded – undo
502 502
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
503 503
  * @return int Returns the position of the last occurrence of search.
504 504
  */
505
-function wpinv_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
506
-    if ( function_exists( 'mb_strrpos' ) ) {
507
-        return mb_strrpos( $str, $find, $offset, $encoding );
505
+function wpinv_utf8_strrpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
506
+    if (function_exists('mb_strrpos')) {
507
+        return mb_strrpos($str, $find, $offset, $encoding);
508 508
     }
509 509
         
510
-    return strrpos( $str, $find, $offset );
510
+    return strrpos($str, $find, $offset);
511 511
 }
512 512
 
513 513
 /**
@@ -522,16 +522,16 @@  discard block
 block discarded – undo
522 522
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
523 523
  * @return string
524 524
  */
525
-function wpinv_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
526
-    if ( function_exists( 'mb_substr' ) ) {
527
-        if ( $length === null ) {
528
-            return mb_substr( $str, $start, wpinv_utf8_strlen( $str, $encoding ), $encoding );
525
+function wpinv_utf8_substr($str, $start, $length = null, $encoding = 'UTF-8') {
526
+    if (function_exists('mb_substr')) {
527
+        if ($length === null) {
528
+            return mb_substr($str, $start, wpinv_utf8_strlen($str, $encoding), $encoding);
529 529
         } else {
530
-            return mb_substr( $str, $start, $length, $encoding );
530
+            return mb_substr($str, $start, $length, $encoding);
531 531
         }
532 532
     }
533 533
         
534
-    return substr( $str, $start, $length );
534
+    return substr($str, $start, $length);
535 535
 }
536 536
 
537 537
 /**
@@ -543,48 +543,48 @@  discard block
 block discarded – undo
543 543
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
544 544
  * @return string The width of string.
545 545
  */
546
-function wpinv_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
547
-    if ( function_exists( 'mb_strwidth' ) ) {
548
-        return mb_strwidth( $str, $encoding );
546
+function wpinv_utf8_strwidth($str, $encoding = 'UTF-8') {
547
+    if (function_exists('mb_strwidth')) {
548
+        return mb_strwidth($str, $encoding);
549 549
     }
550 550
     
551
-    return wpinv_utf8_strlen( $str, $encoding );
551
+    return wpinv_utf8_strlen($str, $encoding);
552 552
 }
553 553
 
554
-function wpinv_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
555
-    if ( function_exists( 'mb_strlen' ) ) {
556
-        $first_letter = wpinv_utf8_strtoupper( wpinv_utf8_substr( $str, 0, 1, $encoding ), $encoding );
554
+function wpinv_utf8_ucfirst($str, $lower_str_end = false, $encoding = 'UTF-8') {
555
+    if (function_exists('mb_strlen')) {
556
+        $first_letter = wpinv_utf8_strtoupper(wpinv_utf8_substr($str, 0, 1, $encoding), $encoding);
557 557
         $str_end = "";
558 558
         
559
-        if ( $lower_str_end ) {
560
-            $str_end = wpinv_utf8_strtolower( wpinv_utf8_substr( $str, 1, wpinv_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
559
+        if ($lower_str_end) {
560
+            $str_end = wpinv_utf8_strtolower(wpinv_utf8_substr($str, 1, wpinv_utf8_strlen($str, $encoding), $encoding), $encoding);
561 561
         } else {
562
-            $str_end = wpinv_utf8_substr( $str, 1, wpinv_utf8_strlen( $str, $encoding ), $encoding );
562
+            $str_end = wpinv_utf8_substr($str, 1, wpinv_utf8_strlen($str, $encoding), $encoding);
563 563
         }
564 564
 
565 565
         return $first_letter . $str_end;
566 566
     }
567 567
     
568
-    return ucfirst( $str );
568
+    return ucfirst($str);
569 569
 }
570 570
 
571
-function wpinv_utf8_ucwords( $str, $encoding = 'UTF-8' ) {
572
-    if ( function_exists( 'mb_convert_case' ) ) {
573
-        return mb_convert_case( $str, MB_CASE_TITLE, $encoding );
571
+function wpinv_utf8_ucwords($str, $encoding = 'UTF-8') {
572
+    if (function_exists('mb_convert_case')) {
573
+        return mb_convert_case($str, MB_CASE_TITLE, $encoding);
574 574
     }
575 575
     
576
-    return ucwords( $str );
576
+    return ucwords($str);
577 577
 }
578 578
 
579
-function wpinv_period_in_days( $period, $unit ) {
580
-    $period = absint( $period );
579
+function wpinv_period_in_days($period, $unit) {
580
+    $period = absint($period);
581 581
     
582
-    if ( $period > 0 ) {
583
-        if ( in_array( strtolower( $unit ), array( 'w', 'week', 'weeks' ) ) ) {
582
+    if ($period > 0) {
583
+        if (in_array(strtolower($unit), array('w', 'week', 'weeks'))) {
584 584
             $period = $period * 7;
585
-        } else if ( in_array( strtolower( $unit ), array( 'm', 'month', 'months' ) ) ) {
585
+        } else if (in_array(strtolower($unit), array('m', 'month', 'months'))) {
586 586
             $period = $period * 30;
587
-        } else if ( in_array( strtolower( $unit ), array( 'y', 'year', 'years' ) ) ) {
587
+        } else if (in_array(strtolower($unit), array('y', 'year', 'years'))) {
588 588
             $period = $period * 365;
589 589
         }
590 590
     }
@@ -592,14 +592,14 @@  discard block
 block discarded – undo
592 592
     return $period;
593 593
 }
594 594
 
595
-function wpinv_cal_days_in_month( $calendar, $month, $year ) {
596
-    if ( function_exists( 'cal_days_in_month' ) ) {
597
-        return cal_days_in_month( $calendar, $month, $year );
595
+function wpinv_cal_days_in_month($calendar, $month, $year) {
596
+    if (function_exists('cal_days_in_month')) {
597
+        return cal_days_in_month($calendar, $month, $year);
598 598
     }
599 599
 
600 600
     // Fallback in case the calendar extension is not loaded in PHP
601 601
     // Only supports Gregorian calendar
602
-    return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
602
+    return date('t', mktime(0, 0, 0, $month, 1, $year));
603 603
 }
604 604
 
605 605
 /**
@@ -610,12 +610,12 @@  discard block
 block discarded – undo
610 610
  *
611 611
  * @return string
612 612
  */
613
-function wpi_help_tip( $tip, $allow_html = false ) {
613
+function wpi_help_tip($tip, $allow_html = false) {
614 614
 
615
-    if ( $allow_html ) {
616
-        $tip = wpi_sanitize_tooltip( $tip );
615
+    if ($allow_html) {
616
+        $tip = wpi_sanitize_tooltip($tip);
617 617
     } else {
618
-        $tip = esc_attr( $tip );
618
+        $tip = esc_attr($tip);
619 619
     }
620 620
 
621 621
     return '<span class="wpi-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
@@ -629,8 +629,8 @@  discard block
 block discarded – undo
629 629
  * @param string $var
630 630
  * @return string
631 631
  */
632
-function wpi_sanitize_tooltip( $var ) {
633
-    return wp_kses( html_entity_decode( $var ), array(
632
+function wpi_sanitize_tooltip($var) {
633
+    return wp_kses(html_entity_decode($var), array(
634 634
         'br'     => array(),
635 635
         'em'     => array(),
636 636
         'strong' => array(),
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
         'li'     => array(),
642 642
         'ol'     => array(),
643 643
         'p'      => array(),
644
-    ) );
644
+    ));
645 645
 }
646 646
 
647 647
 /**
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
  */
652 652
 function wpinv_get_screen_ids() {
653 653
 
654
-    $screen_id = sanitize_title( __( 'Invoicing', 'invoicing' ) );
654
+    $screen_id = sanitize_title(__('Invoicing', 'invoicing'));
655 655
 
656 656
     $screen_ids = array(
657 657
         'toplevel_page_' . $screen_id,
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
         'invoicing_page_wpi-addons',
670 670
     );
671 671
 
672
-    return apply_filters( 'wpinv_screen_ids', $screen_ids );
672
+    return apply_filters('wpinv_screen_ids', $screen_ids);
673 673
 }
674 674
 
675 675
 /**
@@ -680,14 +680,14 @@  discard block
 block discarded – undo
680 680
  * @param array|string $list List of values.
681 681
  * @return array Sanitized array of values.
682 682
  */
683
-function wpinv_parse_list( $list ) {
683
+function wpinv_parse_list($list) {
684 684
 
685
-    if ( empty( $list ) ) {
685
+    if (empty($list)) {
686 686
         $list = array();
687 687
     }
688 688
 
689
-	if ( ! is_array( $list ) ) {
690
-		return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
689
+	if (!is_array($list)) {
690
+		return preg_split('/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY);
691 691
 	}
692 692
 
693 693
 	return $list;
@@ -701,16 +701,16 @@  discard block
 block discarded – undo
701 701
  * @param string $key Type of data to fetch.
702 702
  * @return mixed Fetched data.
703 703
  */
704
-function wpinv_get_data( $key ) {
704
+function wpinv_get_data($key) {
705 705
 
706 706
     // Try fetching it from the cache.
707
-    $data = wp_cache_get( "wpinv-data-$key", 'wpinv' );
708
-    if( $data ) {
707
+    $data = wp_cache_get("wpinv-data-$key", 'wpinv');
708
+    if ($data) {
709 709
         return $data;
710 710
     }
711 711
 
712
-    $data = apply_filters( "wpinv_get_$key", include WPINV_PLUGIN_DIR . "includes/data/$key.php" );
713
-	wp_cache_set( "wpinv-data-$key", $data, 'wpinv' );
712
+    $data = apply_filters("wpinv_get_$key", include WPINV_PLUGIN_DIR . "includes/data/$key.php");
713
+	wp_cache_set("wpinv-data-$key", $data, 'wpinv');
714 714
 
715 715
 	return $data;
716 716
 }
@@ -724,10 +724,10 @@  discard block
 block discarded – undo
724 724
  * @param bool $first_empty Whether or not the first item in the list should be empty
725 725
  * @return mixed Fetched data.
726 726
  */
727
-function wpinv_maybe_add_empty_option( $options, $first_empty ) {
727
+function wpinv_maybe_add_empty_option($options, $first_empty) {
728 728
 
729
-    if ( ! empty( $options ) && $first_empty ) {
730
-        return array_merge( array( '' => '' ), $options );
729
+    if (!empty($options) && $first_empty) {
730
+        return array_merge(array('' => ''), $options);
731 731
     }
732 732
     return $options;
733 733
 
@@ -739,21 +739,21 @@  discard block
 block discarded – undo
739 739
  * @param mixed $var Data to sanitize.
740 740
  * @return string|array
741 741
  */
742
-function wpinv_clean( $var ) {
742
+function wpinv_clean($var) {
743 743
 
744
-	if ( is_array( $var ) ) {
745
-		return array_map( 'wpinv_clean', $var );
744
+	if (is_array($var)) {
745
+		return array_map('wpinv_clean', $var);
746 746
     }
747 747
 
748
-    if ( is_object( $var ) ) {
749
-		$object_vars = get_object_vars( $var );
750
-		foreach ( $object_vars as $property_name => $property_value ) {
751
-			$var->$property_name = wpinv_clean( $property_value );
748
+    if (is_object($var)) {
749
+		$object_vars = get_object_vars($var);
750
+		foreach ($object_vars as $property_name => $property_value) {
751
+			$var->$property_name = wpinv_clean($property_value);
752 752
         }
753 753
         return $var;
754 754
 	}
755 755
     
756
-    return is_string( $var ) ? sanitize_text_field( $var ) : $var;
756
+    return is_string($var) ? sanitize_text_field($var) : $var;
757 757
 }
758 758
 
759 759
 /**
@@ -762,43 +762,43 @@  discard block
 block discarded – undo
762 762
  * @param string $str Data to convert.
763 763
  * @return string|array
764 764
  */
765
-function getpaid_convert_price_string_to_options( $str ) {
765
+function getpaid_convert_price_string_to_options($str) {
766 766
 
767
-	$raw_options = array_map( 'trim', explode( ',', $str ) );
768
-    $options     = array();
767
+	$raw_options = array_map('trim', explode(',', $str));
768
+    $options = array();
769 769
 
770
-    foreach ( $raw_options as $option ) {
770
+    foreach ($raw_options as $option) {
771 771
 
772
-        if ( '' == $option ) {
772
+        if ('' == $option) {
773 773
             continue;
774 774
         }
775 775
 
776
-        $option = array_map( 'trim', explode( '|', $option ) );
776
+        $option = array_map('trim', explode('|', $option));
777 777
 
778 778
         $price = null;
779 779
         $label = null;
780 780
 
781
-        if ( isset( $option[0] ) && '' !=  $option[0] ) {
782
-            $label  = $option[0];
781
+        if (isset($option[0]) && '' != $option[0]) {
782
+            $label = $option[0];
783 783
         }
784 784
 
785
-        if ( isset( $option[1] ) && '' !=  $option[1] ) {
785
+        if (isset($option[1]) && '' != $option[1]) {
786 786
             $price = $option[1];
787 787
         }
788 788
 
789
-        if ( ! isset( $price ) ) {
789
+        if (!isset($price)) {
790 790
             $price = $label;
791 791
         }
792 792
 
793
-        if ( ! isset( $price ) || ! is_numeric( $price ) ) {
793
+        if (!isset($price) || !is_numeric($price)) {
794 794
             continue;
795 795
         }
796 796
 
797
-        if ( ! isset( $label ) ) {
797
+        if (!isset($label)) {
798 798
             $label = $price;
799 799
         }
800 800
 
801
-        $options[ $price ] = $label;
801
+        $options[$price] = $label;
802 802
     }
803 803
 
804 804
     return $options;
@@ -807,22 +807,22 @@  discard block
 block discarded – undo
807 807
 /**
808 808
  * Returns the help tip.
809 809
  */
810
-function getpaid_get_help_tip( $tip, $additional_classes = '' ) {
811
-    $additional_classes = sanitize_html_class( $additional_classes );
812
-    $tip                = esc_attr__( $tip );
810
+function getpaid_get_help_tip($tip, $additional_classes = '') {
811
+    $additional_classes = sanitize_html_class($additional_classes);
812
+    $tip                = esc_attr__($tip);
813 813
     return "<span class='wpi-help-tip dashicons dashicons-editor-help $additional_classes' title='$tip'></span>";
814 814
 }
815 815
 
816 816
 /**
817 817
  * Formats a date
818 818
  */
819
-function getpaid_format_date( $date ) {
819
+function getpaid_format_date($date) {
820 820
 
821
-    if ( empty( $date ) || $date == '0000-00-00 00:00:00' ) {
821
+    if (empty($date) || $date == '0000-00-00 00:00:00') {
822 822
         return '';
823 823
     }
824 824
 
825
-    return date_i18n( getpaid_date_format(), strtotime( $date ) );
825
+    return date_i18n(getpaid_date_format(), strtotime($date));
826 826
 
827 827
 }
828 828
 
@@ -831,9 +831,9 @@  discard block
 block discarded – undo
831 831
  *
832 832
  * @return string
833 833
  */
834
-function getpaid_format_date_value( $date, $default = "&mdash;" ) {
835
-    $date = getpaid_format_date( $date );
836
-    return empty( $date ) ? $default : $date;
834
+function getpaid_format_date_value($date, $default = "&mdash;") {
835
+    $date = getpaid_format_date($date);
836
+    return empty($date) ? $default : $date;
837 837
 }
838 838
 
839 839
 /**
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
  * @return string
843 843
  */
844 844
 function getpaid_date_format() {
845
-	return apply_filters( 'getpaid_date_format', get_option( 'date_format' ) );
845
+	return apply_filters('getpaid_date_format', get_option('date_format'));
846 846
 }
847 847
 
848 848
 /**
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
  * @return string
852 852
  */
853 853
 function getpaid_time_format() {
854
-	return apply_filters( 'getpaid_time_format', get_option( 'time_format' ) );
854
+	return apply_filters('getpaid_time_format', get_option('time_format'));
855 855
 }
856 856
 
857 857
 /**
@@ -861,16 +861,16 @@  discard block
 block discarded – undo
861 861
  * @param  integer $limit Limit size in characters.
862 862
  * @return string
863 863
  */
864
-function getpaid_limit_length( $string, $limit ) {
864
+function getpaid_limit_length($string, $limit) {
865 865
     $str_limit = $limit - 3;
866 866
 
867
-	if ( function_exists( 'mb_strimwidth' ) ) {
868
-		if ( mb_strlen( $string ) > $limit ) {
869
-			$string = mb_strimwidth( $string, 0, $str_limit ) . '...';
867
+	if (function_exists('mb_strimwidth')) {
868
+		if (mb_strlen($string) > $limit) {
869
+			$string = mb_strimwidth($string, 0, $str_limit) . '...';
870 870
 		}
871 871
 	} else {
872
-		if ( strlen( $string ) > $limit ) {
873
-			$string = substr( $string, 0, $str_limit ) . '...';
872
+		if (strlen($string) > $limit) {
873
+			$string = substr($string, 0, $str_limit) . '...';
874 874
 		}
875 875
 	}
876 876
     return $string;
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
  * @since 1.0.19
885 885
  */
886 886
 function getpaid_api() {
887
-    return getpaid()->get( 'api' );
887
+    return getpaid()->get('api');
888 888
 }
889 889
 
890 890
 /**
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
  * @since 1.0.19
895 895
  */
896 896
 function getpaid_post_types() {
897
-    return getpaid()->get( 'post_types' );
897
+    return getpaid()->get('post_types');
898 898
 }
899 899
 
900 900
 /**
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
  * @since 1.0.19
905 905
  */
906 906
 function getpaid_session() {
907
-    return getpaid()->get( 'session' );
907
+    return getpaid()->get('session');
908 908
 }
909 909
 
910 910
 /**
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
  * @since 1.0.19
915 915
  */
916 916
 function getpaid_notes() {
917
-    return getpaid()->get( 'notes' );
917
+    return getpaid()->get('notes');
918 918
 }
919 919
 
920 920
 /**
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
  * @return GetPaid_Admin
924 924
  */
925 925
 function getpaid_admin() {
926
-    return getpaid()->get( 'admin' );
926
+    return getpaid()->get('admin');
927 927
 }
928 928
 
929 929
 /**
@@ -933,6 +933,6 @@  discard block
 block discarded – undo
933 933
  * @param string $base the base url
934 934
  * @return string
935 935
  */
936
-function getpaid_get_authenticated_action_url( $action, $base = false ) {
937
-    return wp_nonce_url( add_query_arg( 'getpaid-action', $action, $base ), 'getpaid-nonce', 'getpaid-nonce' );
936
+function getpaid_get_authenticated_action_url($action, $base = false) {
937
+    return wp_nonce_url(add_query_arg('getpaid-action', $action, $base), 'getpaid-nonce', 'getpaid-nonce');
938 938
 }
Please login to merge, or discard this patch.
includes/payments/class-getpaid-payment-form-submission-items.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Payment form submission itemss class
@@ -23,26 +23,26 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @param GetPaid_Payment_Form_Submission $submission
25 25
 	 */
26
-	public function __construct( $submission ) {
26
+	public function __construct($submission) {
27 27
 
28 28
 		$data         = $submission->get_data();
29 29
 		$payment_form = $submission->get_payment_form();
30 30
 
31 31
 		// Prepare the selected items.
32 32
 		$selected_items = array();
33
-		if ( ! empty( $data['getpaid-items'] ) ) {
34
-			$selected_items = wpinv_clean( $data['getpaid-items'] );
33
+		if (!empty($data['getpaid-items'])) {
34
+			$selected_items = wpinv_clean($data['getpaid-items']);
35 35
 		}
36 36
 
37 37
 		// For default forms, ensure that an item has been set.
38
-		if ( $payment_form->is_default() && ! $submission->has_invoice() && isset( $data['getpaid-form-items'] ) ) {
39
-			$form_items = wpinv_clean( $data['getpaid-form-items'] );
40
-			$payment_form->set_items( getpaid_convert_items_to_array( $form_items ) );
38
+		if ($payment_form->is_default() && !$submission->has_invoice() && isset($data['getpaid-form-items'])) {
39
+			$form_items = wpinv_clean($data['getpaid-form-items']);
40
+			$payment_form->set_items(getpaid_convert_items_to_array($form_items));
41 41
 		}
42 42
 
43 43
 		// Process each individual item.
44
-		foreach ( $payment_form->get_items() as $item ) {
45
-			$this->process_item( $item, $selected_items );
44
+		foreach ($payment_form->get_items() as $item) {
45
+			$this->process_item($item, $selected_items);
46 46
 		}
47 47
 
48 48
 	}
@@ -53,30 +53,30 @@  discard block
 block discarded – undo
53 53
 	 * @param GetPaid_Form_Item $item
54 54
 	 * @param array $selected_items
55 55
 	 */
56
-	public function process_item( $item, $selected_items ) {
56
+	public function process_item($item, $selected_items) {
57 57
 
58 58
 		// Abort if this is an optional item and it has not been selected.
59
-		if ( ! $item->is_required() && ! isset( $selected_items[ $item->get_id() ] ) ) {
59
+		if (!$item->is_required() && !isset($selected_items[$item->get_id()])) {
60 60
 			return;
61 61
 		}
62 62
 
63 63
 		// (maybe) let customers change the quantities and prices.
64
-		if ( isset( $selected_items[ $item->get_id() ] ) ) {
64
+		if (isset($selected_items[$item->get_id()])) {
65 65
 
66 66
 			// Maybe change the quantities.
67
-			if ( $item->allows_quantities() ) {
68
-				$item->set_quantity( (int) $selected_items[ $item->get_id() ]['quantity'] );
67
+			if ($item->allows_quantities()) {
68
+				$item->set_quantity((int) $selected_items[$item->get_id()]['quantity']);
69 69
 			}
70 70
 
71 71
 			// Maybe change the price.
72
-			if ( $item->user_can_set_their_price() ) {
73
-				$price = (float) wpinv_sanitize_amount( $selected_items[ $item->get_id() ]['price'] );
72
+			if ($item->user_can_set_their_price()) {
73
+				$price = (float) wpinv_sanitize_amount($selected_items[$item->get_id()]['price']);
74 74
 
75
-				if ( $item->get_minimum_price() > $price ) {
76
-					throw new Exception( sprintf( __( 'The minimum allowed amount is %s', 'invoicing' ), wpinv_sanitize_amount( $item->get_minimum_price() ) ) );
75
+				if ($item->get_minimum_price() > $price) {
76
+					throw new Exception(sprintf(__('The minimum allowed amount is %s', 'invoicing'), wpinv_sanitize_amount($item->get_minimum_price())));
77 77
 				}
78 78
 
79
-				$item->set_price( $price );
79
+				$item->set_price($price);
80 80
 
81 81
 			}
82 82
 
Please login to merge, or discard this patch.
templates/payment-forms/cart-item.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -7,80 +7,80 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-do_action( 'getpaid_before_payment_form_cart_item', $form, $item );
12
+do_action('getpaid_before_payment_form_cart_item', $form, $item);
13 13
 
14 14
 $currency = $form->get_currency();
15 15
 
16 16
 ?>
17
-<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required'  : 'selectable'; ?> item-<?php echo $item->get_id(); ?>'>
17
+<div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo $item->get_id(); ?>'>
18 18
     <div class="form-row">
19
-        <?php foreach ( $columns as $key => $label ) : ?>
20
-            <div class="<?php echo 'name' == $key ? 'col-12 col-sm-5' : 'col-12 col-sm' ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>-<?php echo $item->get_id(); ?>">
19
+        <?php foreach ($columns as $key => $label) : ?>
20
+            <div class="<?php echo 'name' == $key ? 'col-12 col-sm-5' : 'col-12 col-sm' ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?>-<?php echo $item->get_id(); ?>">
21 21
                 <?php
22 22
 
23 23
                     // Item name.
24
-                    if ( 'name' == $key ) {
25
-                        echo sanitize_text_field( $item->get_name() );
24
+                    if ('name' == $key) {
25
+                        echo sanitize_text_field($item->get_name());
26 26
                         $description = $item->get_description();
27 27
 
28
-                        if ( ! empty( $description ) ) {
29
-                            $description = wp_kses_post( $description );
28
+                        if (!empty($description)) {
29
+                            $description = wp_kses_post($description);
30 30
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
31 31
                         }
32 32
 
33
-                        $description = getpaid_item_recurring_price_help_text( $item, $currency );
33
+                        $description = getpaid_item_recurring_price_help_text($item, $currency);
34 34
 
35
-                        if ( $description ) {
35
+                        if ($description) {
36 36
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
37 37
                         }
38 38
                     }
39 39
 
40 40
                     // Item price.
41
-                    if ( 'price' == $key ) {
41
+                    if ('price' == $key) {
42 42
 
43 43
                         // Set the currency position.
44 44
                         $position = wpinv_currency_position();
45 45
 
46
-                        if ( $position == 'left_space' ) {
46
+                        if ($position == 'left_space') {
47 47
                             $position = 'left';
48 48
                         }
49 49
 
50
-                        if ( $position == 'right_space' ) {
50
+                        if ($position == 'right_space') {
51 51
                             $position = 'right';
52 52
                         }
53 53
 
54
-                        if ( $item->user_can_set_their_price() ) {
55
-                            $price = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
54
+                        if ($item->user_can_set_their_price()) {
55
+                            $price = max((float) $item->get_price(), (float) $item->get_minimum_price());
56 56
                             ?>
57 57
                                 <div class="input-group input-group-sm">
58
-                                    <?php if( 'left' == $position ) : ?>
58
+                                    <?php if ('left' == $position) : ?>
59 59
                                         <div class="input-group-prepend">
60
-                                            <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
60
+                                            <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
61 61
                                         </div>
62 62
                                     <?php endif; ?>
63
-                                    <input type="text" name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo $price; ?>" placeholder="<?php echo esc_attr( $item->get_minimum_price() ); ?>" class="getpaid-item-price-input">
63
+                                    <input type="text" name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo $price; ?>" placeholder="<?php echo esc_attr($item->get_minimum_price()); ?>" class="getpaid-item-price-input">
64 64
 
65
-                                    <?php if( 'left' != $position ) : ?>
65
+                                    <?php if ('left' != $position) : ?>
66 66
                                         <div class="input-group-append">
67
-                                            <span class="input-group-text"><?php echo wpinv_currency_symbol( $currency ); ?></span>
67
+                                            <span class="input-group-text"><?php echo wpinv_currency_symbol($currency); ?></span>
68 68
                                         </div>
69 69
                                     <?php endif; ?>
70 70
                                 </div>
71 71
                             <?php
72 72
                         } else {
73
-                            echo wpinv_price( wpinv_format_amount( $item->get_price() ), $currency );
73
+                            echo wpinv_price(wpinv_format_amount($item->get_price()), $currency);
74 74
                             ?>
75
-                                <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'>
75
+                                <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr($item->get_price()); ?>'>
76 76
                             <?php
77 77
                         }
78 78
                     }
79 79
 
80 80
                     // Item quantity.
81
-                    if ( 'quantity' == $key ) {
81
+                    if ('quantity' == $key) {
82 82
 
83
-                        if ( $item->allows_quantities() ) {
83
+                        if ($item->allows_quantities()) {
84 84
                             ?>
85 85
                                 <input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='number' class='getpaid-item-quantity-input pr-1' value='<?php echo (int) $item->get_qantity(); ?>' min='1' required>
86 86
                             <?php
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
                     }
95 95
 
96 96
                     // Item sub total.
97
-                    if ( 'subtotal' == $key ) {
98
-                        echo wpinv_price( wpinv_format_amount( $item->get_sub_total() ), $currency );
97
+                    if ('subtotal' == $key) {
98
+                        echo wpinv_price(wpinv_format_amount($item->get_sub_total()), $currency);
99 99
                     }
100 100
 
101
-                    do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
101
+                    do_action("getpaid_payment_form_cart_item_$key", $item, $form);
102 102
                 ?>
103 103
             </div>
104 104
         <?php endforeach; ?>
105 105
     </div>
106 106
 </div>
107 107
 <?php
108
-do_action(  'getpaid_payment_form_cart_item', $form, $item );
108
+do_action('getpaid_payment_form_cart_item', $form, $item);
Please login to merge, or discard this patch.