Passed
Push — master ( 30cab3...67eff9 )
by Brian
05:11
created
templates/invoice/line-items.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -8,21 +8,21 @@  discard block
 block discarded – undo
8 8
  * @var WPInv_Invoice $invoice
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 ?>
14 14
 
15
-<?php do_action( 'getpaid_invoice_before_line_items', $invoice ); ?>
15
+<?php do_action('getpaid_invoice_before_line_items', $invoice); ?>
16 16
 
17
-    <h2 class="mt-5 mb-1 h4"><?php echo sprintf( esc_html__( '%s Items', 'invoicing' ), ucfirst( $invoice->get_invoice_quote_type() )); ?></h2>
17
+    <h2 class="mt-5 mb-1 h4"><?php echo sprintf(esc_html__('%s Items', 'invoicing'), ucfirst($invoice->get_invoice_quote_type())); ?></h2>
18 18
     <div class="getpaid-invoice-items mb-4 border">
19 19
 
20 20
 
21
-        <div class="getpaid-invoice-items-header <?php echo sanitize_html_class( $invoice->get_template() ); ?>">
21
+        <div class="getpaid-invoice-items-header <?php echo sanitize_html_class($invoice->get_template()); ?>">
22 22
             <div class="form-row">
23
-                <?php foreach ( $columns as $key => $label ) : ?>
24
-                    <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-line-item-col-<?php echo esc_attr( $key ); ?>">
25
-                        <?php echo esc_html( $label ); ?>
23
+                <?php foreach ($columns as $key => $label) : ?>
24
+                    <div class="<?php echo 'name' == $key ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-line-item-col-<?php echo esc_attr($key); ?>">
25
+                        <?php echo esc_html($label); ?>
26 26
                     </div>
27 27
                 <?php endforeach; ?>
28 28
             </div>
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
         <?php
33 33
 
34 34
             // Display the item totals.
35
-            foreach ( $invoice->get_items() as $item ) {
36
-                wpinv_get_template( 'invoice/line-item.php', compact( 'invoice', 'item', 'columns' ) );
35
+            foreach ($invoice->get_items() as $item) {
36
+                wpinv_get_template('invoice/line-item.php', compact('invoice', 'item', 'columns'));
37 37
             }
38 38
 
39 39
             // Display the fee totals.
40
-            foreach ( $invoice->get_fees() as $fee ) {
41
-                wpinv_get_template( 'invoice/fee-item.php', compact( 'invoice', 'fee', 'columns' ) );
40
+            foreach ($invoice->get_fees() as $fee) {
41
+                wpinv_get_template('invoice/fee-item.php', compact('invoice', 'fee', 'columns'));
42 42
             }
43 43
 
44 44
             // Display the cart totals.
45
-            wpinv_get_template( 'invoice/line-totals.php', compact( 'invoice' ) );
45
+            wpinv_get_template('invoice/line-totals.php', compact('invoice'));
46 46
 
47 47
         ?>
48 48
 
49 49
     </div>
50 50
 
51
-<?php do_action( 'getpaid_invoice_after_line_items', $invoice ); ?>
51
+<?php do_action('getpaid_invoice_after_line_items', $invoice); ?>
Please login to merge, or discard this patch.
templates/invoice/invoice-meta.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,50 +7,50 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$class = ! is_singular( 'page' ) ? 'px-1' : '';
12
+$class = !is_singular('page') ? 'px-1' : '';
13 13
 ?>
14 14
 
15
-        <?php do_action( 'getpaid_before_invoice_meta', $invoice ); ?>
15
+        <?php do_action('getpaid_before_invoice_meta', $invoice); ?>
16 16
         <div class="getpaid-invoice-meta-data">
17 17
 
18
-            <?php do_action( 'getpaid_before_invoice_meta_table', $invoice ); ?>
18
+            <?php do_action('getpaid_before_invoice_meta_table', $invoice); ?>
19 19
             <table class="table table-bordered">
20 20
                 <tbody>
21 21
 
22
-                    <?php do_action( "getpaid_before_invoice_meta_rows", $invoice ); ?>
23
-                    <?php foreach ( $meta as $key => $data ) : ?>
22
+                    <?php do_action("getpaid_before_invoice_meta_rows", $invoice); ?>
23
+                    <?php foreach ($meta as $key => $data) : ?>
24 24
 
25
-                        <?php if ( ! empty( $data['value'] ) ) : ?>
25
+                        <?php if (!empty($data['value'])) : ?>
26 26
 
27
-                            <?php do_action( "getpaid_before_invoice_meta_$key", $invoice, $data ); ?>
27
+                            <?php do_action("getpaid_before_invoice_meta_$key", $invoice, $data); ?>
28 28
 
29
-                            <tr class="getpaid-invoice-meta-<?php echo sanitize_html_class( $key ); ?>">
29
+                            <tr class="getpaid-invoice-meta-<?php echo sanitize_html_class($key); ?>">
30 30
 
31 31
                                 <th class="<?php echo $class; ?> font-weight-bold" style="width: 40%">
32
-                                    <?php echo esc_html( $data['label'] ); ?>
32
+                                    <?php echo esc_html($data['label']); ?>
33 33
                                 </th>
34 34
 
35 35
                                 <td class="<?php echo $class; ?> <?php echo $key == 'invoice_total' ? 'font-weight-bold' : 'font-weight-normal'; ?> text-break" style="width: 60%">
36
-                                    <span class="getpaid-invoice-meta-<?php echo sanitize_html_class( $key ); ?>-value"><?php echo wp_kses_post( $data['value'] ); ?></span>
36
+                                    <span class="getpaid-invoice-meta-<?php echo sanitize_html_class($key); ?>-value"><?php echo wp_kses_post($data['value']); ?></span>
37 37
                                 </td>
38 38
 
39 39
                             </tr>
40 40
 
41
-                            <?php do_action( "getpaid_after_invoice_meta_$key", $invoice, $data ); ?>
41
+                            <?php do_action("getpaid_after_invoice_meta_$key", $invoice, $data); ?>
42 42
 
43 43
                         <?php endif; ?>
44 44
                     
45 45
                     <?php endforeach; ?>
46
-                    <?php do_action( "getpaid_after_invoice_meta_rows", $invoice ); ?>
46
+                    <?php do_action("getpaid_after_invoice_meta_rows", $invoice); ?>
47 47
 
48 48
                 </tbody>
49 49
             </table>
50
-            <?php do_action( 'getpaid_after_invoice_meta_table', $invoice ); ?>
50
+            <?php do_action('getpaid_after_invoice_meta_table', $invoice); ?>
51 51
 
52 52
 
53 53
         </div>
54
-        <?php do_action( 'getpaid_after_invoice_meta', $invoice ); ?>
54
+        <?php do_action('getpaid_after_invoice_meta', $invoice); ?>
55 55
 
56 56
 <?php
Please login to merge, or discard this patch.
templates/invoice/fee-item.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
  * @var array $fee
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14
-do_action( 'getpaid_before_invoice_fee_item', $invoice, $fee );
14
+do_action('getpaid_before_invoice_fee_item', $invoice, $fee);
15 15
 
16 16
 ?>
17 17
 
@@ -19,66 +19,66 @@  discard block
 block discarded – undo
19 19
 
20 20
     <div class="form-row">
21 21
 
22
-        <?php foreach ( array_keys( $columns ) as $column ): ?>
22
+        <?php foreach (array_keys($columns) as $column): ?>
23 23
 
24
-            <div class="<?php echo 'name' == $column ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-item-<?php echo sanitize_html_class( $column ); ?>">
24
+            <div class="<?php echo 'name' == $column ? 'col-12 col-sm-6' : 'col-12 col-sm' ?> getpaid-invoice-item-<?php echo sanitize_html_class($column); ?>">
25 25
 
26 26
                 <?php
27 27
 
28 28
                     // Fires before printing a fee item column.
29
-                    do_action( "getpaid_invoice_fee_item_before_$column", $fee, $invoice );
29
+                    do_action("getpaid_invoice_fee_item_before_$column", $fee, $invoice);
30 30
 
31 31
                     // Item name.
32
-                    if ( 'name' == $column ) {
32
+                    if ('name' == $column) {
33 33
 
34 34
                         // Display the name.
35
-                        echo '<div class="mb-1">' . esc_html( $fee['name'] ) . '</div>';
35
+                        echo '<div class="mb-1">' . esc_html($fee['name']) . '</div>';
36 36
 
37 37
                         // And an optional description.
38
-                        $description = empty( $fee['description'] ) ? esc_html__( 'Fee', 'invoicing' ) : esc_html( $fee['description'] );
38
+                        $description = empty($fee['description']) ? esc_html__('Fee', 'invoicing') : esc_html($fee['description']);
39 39
                         echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
40 40
 
41 41
                     }
42 42
 
43 43
                     // Item price.
44
-                    if ( 'price' == $column ) {
44
+                    if ('price' == $column) {
45 45
 
46 46
                         // Display the item price (or recurring price if this is a renewal invoice)
47
-                        if ( $invoice->is_recurring() && $invoice->is_renewal() ) {
48
-                            echo wpinv_price( $fee['recurring_fee'], $invoice->get_currency() );
47
+                        if ($invoice->is_recurring() && $invoice->is_renewal()) {
48
+                            echo wpinv_price($fee['recurring_fee'], $invoice->get_currency());
49 49
                         } else {
50
-                            echo wpinv_price( $fee['initial_fee'], $invoice->get_currency() );
50
+                            echo wpinv_price($fee['initial_fee'], $invoice->get_currency());
51 51
                         }
52 52
 
53 53
                     }
54 54
 
55 55
                     // Item quantity.
56
-                    if ( 'quantity' == $column ) {
56
+                    if ('quantity' == $column) {
57 57
                         echo "&mdash;";
58 58
                     }
59 59
 
60 60
                     // Item tax.
61
-                    if ( 'tax_rate' == $column ) {
61
+                    if ('tax_rate' == $column) {
62 62
                         echo "&mdash;";
63 63
                     }
64 64
 
65 65
                     // Item sub total.
66
-                    if ( 'subtotal' == $column ) {
66
+                    if ('subtotal' == $column) {
67 67
 
68 68
                         // Display the item price (or recurring price if this is a renewal invoice)
69
-                        if ( $invoice->is_recurring() && $invoice->is_renewal() ) {
70
-                            echo wpinv_price( $fee['recurring_fee'], $invoice->get_currency() );
69
+                        if ($invoice->is_recurring() && $invoice->is_renewal()) {
70
+                            echo wpinv_price($fee['recurring_fee'], $invoice->get_currency());
71 71
                         } else {
72
-                            echo wpinv_price( $fee['initial_fee'], $invoice->get_currency() );
72
+                            echo wpinv_price($fee['initial_fee'], $invoice->get_currency());
73 73
                         }
74 74
 
75 75
                     }
76 76
 
77 77
                     // Fires when printing a fee item column.
78
-                    do_action( "getpaid_invoice_fee_item_$column", $fee, $invoice );
78
+                    do_action("getpaid_invoice_fee_item_$column", $fee, $invoice);
79 79
 
80 80
                     // Fires after printing a fee item column.
81
-                    do_action( "getpaid_invoice_fee_item_after_$column", $fee, $invoice );
81
+                    do_action("getpaid_invoice_fee_item_after_$column", $fee, $invoice);
82 82
 
83 83
                 ?>
84 84
 
Please login to merge, or discard this patch.
templates/wpinv-invoice-print.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,20 +7,20 @@  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
 // Fetch the invoice.
13
-if ( empty( $invoice ) ) {
14
-    $invoice = new WPInv_Invoice( $GLOBALS['post'] );
13
+if (empty($invoice)) {
14
+    $invoice = new WPInv_Invoice($GLOBALS['post']);
15 15
 }
16 16
 
17 17
 // Abort if it does not exist.
18
-if ( $invoice->get_id() == 0 ) {
18
+if ($invoice->get_id() == 0) {
19 19
     exit;
20 20
 }
21 21
 
22 22
 // Fires before printing an invoice.
23
-do_action( 'wpinv_invoice_print_before_display', $invoice );
23
+do_action('wpinv_invoice_print_before_display', $invoice);
24 24
 
25 25
 ?><!DOCTYPE html>
26 26
 
@@ -29,24 +29,24 @@  discard block
 block discarded – undo
29 29
 
30 30
     <head>
31 31
 
32
-		<meta charset="<?php bloginfo( 'charset' ); ?>">
32
+		<meta charset="<?php bloginfo('charset'); ?>">
33 33
         <meta name="viewport" content="width=device-width, initial-scale=1.0" >
34 34
 
35 35
         <meta name="robots" content="noindex,nofollow">
36 36
 
37 37
 		<link rel="profile" href="https://gmpg.org/xfn/11">
38 38
 
39
-        <title>#<?php echo esc_html( $invoice->get_number() ); ?></title>
39
+        <title>#<?php echo esc_html($invoice->get_number()); ?></title>
40 40
 
41
-        <?php do_action( 'wpinv_invoice_print_head', $invoice ); ?>
41
+        <?php do_action('wpinv_invoice_print_head', $invoice); ?>
42 42
 
43 43
     </head>
44 44
 
45 45
 
46 46
     <body class="body wpinv wpinv-print" style="font-weight: 400;">
47 47
 
48
-        <?php do_action( 'getpaid_invoice', $invoice ); ?>
49
-        <?php do_action( 'wpinv_invoice_print_body_end', $invoice ); ?>
48
+        <?php do_action('getpaid_invoice', $invoice); ?>
49
+        <?php do_action('wpinv_invoice_print_body_end', $invoice); ?>
50 50
 
51 51
     </body>
52 52
 
Please login to merge, or discard this patch.
templates/payment-forms-admin/previews/ip_address.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 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
 ?>
13 13
 <span>{{form_element.text}}</span>
14 14
 <a target='_blank' href="#">
15
-    <?php echo esc_html( wpinv_get_ip() ); ?>&nbsp;&nbsp;<i class='fa fa-external-link-square' aria-hidden='true'></i>
15
+    <?php echo esc_html(wpinv_get_ip()); ?>&nbsp;&nbsp;<i class='fa fa-external-link-square' aria-hidden='true'></i>
16 16
 </a>
Please login to merge, or discard this patch.
includes/admin/register-settings.php 2 patches
Indentation   +301 added lines, -301 removed lines patch added patch discarded remove patch
@@ -195,13 +195,13 @@  discard block
 block discarded – undo
195 195
     $name       = isset( $option['name'] ) ? $option['name'] : '';
196 196
     $cb         = "wpinv_{$option['type']}_callback";
197 197
     $section    = "wpinv_settings_{$tab}_$section";
198
-	$is_wizzard = is_admin() && isset( $_GET['page'] ) && 'gp-setup' == $_GET['page'];
198
+    $is_wizzard = is_admin() && isset( $_GET['page'] ) && 'gp-setup' == $_GET['page'];
199 199
 
200
-	if ( isset( $option['desc'] ) && ( ! $is_wizzard && ! empty( $option['help-tip'] ) ) ) {
201
-		$tip   = wpinv_clean( $option['desc'] );
202
-		$name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
203
-		unset( $option['desc'] );
204
-	}
200
+    if ( isset( $option['desc'] ) && ( ! $is_wizzard && ! empty( $option['help-tip'] ) ) ) {
201
+        $tip   = wpinv_clean( $option['desc'] );
202
+        $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
203
+        unset( $option['desc'] );
204
+    }
205 205
 
206 206
     // Loop through all tabs.
207 207
     add_settings_field(
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
             'faux'        => isset( $option['faux'] )        ? $option['faux']        : false,
229 229
             'onchange'    => isset( $option['onchange'] )   ? $option['onchange']     : '',
230 230
             'custom'      => isset( $option['custom'] )     ? $option['custom']       : '',
231
-			'default_content' => isset( $option['default_content'] )     ? $option['default_content']       : '',
232
-			'class'       => isset( $option['class'] )     ? $option['class']         : '',
233
-			'style'       => isset( $option['style'] )     ? $option['style']         : '',
231
+            'default_content' => isset( $option['default_content'] )     ? $option['default_content']       : '',
232
+            'class'       => isset( $option['class'] )     ? $option['class']         : '',
233
+            'style'       => isset( $option['style'] )     ? $option['style']         : '',
234 234
             'cols'        => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
235 235
             'rows'        => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
236 236
         )
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
  * @return array
245 245
  */
246 246
 function wpinv_get_registered_settings() {
247
-	return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
247
+    return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
248 248
 }
249 249
 
250 250
 /**
@@ -263,18 +263,18 @@  discard block
 block discarded – undo
263 263
  */
264 264
 function wpinv_settings_sanitize( $input = array() ) {
265 265
 
266
-	$wpinv_options = wpinv_get_options();
267
-	$raw_referrer  = wp_get_raw_referer();
266
+    $wpinv_options = wpinv_get_options();
267
+    $raw_referrer  = wp_get_raw_referer();
268 268
 
269 269
     if ( empty( $raw_referrer ) ) {
270
-		return array_merge( $wpinv_options, $input );
270
+        return array_merge( $wpinv_options, $input );
271 271
     }
272 272
 
273 273
     wp_parse_str( $raw_referrer, $referrer );
274 274
 
275
-	if ( in_array( 'gp-setup', $referrer ) ) {
276
-		return array_merge( $wpinv_options, $input );
277
-	}
275
+    if ( in_array( 'gp-setup', $referrer ) ) {
276
+        return array_merge( $wpinv_options, $input );
277
+    }
278 278
 
279 279
     $settings = wpinv_get_registered_settings();
280 280
     $tab      = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
@@ -296,10 +296,10 @@  discard block
 block discarded – undo
296 296
         }
297 297
 
298 298
         // General filter
299
-		$input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
299
+        $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
300 300
 
301
-		// Key specific filter.
302
-		$input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
301
+        // Key specific filter.
302
+        $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
303 303
     }
304 304
 
305 305
     // Loop through the whitelist and unset any that are empty for the tab being saved
@@ -342,14 +342,14 @@  discard block
 block discarded – undo
342 342
 
343 343
     foreach ( $new_rates as $rate ) {
344 344
 
345
-		$rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
346
-		$rate['name']    = sanitize_text_field( $rate['name'] );
347
-		$rate['state']   = sanitize_text_field( $rate['state'] );
348
-		$rate['country'] = sanitize_text_field( $rate['country'] );
349
-		$rate['global']  = empty( $rate['state'] );
350
-		$tax_rates[]     = $rate;
345
+        $rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
346
+        $rate['name']    = sanitize_text_field( $rate['name'] );
347
+        $rate['state']   = sanitize_text_field( $rate['state'] );
348
+        $rate['country'] = sanitize_text_field( $rate['country'] );
349
+        $rate['global']  = empty( $rate['state'] );
350
+        $tax_rates[]     = $rate;
351 351
 
352
-	}
352
+    }
353 353
 
354 354
     update_option( 'wpinv_tax_rates', $tax_rates );
355 355
 
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
     $tabs['general']  = __( 'General', 'invoicing' );
363 363
     $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
364 364
     $tabs['taxes']    = __( 'Taxes', 'invoicing' );
365
-	$tabs['emails']   = __( 'Emails', 'invoicing' );
365
+    $tabs['emails']   = __( 'Emails', 'invoicing' );
366 366
 
367
-	if ( count( getpaid_get_integration_settings() ) > 0 ) {
368
-		$tabs['integrations'] = __( 'Integrations', 'invoicing' );
369
-	}
367
+    if ( count( getpaid_get_integration_settings() ) > 0 ) {
368
+        $tabs['integrations'] = __( 'Integrations', 'invoicing' );
369
+    }
370 370
 
371 371
     $tabs['privacy']  = __( 'Privacy', 'invoicing' );
372 372
     $tabs['misc']     = __( 'Misc', 'invoicing' );
@@ -405,14 +405,14 @@  discard block
 block discarded – undo
405 405
         ) ),
406 406
         'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array(
407 407
             'main'  => __( 'Tax Settings', 'invoicing' ),
408
-			'rates' => __( 'Tax Rates', 'invoicing' ),
409
-			'vat'   => __( 'EU VAT Settings', 'invoicing' )
408
+            'rates' => __( 'Tax Rates', 'invoicing' ),
409
+            'vat'   => __( 'EU VAT Settings', 'invoicing' )
410 410
         ) ),
411 411
         'emails' => apply_filters( 'wpinv_settings_sections_emails', array(
412 412
             'main' => __( 'Email Settings', 'invoicing' ),
413
-		) ),
413
+        ) ),
414 414
 
415
-		'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
415
+        'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
416 416
 
417 417
         'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array(
418 418
             'main' => __( 'Privacy policy', 'invoicing' ),
@@ -432,48 +432,48 @@  discard block
 block discarded – undo
432 432
 }
433 433
 
434 434
 function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
435
-	$pages_options = array();
435
+    $pages_options = array();
436 436
 
437
-	if( $default_label !== NULL && $default_label !== false ) {
438
-		$pages_options = array( '' => $default_label ); // Blank option
439
-	}
437
+    if( $default_label !== NULL && $default_label !== false ) {
438
+        $pages_options = array( '' => $default_label ); // Blank option
439
+    }
440 440
 
441
-	$pages = get_pages();
442
-	if ( $pages ) {
443
-		foreach ( $pages as $page ) {
444
-			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
441
+    $pages = get_pages();
442
+    if ( $pages ) {
443
+        foreach ( $pages as $page ) {
444
+            $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
445 445
             $pages_options[ $page->ID ] = $title;
446
-		}
447
-	}
446
+        }
447
+    }
448 448
 
449
-	return $pages_options;
449
+    return $pages_options;
450 450
 }
451 451
 
452 452
 function wpinv_header_callback( $args ) {
453
-	if ( !empty( $args['desc'] ) ) {
453
+    if ( !empty( $args['desc'] ) ) {
454 454
         echo $args['desc'];
455 455
     }
456 456
 }
457 457
 
458 458
 function wpinv_hidden_callback( $args ) {
459 459
 
460
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
461
-	$value   = wpinv_get_option( $args['id'], $std );
460
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
461
+    $value   = wpinv_get_option( $args['id'], $std );
462 462
 
463
-	if ( isset( $args['set_value'] ) ) {
464
-		$value = $args['set_value'];
465
-	}
463
+    if ( isset( $args['set_value'] ) ) {
464
+        $value = $args['set_value'];
465
+    }
466 466
 
467
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
468
-		$args['readonly'] = true;
469
-		$name  = '';
470
-	} else {
471
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
472
-	}
467
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
468
+        $args['readonly'] = true;
469
+        $name  = '';
470
+    } else {
471
+        $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
472
+    }
473 473
 
474
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
474
+    $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
475 475
     
476
-	echo $html;
476
+    echo $html;
477 477
 }
478 478
 
479 479
 /**
@@ -481,12 +481,12 @@  discard block
 block discarded – undo
481 481
  */
482 482
 function wpinv_checkbox_callback( $args ) {
483 483
 
484
-	$std = isset( $args['std'] ) ? $args['std'] : '';
485
-	$std = wpinv_get_option( $args['id'], $std );
486
-	$id  = esc_attr( $args['id'] );
484
+    $std = isset( $args['std'] ) ? $args['std'] : '';
485
+    $std = wpinv_get_option( $args['id'], $std );
486
+    $id  = esc_attr( $args['id'] );
487 487
 
488
-	getpaid_hidden_field( "wpinv_settings[$id]", '0' );
489
-	?>
488
+    getpaid_hidden_field( "wpinv_settings[$id]", '0' );
489
+    ?>
490 490
 		<fieldset>
491 491
 			<label>
492 492
 				<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox">
@@ -498,75 +498,75 @@  discard block
 block discarded – undo
498 498
 
499 499
 function wpinv_multicheck_callback( $args ) {
500 500
 
501
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
502
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
501
+    $sanitize_id = wpinv_sanitize_key( $args['id'] );
502
+    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
503 503
 
504
-	if ( ! empty( $args['options'] ) ) {
504
+    if ( ! empty( $args['options'] ) ) {
505 505
 
506
-		$std     = isset( $args['std'] ) ? $args['std'] : array();
507
-		$value   = wpinv_get_option( $args['id'], $std );
506
+        $std     = isset( $args['std'] ) ? $args['std'] : array();
507
+        $value   = wpinv_get_option( $args['id'], $std );
508 508
 
509
-		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
509
+        echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
510 510
         foreach( $args['options'] as $key => $option ):
511
-			$sanitize_key = wpinv_sanitize_key( $key );
512
-			if ( in_array( $sanitize_key, $value ) ) { 
513
-				$enabled = $sanitize_key;
514
-			} else { 
515
-				$enabled = NULL; 
516
-			}
517
-			echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
518
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
519
-		endforeach;
520
-		echo '</div>';
521
-		echo '<p class="description">' . $args['desc'] . '</p>';
522
-	}
511
+            $sanitize_key = wpinv_sanitize_key( $key );
512
+            if ( in_array( $sanitize_key, $value ) ) { 
513
+                $enabled = $sanitize_key;
514
+            } else { 
515
+                $enabled = NULL; 
516
+            }
517
+            echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
518
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
519
+        endforeach;
520
+        echo '</div>';
521
+        echo '<p class="description">' . $args['desc'] . '</p>';
522
+    }
523 523
 }
524 524
 
525 525
 function wpinv_payment_icons_callback( $args ) {
526 526
     
527 527
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
528
-	$value   = wpinv_get_option( $args['id'], false);
528
+    $value   = wpinv_get_option( $args['id'], false);
529 529
 
530
-	if ( ! empty( $args['options'] ) ) {
531
-		foreach( $args['options'] as $key => $option ) {
530
+    if ( ! empty( $args['options'] ) ) {
531
+        foreach( $args['options'] as $key => $option ) {
532 532
             $sanitize_key = wpinv_sanitize_key( $key );
533 533
             
534
-			if( empty( $value ) ) {
535
-				$enabled = $option;
536
-			} else {
537
-				$enabled = NULL;
538
-			}
539
-
540
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
541
-
542
-				echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
543
-
544
-				if ( wpinv_string_is_image_url( $key ) ) {
545
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
546
-				} else {
547
-					$card = strtolower( str_replace( ' ', '', $option ) );
548
-
549
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
550
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
551
-					} else {
552
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
553
-						$content_dir = WP_CONTENT_DIR;
554
-
555
-						if ( function_exists( 'wp_normalize_path' ) ) {
556
-							// Replaces backslashes with forward slashes for Windows systems
557
-							$image = wp_normalize_path( $image );
558
-							$content_dir = wp_normalize_path( $content_dir );
559
-						}
560
-
561
-						$image = str_replace( $content_dir, content_url(), $image );
562
-					}
563
-
564
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
565
-				}
566
-			echo $option . '</label>';
567
-		}
568
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
569
-	}
534
+            if( empty( $value ) ) {
535
+                $enabled = $option;
536
+            } else {
537
+                $enabled = NULL;
538
+            }
539
+
540
+            echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
541
+
542
+                echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
543
+
544
+                if ( wpinv_string_is_image_url( $key ) ) {
545
+                    echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
546
+                } else {
547
+                    $card = strtolower( str_replace( ' ', '', $option ) );
548
+
549
+                    if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
550
+                        $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
551
+                    } else {
552
+                        $image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
553
+                        $content_dir = WP_CONTENT_DIR;
554
+
555
+                        if ( function_exists( 'wp_normalize_path' ) ) {
556
+                            // Replaces backslashes with forward slashes for Windows systems
557
+                            $image = wp_normalize_path( $image );
558
+                            $content_dir = wp_normalize_path( $content_dir );
559
+                        }
560
+
561
+                        $image = str_replace( $content_dir, content_url(), $image );
562
+                    }
563
+
564
+                    echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
565
+                }
566
+            echo $option . '</label>';
567
+        }
568
+        echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
569
+    }
570 570
 }
571 571
 
572 572
 /**
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
  */
575 575
 function wpinv_radio_callback( $args ) {
576 576
 
577
-	$std = isset( $args['std'] ) ? $args['std'] : '';
578
-	$std = wpinv_get_option( $args['id'], $std );
579
-	?>
577
+    $std = isset( $args['std'] ) ? $args['std'] : '';
578
+    $std = wpinv_get_option( $args['id'], $std );
579
+    ?>
580 580
 		<fieldset>
581 581
 			<ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;">
582 582
 				<?php foreach( $args['options'] as $key => $option ) : ?>
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 			</ul>
591 591
 		</fieldset>
592 592
 	<?php
593
-	getpaid_settings_description_callback( $args );
593
+    getpaid_settings_description_callback( $args );
594 594
 }
595 595
 
596 596
 /**
@@ -598,10 +598,10 @@  discard block
 block discarded – undo
598 598
  */
599 599
 function getpaid_settings_description_callback( $args ) {
600 600
 
601
-	if ( ! empty( $args['desc'] ) ) {
602
-		$description = wp_kses_post( $args['desc'] );
603
-		echo "<p class='description'>$description</p>";
604
-	}
601
+    if ( ! empty( $args['desc'] ) ) {
602
+        $description = wp_kses_post( $args['desc'] );
603
+        echo "<p class='description'>$description</p>";
604
+    }
605 605
 
606 606
 }
607 607
 
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
  */
611 611
 function wpinv_gateways_callback() {
612 612
 
613
-	?>
613
+    ?>
614 614
 		</td>
615 615
 	</tr>
616 616
 	<tr class="bsui">
@@ -624,22 +624,22 @@  discard block
 block discarded – undo
624 624
     
625 625
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
626 626
     $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
627
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
628
-	$value   = wpinv_get_option( $args['id'], $std );
627
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
628
+    $value   = wpinv_get_option( $args['id'], $std );
629 629
 
630
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
630
+    echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
631 631
 
632
-	foreach ( $args['options'] as $key => $option ) :
633
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
632
+    foreach ( $args['options'] as $key => $option ) :
633
+        if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
634 634
             $selected = selected( $key, $args['selected'], false );
635 635
         } else {
636 636
             $selected = selected( $key, $value, false );
637 637
         }
638
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
639
-	endforeach;
638
+        echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
639
+    endforeach;
640 640
 
641
-	echo '</select>';
642
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
641
+    echo '</select>';
642
+    echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
643 643
 }
644 644
 
645 645
 /**
@@ -650,29 +650,29 @@  discard block
 block discarded – undo
650 650
  */
651 651
 function wpinv_settings_attrs_helper( $args ) {
652 652
 
653
-	$value        = isset( $args['std'] ) ? $args['std'] : '';
654
-	$id           = esc_attr( $args['id'] );
655
-	$placeholder  = esc_attr( $args['placeholder'] );
653
+    $value        = isset( $args['std'] ) ? $args['std'] : '';
654
+    $id           = esc_attr( $args['id'] );
655
+    $placeholder  = esc_attr( $args['placeholder'] );
656 656
 
657
-	if ( ! empty( $args['faux'] ) ) {
658
-		$args['readonly'] = true;
659
-		$name             = '';
660
-	} else {
661
-		$value  = wpinv_get_option( $args['id'], $value );
662
-		$name   = "wpinv_settings[$id]";
663
-	}
657
+    if ( ! empty( $args['faux'] ) ) {
658
+        $args['readonly'] = true;
659
+        $name             = '';
660
+    } else {
661
+        $value  = wpinv_get_option( $args['id'], $value );
662
+        $name   = "wpinv_settings[$id]";
663
+    }
664 664
 
665
-	$value    = is_scalar( $value ) ? esc_attr( $value ) : '';
666
-	$class    = esc_attr( $args['class'] );
667
-	$style    = esc_attr( $args['style'] );
668
-	$readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"';
665
+    $value    = is_scalar( $value ) ? esc_attr( $value ) : '';
666
+    $class    = esc_attr( $args['class'] );
667
+    $style    = esc_attr( $args['style'] );
668
+    $readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"';
669 669
 
670
-	$onchange = '';
670
+    $onchange = '';
671 671
     if ( ! empty( $args['onchange'] ) ) {
672 672
         $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
673
-	}
673
+    }
674 674
 
675
-	return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly";
675
+    return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly";
676 676
 }
677 677
 
678 678
 /**
@@ -680,11 +680,11 @@  discard block
 block discarded – undo
680 680
  */
681 681
 function wpinv_text_callback( $args ) {
682 682
 
683
-	$desc = wp_kses_post( $args['desc'] );
684
-	$desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
685
-	$attr = wpinv_settings_attrs_helper( $args );
683
+    $desc = wp_kses_post( $args['desc'] );
684
+    $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
685
+    $attr = wpinv_settings_attrs_helper( $args );
686 686
 
687
-	?>
687
+    ?>
688 688
 		<label style="width: 100%;">
689 689
 			<input type="text" <?php echo $attr; ?>>
690 690
 			<?php echo $desc; ?>
@@ -698,14 +698,14 @@  discard block
 block discarded – undo
698 698
  */
699 699
 function wpinv_number_callback( $args ) {
700 700
 
701
-	$desc = wp_kses_post( $args['desc'] );
702
-	$desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
703
-	$attr = wpinv_settings_attrs_helper( $args );
704
-	$max  = intval( $args['max'] );
705
-	$min  = intval( $args['min'] );
706
-	$step = floatval( $args['step'] );
701
+    $desc = wp_kses_post( $args['desc'] );
702
+    $desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
703
+    $attr = wpinv_settings_attrs_helper( $args );
704
+    $max  = intval( $args['max'] );
705
+    $min  = intval( $args['min'] );
706
+    $step = floatval( $args['step'] );
707 707
 
708
-	?>
708
+    ?>
709 709
 		<label style="width: 100%;">
710 710
 			<input type="number" step="<?php echo $step; ?>" max="<?php echo $max; ?>" min="<?php echo $min; ?>" <?php echo $attr; ?>>
711 711
 			<?php echo $desc; ?>
@@ -717,36 +717,36 @@  discard block
 block discarded – undo
717 717
 function wpinv_textarea_callback( $args ) {
718 718
     
719 719
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
720
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
721
-	$value   = wpinv_get_option( $args['id'], $std );
720
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
721
+    $value   = wpinv_get_option( $args['id'], $std );
722 722
 
723 723
     $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
724 724
     $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
725 725
 
726
-	$html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
727
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
726
+    $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
727
+    $html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
728 728
 
729
-	echo $html;
729
+    echo $html;
730 730
 }
731 731
 
732 732
 function wpinv_password_callback( $args ) {
733 733
     
734 734
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
735
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
736
-	$value   = wpinv_get_option( $args['id'], $std );
735
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
736
+    $value   = wpinv_get_option( $args['id'], $std );
737 737
 
738
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
739
-	$html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
740
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
738
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
739
+    $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
740
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
741 741
 
742
-	echo $html;
742
+    echo $html;
743 743
 }
744 744
 
745 745
 function wpinv_missing_callback($args) {
746
-	printf(
747
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
748
-		'<strong>' . $args['id'] . '</strong>'
749
-	);
746
+    printf(
747
+        __( 'The callback function used for the %s setting is missing.', 'invoicing' ),
748
+        '<strong>' . $args['id'] . '</strong>'
749
+    );
750 750
 }
751 751
 
752 752
 /**
@@ -754,14 +754,14 @@  discard block
 block discarded – undo
754 754
  */
755 755
 function wpinv_select_callback( $args ) {
756 756
 
757
-	$desc   = wp_kses_post( $args['desc'] );
758
-	$desc   = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
759
-	$attr   = wpinv_settings_attrs_helper( $args );
760
-	$value  = isset( $args['std'] ) ? $args['std'] : '';
761
-	$value  = wpinv_get_option( $args['id'], $value );
762
-	$rand   = uniqid( 'random_id' );
757
+    $desc   = wp_kses_post( $args['desc'] );
758
+    $desc   = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
759
+    $attr   = wpinv_settings_attrs_helper( $args );
760
+    $value  = isset( $args['std'] ) ? $args['std'] : '';
761
+    $value  = wpinv_get_option( $args['id'], $value );
762
+    $rand   = uniqid( 'random_id' );
763 763
 
764
-	?>
764
+    ?>
765 765
 		<label style="width: 100%;">
766 766
 			<select <?php echo $attr; ?> data-allow-clear="true">
767 767
 				<?php foreach ( $args['options'] as $option => $name ) : ?>
@@ -794,104 +794,104 @@  discard block
 block discarded – undo
794 794
 function wpinv_color_select_callback( $args ) {
795 795
     
796 796
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
797
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
798
-	$value   = wpinv_get_option( $args['id'], $std );
797
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
798
+    $value   = wpinv_get_option( $args['id'], $std );
799 799
 
800
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
800
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
801 801
 
802
-	foreach ( $args['options'] as $option => $color ) {
803
-		$selected = selected( $option, $value, false );
804
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
805
-	}
802
+    foreach ( $args['options'] as $option => $color ) {
803
+        $selected = selected( $option, $value, false );
804
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
805
+    }
806 806
 
807
-	$html .= '</select>';
808
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
807
+    $html .= '</select>';
808
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
809 809
 
810
-	echo $html;
810
+    echo $html;
811 811
 }
812 812
 
813 813
 function wpinv_rich_editor_callback( $args ) {
814
-	global $wp_version;
814
+    global $wp_version;
815 815
     
816 816
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
817 817
 
818
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
819
-	$value   = wpinv_get_option( $args['id'], $std );
818
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
819
+    $value   = wpinv_get_option( $args['id'], $std );
820 820
 	
821
-	if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) {
822
-		$value = $std;
823
-	}
821
+    if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) {
822
+        $value = $std;
823
+    }
824 824
 
825
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
825
+    $rows = isset( $args['size'] ) ? $args['size'] : 20;
826 826
 
827
-	$html = '<div class="getpaid-settings-editor-input">';
828
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
829
-		ob_start();
830
-		wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) );
831
-		$html .= ob_get_clean();
832
-	} else {
833
-		$html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
834
-	}
827
+    $html = '<div class="getpaid-settings-editor-input">';
828
+    if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
829
+        ob_start();
830
+        wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) );
831
+        $html .= ob_get_clean();
832
+    } else {
833
+        $html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
834
+    }
835 835
 
836
-	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
836
+    $html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
837 837
 
838
-	echo $html;
838
+    echo $html;
839 839
 }
840 840
 
841 841
 function wpinv_upload_callback( $args ) {
842 842
     
843 843
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
844 844
 
845
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
846
-	$value   = wpinv_get_option( $args['id'], $std );
845
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
846
+    $value   = wpinv_get_option( $args['id'], $std );
847 847
 
848
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
849
-	$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
850
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
851
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
848
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
849
+    $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
850
+    $html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
851
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
852 852
 
853
-	echo $html;
853
+    echo $html;
854 854
 }
855 855
 
856 856
 function wpinv_color_callback( $args ) {
857 857
 
858
-	$std         = isset( $args['std'] ) ? $args['std'] : '';
859
-	$value       = wpinv_get_option( $args['id'], $std );
858
+    $std         = isset( $args['std'] ) ? $args['std'] : '';
859
+    $value       = wpinv_get_option( $args['id'], $std );
860 860
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
861 861
 
862
-	$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />';
863
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
862
+    $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />';
863
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
864 864
 
865
-	echo $html;
865
+    echo $html;
866 866
 }
867 867
 
868 868
 function wpinv_country_states_callback($args) {
869 869
 
870
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
871
-	$value   = wpinv_get_option( $args['id'], $std );
870
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
871
+    $value   = wpinv_get_option( $args['id'], $std );
872 872
 
873 873
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
874 874
 
875
-	if ( isset( $args['placeholder'] ) ) {
876
-		$placeholder = $args['placeholder'];
877
-	} else {
878
-		$placeholder = '';
879
-	}
875
+    if ( isset( $args['placeholder'] ) ) {
876
+        $placeholder = $args['placeholder'];
877
+    } else {
878
+        $placeholder = '';
879
+    }
880 880
 
881
-	$states = wpinv_get_country_states();
881
+    $states = wpinv_get_country_states();
882 882
 
883
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
884
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
883
+    $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
884
+    $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
885 885
 
886
-	foreach ( $states as $option => $name ) {
887
-		$selected = selected( $option, $value, false );
888
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
889
-	}
886
+    foreach ( $states as $option => $name ) {
887
+        $selected = selected( $option, $value, false );
888
+        $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
889
+    }
890 890
 
891
-	$html .= '</select>';
892
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
891
+    $html .= '</select>';
892
+    $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
893 893
 
894
-	echo $html;
894
+    echo $html;
895 895
 }
896 896
 
897 897
 /**
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
  */
900 900
 function wpinv_tax_rates_callback() {
901 901
 	
902
-	?>
902
+    ?>
903 903
 		</td>
904 904
 	</tr>
905 905
 	<tr class="bsui">
@@ -914,17 +914,17 @@  discard block
 block discarded – undo
914 914
  * Displays a tax rate' edit row.
915 915
  */
916 916
 function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) {
917
-	ob_start();
917
+    ob_start();
918 918
 
919
-	$key                      = sanitize_key( $key );
920
-	$tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
921
-	include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
919
+    $key                      = sanitize_key( $key );
920
+    $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
921
+    include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
922 922
 
923
-	if ( $echo ) {
924
-		echo ob_get_clean();
925
-	} else {
926
-		return ob_get_clean(); 
927
-	}
923
+    if ( $echo ) {
924
+        echo ob_get_clean();
925
+    } else {
926
+        return ob_get_clean(); 
927
+    }
928 928
 
929 929
 }
930 930
 
@@ -952,14 +952,14 @@  discard block
 block discarded – undo
952 952
                 </td>
953 953
                 <td>
954 954
 					<a href="<?php
955
-						echo esc_url(
956
-							wp_nonce_url(
957
-								add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
958
-								'getpaid-nonce',
959
-								'getpaid-nonce'
960
-							)
961
-						);
962
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
955
+                        echo esc_url(
956
+                            wp_nonce_url(
957
+                                add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
958
+                                'getpaid-nonce',
959
+                                'getpaid-nonce'
960
+                            )
961
+                        );
962
+                    ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
963 963
                 </td>
964 964
             </tr>
965 965
 			<tr>
@@ -969,14 +969,14 @@  discard block
 block discarded – undo
969 969
                 </td>
970 970
                 <td>
971 971
 					<a href="<?php
972
-						echo esc_url(
973
-							wp_nonce_url(
974
-								add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
975
-								'getpaid-nonce',
976
-								'getpaid-nonce'
977
-							)
978
-						);
979
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
972
+                        echo esc_url(
973
+                            wp_nonce_url(
974
+                                add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
975
+                                'getpaid-nonce',
976
+                                'getpaid-nonce'
977
+                            )
978
+                        );
979
+                    ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
980 980
                 </td>
981 981
             </tr>
982 982
 			<tr>
@@ -986,14 +986,14 @@  discard block
 block discarded – undo
986 986
                 </td>
987 987
                 <td>
988 988
 					<a href="<?php
989
-						echo esc_url(
990
-							wp_nonce_url(
991
-								add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ),
992
-								'getpaid-nonce',
993
-								'getpaid-nonce'
994
-							)
995
-						);
996
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
989
+                        echo esc_url(
990
+                            wp_nonce_url(
991
+                                add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ),
992
+                                'getpaid-nonce',
993
+                                'getpaid-nonce'
994
+                            )
995
+                        );
996
+                    ?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
997 997
                 </td>
998 998
             </tr>
999 999
 
@@ -1004,14 +1004,14 @@  discard block
 block discarded – undo
1004 1004
                 </td>
1005 1005
                 <td>
1006 1006
 					<a href="<?php
1007
-						echo esc_url(
1008
-							wp_nonce_url(
1009
-								add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ),
1010
-								'getpaid-nonce',
1011
-								'getpaid-nonce'
1012
-							)
1013
-						);
1014
-					?>" class="button button-primary"><?php _e( 'Run', 'invoicing' );?></a>
1007
+                        echo esc_url(
1008
+                            wp_nonce_url(
1009
+                                add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ),
1010
+                                'getpaid-nonce',
1011
+                                'getpaid-nonce'
1012
+                            )
1013
+                        );
1014
+                    ?>" class="button button-primary"><?php _e( 'Run', 'invoicing' );?></a>
1015 1015
                 </td>
1016 1016
             </tr>
1017 1017
 
@@ -1022,8 +1022,8 @@  discard block
 block discarded – undo
1022 1022
                 </td>
1023 1023
                 <td>
1024 1024
 					<a href="<?php
1025
-						echo esc_url( admin_url( 'index.php?page=gp-setup' ) );
1026
-					?>" class="button button-primary"><?php _e( 'Launch', 'invoicing' );?></a>
1025
+                        echo esc_url( admin_url( 'index.php?page=gp-setup' ) );
1026
+                    ?>" class="button button-primary"><?php _e( 'Launch', 'invoicing' );?></a>
1027 1027
                 </td>
1028 1028
             </tr>
1029 1029
 
@@ -1037,19 +1037,19 @@  discard block
 block discarded – undo
1037 1037
 
1038 1038
 
1039 1039
 function wpinv_descriptive_text_callback( $args ) {
1040
-	echo wp_kses_post( $args['desc'] );
1040
+    echo wp_kses_post( $args['desc'] );
1041 1041
 }
1042 1042
 
1043 1043
 function wpinv_raw_html_callback( $args ) {
1044
-	echo $args['desc'];
1044
+    echo $args['desc'];
1045 1045
 }
1046 1046
 
1047 1047
 function wpinv_hook_callback( $args ) {
1048
-	do_action( 'wpinv_' . $args['id'], $args );
1048
+    do_action( 'wpinv_' . $args['id'], $args );
1049 1049
 }
1050 1050
 
1051 1051
 function wpinv_set_settings_cap() {
1052
-	return wpinv_get_capability();
1052
+    return wpinv_get_capability();
1053 1053
 }
1054 1054
 add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1055 1055
 
@@ -1073,15 +1073,15 @@  discard block
 block discarded – undo
1073 1073
  */
1074 1074
 function wpinv_get_merge_tags_help_text( $subscription = false ) {
1075 1075
 
1076
-	$url  = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f';
1077
-	$link = sprintf(
1078
-		'<strong><a href="%s" target="_blank">%s</a></strong>',
1079
-		$url,
1080
-		esc_html__( 'View available merge tags.', 'wpinv-quotes' )
1081
-	);
1076
+    $url  = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f';
1077
+    $link = sprintf(
1078
+        '<strong><a href="%s" target="_blank">%s</a></strong>',
1079
+        $url,
1080
+        esc_html__( 'View available merge tags.', 'wpinv-quotes' )
1081
+    );
1082 1082
 
1083
-	$description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' );
1083
+    $description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' );
1084 1084
 
1085
-	return "$description $link";
1085
+    return "$description $link";
1086 1086
 
1087 1087
 }
Please login to merge, or discard this patch.
Spacing   +373 added lines, -373 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @since   1.0.0
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Retrieves all default settings.
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 function wpinv_get_settings() {
17 17
     $defaults = array();
18 18
 
19
-    foreach ( array_values( wpinv_get_registered_settings() ) as $tab_settings ) {
19
+    foreach (array_values(wpinv_get_registered_settings()) as $tab_settings) {
20 20
 
21
-        foreach ( array_values( $tab_settings ) as $section_settings ) {
21
+        foreach (array_values($tab_settings) as $section_settings) {
22 22
 
23
-            foreach ( $section_settings as $key => $setting ) {
24
-                if ( isset( $setting['std'] ) ) {
25
-                    $defaults[ $key ] = $setting['std'];
23
+            foreach ($section_settings as $key => $setting) {
24
+                if (isset($setting['std'])) {
25
+                    $defaults[$key] = $setting['std'];
26 26
                 }
27 27
             }
28 28
 
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
     global $wpinv_options;
44 44
 
45 45
     // Try fetching the saved options.
46
-    if ( empty( $wpinv_options ) ) {
47
-        $wpinv_options = get_option( 'wpinv_settings' );
46
+    if (empty($wpinv_options)) {
47
+        $wpinv_options = get_option('wpinv_settings');
48 48
     }
49 49
 
50 50
     // If that fails, don't fetch the default settings to prevent a loop.
51
-    if ( ! is_array( $wpinv_options ) ) {
51
+    if (!is_array($wpinv_options)) {
52 52
         $wpinv_options = array();
53 53
     }
54 54
 
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
  * @param mixed $default The default value to use if the setting has not been set.
63 63
  * @return mixed
64 64
  */
65
-function wpinv_get_option( $key = '', $default = false ) {
65
+function wpinv_get_option($key = '', $default = false) {
66 66
 
67 67
     $options = wpinv_get_options();
68
-    $value   = isset( $options[ $key ] ) ? $options[ $key ] : $default;
69
-    $value   = apply_filters( 'wpinv_get_option', $value, $key, $default );
68
+    $value   = isset($options[$key]) ? $options[$key] : $default;
69
+    $value   = apply_filters('wpinv_get_option', $value, $key, $default);
70 70
 
71
-    return apply_filters( 'wpinv_get_option_' . $key, $value, $key, $default );
71
+    return apply_filters('wpinv_get_option_' . $key, $value, $key, $default);
72 72
 }
73 73
 
74 74
 /**
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
  * @param array $options the new options.
78 78
  * @return bool
79 79
  */
80
-function wpinv_update_options( $options ) {
80
+function wpinv_update_options($options) {
81 81
     global $wpinv_options;
82 82
 
83 83
     // update the option.
84
-    if ( is_array( $options ) && update_option( 'wpinv_settings', $options ) ) {
84
+    if (is_array($options) && update_option('wpinv_settings', $options)) {
85 85
         $wpinv_options = $options;
86 86
         return true;
87 87
     }
@@ -96,24 +96,24 @@  discard block
 block discarded – undo
96 96
  * @param mixed $value The setting value.
97 97
  * @return bool
98 98
  */
99
-function wpinv_update_option( $key = '', $value = false ) {
99
+function wpinv_update_option($key = '', $value = false) {
100 100
 
101 101
     // If no key, exit.
102
-    if ( empty( $key ) ) {
102
+    if (empty($key)) {
103 103
         return false;
104 104
     }
105 105
 
106 106
     // Maybe delete the option instead.
107
-    if ( is_null( $value ) ) {
108
-        return wpinv_delete_option( $key );
107
+    if (is_null($value)) {
108
+        return wpinv_delete_option($key);
109 109
     }
110 110
 
111 111
     // Prepare the new options.
112 112
     $options         = wpinv_get_options();
113
-    $options[ $key ] = apply_filters( 'wpinv_update_option', $value, $key );
113
+    $options[$key] = apply_filters('wpinv_update_option', $value, $key);
114 114
 
115 115
     // Save the new options.
116
-    return wpinv_update_options( $options );
116
+    return wpinv_update_options($options);
117 117
 
118 118
 }
119 119
 
@@ -123,18 +123,18 @@  discard block
 block discarded – undo
123 123
  * @param string $key the setting key.
124 124
  * @return bool
125 125
  */
126
-function wpinv_delete_option( $key = '' ) {
126
+function wpinv_delete_option($key = '') {
127 127
 
128 128
     // If no key, exit
129
-    if ( empty( $key ) ) {
129
+    if (empty($key)) {
130 130
         return false;
131 131
     }
132 132
 
133 133
     $options = wpinv_get_options();
134 134
 
135
-    if ( isset( $options[ $key ] ) ) {
136
-        unset( $options[ $key ] );
137
-        return wpinv_update_options( $options );
135
+    if (isset($options[$key])) {
136
+        unset($options[$key]);
137
+        return wpinv_update_options($options);
138 138
     }
139 139
 
140 140
     return true;
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 function wpinv_register_settings() {
149 149
 
150 150
     // Loop through all tabs.
151
-    foreach ( wpinv_get_registered_settings() as $tab => $sections ) {
151
+    foreach (wpinv_get_registered_settings() as $tab => $sections) {
152 152
 
153 153
         // In each tab, loop through sections.
154
-        foreach ( $sections as $section => $settings ) {
154
+        foreach ($sections as $section => $settings) {
155 155
 
156 156
             // Check for backwards compatibility
157
-            $section_tabs = wpinv_get_settings_tab_sections( $tab );
158
-            if ( ! is_array( $section_tabs ) || ! array_key_exists( $section, $section_tabs ) ) {
157
+            $section_tabs = wpinv_get_settings_tab_sections($tab);
158
+            if (!is_array($section_tabs) || !array_key_exists($section, $section_tabs)) {
159 159
                 $section = 'main';
160 160
                 $settings = $sections;
161 161
             }
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
                 'wpinv_settings_' . $tab . '_' . $section
169 169
             );
170 170
 
171
-            foreach ( $settings as $option ) {
172
-                if ( ! empty( $option['id'] ) ) {
173
-                    wpinv_register_settings_option( $tab, $section, $option );
171
+            foreach ($settings as $option) {
172
+                if (!empty($option['id'])) {
173
+                    wpinv_register_settings_option($tab, $section, $option);
174 174
                 }
175 175
             }
176 176
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
     }
179 179
 
180 180
     // Creates our settings in the options table.
181
-    register_setting( 'wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize' );
181
+    register_setting('wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize');
182 182
 }
183
-add_action( 'admin_init', 'wpinv_register_settings' );
183
+add_action('admin_init', 'wpinv_register_settings');
184 184
 
185 185
 /**
186 186
  * Register a single settings option.
@@ -190,49 +190,49 @@  discard block
 block discarded – undo
190 190
  * @param string $option
191 191
  * 
192 192
  */
193
-function wpinv_register_settings_option( $tab, $section, $option ) {
193
+function wpinv_register_settings_option($tab, $section, $option) {
194 194
 
195
-    $name       = isset( $option['name'] ) ? $option['name'] : '';
195
+    $name       = isset($option['name']) ? $option['name'] : '';
196 196
     $cb         = "wpinv_{$option['type']}_callback";
197 197
     $section    = "wpinv_settings_{$tab}_$section";
198
-	$is_wizzard = is_admin() && isset( $_GET['page'] ) && 'gp-setup' == $_GET['page'];
198
+	$is_wizzard = is_admin() && isset($_GET['page']) && 'gp-setup' == $_GET['page'];
199 199
 
200
-	if ( isset( $option['desc'] ) && ( ! $is_wizzard && ! empty( $option['help-tip'] ) ) ) {
201
-		$tip   = wpinv_clean( $option['desc'] );
200
+	if (isset($option['desc']) && (!$is_wizzard && !empty($option['help-tip']))) {
201
+		$tip   = wpinv_clean($option['desc']);
202 202
 		$name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
203
-		unset( $option['desc'] );
203
+		unset($option['desc']);
204 204
 	}
205 205
 
206 206
     // Loop through all tabs.
207 207
     add_settings_field(
208 208
         'wpinv_settings[' . $option['id'] . ']',
209 209
         $name,
210
-        function_exists( $cb ) ? $cb : 'wpinv_missing_callback',
210
+        function_exists($cb) ? $cb : 'wpinv_missing_callback',
211 211
         $section,
212 212
         $section,
213 213
         array(
214 214
             'section'     => $section,
215
-            'id'          => isset( $option['id'] )          ? $option['id']          : uniqid( 'wpinv-' ),
216
-            'desc'        => isset( $option['desc'] )        ? $option['desc']        : '',
215
+            'id'          => isset($option['id']) ? $option['id'] : uniqid('wpinv-'),
216
+            'desc'        => isset($option['desc']) ? $option['desc'] : '',
217 217
             'name'        => $name,
218
-            'size'        => isset( $option['size'] )        ? $option['size']        : null,
219
-            'options'     => isset( $option['options'] )     ? $option['options']     : '',
220
-            'selected'    => isset( $option['selected'] )    ? $option['selected']    : null,
221
-            'std'         => isset( $option['std'] )         ? $option['std']         : '',
222
-            'min'         => isset( $option['min'] )         ? $option['min']         : 0,
223
-            'max'         => isset( $option['max'] )         ? $option['max']         : 999999,
224
-            'step'        => isset( $option['step'] )        ? $option['step']        : 1,
225
-            'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : null,
226
-            'allow_blank' => isset( $option['allow_blank'] ) ? $option['allow_blank'] : true,
227
-            'readonly'    => isset( $option['readonly'] )    ? $option['readonly']    : false,
228
-            'faux'        => isset( $option['faux'] )        ? $option['faux']        : false,
229
-            'onchange'    => isset( $option['onchange'] )   ? $option['onchange']     : '',
230
-            'custom'      => isset( $option['custom'] )     ? $option['custom']       : '',
231
-			'default_content' => isset( $option['default_content'] )     ? $option['default_content']       : '',
232
-			'class'       => isset( $option['class'] )     ? $option['class']         : '',
233
-			'style'       => isset( $option['style'] )     ? $option['style']         : '',
234
-            'cols'        => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
235
-            'rows'        => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
218
+            'size'        => isset($option['size']) ? $option['size'] : null,
219
+            'options'     => isset($option['options']) ? $option['options'] : '',
220
+            'selected'    => isset($option['selected']) ? $option['selected'] : null,
221
+            'std'         => isset($option['std']) ? $option['std'] : '',
222
+            'min'         => isset($option['min']) ? $option['min'] : 0,
223
+            'max'         => isset($option['max']) ? $option['max'] : 999999,
224
+            'step'        => isset($option['step']) ? $option['step'] : 1,
225
+            'placeholder' => isset($option['placeholder']) ? $option['placeholder'] : null,
226
+            'allow_blank' => isset($option['allow_blank']) ? $option['allow_blank'] : true,
227
+            'readonly'    => isset($option['readonly']) ? $option['readonly'] : false,
228
+            'faux'        => isset($option['faux']) ? $option['faux'] : false,
229
+            'onchange'    => isset($option['onchange']) ? $option['onchange'] : '',
230
+            'custom'      => isset($option['custom']) ? $option['custom'] : '',
231
+			'default_content' => isset($option['default_content']) ? $option['default_content'] : '',
232
+			'class'       => isset($option['class']) ? $option['class'] : '',
233
+			'style'       => isset($option['style']) ? $option['style'] : '',
234
+            'cols'        => isset($option['cols']) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
235
+            'rows'        => isset($option['rows']) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
236 236
         )
237 237
     );
238 238
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
  * @return array
245 245
  */
246 246
 function wpinv_get_registered_settings() {
247
-	return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
247
+	return array_filter(apply_filters('wpinv_registered_settings', wpinv_get_data('admin-settings')));
248 248
 }
249 249
 
250 250
 /**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
  * @return array
254 254
  */
255 255
 function getpaid_get_integration_settings() {
256
-    return apply_filters( 'getpaid_integration_settings', array() );
256
+    return apply_filters('getpaid_integration_settings', array());
257 257
 }
258 258
 
259 259
 /**
@@ -261,126 +261,126 @@  discard block
 block discarded – undo
261 261
  * 
262 262
  * @return array
263 263
  */
264
-function wpinv_settings_sanitize( $input = array() ) {
264
+function wpinv_settings_sanitize($input = array()) {
265 265
 
266 266
 	$wpinv_options = wpinv_get_options();
267 267
 	$raw_referrer  = wp_get_raw_referer();
268 268
 
269
-    if ( empty( $raw_referrer ) ) {
270
-		return array_merge( $wpinv_options, $input );
269
+    if (empty($raw_referrer)) {
270
+		return array_merge($wpinv_options, $input);
271 271
     }
272 272
 
273
-    wp_parse_str( $raw_referrer, $referrer );
273
+    wp_parse_str($raw_referrer, $referrer);
274 274
 
275
-	if ( in_array( 'gp-setup', $referrer ) ) {
276
-		return array_merge( $wpinv_options, $input );
275
+	if (in_array('gp-setup', $referrer)) {
276
+		return array_merge($wpinv_options, $input);
277 277
 	}
278 278
 
279 279
     $settings = wpinv_get_registered_settings();
280
-    $tab      = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
281
-    $section  = isset( $referrer['section'] ) ? $referrer['section'] : 'main';
280
+    $tab      = isset($referrer['tab']) ? $referrer['tab'] : 'general';
281
+    $section  = isset($referrer['section']) ? $referrer['section'] : 'main';
282 282
 
283 283
     $input = $input ? $input : array();
284
-    $input = apply_filters( 'wpinv_settings_tab_' . $tab . '_sanitize', $input );
285
-    $input = apply_filters( 'wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input );
284
+    $input = apply_filters('wpinv_settings_tab_' . $tab . '_sanitize', $input);
285
+    $input = apply_filters('wpinv_settings_' . $tab . '-' . $section . '_sanitize', $input);
286 286
 
287 287
     // Loop through each setting being saved and pass it through a sanitization filter
288
-    foreach ( $input as $key => $value ) {
288
+    foreach ($input as $key => $value) {
289 289
 
290 290
         // Get the setting type (checkbox, select, etc)
291
-        $type = isset( $settings[ $tab ][$section][ $key ]['type'] ) ? $settings[ $tab ][$section][ $key ]['type'] : false;
291
+        $type = isset($settings[$tab][$section][$key]['type']) ? $settings[$tab][$section][$key]['type'] : false;
292 292
 
293
-        if ( $type ) {
293
+        if ($type) {
294 294
             // Field type specific filter
295
-            $input[$key] = apply_filters( "wpinv_settings_sanitize_$type", $value, $key );
295
+            $input[$key] = apply_filters("wpinv_settings_sanitize_$type", $value, $key);
296 296
         }
297 297
 
298 298
         // General filter
299
-		$input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
299
+		$input[$key] = apply_filters('wpinv_settings_sanitize', $input[$key], $key);
300 300
 
301 301
 		// Key specific filter.
302
-		$input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
302
+		$input[$key] = apply_filters("wpinv_settings_sanitize_$key", $input[$key]);
303 303
     }
304 304
 
305 305
     // Loop through the whitelist and unset any that are empty for the tab being saved
306
-    $main_settings    = isset( $settings[ $tab ] ) ? $settings[ $tab ] : array(); // Check for extensions that aren't using new sections
307
-    $section_settings = ! empty( $settings[ $tab ][ $section ] ) ? $settings[ $tab ][ $section ] : array();
306
+    $main_settings    = isset($settings[$tab]) ? $settings[$tab] : array(); // Check for extensions that aren't using new sections
307
+    $section_settings = !empty($settings[$tab][$section]) ? $settings[$tab][$section] : array();
308 308
 
309
-    $found_settings   = array_merge( $main_settings, $section_settings );
309
+    $found_settings   = array_merge($main_settings, $section_settings);
310 310
 
311
-    if ( ! empty( $found_settings ) ) {
312
-        foreach ( $found_settings as $key => $value ) {
311
+    if (!empty($found_settings)) {
312
+        foreach ($found_settings as $key => $value) {
313 313
 
314 314
             // settings used to have numeric keys, now they have keys that match the option ID. This ensures both methods work
315
-            if ( is_numeric( $key ) ) {
315
+            if (is_numeric($key)) {
316 316
                 $key = $value['id'];
317 317
             }
318 318
 
319
-            if ( ! isset( $input[ $key ] ) && isset( $wpinv_options[ $key ] ) ) {
320
-                unset( $wpinv_options[ $key ] );
319
+            if (!isset($input[$key]) && isset($wpinv_options[$key])) {
320
+                unset($wpinv_options[$key]);
321 321
             }
322 322
         }
323 323
     }
324 324
 
325 325
     // Merge our new settings with the existing
326
-    $output = array_merge( $wpinv_options, $input );
326
+    $output = array_merge($wpinv_options, $input);
327 327
 
328
-    add_settings_error( 'wpinv-notices', '', __( 'Settings updated.', 'invoicing' ), 'updated' );
328
+    add_settings_error('wpinv-notices', '', __('Settings updated.', 'invoicing'), 'updated');
329 329
 
330 330
     return $output;
331 331
 }
332
-add_filter( 'wpinv_settings_sanitize_text', 'trim', 10, 1 );
333
-add_filter( 'wpinv_settings_sanitize_tax_rate', 'wpinv_sanitize_amount' );
332
+add_filter('wpinv_settings_sanitize_text', 'trim', 10, 1);
333
+add_filter('wpinv_settings_sanitize_tax_rate', 'wpinv_sanitize_amount');
334 334
 
335
-function wpinv_settings_sanitize_tax_rates( $input ) {
336
-    if( ! wpinv_current_user_can_manage_invoicing() ) {
335
+function wpinv_settings_sanitize_tax_rates($input) {
336
+    if (!wpinv_current_user_can_manage_invoicing()) {
337 337
         return $input;
338 338
     }
339 339
 
340
-    $new_rates = ! empty( $_POST['tax_rates'] ) ? wp_kses_post_deep( array_values( $_POST['tax_rates'] ) ) : array();
340
+    $new_rates = !empty($_POST['tax_rates']) ? wp_kses_post_deep(array_values($_POST['tax_rates'])) : array();
341 341
     $tax_rates = array();
342 342
 
343
-    foreach ( $new_rates as $rate ) {
343
+    foreach ($new_rates as $rate) {
344 344
 
345
-		$rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
346
-		$rate['name']    = sanitize_text_field( $rate['name'] );
347
-		$rate['state']   = sanitize_text_field( $rate['state'] );
348
-		$rate['country'] = sanitize_text_field( $rate['country'] );
349
-		$rate['global']  = empty( $rate['state'] );
345
+		$rate['rate']    = wpinv_sanitize_amount($rate['rate']);
346
+		$rate['name']    = sanitize_text_field($rate['name']);
347
+		$rate['state']   = sanitize_text_field($rate['state']);
348
+		$rate['country'] = sanitize_text_field($rate['country']);
349
+		$rate['global']  = empty($rate['state']);
350 350
 		$tax_rates[]     = $rate;
351 351
 
352 352
 	}
353 353
 
354
-    update_option( 'wpinv_tax_rates', $tax_rates );
354
+    update_option('wpinv_tax_rates', $tax_rates);
355 355
 
356 356
     return $input;
357 357
 }
358
-add_filter( 'wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates' );
358
+add_filter('wpinv_settings_taxes-rates_sanitize', 'wpinv_settings_sanitize_tax_rates');
359 359
 
360 360
 function wpinv_get_settings_tabs() {
361 361
     $tabs             = array();
362
-    $tabs['general']  = __( 'General', 'invoicing' );
363
-    $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
364
-    $tabs['taxes']    = __( 'Taxes', 'invoicing' );
365
-	$tabs['emails']   = __( 'Emails', 'invoicing' );
362
+    $tabs['general']  = __('General', 'invoicing');
363
+    $tabs['gateways'] = __('Payment Gateways', 'invoicing');
364
+    $tabs['taxes']    = __('Taxes', 'invoicing');
365
+	$tabs['emails'] = __('Emails', 'invoicing');
366 366
 
367
-	if ( count( getpaid_get_integration_settings() ) > 0 ) {
368
-		$tabs['integrations'] = __( 'Integrations', 'invoicing' );
367
+	if (count(getpaid_get_integration_settings()) > 0) {
368
+		$tabs['integrations'] = __('Integrations', 'invoicing');
369 369
 	}
370 370
 
371
-    $tabs['privacy']  = __( 'Privacy', 'invoicing' );
372
-    $tabs['misc']     = __( 'Misc', 'invoicing' );
373
-    $tabs['tools']    = __( 'Tools', 'invoicing' );
371
+    $tabs['privacy']  = __('Privacy', 'invoicing');
372
+    $tabs['misc']     = __('Misc', 'invoicing');
373
+    $tabs['tools']    = __('Tools', 'invoicing');
374 374
 
375
-    return apply_filters( 'wpinv_settings_tabs', $tabs );
375
+    return apply_filters('wpinv_settings_tabs', $tabs);
376 376
 }
377 377
 
378
-function wpinv_get_settings_tab_sections( $tab = false ) {
378
+function wpinv_get_settings_tab_sections($tab = false) {
379 379
     $tabs     = false;
380 380
     $sections = wpinv_get_registered_settings_sections();
381 381
 
382
-    if( $tab && ! empty( $sections[ $tab ] ) ) {
383
-        $tabs = $sections[ $tab ];
382
+    if ($tab && !empty($sections[$tab])) {
383
+        $tabs = $sections[$tab];
384 384
     }
385 385
 
386 386
     return $tabs;
@@ -389,89 +389,89 @@  discard block
 block discarded – undo
389 389
 function wpinv_get_registered_settings_sections() {
390 390
     static $sections = false;
391 391
 
392
-    if ( false !== $sections ) {
392
+    if (false !== $sections) {
393 393
         return $sections;
394 394
     }
395 395
 
396 396
     $sections = array(
397
-        'general' => apply_filters( 'wpinv_settings_sections_general', array(
398
-            'main' => __( 'General Settings', 'invoicing' ),
399
-            'page_section' => __( 'Page Settings', 'invoicing' ),
400
-            'currency_section' => __( 'Currency Settings', 'invoicing' ),
401
-            'labels' => __( 'Label Texts', 'invoicing' ),
402
-        ) ),
403
-        'gateways' => apply_filters( 'wpinv_settings_sections_gateways', array(
404
-            'main' => __( 'Gateway Settings', 'invoicing' ),
405
-        ) ),
406
-        'taxes' => apply_filters( 'wpinv_settings_sections_taxes', array(
407
-            'main'  => __( 'Tax Settings', 'invoicing' ),
408
-			'rates' => __( 'Tax Rates', 'invoicing' ),
409
-			'vat'   => __( 'EU VAT Settings', 'invoicing' )
410
-        ) ),
411
-        'emails' => apply_filters( 'wpinv_settings_sections_emails', array(
412
-            'main' => __( 'Email Settings', 'invoicing' ),
413
-		) ),
414
-
415
-		'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
416
-
417
-        'privacy' => apply_filters( 'wpinv_settings_sections_privacy', array(
418
-            'main' => __( 'Privacy policy', 'invoicing' ),
419
-        ) ),
420
-        'misc' => apply_filters( 'wpinv_settings_sections_misc', array(
421
-            'main' => __( 'Miscellaneous', 'invoicing' ),
422
-            'custom-css' => __( 'Custom CSS', 'invoicing' ),
423
-        ) ),
424
-        'tools' => apply_filters( 'wpinv_settings_sections_tools', array(
425
-            'main' => __( 'Diagnostic Tools', 'invoicing' ),
426
-        ) ),
397
+        'general' => apply_filters('wpinv_settings_sections_general', array(
398
+            'main' => __('General Settings', 'invoicing'),
399
+            'page_section' => __('Page Settings', 'invoicing'),
400
+            'currency_section' => __('Currency Settings', 'invoicing'),
401
+            'labels' => __('Label Texts', 'invoicing'),
402
+        )),
403
+        'gateways' => apply_filters('wpinv_settings_sections_gateways', array(
404
+            'main' => __('Gateway Settings', 'invoicing'),
405
+        )),
406
+        'taxes' => apply_filters('wpinv_settings_sections_taxes', array(
407
+            'main'  => __('Tax Settings', 'invoicing'),
408
+			'rates' => __('Tax Rates', 'invoicing'),
409
+			'vat'   => __('EU VAT Settings', 'invoicing')
410
+        )),
411
+        'emails' => apply_filters('wpinv_settings_sections_emails', array(
412
+            'main' => __('Email Settings', 'invoicing'),
413
+		)),
414
+
415
+		'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'label', 'id'),
416
+
417
+        'privacy' => apply_filters('wpinv_settings_sections_privacy', array(
418
+            'main' => __('Privacy policy', 'invoicing'),
419
+        )),
420
+        'misc' => apply_filters('wpinv_settings_sections_misc', array(
421
+            'main' => __('Miscellaneous', 'invoicing'),
422
+            'custom-css' => __('Custom CSS', 'invoicing'),
423
+        )),
424
+        'tools' => apply_filters('wpinv_settings_sections_tools', array(
425
+            'main' => __('Diagnostic Tools', 'invoicing'),
426
+        )),
427 427
     );
428 428
 
429
-    $sections = apply_filters( 'wpinv_settings_sections', $sections );
429
+    $sections = apply_filters('wpinv_settings_sections', $sections);
430 430
 
431 431
     return $sections;
432 432
 }
433 433
 
434
-function wpinv_get_pages( $with_slug = false, $default_label = NULL ) {
434
+function wpinv_get_pages($with_slug = false, $default_label = NULL) {
435 435
 	$pages_options = array();
436 436
 
437
-	if( $default_label !== NULL && $default_label !== false ) {
438
-		$pages_options = array( '' => $default_label ); // Blank option
437
+	if ($default_label !== NULL && $default_label !== false) {
438
+		$pages_options = array('' => $default_label); // Blank option
439 439
 	}
440 440
 
441 441
 	$pages = get_pages();
442
-	if ( $pages ) {
443
-		foreach ( $pages as $page ) {
442
+	if ($pages) {
443
+		foreach ($pages as $page) {
444 444
 			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
445
-            $pages_options[ $page->ID ] = $title;
445
+            $pages_options[$page->ID] = $title;
446 446
 		}
447 447
 	}
448 448
 
449 449
 	return $pages_options;
450 450
 }
451 451
 
452
-function wpinv_header_callback( $args ) {
453
-	if ( !empty( $args['desc'] ) ) {
452
+function wpinv_header_callback($args) {
453
+	if (!empty($args['desc'])) {
454 454
         echo $args['desc'];
455 455
     }
456 456
 }
457 457
 
458
-function wpinv_hidden_callback( $args ) {
458
+function wpinv_hidden_callback($args) {
459 459
 
460
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
461
-	$value   = wpinv_get_option( $args['id'], $std );
460
+	$std     = isset($args['std']) ? $args['std'] : '';
461
+	$value   = wpinv_get_option($args['id'], $std);
462 462
 
463
-	if ( isset( $args['set_value'] ) ) {
463
+	if (isset($args['set_value'])) {
464 464
 		$value = $args['set_value'];
465 465
 	}
466 466
 
467
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
467
+	if (isset($args['faux']) && true === $args['faux']) {
468 468
 		$args['readonly'] = true;
469
-		$name  = '';
469
+		$name = '';
470 470
 	} else {
471
-		$name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"';
471
+		$name = 'name="wpinv_settings[' . esc_attr($args['id']) . ']"';
472 472
 	}
473 473
 
474
-	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />';
474
+	$html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key($args['id']) . ']" ' . $name . ' value="' . esc_attr(stripslashes($value)) . '" />';
475 475
     
476 476
 	echo $html;
477 477
 }
@@ -479,59 +479,59 @@  discard block
 block discarded – undo
479 479
 /**
480 480
  * Displays a checkbox settings callback.
481 481
  */
482
-function wpinv_checkbox_callback( $args ) {
482
+function wpinv_checkbox_callback($args) {
483 483
 
484
-	$std = isset( $args['std'] ) ? $args['std'] : '';
485
-	$std = wpinv_get_option( $args['id'], $std );
486
-	$id  = esc_attr( $args['id'] );
484
+	$std = isset($args['std']) ? $args['std'] : '';
485
+	$std = wpinv_get_option($args['id'], $std);
486
+	$id  = esc_attr($args['id']);
487 487
 
488
-	getpaid_hidden_field( "wpinv_settings[$id]", '0' );
488
+	getpaid_hidden_field("wpinv_settings[$id]", '0');
489 489
 	?>
490 490
 		<fieldset>
491 491
 			<label>
492
-				<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox">
493
-				<?php echo wp_kses_post( $args['desc'] ); ?>
492
+				<input id="wpinv-settings-<?php echo $id; ?>" name="wpinv_settings[<?php echo $id; ?>]" <?php checked(empty($std), false); ?> value="1" type="checkbox">
493
+				<?php echo wp_kses_post($args['desc']); ?>
494 494
 			</label>
495 495
 		</fieldset>
496 496
 	<?php
497 497
 }
498 498
 
499
-function wpinv_multicheck_callback( $args ) {
499
+function wpinv_multicheck_callback($args) {
500 500
 
501
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
502
-	$class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
501
+	$sanitize_id = wpinv_sanitize_key($args['id']);
502
+	$class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
503 503
 
504
-	if ( ! empty( $args['options'] ) ) {
504
+	if (!empty($args['options'])) {
505 505
 
506
-		$std     = isset( $args['std'] ) ? $args['std'] : array();
507
-		$value   = wpinv_get_option( $args['id'], $std );
506
+		$std     = isset($args['std']) ? $args['std'] : array();
507
+		$value   = wpinv_get_option($args['id'], $std);
508 508
 
509 509
 		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">';
510
-        foreach( $args['options'] as $key => $option ):
511
-			$sanitize_key = wpinv_sanitize_key( $key );
512
-			if ( in_array( $sanitize_key, $value ) ) { 
510
+        foreach ($args['options'] as $key => $option):
511
+			$sanitize_key = wpinv_sanitize_key($key);
512
+			if (in_array($sanitize_key, $value)) { 
513 513
 				$enabled = $sanitize_key;
514 514
 			} else { 
515 515
 				$enabled = NULL; 
516 516
 			}
517
-			echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
518
-			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>';
517
+			echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr($sanitize_key) . '" ' . checked($sanitize_key, $enabled, false) . '/>&nbsp;';
518
+			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post($option) . '</label></div>';
519 519
 		endforeach;
520 520
 		echo '</div>';
521 521
 		echo '<p class="description">' . $args['desc'] . '</p>';
522 522
 	}
523 523
 }
524 524
 
525
-function wpinv_payment_icons_callback( $args ) {
525
+function wpinv_payment_icons_callback($args) {
526 526
     
527
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
528
-	$value   = wpinv_get_option( $args['id'], false);
527
+    $sanitize_id = wpinv_sanitize_key($args['id']);
528
+	$value = wpinv_get_option($args['id'], false);
529 529
 
530
-	if ( ! empty( $args['options'] ) ) {
531
-		foreach( $args['options'] as $key => $option ) {
532
-            $sanitize_key = wpinv_sanitize_key( $key );
530
+	if (!empty($args['options'])) {
531
+		foreach ($args['options'] as $key => $option) {
532
+            $sanitize_key = wpinv_sanitize_key($key);
533 533
             
534
-			if( empty( $value ) ) {
534
+			if (empty($value)) {
535 535
 				$enabled = $option;
536 536
 			} else {
537 537
 				$enabled = NULL;
@@ -539,67 +539,67 @@  discard block
 block discarded – undo
539 539
 
540 540
 			echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
541 541
 
542
-				echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
542
+				echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr($option) . '" ' . checked($option, $enabled, false) . '/>&nbsp;';
543 543
 
544
-				if ( wpinv_string_is_image_url( $key ) ) {
545
-					echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
544
+				if (wpinv_string_is_image_url($key)) {
545
+					echo '<img class="payment-icon" src="' . esc_url($key) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
546 546
 				} else {
547
-					$card = strtolower( str_replace( ' ', '', $option ) );
547
+					$card = strtolower(str_replace(' ', '', $option));
548 548
 
549
-					if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
550
-						$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
549
+					if (has_filter('wpinv_accepted_payment_' . $card . '_image')) {
550
+						$image = apply_filters('wpinv_accepted_payment_' . $card . '_image', '');
551 551
 					} else {
552
-						$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
552
+						$image       = wpinv_locate_template('images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false);
553 553
 						$content_dir = WP_CONTENT_DIR;
554 554
 
555
-						if ( function_exists( 'wp_normalize_path' ) ) {
555
+						if (function_exists('wp_normalize_path')) {
556 556
 							// Replaces backslashes with forward slashes for Windows systems
557
-							$image = wp_normalize_path( $image );
558
-							$content_dir = wp_normalize_path( $content_dir );
557
+							$image = wp_normalize_path($image);
558
+							$content_dir = wp_normalize_path($content_dir);
559 559
 						}
560 560
 
561
-						$image = str_replace( $content_dir, content_url(), $image );
561
+						$image = str_replace($content_dir, content_url(), $image);
562 562
 					}
563 563
 
564
-					echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
564
+					echo '<img class="payment-icon" src="' . esc_url($image) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
565 565
 				}
566 566
 			echo $option . '</label>';
567 567
 		}
568
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
568
+		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post($args['desc']) . '</p>';
569 569
 	}
570 570
 }
571 571
 
572 572
 /**
573 573
  * Displays a radio settings field.
574 574
  */
575
-function wpinv_radio_callback( $args ) {
575
+function wpinv_radio_callback($args) {
576 576
 
577
-	$std = isset( $args['std'] ) ? $args['std'] : '';
578
-	$std = wpinv_get_option( $args['id'], $std );
577
+	$std = isset($args['std']) ? $args['std'] : '';
578
+	$std = wpinv_get_option($args['id'], $std);
579 579
 	?>
580 580
 		<fieldset>
581
-			<ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;">
582
-				<?php foreach( $args['options'] as $key => $option ) : ?>
581
+			<ul id="wpinv-settings-<?php echo esc_attr($args['id']); ?>" style="margin-top: 0;">
582
+				<?php foreach ($args['options'] as $key => $option) : ?>
583 583
 					<li>
584 584
 						<label>
585
-							<input name="wpinv_settings[<?php echo esc_attr( $args['id'] ); ?>]" <?php checked( $std, $key ); ?> value="<?php echo esc_attr( $key ); ?>" type="radio">
586
-							<?php echo wp_kses_post( $option ); ?>
585
+							<input name="wpinv_settings[<?php echo esc_attr($args['id']); ?>]" <?php checked($std, $key); ?> value="<?php echo esc_attr($key); ?>" type="radio">
586
+							<?php echo wp_kses_post($option); ?>
587 587
 						</label>
588 588
 					</li>
589 589
 				<?php endforeach; ?>
590 590
 			</ul>
591 591
 		</fieldset>
592 592
 	<?php
593
-	getpaid_settings_description_callback( $args );
593
+	getpaid_settings_description_callback($args);
594 594
 }
595 595
 
596 596
 /**
597 597
  * Displays a description if available.
598 598
  */
599
-function getpaid_settings_description_callback( $args ) {
599
+function getpaid_settings_description_callback($args) {
600 600
 
601
-	if ( ! empty( $args['desc'] ) ) {
602
-		$description = wp_kses_post( $args['desc'] );
601
+	if (!empty($args['desc'])) {
602
+		$description = wp_kses_post($args['desc']);
603 603
 		echo "<p class='description'>$description</p>";
604 604
 	}
605 605
 
@@ -615,31 +615,31 @@  discard block
 block discarded – undo
615 615
 	</tr>
616 616
 	<tr class="bsui">
617 617
     	<td colspan="2" class="p-0">
618
-			<?php include plugin_dir_path( __FILE__ ) . 'views/html-gateways-edit.php'; ?>
618
+			<?php include plugin_dir_path(__FILE__) . 'views/html-gateways-edit.php'; ?>
619 619
 
620 620
 	<?php
621 621
 }
622 622
 
623 623
 function wpinv_gateway_select_callback($args) {
624 624
     
625
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
626
-    $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
627
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
628
-	$value   = wpinv_get_option( $args['id'], $std );
625
+    $sanitize_id = wpinv_sanitize_key($args['id']);
626
+    $class = !empty($args['class']) ? ' ' . esc_attr($args['class']) : '';
627
+	$std     = isset($args['std']) ? $args['std'] : '';
628
+	$value   = wpinv_get_option($args['id'], $std);
629 629
 
630
-	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >';
630
+	echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="' . $class . '" >';
631 631
 
632
-	foreach ( $args['options'] as $key => $option ) :
633
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
634
-            $selected = selected( $key, $args['selected'], false );
632
+	foreach ($args['options'] as $key => $option) :
633
+		if (isset($args['selected']) && $args['selected'] !== null && $args['selected'] !== false) {
634
+            $selected = selected($key, $args['selected'], false);
635 635
         } else {
636
-            $selected = selected( $key, $value, false );
636
+            $selected = selected($key, $value, false);
637 637
         }
638
-		echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
638
+		echo '<option value="' . wpinv_sanitize_key($key) . '"' . $selected . '>' . esc_html($option['admin_label']) . '</option>';
639 639
 	endforeach;
640 640
 
641 641
 	echo '</select>';
642
-	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
642
+	echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
643 643
 }
644 644
 
645 645
 /**
@@ -648,28 +648,28 @@  discard block
 block discarded – undo
648 648
  * @param array $args
649 649
  * @return string
650 650
  */
651
-function wpinv_settings_attrs_helper( $args ) {
651
+function wpinv_settings_attrs_helper($args) {
652 652
 
653
-	$value        = isset( $args['std'] ) ? $args['std'] : '';
654
-	$id           = esc_attr( $args['id'] );
655
-	$placeholder  = esc_attr( $args['placeholder'] );
653
+	$value        = isset($args['std']) ? $args['std'] : '';
654
+	$id           = esc_attr($args['id']);
655
+	$placeholder  = esc_attr($args['placeholder']);
656 656
 
657
-	if ( ! empty( $args['faux'] ) ) {
657
+	if (!empty($args['faux'])) {
658 658
 		$args['readonly'] = true;
659 659
 		$name             = '';
660 660
 	} else {
661
-		$value  = wpinv_get_option( $args['id'], $value );
661
+		$value  = wpinv_get_option($args['id'], $value);
662 662
 		$name   = "wpinv_settings[$id]";
663 663
 	}
664 664
 
665
-	$value    = is_scalar( $value ) ? esc_attr( $value ) : '';
666
-	$class    = esc_attr( $args['class'] );
667
-	$style    = esc_attr( $args['style'] );
668
-	$readonly = empty( $args['readonly'] ) ? '' : 'readonly onclick="this.select()"';
665
+	$value    = is_scalar($value) ? esc_attr($value) : '';
666
+	$class    = esc_attr($args['class']);
667
+	$style    = esc_attr($args['style']);
668
+	$readonly = empty($args['readonly']) ? '' : 'readonly onclick="this.select()"';
669 669
 
670 670
 	$onchange = '';
671
-    if ( ! empty( $args['onchange'] ) ) {
672
-        $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"';
671
+    if (!empty($args['onchange'])) {
672
+        $onchange = ' onchange="' . esc_attr($args['onchange']) . '"';
673 673
 	}
674 674
 
675 675
 	return "name='$name' id='wpinv-settings-$id' style='$style' value='$value' class='$class' placeholder='$placeholder' data-placeholder='$placeholder' $onchange $readonly";
@@ -678,11 +678,11 @@  discard block
 block discarded – undo
678 678
 /**
679 679
  * Displays a text input settings callback.
680 680
  */
681
-function wpinv_text_callback( $args ) {
681
+function wpinv_text_callback($args) {
682 682
 
683
-	$desc = wp_kses_post( $args['desc'] );
684
-	$desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
685
-	$attr = wpinv_settings_attrs_helper( $args );
683
+	$desc = wp_kses_post($args['desc']);
684
+	$desc = empty($desc) ? '' : "<p class='description'>$desc</p>";
685
+	$attr = wpinv_settings_attrs_helper($args);
686 686
 
687 687
 	?>
688 688
 		<label style="width: 100%;">
@@ -696,14 +696,14 @@  discard block
 block discarded – undo
696 696
 /**
697 697
  * Displays a number input settings callback.
698 698
  */
699
-function wpinv_number_callback( $args ) {
699
+function wpinv_number_callback($args) {
700 700
 
701
-	$desc = wp_kses_post( $args['desc'] );
702
-	$desc = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
703
-	$attr = wpinv_settings_attrs_helper( $args );
704
-	$max  = intval( $args['max'] );
705
-	$min  = intval( $args['min'] );
706
-	$step = floatval( $args['step'] );
701
+	$desc = wp_kses_post($args['desc']);
702
+	$desc = empty($desc) ? '' : "<p class='description'>$desc</p>";
703
+	$attr = wpinv_settings_attrs_helper($args);
704
+	$max  = intval($args['max']);
705
+	$min  = intval($args['min']);
706
+	$step = floatval($args['step']);
707 707
 
708 708
 	?>
709 709
 		<label style="width: 100%;">
@@ -714,37 +714,37 @@  discard block
 block discarded – undo
714 714
 
715 715
 }
716 716
 
717
-function wpinv_textarea_callback( $args ) {
717
+function wpinv_textarea_callback($args) {
718 718
     
719
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
720
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
721
-	$value   = wpinv_get_option( $args['id'], $std );
719
+    $sanitize_id = wpinv_sanitize_key($args['id']);
720
+	$std     = isset($args['std']) ? $args['std'] : '';
721
+	$value   = wpinv_get_option($args['id'], $std);
722 722
 
723
-    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
724
-    $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
723
+    $size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
724
+    $class = (isset($args['class']) && !is_null($args['class'])) ? $args['class'] : 'large-text';
725 725
 
726
-	$html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
727
-	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
726
+	$html = '<textarea class="' . sanitize_html_class($class) . ' txtarea-' . sanitize_html_class($size) . ' wpi-' . esc_attr(sanitize_html_class($sanitize_id)) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']">' . esc_textarea(stripslashes($value)) . '</textarea>';
727
+	$html .= '<br /><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
728 728
 
729 729
 	echo $html;
730 730
 }
731 731
 
732
-function wpinv_password_callback( $args ) {
732
+function wpinv_password_callback($args) {
733 733
     
734
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
735
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
736
-	$value   = wpinv_get_option( $args['id'], $std );
734
+    $sanitize_id = wpinv_sanitize_key($args['id']);
735
+	$std     = isset($args['std']) ? $args['std'] : '';
736
+	$value   = wpinv_get_option($args['id'], $std);
737 737
 
738
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
739
-	$html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
740
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
738
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
739
+	$html = '<input type="password" class="' . sanitize_html_class($size) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr($value) . '"/>';
740
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
741 741
 
742 742
 	echo $html;
743 743
 }
744 744
 
745 745
 function wpinv_missing_callback($args) {
746 746
 	printf(
747
-		__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
747
+		__('The callback function used for the %s setting is missing.', 'invoicing'),
748 748
 		'<strong>' . $args['id'] . '</strong>'
749 749
 	);
750 750
 }
@@ -752,35 +752,35 @@  discard block
 block discarded – undo
752 752
 /**
753 753
  * Displays a number input settings callback.
754 754
  */
755
-function wpinv_select_callback( $args ) {
755
+function wpinv_select_callback($args) {
756 756
 
757
-	$desc   = wp_kses_post( $args['desc'] );
758
-	$desc   = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
759
-	$attr   = wpinv_settings_attrs_helper( $args );
760
-	$value  = isset( $args['std'] ) ? $args['std'] : '';
761
-	$value  = wpinv_get_option( $args['id'], $value );
762
-	$rand   = uniqid( 'random_id' );
757
+	$desc   = wp_kses_post($args['desc']);
758
+	$desc   = empty($desc) ? '' : "<p class='description'>$desc</p>";
759
+	$attr   = wpinv_settings_attrs_helper($args);
760
+	$value  = isset($args['std']) ? $args['std'] : '';
761
+	$value  = wpinv_get_option($args['id'], $value);
762
+	$rand   = uniqid('random_id');
763 763
 
764 764
 	?>
765 765
 		<label style="width: 100%;">
766 766
 			<select <?php echo $attr; ?> data-allow-clear="true">
767
-				<?php foreach ( $args['options'] as $option => $name ) : ?>
768
-					<option value="<?php echo esc_attr( $option ); ?>" <?php echo selected( $option, $value ); ?>><?php echo wpinv_clean( $name ); ?></option>
769
-				<?php endforeach;?>
767
+				<?php foreach ($args['options'] as $option => $name) : ?>
768
+					<option value="<?php echo esc_attr($option); ?>" <?php echo selected($option, $value); ?>><?php echo wpinv_clean($name); ?></option>
769
+				<?php endforeach; ?>
770 770
 			</select>
771 771
 
772
-			<?php if ( substr( $args['id'], -5 ) === '_page' && is_numeric( $value ) ) : ?>
773
-				<a href="<?php echo get_edit_post_link( $value ); ?>" target="_blank" class="button getpaid-page-setting-edit"><?php _e( 'Edit Page', 'invoicing' ) ?></a>
772
+			<?php if (substr($args['id'], -5) === '_page' && is_numeric($value)) : ?>
773
+				<a href="<?php echo get_edit_post_link($value); ?>" target="_blank" class="button getpaid-page-setting-edit"><?php _e('Edit Page', 'invoicing') ?></a>
774 774
 			<?php endif; ?>
775 775
 
776
-			<?php if ( substr( $args['id'], -5 ) === '_page' && ! empty( $args['default_content'] ) ) : ?>
777
-				&nbsp;<a href="#TB_inline?&width=400&height=550&inlineId=<?php echo $rand; ?>" class="button thickbox getpaid-page-setting-view-default"><?php _e( 'View Default Content', 'invoicing' ) ?></a>
776
+			<?php if (substr($args['id'], -5) === '_page' && !empty($args['default_content'])) : ?>
777
+				&nbsp;<a href="#TB_inline?&width=400&height=550&inlineId=<?php echo $rand; ?>" class="button thickbox getpaid-page-setting-view-default"><?php _e('View Default Content', 'invoicing') ?></a>
778 778
 				<div id='<?php echo $rand; ?>' style='display:none;'>
779 779
 					<div>
780
-						<h3><?php _e( 'Original Content', 'invoicing' ) ?></h3>
781
-						<textarea readonly onclick="this.select()" rows="8" style="width: 100%;"><?php echo gepaid_trim_lines( wp_kses_post( $args['default_content'] ) ); ?></textarea>
782
-						<h3><?php _e( 'Current Content', 'invoicing' ) ?></h3>
783
-						<textarea readonly onclick="this.select()" rows="8" style="width: 100%;"><?php $_post = get_post( $value ); echo empty( $_post ) ? '' : gepaid_trim_lines( wp_kses_post( $_post->post_content ) ); ?></textarea>
780
+						<h3><?php _e('Original Content', 'invoicing') ?></h3>
781
+						<textarea readonly onclick="this.select()" rows="8" style="width: 100%;"><?php echo gepaid_trim_lines(wp_kses_post($args['default_content'])); ?></textarea>
782
+						<h3><?php _e('Current Content', 'invoicing') ?></h3>
783
+						<textarea readonly onclick="this.select()" rows="8" style="width: 100%;"><?php $_post = get_post($value); echo empty($_post) ? '' : gepaid_trim_lines(wp_kses_post($_post->post_content)); ?></textarea>
784 784
 					</div>
785 785
 				</div>
786 786
 			<?php endif; ?>
@@ -791,88 +791,88 @@  discard block
 block discarded – undo
791 791
 
792 792
 }
793 793
 
794
-function wpinv_color_select_callback( $args ) {
794
+function wpinv_color_select_callback($args) {
795 795
     
796
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
797
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
798
-	$value   = wpinv_get_option( $args['id'], $std );
796
+    $sanitize_id = wpinv_sanitize_key($args['id']);
797
+	$std     = isset($args['std']) ? $args['std'] : '';
798
+	$value   = wpinv_get_option($args['id'], $std);
799 799
 
800
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
800
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"/>';
801 801
 
802
-	foreach ( $args['options'] as $option => $color ) {
803
-		$selected = selected( $option, $value, false );
804
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>';
802
+	foreach ($args['options'] as $option => $color) {
803
+		$selected = selected($option, $value, false);
804
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($color['label']) . '</option>';
805 805
 	}
806 806
 
807 807
 	$html .= '</select>';
808
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
808
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
809 809
 
810 810
 	echo $html;
811 811
 }
812 812
 
813
-function wpinv_rich_editor_callback( $args ) {
813
+function wpinv_rich_editor_callback($args) {
814 814
 	global $wp_version;
815 815
     
816
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
816
+    $sanitize_id = wpinv_sanitize_key($args['id']);
817 817
 
818
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
819
-	$value   = wpinv_get_option( $args['id'], $std );
818
+	$std     = isset($args['std']) ? $args['std'] : '';
819
+	$value   = wpinv_get_option($args['id'], $std);
820 820
 	
821
-	if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) {
821
+	if (!empty($args['allow_blank']) && empty($value)) {
822 822
 		$value = $std;
823 823
 	}
824 824
 
825
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
825
+	$rows = isset($args['size']) ? $args['size'] : 20;
826 826
 
827 827
 	$html = '<div class="getpaid-settings-editor-input">';
828
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
828
+	if ($wp_version >= 3.3 && function_exists('wp_editor')) {
829 829
 		ob_start();
830
-		wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) );
830
+		wp_editor(stripslashes($value), 'wpinv_settings_' . esc_attr($args['id']), array('textarea_name' => 'wpinv_settings[' . esc_attr($args['id']) . ']', 'textarea_rows' => absint($rows), 'media_buttons' => false));
831 831
 		$html .= ob_get_clean();
832 832
 	} else {
833
-		$html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
833
+		$html .= '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" class="wpi-' . esc_attr(sanitize_html_class($args['id'])) . '">' . esc_textarea(stripslashes($value)) . '</textarea>';
834 834
 	}
835 835
 
836
-	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
836
+	$html .= '</div><br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
837 837
 
838 838
 	echo $html;
839 839
 }
840 840
 
841
-function wpinv_upload_callback( $args ) {
841
+function wpinv_upload_callback($args) {
842 842
     
843
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
843
+    $sanitize_id = wpinv_sanitize_key($args['id']);
844 844
 
845
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
846
-	$value   = wpinv_get_option( $args['id'], $std );
845
+	$std     = isset($args['std']) ? $args['std'] : '';
846
+	$value   = wpinv_get_option($args['id'], $std);
847 847
 
848
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
849
-	$html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
850
-	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>';
851
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
848
+	$size = (isset($args['size']) && !is_null($args['size'])) ? $args['size'] : 'regular';
849
+	$html = '<input type="text" class="' . sanitize_html_class($size) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr(stripslashes($value)) . '"/>';
850
+	$html .= '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __('Upload File', 'invoicing') . '"/></span>';
851
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
852 852
 
853 853
 	echo $html;
854 854
 }
855 855
 
856
-function wpinv_color_callback( $args ) {
856
+function wpinv_color_callback($args) {
857 857
 
858
-	$std         = isset( $args['std'] ) ? $args['std'] : '';
859
-	$value       = wpinv_get_option( $args['id'], $std );
860
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
858
+	$std         = isset($args['std']) ? $args['std'] : '';
859
+	$value       = wpinv_get_option($args['id'], $std);
860
+    $sanitize_id = wpinv_sanitize_key($args['id']);
861 861
 
862
-	$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />';
863
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
862
+	$html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']" value="' . esc_attr($value) . '" data-default-color="' . esc_attr($std) . '" />';
863
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
864 864
 
865 865
 	echo $html;
866 866
 }
867 867
 
868 868
 function wpinv_country_states_callback($args) {
869 869
 
870
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
871
-	$value   = wpinv_get_option( $args['id'], $std );
870
+	$std     = isset($args['std']) ? $args['std'] : '';
871
+	$value   = wpinv_get_option($args['id'], $std);
872 872
 
873
-    $sanitize_id = wpinv_sanitize_key( $args['id'] );
873
+    $sanitize_id = wpinv_sanitize_key($args['id']);
874 874
 
875
-	if ( isset( $args['placeholder'] ) ) {
875
+	if (isset($args['placeholder'])) {
876 876
 		$placeholder = $args['placeholder'];
877 877
 	} else {
878 878
 		$placeholder = '';
@@ -880,16 +880,16 @@  discard block
 block discarded – undo
880 880
 
881 881
 	$states = wpinv_get_country_states();
882 882
 
883
-	$class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
884
-	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>';
883
+	$class = empty($states) ? ' class="wpinv-no-states"' : ' class="wpi_select2"';
884
+	$html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr($args['id']) . ']"' . $class . 'data-placeholder="' . esc_html($placeholder) . '"/>';
885 885
 
886
-	foreach ( $states as $option => $name ) {
887
-		$selected = selected( $option, $value, false );
888
-		$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>';
886
+	foreach ($states as $option => $name) {
887
+		$selected = selected($option, $value, false);
888
+		$html .= '<option value="' . esc_attr($option) . '" ' . $selected . '>' . esc_html($name) . '</option>';
889 889
 	}
890 890
 
891 891
 	$html .= '</select>';
892
-	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> '  . wp_kses_post( $args['desc'] ) . '</label>';
892
+	$html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post($args['desc']) . '</label>';
893 893
 
894 894
 	echo $html;
895 895
 }
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 	</tr>
905 905
 	<tr class="bsui">
906 906
     	<td colspan="2" class="p-0">
907
-			<?php include plugin_dir_path( __FILE__ ) . 'views/html-tax-rates-edit.php'; ?>
907
+			<?php include plugin_dir_path(__FILE__) . 'views/html-tax-rates-edit.php'; ?>
908 908
 
909 909
 	<?php
910 910
 
@@ -913,14 +913,14 @@  discard block
 block discarded – undo
913 913
 /**
914 914
  * Displays a tax rate' edit row.
915 915
  */
916
-function wpinv_tax_rate_callback( $tax_rate, $key, $echo = true ) {
916
+function wpinv_tax_rate_callback($tax_rate, $key, $echo = true) {
917 917
 	ob_start();
918 918
 
919
-	$key                      = sanitize_key( $key );
920
-	$tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
921
-	include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
919
+	$key                      = sanitize_key($key);
920
+	$tax_rate['reduced_rate'] = empty($tax_rate['reduced_rate']) ? 0 : $tax_rate['reduced_rate'];
921
+	include plugin_dir_path(__FILE__) . 'views/html-tax-rate-edit.php';
922 922
 
923
-	if ( $echo ) {
923
+	if ($echo) {
924 924
 		echo ob_get_clean();
925 925
 	} else {
926 926
 		return ob_get_clean(); 
@@ -933,136 +933,136 @@  discard block
 block discarded – undo
933 933
     ob_start(); ?>
934 934
     </td><tr>
935 935
     <td colspan="2" class="wpinv_tools_tdbox">
936
-    <?php if ( $args['desc'] ) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
937
-    <?php do_action( 'wpinv_tools_before' ); ?>
936
+    <?php if ($args['desc']) { ?><p><?php echo $args['desc']; ?></p><?php } ?>
937
+    <?php do_action('wpinv_tools_before'); ?>
938 938
     <table id="wpinv_tools_table" class="wp-list-table widefat fixed posts">
939 939
         <thead>
940 940
             <tr>
941
-                <th scope="col" class="wpinv-th-tool"><?php _e( 'Tool', 'invoicing' ); ?></th>
942
-                <th scope="col" class="wpinv-th-desc"><?php _e( 'Description', 'invoicing' ); ?></th>
943
-                <th scope="col" class="wpinv-th-action"><?php _e( 'Action', 'invoicing' ); ?></th>
941
+                <th scope="col" class="wpinv-th-tool"><?php _e('Tool', 'invoicing'); ?></th>
942
+                <th scope="col" class="wpinv-th-desc"><?php _e('Description', 'invoicing'); ?></th>
943
+                <th scope="col" class="wpinv-th-action"><?php _e('Action', 'invoicing'); ?></th>
944 944
             </tr>
945 945
         </thead>
946 946
 
947 947
         <tbody>
948 948
 			<tr>
949
-                <td><?php _e( 'Check Pages', 'invoicing' );?></td>
949
+                <td><?php _e('Check Pages', 'invoicing'); ?></td>
950 950
                 <td>
951
-                    <small><?php _e( 'Creates any missing GetPaid pages.', 'invoicing' ); ?></small>
951
+                    <small><?php _e('Creates any missing GetPaid pages.', 'invoicing'); ?></small>
952 952
                 </td>
953 953
                 <td>
954 954
 					<a href="<?php
955 955
 						echo esc_url(
956 956
 							wp_nonce_url(
957
-								add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
957
+								add_query_arg('getpaid-admin-action', 'create_missing_pages'),
958 958
 								'getpaid-nonce',
959 959
 								'getpaid-nonce'
960 960
 							)
961 961
 						);
962
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
962
+					?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a>
963 963
                 </td>
964 964
             </tr>
965 965
 			<tr>
966
-                <td><?php _e( 'Create Database Tables', 'invoicing' );?></td>
966
+                <td><?php _e('Create Database Tables', 'invoicing'); ?></td>
967 967
                 <td>
968
-                    <small><?php _e( 'Run this tool to create any missing database tables.', 'invoicing' ); ?></small>
968
+                    <small><?php _e('Run this tool to create any missing database tables.', 'invoicing'); ?></small>
969 969
                 </td>
970 970
                 <td>
971 971
 					<a href="<?php
972 972
 						echo esc_url(
973 973
 							wp_nonce_url(
974
-								add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
974
+								add_query_arg('getpaid-admin-action', 'create_missing_tables'),
975 975
 								'getpaid-nonce',
976 976
 								'getpaid-nonce'
977 977
 							)
978 978
 						);
979
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
979
+					?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a>
980 980
                 </td>
981 981
             </tr>
982 982
 			<tr>
983
-                <td><?php _e( 'Migrate old invoices', 'invoicing' );?></td>
983
+                <td><?php _e('Migrate old invoices', 'invoicing'); ?></td>
984 984
                 <td>
985
-                    <small><?php _e( 'If your old invoices were not migrated after updating from Invoicing to GetPaid, you can use this tool to migrate them.', 'invoicing' ); ?></small>
985
+                    <small><?php _e('If your old invoices were not migrated after updating from Invoicing to GetPaid, you can use this tool to migrate them.', 'invoicing'); ?></small>
986 986
                 </td>
987 987
                 <td>
988 988
 					<a href="<?php
989 989
 						echo esc_url(
990 990
 							wp_nonce_url(
991
-								add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ),
991
+								add_query_arg('getpaid-admin-action', 'migrate_old_invoices'),
992 992
 								'getpaid-nonce',
993 993
 								'getpaid-nonce'
994 994
 							)
995 995
 						);
996
-					?>" class="button button-primary"><?php _e('Run', 'invoicing');?></a>
996
+					?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a>
997 997
                 </td>
998 998
             </tr>
999 999
 
1000 1000
 			<tr>
1001
-                <td><?php _e( 'Recalculate Discounts', 'invoicing' );?></td>
1001
+                <td><?php _e('Recalculate Discounts', 'invoicing'); ?></td>
1002 1002
                 <td>
1003
-                    <small><?php _e( 'Recalculate discounts for existing invoices that have discount codes but are not discounted.', 'invoicing' ); ?></small>
1003
+                    <small><?php _e('Recalculate discounts for existing invoices that have discount codes but are not discounted.', 'invoicing'); ?></small>
1004 1004
                 </td>
1005 1005
                 <td>
1006 1006
 					<a href="<?php
1007 1007
 						echo esc_url(
1008 1008
 							wp_nonce_url(
1009
-								add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ),
1009
+								add_query_arg('getpaid-admin-action', 'recalculate_discounts'),
1010 1010
 								'getpaid-nonce',
1011 1011
 								'getpaid-nonce'
1012 1012
 							)
1013 1013
 						);
1014
-					?>" class="button button-primary"><?php _e( 'Run', 'invoicing' );?></a>
1014
+					?>" class="button button-primary"><?php _e('Run', 'invoicing'); ?></a>
1015 1015
                 </td>
1016 1016
             </tr>
1017 1017
 
1018 1018
 			<tr>
1019
-                <td><?php _e( 'Set-up Wizard', 'invoicing' );?></td>
1019
+                <td><?php _e('Set-up Wizard', 'invoicing'); ?></td>
1020 1020
                 <td>
1021
-                    <small><?php _e( 'Launch the quick set-up wizard.', 'invoicing' ); ?></small>
1021
+                    <small><?php _e('Launch the quick set-up wizard.', 'invoicing'); ?></small>
1022 1022
                 </td>
1023 1023
                 <td>
1024 1024
 					<a href="<?php
1025
-						echo esc_url( admin_url( 'index.php?page=gp-setup' ) );
1026
-					?>" class="button button-primary"><?php _e( 'Launch', 'invoicing' );?></a>
1025
+						echo esc_url(admin_url('index.php?page=gp-setup'));
1026
+					?>" class="button button-primary"><?php _e('Launch', 'invoicing'); ?></a>
1027 1027
                 </td>
1028 1028
             </tr>
1029 1029
 
1030
-			<?php do_action( 'wpinv_tools_row' ); ?>
1030
+			<?php do_action('wpinv_tools_row'); ?>
1031 1031
         </tbody>
1032 1032
     </table>
1033
-    <?php do_action( 'wpinv_tools_after' ); ?>
1033
+    <?php do_action('wpinv_tools_after'); ?>
1034 1034
     <?php
1035 1035
     echo ob_get_clean();
1036 1036
 }
1037 1037
 
1038 1038
 
1039
-function wpinv_descriptive_text_callback( $args ) {
1040
-	echo wp_kses_post( $args['desc'] );
1039
+function wpinv_descriptive_text_callback($args) {
1040
+	echo wp_kses_post($args['desc']);
1041 1041
 }
1042 1042
 
1043
-function wpinv_raw_html_callback( $args ) {
1043
+function wpinv_raw_html_callback($args) {
1044 1044
 	echo $args['desc'];
1045 1045
 }
1046 1046
 
1047
-function wpinv_hook_callback( $args ) {
1048
-	do_action( 'wpinv_' . $args['id'], $args );
1047
+function wpinv_hook_callback($args) {
1048
+	do_action('wpinv_' . $args['id'], $args);
1049 1049
 }
1050 1050
 
1051 1051
 function wpinv_set_settings_cap() {
1052 1052
 	return wpinv_get_capability();
1053 1053
 }
1054
-add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1054
+add_filter('option_page_capability_wpinv_settings', 'wpinv_set_settings_cap');
1055 1055
 
1056 1056
 
1057
-function wpinv_on_update_settings( $old_value, $value, $option ) {
1058
-    $old = !empty( $old_value['remove_data_on_unistall'] ) ? 1 : '';
1059
-    $new = !empty( $value['remove_data_on_unistall'] ) ? 1 : '';
1057
+function wpinv_on_update_settings($old_value, $value, $option) {
1058
+    $old = !empty($old_value['remove_data_on_unistall']) ? 1 : '';
1059
+    $new = !empty($value['remove_data_on_unistall']) ? 1 : '';
1060 1060
     
1061
-    if ( $old != $new ) {
1062
-        update_option( 'wpinv_remove_data_on_invoice_unistall', $new );
1061
+    if ($old != $new) {
1062
+        update_option('wpinv_remove_data_on_invoice_unistall', $new);
1063 1063
     }
1064 1064
 }
1065
-add_action( 'update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3 );
1065
+add_action('update_option_wpinv_settings', 'wpinv_on_update_settings', 10, 3);
1066 1066
 
1067 1067
 /**
1068 1068
  * Returns the merge tags help text.
@@ -1071,16 +1071,16 @@  discard block
 block discarded – undo
1071 1071
  * 
1072 1072
  * @return string
1073 1073
  */
1074
-function wpinv_get_merge_tags_help_text( $subscription = false ) {
1074
+function wpinv_get_merge_tags_help_text($subscription = false) {
1075 1075
 
1076 1076
 	$url  = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f';
1077 1077
 	$link = sprintf(
1078 1078
 		'<strong><a href="%s" target="_blank">%s</a></strong>',
1079 1079
 		$url,
1080
-		esc_html__( 'View available merge tags.', 'wpinv-quotes' )
1080
+		esc_html__('View available merge tags.', 'wpinv-quotes')
1081 1081
 	);
1082 1082
 
1083
-	$description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' );
1083
+	$description = esc_html__('The content of the email (Merge Tags and HTML are allowed).', 'invoicing');
1084 1084
 
1085 1085
 	return "$description $link";
1086 1086
 
Please login to merge, or discard this patch.
includes/class-getpaid-post-types.php 2 patches
Indentation   +295 added lines, -295 removed lines patch added patch discarded remove patch
@@ -15,321 +15,321 @@
 block discarded – undo
15 15
 class GetPaid_Post_Types {
16 16
 
17 17
     /**
18
-	 * Hook in methods.
19
-	 */
20
-	public function __construct() {
21
-		add_action( 'init', array( __CLASS__, 'register_post_types' ), 1 );
22
-		add_action( 'init', array( __CLASS__, 'register_post_status' ), 4 );
23
-		add_action( 'getpaid_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) );
24
-		add_action( 'getpaid_after_register_post_types', array( __CLASS__, 'maybe_flush_rewrite_rules' ) );
25
-	}
18
+     * Hook in methods.
19
+     */
20
+    public function __construct() {
21
+        add_action( 'init', array( __CLASS__, 'register_post_types' ), 1 );
22
+        add_action( 'init', array( __CLASS__, 'register_post_status' ), 4 );
23
+        add_action( 'getpaid_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) );
24
+        add_action( 'getpaid_after_register_post_types', array( __CLASS__, 'maybe_flush_rewrite_rules' ) );
25
+    }
26 26
 
27
-	/**
28
-	 * Register core post types.
29
-	 */
30
-	public static function register_post_types() {
27
+    /**
28
+     * Register core post types.
29
+     */
30
+    public static function register_post_types() {
31 31
 
32
-		if ( ! is_blog_installed() || post_type_exists( 'wpi_item' ) ) {
33
-			return;
34
-		}
32
+        if ( ! is_blog_installed() || post_type_exists( 'wpi_item' ) ) {
33
+            return;
34
+        }
35 35
 
36
-		$capabilities = wpinv_current_user_can_manage_invoicing();
36
+        $capabilities = wpinv_current_user_can_manage_invoicing();
37 37
 
38
-		// Fires before registering post types.
39
-		do_action( 'getpaid_register_post_types' );
38
+        // Fires before registering post types.
39
+        do_action( 'getpaid_register_post_types' );
40 40
 
41
-		// Register item post type.
42
-		register_post_type(
43
-			'wpi_item',
44
-			apply_filters(
45
-				'wpinv_register_post_type_invoice_item',
46
-				array(
47
-					'labels'             => array(
48
-						'name'               => _x( 'Items', 'post type general name', 'invoicing' ),
49
-						'singular_name'      => _x( 'Item', 'post type singular name', 'invoicing' ),
50
-						'menu_name'          => _x( 'Items', 'admin menu', 'invoicing' ),
51
-						'name_admin_bar'     => _x( 'Item', 'add new on admin bar', 'invoicing' ),
52
-						'add_new'            => _x( 'Add New', 'Item', 'invoicing' ),
53
-						'add_new_item'       => __( 'Add New Item', 'invoicing' ),
54
-						'new_item'           => __( 'New Item', 'invoicing' ),
55
-						'edit_item'          => __( 'Edit Item', 'invoicing' ),
56
-						'view_item'          => __( 'View Item', 'invoicing' ),
57
-						'all_items'          => __( 'Items', 'invoicing' ),
58
-						'search_items'       => __( 'Search items', 'invoicing' ),
59
-						'parent_item_colon'  => __( 'Parent item:', 'invoicing' ),
60
-						'not_found'          => __( 'No items found.', 'invoicing' ),
61
-						'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' )
62
-					),
63
-					'description'           => __( 'This is where you can add new invoice items.', 'invoicing' ),
64
-					'public'                => false,
65
-					'has_archive'           => false,
66
-					'_builtin'              => false,
67
-					'show_ui'               => true,
68
-					'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
69
-					'show_in_nav_menus'     => false,
70
-					'supports'              => array( 'title', 'excerpt', 'thumbnail' ),
71
-					'rewrite'               => false,
72
-					'query_var'             => false,
73
-					'map_meta_cap'          => true,
74
-					'show_in_admin_bar'     => true,
75
-					'can_export'            => true,
76
-				)
77
-			)
78
-		);
41
+        // Register item post type.
42
+        register_post_type(
43
+            'wpi_item',
44
+            apply_filters(
45
+                'wpinv_register_post_type_invoice_item',
46
+                array(
47
+                    'labels'             => array(
48
+                        'name'               => _x( 'Items', 'post type general name', 'invoicing' ),
49
+                        'singular_name'      => _x( 'Item', 'post type singular name', 'invoicing' ),
50
+                        'menu_name'          => _x( 'Items', 'admin menu', 'invoicing' ),
51
+                        'name_admin_bar'     => _x( 'Item', 'add new on admin bar', 'invoicing' ),
52
+                        'add_new'            => _x( 'Add New', 'Item', 'invoicing' ),
53
+                        'add_new_item'       => __( 'Add New Item', 'invoicing' ),
54
+                        'new_item'           => __( 'New Item', 'invoicing' ),
55
+                        'edit_item'          => __( 'Edit Item', 'invoicing' ),
56
+                        'view_item'          => __( 'View Item', 'invoicing' ),
57
+                        'all_items'          => __( 'Items', 'invoicing' ),
58
+                        'search_items'       => __( 'Search items', 'invoicing' ),
59
+                        'parent_item_colon'  => __( 'Parent item:', 'invoicing' ),
60
+                        'not_found'          => __( 'No items found.', 'invoicing' ),
61
+                        'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' )
62
+                    ),
63
+                    'description'           => __( 'This is where you can add new invoice items.', 'invoicing' ),
64
+                    'public'                => false,
65
+                    'has_archive'           => false,
66
+                    '_builtin'              => false,
67
+                    'show_ui'               => true,
68
+                    'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
69
+                    'show_in_nav_menus'     => false,
70
+                    'supports'              => array( 'title', 'excerpt', 'thumbnail' ),
71
+                    'rewrite'               => false,
72
+                    'query_var'             => false,
73
+                    'map_meta_cap'          => true,
74
+                    'show_in_admin_bar'     => true,
75
+                    'can_export'            => true,
76
+                )
77
+            )
78
+        );
79 79
 
80
-		// Register payment form post type.
81
-		register_post_type(
82
-			'wpi_payment_form',
83
-			apply_filters(
84
-				'wpinv_register_post_type_payment_form',
85
-				array(
86
-					'labels'             => array(
87
-						'name'               => _x( 'Payment Forms', 'post type general name', 'invoicing' ),
88
-						'singular_name'      => _x( 'Payment Form', 'post type singular name', 'invoicing' ),
89
-						'menu_name'          => _x( 'Payment Forms', 'admin menu', 'invoicing' ),
90
-						'name_admin_bar'     => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ),
91
-						'add_new'            => _x( 'Add New', 'Payment Form', 'invoicing' ),
92
-						'add_new_item'       => __( 'Add New Payment Form', 'invoicing' ),
93
-						'new_item'           => __( 'New Payment Form', 'invoicing' ),
94
-						'edit_item'          => __( 'Edit Payment Form', 'invoicing' ),
95
-						'view_item'          => __( 'View Payment Form', 'invoicing' ),
96
-						'all_items'          => __( 'Payment Forms', 'invoicing' ),
97
-						'search_items'       => __( 'Search Payment Forms', 'invoicing' ),
98
-						'parent_item_colon'  => __( 'Parent Payment Forms:', 'invoicing' ),
99
-						'not_found'          => __( 'No payment forms found.', 'invoicing' ),
100
-						'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' )
101
-					),
102
-					'description'        => __( 'Add new payment forms.', 'invoicing' ),
103
-					'public'             => false,
104
-					'show_ui'            => true,
105
-					'show_in_menu'       => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
106
-					'show_in_nav_menus'  => false,
107
-					'query_var'          => false,
108
-					'rewrite'            => true,
109
-					'map_meta_cap'       => true,
110
-					'has_archive'        => false,
111
-					'hierarchical'       => false,
112
-					'menu_position'      => null,
113
-					'supports'           => array( 'title' ),
114
-					'menu_icon'          => 'dashicons-media-form',
115
-				)
116
-			)
117
-		);
80
+        // Register payment form post type.
81
+        register_post_type(
82
+            'wpi_payment_form',
83
+            apply_filters(
84
+                'wpinv_register_post_type_payment_form',
85
+                array(
86
+                    'labels'             => array(
87
+                        'name'               => _x( 'Payment Forms', 'post type general name', 'invoicing' ),
88
+                        'singular_name'      => _x( 'Payment Form', 'post type singular name', 'invoicing' ),
89
+                        'menu_name'          => _x( 'Payment Forms', 'admin menu', 'invoicing' ),
90
+                        'name_admin_bar'     => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ),
91
+                        'add_new'            => _x( 'Add New', 'Payment Form', 'invoicing' ),
92
+                        'add_new_item'       => __( 'Add New Payment Form', 'invoicing' ),
93
+                        'new_item'           => __( 'New Payment Form', 'invoicing' ),
94
+                        'edit_item'          => __( 'Edit Payment Form', 'invoicing' ),
95
+                        'view_item'          => __( 'View Payment Form', 'invoicing' ),
96
+                        'all_items'          => __( 'Payment Forms', 'invoicing' ),
97
+                        'search_items'       => __( 'Search Payment Forms', 'invoicing' ),
98
+                        'parent_item_colon'  => __( 'Parent Payment Forms:', 'invoicing' ),
99
+                        'not_found'          => __( 'No payment forms found.', 'invoicing' ),
100
+                        'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' )
101
+                    ),
102
+                    'description'        => __( 'Add new payment forms.', 'invoicing' ),
103
+                    'public'             => false,
104
+                    'show_ui'            => true,
105
+                    'show_in_menu'       => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
106
+                    'show_in_nav_menus'  => false,
107
+                    'query_var'          => false,
108
+                    'rewrite'            => true,
109
+                    'map_meta_cap'       => true,
110
+                    'has_archive'        => false,
111
+                    'hierarchical'       => false,
112
+                    'menu_position'      => null,
113
+                    'supports'           => array( 'title' ),
114
+                    'menu_icon'          => 'dashicons-media-form',
115
+                )
116
+            )
117
+        );
118 118
 
119
-		// Register invoice post type.
120
-		register_post_type(
121
-			'wpi_invoice',
122
-			apply_filters(
123
-				'wpinv_register_post_type_invoice',
124
-				array(
125
-					'labels'                 => array(
126
-						'name'                  => __( 'Invoices', 'invoicing' ),
127
-						'singular_name'         => __( 'Invoice', 'invoicing' ),
128
-						'all_items'             => __( 'Invoices', 'invoicing' ),
129
-						'menu_name'             => _x( 'Invoices', 'Admin menu name', 'invoicing' ),
130
-						'add_new'               => __( 'Add New', 'invoicing' ),
131
-						'add_new_item'          => __( 'Add new invoice', 'invoicing' ),
132
-						'edit'                  => __( 'Edit', 'invoicing' ),
133
-						'edit_item'             => __( 'Edit invoice', 'invoicing' ),
134
-						'new_item'              => __( 'New invoice', 'invoicing' ),
135
-						'view_item'             => __( 'View invoice', 'invoicing' ),
136
-						'view_items'            => __( 'View Invoices', 'invoicing' ),
137
-						'search_items'          => __( 'Search invoices', 'invoicing' ),
138
-						'not_found'             => __( 'No invoices found', 'invoicing' ),
139
-						'not_found_in_trash'    => __( 'No invoices found in trash', 'invoicing' ),
140
-						'parent'                => __( 'Parent invoice', 'invoicing' ),
141
-						'featured_image'        => __( 'Invoice image', 'invoicing' ),
142
-						'set_featured_image'    => __( 'Set invoice image', 'invoicing' ),
143
-						'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ),
144
-						'use_featured_image'    => __( 'Use as invoice image', 'invoicing' ),
145
-						'insert_into_item'      => __( 'Insert into invoice', 'invoicing' ),
146
-						'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ),
147
-						'filter_items_list'     => __( 'Filter invoices', 'invoicing' ),
148
-						'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ),
149
-						'items_list'            => __( 'Invoices list', 'invoicing' ),
150
-					),
151
-					'description'           => __( 'This is where invoices are stored.', 'invoicing' ),
152
-					'public'                => true,
153
-					'has_archive'           => false,
154
-					'publicly_queryable'    => true,
155
-        			'exclude_from_search'   => true,
156
-        			'show_ui'               => true,
157
-					'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
158
-					'show_in_nav_menus'     => false,
159
-					'supports'              => array( 'title', 'author', 'excerpt'  ),
160
-					'rewrite'               => array(
161
-						'slug'              => 'invoice',
162
-						'with_front'        => false,
163
-					),
164
-					'query_var'             => false,
165
-					'map_meta_cap'          => true,
166
-					'show_in_admin_bar'     => true,
167
-					'can_export'            => true,
168
-					'hierarchical'          => false,
169
-					'menu_position'         => null,
170
-					'menu_icon'             => 'dashicons-media-spreadsheet',
171
-				)
172
-			)
173
-		);
119
+        // Register invoice post type.
120
+        register_post_type(
121
+            'wpi_invoice',
122
+            apply_filters(
123
+                'wpinv_register_post_type_invoice',
124
+                array(
125
+                    'labels'                 => array(
126
+                        'name'                  => __( 'Invoices', 'invoicing' ),
127
+                        'singular_name'         => __( 'Invoice', 'invoicing' ),
128
+                        'all_items'             => __( 'Invoices', 'invoicing' ),
129
+                        'menu_name'             => _x( 'Invoices', 'Admin menu name', 'invoicing' ),
130
+                        'add_new'               => __( 'Add New', 'invoicing' ),
131
+                        'add_new_item'          => __( 'Add new invoice', 'invoicing' ),
132
+                        'edit'                  => __( 'Edit', 'invoicing' ),
133
+                        'edit_item'             => __( 'Edit invoice', 'invoicing' ),
134
+                        'new_item'              => __( 'New invoice', 'invoicing' ),
135
+                        'view_item'             => __( 'View invoice', 'invoicing' ),
136
+                        'view_items'            => __( 'View Invoices', 'invoicing' ),
137
+                        'search_items'          => __( 'Search invoices', 'invoicing' ),
138
+                        'not_found'             => __( 'No invoices found', 'invoicing' ),
139
+                        'not_found_in_trash'    => __( 'No invoices found in trash', 'invoicing' ),
140
+                        'parent'                => __( 'Parent invoice', 'invoicing' ),
141
+                        'featured_image'        => __( 'Invoice image', 'invoicing' ),
142
+                        'set_featured_image'    => __( 'Set invoice image', 'invoicing' ),
143
+                        'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ),
144
+                        'use_featured_image'    => __( 'Use as invoice image', 'invoicing' ),
145
+                        'insert_into_item'      => __( 'Insert into invoice', 'invoicing' ),
146
+                        'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ),
147
+                        'filter_items_list'     => __( 'Filter invoices', 'invoicing' ),
148
+                        'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ),
149
+                        'items_list'            => __( 'Invoices list', 'invoicing' ),
150
+                    ),
151
+                    'description'           => __( 'This is where invoices are stored.', 'invoicing' ),
152
+                    'public'                => true,
153
+                    'has_archive'           => false,
154
+                    'publicly_queryable'    => true,
155
+                    'exclude_from_search'   => true,
156
+                    'show_ui'               => true,
157
+                    'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
158
+                    'show_in_nav_menus'     => false,
159
+                    'supports'              => array( 'title', 'author', 'excerpt'  ),
160
+                    'rewrite'               => array(
161
+                        'slug'              => 'invoice',
162
+                        'with_front'        => false,
163
+                    ),
164
+                    'query_var'             => false,
165
+                    'map_meta_cap'          => true,
166
+                    'show_in_admin_bar'     => true,
167
+                    'can_export'            => true,
168
+                    'hierarchical'          => false,
169
+                    'menu_position'         => null,
170
+                    'menu_icon'             => 'dashicons-media-spreadsheet',
171
+                )
172
+            )
173
+        );
174 174
 
175
-		// Register discount post type.
176
-		register_post_type(
177
-			'wpi_discount',
178
-			apply_filters(
179
-				'wpinv_register_post_type_discount',
180
-				array(
181
-					'labels'                 => array(
182
-						'name'                  => __( 'Discounts', 'invoicing' ),
183
-						'singular_name'         => __( 'Discount', 'invoicing' ),
184
-						'all_items'             => __( 'Discounts', 'invoicing' ),
185
-						'menu_name'             => _x( 'Discounts', 'Admin menu name', 'invoicing' ),
186
-						'add_new'               => __( 'Add New', 'invoicing' ),
187
-						'add_new_item'          => __( 'Add new discount', 'invoicing' ),
188
-						'edit'                  => __( 'Edit', 'invoicing' ),
189
-						'edit_item'             => __( 'Edit discount', 'invoicing' ),
190
-						'new_item'              => __( 'New discount', 'invoicing' ),
191
-						'view_item'             => __( 'View discount', 'invoicing' ),
192
-						'view_items'            => __( 'View Discounts', 'invoicing' ),
193
-						'search_items'          => __( 'Search discounts', 'invoicing' ),
194
-						'not_found'             => __( 'No discounts found', 'invoicing' ),
195
-						'not_found_in_trash'    => __( 'No discounts found in trash', 'invoicing' ),
196
-						'parent'                => __( 'Parent discount', 'invoicing' ),
197
-						'featured_image'        => __( 'Discount image', 'invoicing' ),
198
-						'set_featured_image'    => __( 'Set discount image', 'invoicing' ),
199
-						'remove_featured_image' => __( 'Remove discount image', 'invoicing' ),
200
-						'use_featured_image'    => __( 'Use as discount image', 'invoicing' ),
201
-						'insert_into_item'      => __( 'Insert into discount', 'invoicing' ),
202
-						'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ),
203
-						'filter_items_list'     => __( 'Filter discounts', 'invoicing' ),
204
-						'items_list_navigation' => __( 'Discount navigation', 'invoicing' ),
205
-						'items_list'            => __( 'Discounts list', 'invoicing' ),
206
-					),
207
-					'description'        => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ),
208
-					'public'             => false,
209
-					'can_export'         => true,
210
-					'_builtin'           => false,
211
-					'publicly_queryable' => false,
212
-					'exclude_from_search'=> true,
213
-					'show_ui'            => true,
214
-					'show_in_menu'       => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
215
-					'query_var'          => false,
216
-					'rewrite'            => false,
217
-					'map_meta_cap'       => true,
218
-					'has_archive'        => false,
219
-					'hierarchical'       => false,
220
-					'supports'           => array( 'title', 'excerpt' ),
221
-					'show_in_nav_menus'  => false,
222
-					'show_in_admin_bar'  => true,
223
-					'menu_position'      => null,
224
-				)
225
-			)
226
-		);
175
+        // Register discount post type.
176
+        register_post_type(
177
+            'wpi_discount',
178
+            apply_filters(
179
+                'wpinv_register_post_type_discount',
180
+                array(
181
+                    'labels'                 => array(
182
+                        'name'                  => __( 'Discounts', 'invoicing' ),
183
+                        'singular_name'         => __( 'Discount', 'invoicing' ),
184
+                        'all_items'             => __( 'Discounts', 'invoicing' ),
185
+                        'menu_name'             => _x( 'Discounts', 'Admin menu name', 'invoicing' ),
186
+                        'add_new'               => __( 'Add New', 'invoicing' ),
187
+                        'add_new_item'          => __( 'Add new discount', 'invoicing' ),
188
+                        'edit'                  => __( 'Edit', 'invoicing' ),
189
+                        'edit_item'             => __( 'Edit discount', 'invoicing' ),
190
+                        'new_item'              => __( 'New discount', 'invoicing' ),
191
+                        'view_item'             => __( 'View discount', 'invoicing' ),
192
+                        'view_items'            => __( 'View Discounts', 'invoicing' ),
193
+                        'search_items'          => __( 'Search discounts', 'invoicing' ),
194
+                        'not_found'             => __( 'No discounts found', 'invoicing' ),
195
+                        'not_found_in_trash'    => __( 'No discounts found in trash', 'invoicing' ),
196
+                        'parent'                => __( 'Parent discount', 'invoicing' ),
197
+                        'featured_image'        => __( 'Discount image', 'invoicing' ),
198
+                        'set_featured_image'    => __( 'Set discount image', 'invoicing' ),
199
+                        'remove_featured_image' => __( 'Remove discount image', 'invoicing' ),
200
+                        'use_featured_image'    => __( 'Use as discount image', 'invoicing' ),
201
+                        'insert_into_item'      => __( 'Insert into discount', 'invoicing' ),
202
+                        'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ),
203
+                        'filter_items_list'     => __( 'Filter discounts', 'invoicing' ),
204
+                        'items_list_navigation' => __( 'Discount navigation', 'invoicing' ),
205
+                        'items_list'            => __( 'Discounts list', 'invoicing' ),
206
+                    ),
207
+                    'description'        => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ),
208
+                    'public'             => false,
209
+                    'can_export'         => true,
210
+                    '_builtin'           => false,
211
+                    'publicly_queryable' => false,
212
+                    'exclude_from_search'=> true,
213
+                    'show_ui'            => true,
214
+                    'show_in_menu'       => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
215
+                    'query_var'          => false,
216
+                    'rewrite'            => false,
217
+                    'map_meta_cap'       => true,
218
+                    'has_archive'        => false,
219
+                    'hierarchical'       => false,
220
+                    'supports'           => array( 'title', 'excerpt' ),
221
+                    'show_in_nav_menus'  => false,
222
+                    'show_in_admin_bar'  => true,
223
+                    'menu_position'      => null,
224
+                )
225
+            )
226
+        );
227 227
 
228
-		do_action( 'getpaid_after_register_post_types' );
229
-	}
228
+        do_action( 'getpaid_after_register_post_types' );
229
+    }
230 230
 
231
-	/**
232
-	 * Register our custom post statuses.
233
-	 */
234
-	public static function register_post_status() {
231
+    /**
232
+     * Register our custom post statuses.
233
+     */
234
+    public static function register_post_status() {
235 235
 
236
-		$invoice_statuses = apply_filters(
237
-			'getpaid_register_invoice_post_statuses',
238
-			array(
236
+        $invoice_statuses = apply_filters(
237
+            'getpaid_register_invoice_post_statuses',
238
+            array(
239 239
 
240
-				'wpi-pending' => array(
241
-					'label'                     => _x( 'Pending Payment', 'Invoice status', 'invoicing' ),
242
-        			'public'                    => true,
243
-        			'exclude_from_search'       => true,
244
-        			'show_in_admin_all_list'    => true,
245
-					'show_in_admin_status_list' => true,
246
-					/* translators: %s: number of invoices */
247
-        			'label_count'               => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' )
248
-				),
240
+                'wpi-pending' => array(
241
+                    'label'                     => _x( 'Pending Payment', 'Invoice status', 'invoicing' ),
242
+                    'public'                    => true,
243
+                    'exclude_from_search'       => true,
244
+                    'show_in_admin_all_list'    => true,
245
+                    'show_in_admin_status_list' => true,
246
+                    /* translators: %s: number of invoices */
247
+                    'label_count'               => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' )
248
+                ),
249 249
 
250
-				'wpi-processing' => array(
251
-					'label'                     => _x( 'Processing', 'Invoice status', 'invoicing' ),
252
-        			'public'                    => true,
253
-        			'exclude_from_search'       => true,
254
-        			'show_in_admin_all_list'    => true,
255
-					'show_in_admin_status_list' => true,
256
-					/* translators: %s: number of invoices */
257
-        			'label_count'               => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' )
258
-				),
250
+                'wpi-processing' => array(
251
+                    'label'                     => _x( 'Processing', 'Invoice status', 'invoicing' ),
252
+                    'public'                    => true,
253
+                    'exclude_from_search'       => true,
254
+                    'show_in_admin_all_list'    => true,
255
+                    'show_in_admin_status_list' => true,
256
+                    /* translators: %s: number of invoices */
257
+                    'label_count'               => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' )
258
+                ),
259 259
 
260
-				'wpi-onhold' => array(
261
-					'label'                     => _x( 'On Hold', 'Invoice status', 'invoicing' ),
262
-        			'public'                    => true,
263
-        			'exclude_from_search'       => true,
264
-        			'show_in_admin_all_list'    => true,
265
-					'show_in_admin_status_list' => true,
266
-					/* translators: %s: number of invoices */
267
-        			'label_count'               => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' )
268
-				),
260
+                'wpi-onhold' => array(
261
+                    'label'                     => _x( 'On Hold', 'Invoice status', 'invoicing' ),
262
+                    'public'                    => true,
263
+                    'exclude_from_search'       => true,
264
+                    'show_in_admin_all_list'    => true,
265
+                    'show_in_admin_status_list' => true,
266
+                    /* translators: %s: number of invoices */
267
+                    'label_count'               => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' )
268
+                ),
269 269
 
270
-				'wpi-cancelled' => array(
271
-					'label'                     => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
272
-        			'public'                    => true,
273
-        			'exclude_from_search'       => true,
274
-        			'show_in_admin_all_list'    => true,
275
-					'show_in_admin_status_list' => true,
276
-					/* translators: %s: number of invoices */
277
-        			'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' )
278
-				),
270
+                'wpi-cancelled' => array(
271
+                    'label'                     => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
272
+                    'public'                    => true,
273
+                    'exclude_from_search'       => true,
274
+                    'show_in_admin_all_list'    => true,
275
+                    'show_in_admin_status_list' => true,
276
+                    /* translators: %s: number of invoices */
277
+                    'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' )
278
+                ),
279 279
 
280
-				'wpi-refunded' => array(
281
-					'label'                     => _x( 'Refunded', 'Invoice status', 'invoicing' ),
282
-        			'public'                    => true,
283
-        			'exclude_from_search'       => true,
284
-        			'show_in_admin_all_list'    => true,
285
-					'show_in_admin_status_list' => true,
286
-					/* translators: %s: number of invoices */
287
-        			'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' )
288
-				),
280
+                'wpi-refunded' => array(
281
+                    'label'                     => _x( 'Refunded', 'Invoice status', 'invoicing' ),
282
+                    'public'                    => true,
283
+                    'exclude_from_search'       => true,
284
+                    'show_in_admin_all_list'    => true,
285
+                    'show_in_admin_status_list' => true,
286
+                    /* translators: %s: number of invoices */
287
+                    'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' )
288
+                ),
289 289
 
290
-				'wpi-failed' => array(
291
-					'label'                     => _x( 'Failed', 'Invoice status', 'invoicing' ),
292
-        			'public'                    => true,
293
-        			'exclude_from_search'       => true,
294
-        			'show_in_admin_all_list'    => true,
295
-					'show_in_admin_status_list' => true,
296
-					/* translators: %s: number of invoices */
297
-        			'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' )
298
-				),
290
+                'wpi-failed' => array(
291
+                    'label'                     => _x( 'Failed', 'Invoice status', 'invoicing' ),
292
+                    'public'                    => true,
293
+                    'exclude_from_search'       => true,
294
+                    'show_in_admin_all_list'    => true,
295
+                    'show_in_admin_status_list' => true,
296
+                    /* translators: %s: number of invoices */
297
+                    'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' )
298
+                ),
299 299
 
300
-				'wpi-renewal' => array(
301
-					'label'                     => _x( 'Renewal', 'Invoice status', 'invoicing' ),
302
-        			'public'                    => true,
303
-        			'exclude_from_search'       => true,
304
-        			'show_in_admin_all_list'    => true,
305
-					'show_in_admin_status_list' => true,
306
-					/* translators: %s: number of invoices */
307
-        			'label_count'               => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' )
308
-				)
309
-			)
310
-		);
300
+                'wpi-renewal' => array(
301
+                    'label'                     => _x( 'Renewal', 'Invoice status', 'invoicing' ),
302
+                    'public'                    => true,
303
+                    'exclude_from_search'       => true,
304
+                    'show_in_admin_all_list'    => true,
305
+                    'show_in_admin_status_list' => true,
306
+                    /* translators: %s: number of invoices */
307
+                    'label_count'               => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' )
308
+                )
309
+            )
310
+        );
311 311
 
312
-		foreach ( $invoice_statuses as $invoice_statuse => $args ) {
313
-			register_post_status( $invoice_statuse, $args );
314
-		}
315
-	}
312
+        foreach ( $invoice_statuses as $invoice_statuse => $args ) {
313
+            register_post_status( $invoice_statuse, $args );
314
+        }
315
+    }
316 316
 
317
-	/**
318
-	 * Flush rewrite rules.
319
-	 */
320
-	public static function flush_rewrite_rules() {
321
-		flush_rewrite_rules();
322
-	}
317
+    /**
318
+     * Flush rewrite rules.
319
+     */
320
+    public static function flush_rewrite_rules() {
321
+        flush_rewrite_rules();
322
+    }
323 323
 
324
-	/**
325
-	 * Flush rules to prevent 404.
326
-	 *
327
-	 */
328
-	public static function maybe_flush_rewrite_rules() {
329
-		if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) {
330
-			update_option( 'getpaid_flushed_rewrite_rules', '1' );
331
-			self::flush_rewrite_rules();
332
-		}
333
-	}
324
+    /**
325
+     * Flush rules to prevent 404.
326
+     *
327
+     */
328
+    public static function maybe_flush_rewrite_rules() {
329
+        if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) {
330
+            update_option( 'getpaid_flushed_rewrite_rules', '1' );
331
+            self::flush_rewrite_rules();
332
+        }
333
+    }
334 334
 
335 335
 }
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  *
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Post types Class
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 * Hook in methods.
19 19
 	 */
20 20
 	public function __construct() {
21
-		add_action( 'init', array( __CLASS__, 'register_post_types' ), 1 );
22
-		add_action( 'init', array( __CLASS__, 'register_post_status' ), 4 );
23
-		add_action( 'getpaid_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) );
24
-		add_action( 'getpaid_after_register_post_types', array( __CLASS__, 'maybe_flush_rewrite_rules' ) );
21
+		add_action('init', array(__CLASS__, 'register_post_types'), 1);
22
+		add_action('init', array(__CLASS__, 'register_post_status'), 4);
23
+		add_action('getpaid_flush_rewrite_rules', array(__CLASS__, 'flush_rewrite_rules'));
24
+		add_action('getpaid_after_register_post_types', array(__CLASS__, 'maybe_flush_rewrite_rules'));
25 25
 	}
26 26
 
27 27
 	/**
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public static function register_post_types() {
31 31
 
32
-		if ( ! is_blog_installed() || post_type_exists( 'wpi_item' ) ) {
32
+		if (!is_blog_installed() || post_type_exists('wpi_item')) {
33 33
 			return;
34 34
 		}
35 35
 
36 36
 		$capabilities = wpinv_current_user_can_manage_invoicing();
37 37
 
38 38
 		// Fires before registering post types.
39
-		do_action( 'getpaid_register_post_types' );
39
+		do_action('getpaid_register_post_types');
40 40
 
41 41
 		// Register item post type.
42 42
 		register_post_type(
@@ -45,29 +45,29 @@  discard block
 block discarded – undo
45 45
 				'wpinv_register_post_type_invoice_item',
46 46
 				array(
47 47
 					'labels'             => array(
48
-						'name'               => _x( 'Items', 'post type general name', 'invoicing' ),
49
-						'singular_name'      => _x( 'Item', 'post type singular name', 'invoicing' ),
50
-						'menu_name'          => _x( 'Items', 'admin menu', 'invoicing' ),
51
-						'name_admin_bar'     => _x( 'Item', 'add new on admin bar', 'invoicing' ),
52
-						'add_new'            => _x( 'Add New', 'Item', 'invoicing' ),
53
-						'add_new_item'       => __( 'Add New Item', 'invoicing' ),
54
-						'new_item'           => __( 'New Item', 'invoicing' ),
55
-						'edit_item'          => __( 'Edit Item', 'invoicing' ),
56
-						'view_item'          => __( 'View Item', 'invoicing' ),
57
-						'all_items'          => __( 'Items', 'invoicing' ),
58
-						'search_items'       => __( 'Search items', 'invoicing' ),
59
-						'parent_item_colon'  => __( 'Parent item:', 'invoicing' ),
60
-						'not_found'          => __( 'No items found.', 'invoicing' ),
61
-						'not_found_in_trash' => __( 'No items found in trash.', 'invoicing' )
48
+						'name'               => _x('Items', 'post type general name', 'invoicing'),
49
+						'singular_name'      => _x('Item', 'post type singular name', 'invoicing'),
50
+						'menu_name'          => _x('Items', 'admin menu', 'invoicing'),
51
+						'name_admin_bar'     => _x('Item', 'add new on admin bar', 'invoicing'),
52
+						'add_new'            => _x('Add New', 'Item', 'invoicing'),
53
+						'add_new_item'       => __('Add New Item', 'invoicing'),
54
+						'new_item'           => __('New Item', 'invoicing'),
55
+						'edit_item'          => __('Edit Item', 'invoicing'),
56
+						'view_item'          => __('View Item', 'invoicing'),
57
+						'all_items'          => __('Items', 'invoicing'),
58
+						'search_items'       => __('Search items', 'invoicing'),
59
+						'parent_item_colon'  => __('Parent item:', 'invoicing'),
60
+						'not_found'          => __('No items found.', 'invoicing'),
61
+						'not_found_in_trash' => __('No items found in trash.', 'invoicing')
62 62
 					),
63
-					'description'           => __( 'This is where you can add new invoice items.', 'invoicing' ),
63
+					'description'           => __('This is where you can add new invoice items.', 'invoicing'),
64 64
 					'public'                => false,
65 65
 					'has_archive'           => false,
66 66
 					'_builtin'              => false,
67 67
 					'show_ui'               => true,
68 68
 					'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
69 69
 					'show_in_nav_menus'     => false,
70
-					'supports'              => array( 'title', 'excerpt', 'thumbnail' ),
70
+					'supports'              => array('title', 'excerpt', 'thumbnail'),
71 71
 					'rewrite'               => false,
72 72
 					'query_var'             => false,
73 73
 					'map_meta_cap'          => true,
@@ -84,22 +84,22 @@  discard block
 block discarded – undo
84 84
 				'wpinv_register_post_type_payment_form',
85 85
 				array(
86 86
 					'labels'             => array(
87
-						'name'               => _x( 'Payment Forms', 'post type general name', 'invoicing' ),
88
-						'singular_name'      => _x( 'Payment Form', 'post type singular name', 'invoicing' ),
89
-						'menu_name'          => _x( 'Payment Forms', 'admin menu', 'invoicing' ),
90
-						'name_admin_bar'     => _x( 'Payment Form', 'add new on admin bar', 'invoicing' ),
91
-						'add_new'            => _x( 'Add New', 'Payment Form', 'invoicing' ),
92
-						'add_new_item'       => __( 'Add New Payment Form', 'invoicing' ),
93
-						'new_item'           => __( 'New Payment Form', 'invoicing' ),
94
-						'edit_item'          => __( 'Edit Payment Form', 'invoicing' ),
95
-						'view_item'          => __( 'View Payment Form', 'invoicing' ),
96
-						'all_items'          => __( 'Payment Forms', 'invoicing' ),
97
-						'search_items'       => __( 'Search Payment Forms', 'invoicing' ),
98
-						'parent_item_colon'  => __( 'Parent Payment Forms:', 'invoicing' ),
99
-						'not_found'          => __( 'No payment forms found.', 'invoicing' ),
100
-						'not_found_in_trash' => __( 'No payment forms found in trash.', 'invoicing' )
87
+						'name'               => _x('Payment Forms', 'post type general name', 'invoicing'),
88
+						'singular_name'      => _x('Payment Form', 'post type singular name', 'invoicing'),
89
+						'menu_name'          => _x('Payment Forms', 'admin menu', 'invoicing'),
90
+						'name_admin_bar'     => _x('Payment Form', 'add new on admin bar', 'invoicing'),
91
+						'add_new'            => _x('Add New', 'Payment Form', 'invoicing'),
92
+						'add_new_item'       => __('Add New Payment Form', 'invoicing'),
93
+						'new_item'           => __('New Payment Form', 'invoicing'),
94
+						'edit_item'          => __('Edit Payment Form', 'invoicing'),
95
+						'view_item'          => __('View Payment Form', 'invoicing'),
96
+						'all_items'          => __('Payment Forms', 'invoicing'),
97
+						'search_items'       => __('Search Payment Forms', 'invoicing'),
98
+						'parent_item_colon'  => __('Parent Payment Forms:', 'invoicing'),
99
+						'not_found'          => __('No payment forms found.', 'invoicing'),
100
+						'not_found_in_trash' => __('No payment forms found in trash.', 'invoicing')
101 101
 					),
102
-					'description'        => __( 'Add new payment forms.', 'invoicing' ),
102
+					'description'        => __('Add new payment forms.', 'invoicing'),
103 103
 					'public'             => false,
104 104
 					'show_ui'            => true,
105 105
 					'show_in_menu'       => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 					'has_archive'        => false,
111 111
 					'hierarchical'       => false,
112 112
 					'menu_position'      => null,
113
-					'supports'           => array( 'title' ),
113
+					'supports'           => array('title'),
114 114
 					'menu_icon'          => 'dashicons-media-form',
115 115
 				)
116 116
 			)
@@ -123,32 +123,32 @@  discard block
 block discarded – undo
123 123
 				'wpinv_register_post_type_invoice',
124 124
 				array(
125 125
 					'labels'                 => array(
126
-						'name'                  => __( 'Invoices', 'invoicing' ),
127
-						'singular_name'         => __( 'Invoice', 'invoicing' ),
128
-						'all_items'             => __( 'Invoices', 'invoicing' ),
129
-						'menu_name'             => _x( 'Invoices', 'Admin menu name', 'invoicing' ),
130
-						'add_new'               => __( 'Add New', 'invoicing' ),
131
-						'add_new_item'          => __( 'Add new invoice', 'invoicing' ),
132
-						'edit'                  => __( 'Edit', 'invoicing' ),
133
-						'edit_item'             => __( 'Edit invoice', 'invoicing' ),
134
-						'new_item'              => __( 'New invoice', 'invoicing' ),
135
-						'view_item'             => __( 'View invoice', 'invoicing' ),
136
-						'view_items'            => __( 'View Invoices', 'invoicing' ),
137
-						'search_items'          => __( 'Search invoices', 'invoicing' ),
138
-						'not_found'             => __( 'No invoices found', 'invoicing' ),
139
-						'not_found_in_trash'    => __( 'No invoices found in trash', 'invoicing' ),
140
-						'parent'                => __( 'Parent invoice', 'invoicing' ),
141
-						'featured_image'        => __( 'Invoice image', 'invoicing' ),
142
-						'set_featured_image'    => __( 'Set invoice image', 'invoicing' ),
143
-						'remove_featured_image' => __( 'Remove invoice image', 'invoicing' ),
144
-						'use_featured_image'    => __( 'Use as invoice image', 'invoicing' ),
145
-						'insert_into_item'      => __( 'Insert into invoice', 'invoicing' ),
146
-						'uploaded_to_this_item' => __( 'Uploaded to this invoice', 'invoicing' ),
147
-						'filter_items_list'     => __( 'Filter invoices', 'invoicing' ),
148
-						'items_list_navigation' => __( 'Invoices navigation', 'invoicing' ),
149
-						'items_list'            => __( 'Invoices list', 'invoicing' ),
126
+						'name'                  => __('Invoices', 'invoicing'),
127
+						'singular_name'         => __('Invoice', 'invoicing'),
128
+						'all_items'             => __('Invoices', 'invoicing'),
129
+						'menu_name'             => _x('Invoices', 'Admin menu name', 'invoicing'),
130
+						'add_new'               => __('Add New', 'invoicing'),
131
+						'add_new_item'          => __('Add new invoice', 'invoicing'),
132
+						'edit'                  => __('Edit', 'invoicing'),
133
+						'edit_item'             => __('Edit invoice', 'invoicing'),
134
+						'new_item'              => __('New invoice', 'invoicing'),
135
+						'view_item'             => __('View invoice', 'invoicing'),
136
+						'view_items'            => __('View Invoices', 'invoicing'),
137
+						'search_items'          => __('Search invoices', 'invoicing'),
138
+						'not_found'             => __('No invoices found', 'invoicing'),
139
+						'not_found_in_trash'    => __('No invoices found in trash', 'invoicing'),
140
+						'parent'                => __('Parent invoice', 'invoicing'),
141
+						'featured_image'        => __('Invoice image', 'invoicing'),
142
+						'set_featured_image'    => __('Set invoice image', 'invoicing'),
143
+						'remove_featured_image' => __('Remove invoice image', 'invoicing'),
144
+						'use_featured_image'    => __('Use as invoice image', 'invoicing'),
145
+						'insert_into_item'      => __('Insert into invoice', 'invoicing'),
146
+						'uploaded_to_this_item' => __('Uploaded to this invoice', 'invoicing'),
147
+						'filter_items_list'     => __('Filter invoices', 'invoicing'),
148
+						'items_list_navigation' => __('Invoices navigation', 'invoicing'),
149
+						'items_list'            => __('Invoices list', 'invoicing'),
150 150
 					),
151
-					'description'           => __( 'This is where invoices are stored.', 'invoicing' ),
151
+					'description'           => __('This is where invoices are stored.', 'invoicing'),
152 152
 					'public'                => true,
153 153
 					'has_archive'           => false,
154 154
 					'publicly_queryable'    => true,
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         			'show_ui'               => true,
157 157
 					'show_in_menu'          => wpinv_current_user_can_manage_invoicing() ? 'wpinv' : false,
158 158
 					'show_in_nav_menus'     => false,
159
-					'supports'              => array( 'title', 'author', 'excerpt'  ),
159
+					'supports'              => array('title', 'author', 'excerpt'),
160 160
 					'rewrite'               => array(
161 161
 						'slug'              => 'invoice',
162 162
 						'with_front'        => false,
@@ -179,32 +179,32 @@  discard block
 block discarded – undo
179 179
 				'wpinv_register_post_type_discount',
180 180
 				array(
181 181
 					'labels'                 => array(
182
-						'name'                  => __( 'Discounts', 'invoicing' ),
183
-						'singular_name'         => __( 'Discount', 'invoicing' ),
184
-						'all_items'             => __( 'Discounts', 'invoicing' ),
185
-						'menu_name'             => _x( 'Discounts', 'Admin menu name', 'invoicing' ),
186
-						'add_new'               => __( 'Add New', 'invoicing' ),
187
-						'add_new_item'          => __( 'Add new discount', 'invoicing' ),
188
-						'edit'                  => __( 'Edit', 'invoicing' ),
189
-						'edit_item'             => __( 'Edit discount', 'invoicing' ),
190
-						'new_item'              => __( 'New discount', 'invoicing' ),
191
-						'view_item'             => __( 'View discount', 'invoicing' ),
192
-						'view_items'            => __( 'View Discounts', 'invoicing' ),
193
-						'search_items'          => __( 'Search discounts', 'invoicing' ),
194
-						'not_found'             => __( 'No discounts found', 'invoicing' ),
195
-						'not_found_in_trash'    => __( 'No discounts found in trash', 'invoicing' ),
196
-						'parent'                => __( 'Parent discount', 'invoicing' ),
197
-						'featured_image'        => __( 'Discount image', 'invoicing' ),
198
-						'set_featured_image'    => __( 'Set discount image', 'invoicing' ),
199
-						'remove_featured_image' => __( 'Remove discount image', 'invoicing' ),
200
-						'use_featured_image'    => __( 'Use as discount image', 'invoicing' ),
201
-						'insert_into_item'      => __( 'Insert into discount', 'invoicing' ),
202
-						'uploaded_to_this_item' => __( 'Uploaded to this discount', 'invoicing' ),
203
-						'filter_items_list'     => __( 'Filter discounts', 'invoicing' ),
204
-						'items_list_navigation' => __( 'Discount navigation', 'invoicing' ),
205
-						'items_list'            => __( 'Discounts list', 'invoicing' ),
182
+						'name'                  => __('Discounts', 'invoicing'),
183
+						'singular_name'         => __('Discount', 'invoicing'),
184
+						'all_items'             => __('Discounts', 'invoicing'),
185
+						'menu_name'             => _x('Discounts', 'Admin menu name', 'invoicing'),
186
+						'add_new'               => __('Add New', 'invoicing'),
187
+						'add_new_item'          => __('Add new discount', 'invoicing'),
188
+						'edit'                  => __('Edit', 'invoicing'),
189
+						'edit_item'             => __('Edit discount', 'invoicing'),
190
+						'new_item'              => __('New discount', 'invoicing'),
191
+						'view_item'             => __('View discount', 'invoicing'),
192
+						'view_items'            => __('View Discounts', 'invoicing'),
193
+						'search_items'          => __('Search discounts', 'invoicing'),
194
+						'not_found'             => __('No discounts found', 'invoicing'),
195
+						'not_found_in_trash'    => __('No discounts found in trash', 'invoicing'),
196
+						'parent'                => __('Parent discount', 'invoicing'),
197
+						'featured_image'        => __('Discount image', 'invoicing'),
198
+						'set_featured_image'    => __('Set discount image', 'invoicing'),
199
+						'remove_featured_image' => __('Remove discount image', 'invoicing'),
200
+						'use_featured_image'    => __('Use as discount image', 'invoicing'),
201
+						'insert_into_item'      => __('Insert into discount', 'invoicing'),
202
+						'uploaded_to_this_item' => __('Uploaded to this discount', 'invoicing'),
203
+						'filter_items_list'     => __('Filter discounts', 'invoicing'),
204
+						'items_list_navigation' => __('Discount navigation', 'invoicing'),
205
+						'items_list'            => __('Discounts list', 'invoicing'),
206 206
 					),
207
-					'description'        => __( 'This is where you can add new discounts that users can use in invoices.', 'invoicing' ),
207
+					'description'        => __('This is where you can add new discounts that users can use in invoices.', 'invoicing'),
208 208
 					'public'             => false,
209 209
 					'can_export'         => true,
210 210
 					'_builtin'           => false,
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 					'map_meta_cap'       => true,
218 218
 					'has_archive'        => false,
219 219
 					'hierarchical'       => false,
220
-					'supports'           => array( 'title', 'excerpt' ),
220
+					'supports'           => array('title', 'excerpt'),
221 221
 					'show_in_nav_menus'  => false,
222 222
 					'show_in_admin_bar'  => true,
223 223
 					'menu_position'      => null,
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 			)
226 226
 		);
227 227
 
228
-		do_action( 'getpaid_after_register_post_types' );
228
+		do_action('getpaid_after_register_post_types');
229 229
 	}
230 230
 
231 231
 	/**
@@ -238,79 +238,79 @@  discard block
 block discarded – undo
238 238
 			array(
239 239
 
240 240
 				'wpi-pending' => array(
241
-					'label'                     => _x( 'Pending Payment', 'Invoice status', 'invoicing' ),
241
+					'label'                     => _x('Pending Payment', 'Invoice status', 'invoicing'),
242 242
         			'public'                    => true,
243 243
         			'exclude_from_search'       => true,
244 244
         			'show_in_admin_all_list'    => true,
245 245
 					'show_in_admin_status_list' => true,
246 246
 					/* translators: %s: number of invoices */
247
-        			'label_count'               => _n_noop( 'Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing' )
247
+        			'label_count'               => _n_noop('Pending Payment <span class="count">(%s)</span>', 'Pending Payment <span class="count">(%s)</span>', 'invoicing')
248 248
 				),
249 249
 
250 250
 				'wpi-processing' => array(
251
-					'label'                     => _x( 'Processing', 'Invoice status', 'invoicing' ),
251
+					'label'                     => _x('Processing', 'Invoice status', 'invoicing'),
252 252
         			'public'                    => true,
253 253
         			'exclude_from_search'       => true,
254 254
         			'show_in_admin_all_list'    => true,
255 255
 					'show_in_admin_status_list' => true,
256 256
 					/* translators: %s: number of invoices */
257
-        			'label_count'               => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing' )
257
+        			'label_count'               => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'invoicing')
258 258
 				),
259 259
 
260 260
 				'wpi-onhold' => array(
261
-					'label'                     => _x( 'On Hold', 'Invoice status', 'invoicing' ),
261
+					'label'                     => _x('On Hold', 'Invoice status', 'invoicing'),
262 262
         			'public'                    => true,
263 263
         			'exclude_from_search'       => true,
264 264
         			'show_in_admin_all_list'    => true,
265 265
 					'show_in_admin_status_list' => true,
266 266
 					/* translators: %s: number of invoices */
267
-        			'label_count'               => _n_noop( 'On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing' )
267
+        			'label_count'               => _n_noop('On Hold <span class="count">(%s)</span>', 'On Hold <span class="count">(%s)</span>', 'invoicing')
268 268
 				),
269 269
 
270 270
 				'wpi-cancelled' => array(
271
-					'label'                     => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
271
+					'label'                     => _x('Cancelled', 'Invoice status', 'invoicing'),
272 272
         			'public'                    => true,
273 273
         			'exclude_from_search'       => true,
274 274
         			'show_in_admin_all_list'    => true,
275 275
 					'show_in_admin_status_list' => true,
276 276
 					/* translators: %s: number of invoices */
277
-        			'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing' )
277
+        			'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'invoicing')
278 278
 				),
279 279
 
280 280
 				'wpi-refunded' => array(
281
-					'label'                     => _x( 'Refunded', 'Invoice status', 'invoicing' ),
281
+					'label'                     => _x('Refunded', 'Invoice status', 'invoicing'),
282 282
         			'public'                    => true,
283 283
         			'exclude_from_search'       => true,
284 284
         			'show_in_admin_all_list'    => true,
285 285
 					'show_in_admin_status_list' => true,
286 286
 					/* translators: %s: number of invoices */
287
-        			'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing' )
287
+        			'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'invoicing')
288 288
 				),
289 289
 
290 290
 				'wpi-failed' => array(
291
-					'label'                     => _x( 'Failed', 'Invoice status', 'invoicing' ),
291
+					'label'                     => _x('Failed', 'Invoice status', 'invoicing'),
292 292
         			'public'                    => true,
293 293
         			'exclude_from_search'       => true,
294 294
         			'show_in_admin_all_list'    => true,
295 295
 					'show_in_admin_status_list' => true,
296 296
 					/* translators: %s: number of invoices */
297
-        			'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing' )
297
+        			'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'invoicing')
298 298
 				),
299 299
 
300 300
 				'wpi-renewal' => array(
301
-					'label'                     => _x( 'Renewal', 'Invoice status', 'invoicing' ),
301
+					'label'                     => _x('Renewal', 'Invoice status', 'invoicing'),
302 302
         			'public'                    => true,
303 303
         			'exclude_from_search'       => true,
304 304
         			'show_in_admin_all_list'    => true,
305 305
 					'show_in_admin_status_list' => true,
306 306
 					/* translators: %s: number of invoices */
307
-        			'label_count'               => _n_noop( 'Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing' )
307
+        			'label_count'               => _n_noop('Renewal <span class="count">(%s)</span>', 'Renewal <span class="count">(%s)</span>', 'invoicing')
308 308
 				)
309 309
 			)
310 310
 		);
311 311
 
312
-		foreach ( $invoice_statuses as $invoice_statuse => $args ) {
313
-			register_post_status( $invoice_statuse, $args );
312
+		foreach ($invoice_statuses as $invoice_statuse => $args) {
313
+			register_post_status($invoice_statuse, $args);
314 314
 		}
315 315
 	}
316 316
 
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 	 *
327 327
 	 */
328 328
 	public static function maybe_flush_rewrite_rules() {
329
-		if ( ! get_option( 'getpaid_flushed_rewrite_rules' ) ) {
330
-			update_option( 'getpaid_flushed_rewrite_rules', '1' );
329
+		if (!get_option('getpaid_flushed_rewrite_rules')) {
330
+			update_option('getpaid_flushed_rewrite_rules', '1');
331 331
 			self::flush_rewrite_rules();
332 332
 		}
333 333
 	}
Please login to merge, or discard this patch.
templates/invoice-receipt.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -7,64 +7,64 @@  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
 // Fetch the invoice.
13
-$invoice = new WPInv_Invoice( $invoice );
13
+$invoice = new WPInv_Invoice($invoice);
14 14
 
15 15
 // @deprecated
16
-do_action( 'wpinv_success_content_before', $invoice );
17
-do_action( 'wpinv_before_receipt', $invoice );
16
+do_action('wpinv_success_content_before', $invoice);
17
+do_action('wpinv_before_receipt', $invoice);
18 18
 
19 19
 wpinv_print_errors();
20 20
 
21 21
 // Prepare header text.
22
-if ( $invoice->is_paid() ) {
22
+if ($invoice->is_paid()) {
23 23
 
24 24
     $alert = aui()->alert(
25 25
         array(
26 26
             'type'    => 'success',
27
-            'content' => __( 'Thank you for your payment!', 'invoicing' ),
27
+            'content' => __('Thank you for your payment!', 'invoicing'),
28 28
         )
29 29
     );
30 30
 
31
-} else if ( $invoice->is_refunded() ) {
31
+} else if ($invoice->is_refunded()) {
32 32
 
33 33
     $alert = aui()->alert(
34 34
         array(
35 35
             'type'    => 'info',
36
-            'content' => __( 'This invoice was refunded.', 'invoicing' ),
36
+            'content' => __('This invoice was refunded.', 'invoicing'),
37 37
         )
38 38
     );
39 39
 
40
-} else if ( $invoice->is_held() ) {
40
+} else if ($invoice->is_held()) {
41 41
 
42 42
     $alert = aui()->alert(
43 43
         array(
44 44
             'type'    => 'info',
45
-            'content' => __( 'This invoice will be processed as soon we verify your payment.', 'invoicing' ),
45
+            'content' => __('This invoice will be processed as soon we verify your payment.', 'invoicing'),
46 46
         )
47 47
     );
48 48
 
49
-} else if ( $invoice->needs_payment() ) {
49
+} else if ($invoice->needs_payment()) {
50 50
 
51
-    if ( ! empty( $_GET['token'] ) ) {
51
+    if (!empty($_GET['token'])) {
52 52
 
53 53
         $alert = aui()->alert(
54 54
             array(
55 55
                 'type'    => 'info',
56
-                'content' => __( "Sometimes it takes a few minutes for us to verify your payment. We'll notify you as soon as we've verified the payment.", 'invoicing' ),
56
+                'content' => __("Sometimes it takes a few minutes for us to verify your payment. We'll notify you as soon as we've verified the payment.", 'invoicing'),
57 57
             )
58 58
         );
59 59
 
60
-    } else if ( $invoice->is_due() ) {
60
+    } else if ($invoice->is_due()) {
61 61
 
62 62
         $alert = aui()->alert(
63 63
             array(
64 64
                 'type'    => 'danger',
65 65
                 'content' => sprintf(
66
-                    __( 'This invoice was due on %.', 'invoicing' ),
67
-                    getpaid_format_date_value( $invoice->get_due_date() )
66
+                    __('This invoice was due on %.', 'invoicing'),
67
+                    getpaid_format_date_value($invoice->get_due_date())
68 68
                 ),
69 69
             )
70 70
         );
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $alert = aui()->alert(
75 75
             array(
76 76
                 'type'    => 'warning',
77
-                'content' => __( 'This invoice needs payment.', 'invoicing' ),
77
+                'content' => __('This invoice needs payment.', 'invoicing'),
78 78
             )
79 79
         );
80 80
 
@@ -89,19 +89,19 @@  discard block
 block discarded – undo
89 89
 
90 90
         'pay' => array(
91 91
             'url'   => $invoice->get_checkout_payment_url(),
92
-            'name'  => __( 'Pay For Invoice', 'invoicing' ),
92
+            'name'  => __('Pay For Invoice', 'invoicing'),
93 93
             'class' => 'btn-success',
94 94
         ),
95 95
 
96 96
         'view' => array(
97 97
             'url'   => $invoice->get_view_url(),
98
-            'name'  => __( 'View Invoice', 'invoicing' ),
98
+            'name'  => __('View Invoice', 'invoicing'),
99 99
             'class' => 'btn-primary',
100 100
         ),
101 101
 
102 102
         'history' => array(
103 103
             'url'   => wpinv_get_history_page_uri(),
104
-            'name'  => __( 'Invoice History', 'invoicing' ),
104
+            'name'  => __('Invoice History', 'invoicing'),
105 105
             'class' => 'btn-warning',
106 106
         ),
107 107
 
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 
111 111
 );
112 112
 
113
-if ( ( ! $invoice->needs_payment() || $invoice->is_held() ) && isset( $actions['pay'] ) ) {
114
-    unset( $actions['pay'] );
113
+if ((!$invoice->needs_payment() || $invoice->is_held()) && isset($actions['pay'])) {
114
+    unset($actions['pay']);
115 115
 }
116 116
 
117
-if ( ! is_user_logged_in() && isset( $actions['history'] ) ) {
118
-    unset( $actions['history'] );
117
+if (!is_user_logged_in() && isset($actions['history'])) {
118
+    unset($actions['history']);
119 119
 }
120 120
 
121 121
 ?>
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
 
125 125
         <?php
126 126
         
127
-            do_action( 'wpinv_receipt_start', $invoice );
127
+            do_action('wpinv_receipt_start', $invoice);
128 128
 
129
-            if ( ! empty( $actions ) ) {
129
+            if (!empty($actions)) {
130 130
 
131 131
                 echo '<div class="wpinv-receipt-actions text-right mt-1 mb-4">';
132 132
 
133
-                foreach ( $actions as $key => $action ) {
133
+                foreach ($actions as $key => $action) {
134 134
 
135
-                    $key    = sanitize_html_class( $key );
136
-                    $class  = empty( $action['class'] ) ? 'btn-dark' : sanitize_html_class( $action['class'] );
137
-                    $url    = empty( $action['url'] ) ? '#' : esc_url( $action['url'] );
138
-                    $attrs  = empty( $action['attrs'] ) ? '' : $action['attrs'];
139
-                    $anchor = esc_html( $action['name'] );
135
+                    $key    = sanitize_html_class($key);
136
+                    $class  = empty($action['class']) ? 'btn-dark' : sanitize_html_class($action['class']);
137
+                    $url    = empty($action['url']) ? '#' : esc_url($action['url']);
138
+                    $attrs  = empty($action['attrs']) ? '' : $action['attrs'];
139
+                    $anchor = esc_html($action['name']);
140 140
 
141 141
                     echo "<a href='$url' class='btn btn-sm ml-1 $class $key' $attrs>$anchor</a>";
142 142
                 }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
             }
147 147
 
148
-            if ( ! empty( $alert ) ) {
148
+            if (!empty($alert)) {
149 149
                 echo $alert;
150 150
             }
151 151
 
@@ -154,19 +154,19 @@  discard block
 block discarded – undo
154 154
         <div class="wpinv-receipt-details">
155 155
 
156 156
             <h4 class="wpinv-details-t mb-3 mt-3">
157
-                <?php echo apply_filters( 'wpinv_receipt_details_title', __( 'Invoice Details', 'invoicing' ), $invoice ); ?>
157
+                <?php echo apply_filters('wpinv_receipt_details_title', __('Invoice Details', 'invoicing'), $invoice); ?>
158 158
             </h4>
159 159
 
160
-            <?php getpaid_invoice_meta( $invoice ); ?>
160
+            <?php getpaid_invoice_meta($invoice); ?>
161 161
 
162 162
         </div>
163 163
 
164
-        <?php do_action( 'wpinv_receipt_end', $invoice ); ?>
164
+        <?php do_action('wpinv_receipt_end', $invoice); ?>
165 165
 
166 166
     </div>
167 167
 
168 168
 <?php
169 169
 
170 170
 // @deprecated
171
-do_action( 'wpinv_success_content_after', $invoice );
172
-do_action( 'wpinv_after_receipt', $invoice );
171
+do_action('wpinv_success_content_after', $invoice);
172
+do_action('wpinv_after_receipt', $invoice);
Please login to merge, or discard this patch.
includes/gateways/class-getpaid-bank-transfer-gateway.php 2 patches
Indentation   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -13,30 +13,30 @@  discard block
 block discarded – undo
13 13
 class GetPaid_Bank_Transfer_Gateway extends GetPaid_Payment_Gateway {
14 14
 
15 15
     /**
16
-	 * Payment method id.
17
-	 *
18
-	 * @var string
19
-	 */
16
+     * Payment method id.
17
+     *
18
+     * @var string
19
+     */
20 20
     public $id = 'bank_transfer';
21 21
 
22
-	/**
23
-	 * An array of features that this gateway supports.
24
-	 *
25
-	 * @var array
26
-	 */
27
-	protected $supports = array( 'subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups' );
22
+    /**
23
+     * An array of features that this gateway supports.
24
+     *
25
+     * @var array
26
+     */
27
+    protected $supports = array( 'subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups' );
28 28
 
29 29
     /**
30
-	 * Payment method order.
31
-	 *
32
-	 * @var int
33
-	 */
34
-	public $order = 8;
30
+     * Payment method order.
31
+     *
32
+     * @var int
33
+     */
34
+    public $order = 8;
35 35
 
36 36
     /**
37
-	 * Class constructor.
38
-	 */
39
-	public function __construct() {
37
+     * Class constructor.
38
+     */
39
+    public function __construct() {
40 40
         parent::__construct();
41 41
 
42 42
         $this->title                = __( 'Direct bank transfer', 'invoicing' );
@@ -44,24 +44,24 @@  discard block
 block discarded – undo
44 44
         $this->checkout_button_text = __( 'Proceed', 'invoicing' );
45 45
         $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
46 46
 
47
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
-		add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
51
-		add_action( 'getpaid_should_renew_subscription', array( $this, 'maybe_renew_subscription' ) );
52
-		add_action( 'getpaid_invoice_status_publish', array( $this, 'invoice_paid' ), 20 );
47
+        add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
+        add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
+        add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
+        add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
51
+        add_action( 'getpaid_should_renew_subscription', array( $this, 'maybe_renew_subscription' ) );
52
+        add_action( 'getpaid_invoice_status_publish', array( $this, 'invoice_paid' ), 20 );
53 53
 
54 54
     }
55 55
 
56 56
     /**
57
-	 * Process Payment.
58
-	 *
59
-	 * @param WPInv_Invoice $invoice Invoice.
60
-	 * @param array $submission_data Posted checkout fields.
61
-	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
62
-	 * @return array
63
-	 */
64
-	public function process_payment( $invoice, $submission_data, $submission ) {
57
+     * Process Payment.
58
+     *
59
+     * @param WPInv_Invoice $invoice Invoice.
60
+     * @param array $submission_data Posted checkout fields.
61
+     * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
62
+     * @return array
63
+     */
64
+    public function process_payment( $invoice, $submission_data, $submission ) {
65 65
 
66 66
         // Add a transaction id.
67 67
         $invoice->set_transaction_id( $invoice->generate_key('bt_') );
@@ -82,66 +82,66 @@  discard block
 block discarded – undo
82 82
     }
83 83
 
84 84
     /**
85
-	 * Output for the order received page.
86
-	 *
87
-	 * @param WPInv_Invoice $invoice Invoice.
88
-	 */
89
-	public function thankyou_page( $invoice ) {
85
+     * Output for the order received page.
86
+     *
87
+     * @param WPInv_Invoice $invoice Invoice.
88
+     */
89
+    public function thankyou_page( $invoice ) {
90 90
 
91 91
         if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
92 92
 
93
-			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
93
+            echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
94 94
 
95 95
             if ( ! empty( $this->instructions ) ) {
96 96
                 echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
97
-			}
97
+            }
98 98
 
99
-			$this->bank_details( $invoice );
99
+            $this->bank_details( $invoice );
100 100
 
101
-			echo '</div>';
101
+            echo '</div>';
102 102
 
103 103
         }
104 104
 
105
-	}
105
+    }
106 106
 
107 107
     /**
108
-	 * Add content to the WPI emails.
109
-	 *
110
-	 * @param WPInv_Invoice $invoice Invoice.
111
-	 * @param string     $email_type Email format: plain text or HTML.
112
-	 * @param bool     $sent_to_admin Sent to admin.
113
-	 */
114
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
108
+     * Add content to the WPI emails.
109
+     *
110
+     * @param WPInv_Invoice $invoice Invoice.
111
+     * @param string     $email_type Email format: plain text or HTML.
112
+     * @param bool     $sent_to_admin Sent to admin.
113
+     */
114
+    public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
115 115
 
116
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
116
+        if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
117 117
 
118
-			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
118
+            echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
119 119
 
120
-			if ( $this->instructions ) {
121
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
120
+            if ( $this->instructions ) {
121
+                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
122 122
             }
123 123
 
124
-			$this->bank_details( $invoice );
124
+            $this->bank_details( $invoice );
125 125
 
126
-			echo '</div>';
126
+            echo '</div>';
127 127
 
128
-		}
128
+        }
129 129
 
130 130
     }
131 131
 
132 132
     /**
133
-	 * Get bank details and place into a list format.
134
-	 *
135
-	 * @param WPInv_Invoice $invoice Invoice.
136
-	 */
137
-	protected function bank_details( $invoice ) {
133
+     * Get bank details and place into a list format.
134
+     *
135
+     * @param WPInv_Invoice $invoice Invoice.
136
+     */
137
+    protected function bank_details( $invoice ) {
138 138
 
139
-		// Get the invoice country and country $locale.
140
-		$country = $invoice->get_country();
141
-		$locale  = $this->get_country_locale();
139
+        // Get the invoice country and country $locale.
140
+        $country = $invoice->get_country();
141
+        $locale  = $this->get_country_locale();
142 142
 
143
-		// Get sortcode label in the $locale array and use appropriate one.
144
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
143
+        // Get sortcode label in the $locale array and use appropriate one.
144
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
145 145
 
146 146
         $bank_fields = array(
147 147
             'ac_name'     => __( 'Account Name', 'invoicing' ),
@@ -170,144 +170,144 @@  discard block
 block discarded – undo
170 170
             return;
171 171
         }
172 172
 
173
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
173
+        echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
174
+
175
+        echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
176
+
177
+        foreach ( $bank_info as $key => $data ) {
178
+
179
+            $key   = sanitize_html_class( $key );
180
+            $label = wp_kses_post( $data['label'] );
181
+            $value = wp_kses_post( wptexturize( $data['value'] ) );
182
+
183
+            echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL;
184
+        }
174 185
 
175
-		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
186
+        echo '</table>';
176 187
 
177
-		foreach ( $bank_info as $key => $data ) {
188
+    }
178 189
 
179
-			$key   = sanitize_html_class( $key );
180
-			$label = wp_kses_post( $data['label'] );
181
-			$value = wp_kses_post( wptexturize( $data['value'] ) );
190
+    /**
191
+     * Get country locale if localized.
192
+     *
193
+     * @return array
194
+     */
195
+    public function get_country_locale() {
196
+
197
+        if ( empty( $this->locale ) ) {
198
+
199
+            // Locale information to be used - only those that are not 'Sort Code'.
200
+            $this->locale = apply_filters(
201
+                'getpaid_get_bank_transfer_locale',
202
+                array(
203
+                    'AU' => array(
204
+                        'sortcode' => array(
205
+                            'label' => __( 'BSB', 'invoicing' ),
206
+                        ),
207
+                    ),
208
+                    'CA' => array(
209
+                        'sortcode' => array(
210
+                            'label' => __( 'Bank transit number', 'invoicing' ),
211
+                        ),
212
+                    ),
213
+                    'IN' => array(
214
+                        'sortcode' => array(
215
+                            'label' => __( 'IFSC', 'invoicing' ),
216
+                        ),
217
+                    ),
218
+                    'IT' => array(
219
+                        'sortcode' => array(
220
+                            'label' => __( 'Branch sort', 'invoicing' ),
221
+                        ),
222
+                    ),
223
+                    'NZ' => array(
224
+                        'sortcode' => array(
225
+                            'label' => __( 'Bank code', 'invoicing' ),
226
+                        ),
227
+                    ),
228
+                    'SE' => array(
229
+                        'sortcode' => array(
230
+                            'label' => __( 'Bank code', 'invoicing' ),
231
+                        ),
232
+                    ),
233
+                    'US' => array(
234
+                        'sortcode' => array(
235
+                            'label' => __( 'Routing number', 'invoicing' ),
236
+                        ),
237
+                    ),
238
+                    'ZA' => array(
239
+                        'sortcode' => array(
240
+                            'label' => __( 'Branch code', 'invoicing' ),
241
+                        ),
242
+                    ),
243
+                )
244
+            );
182 245
 
183
-			echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL;
184
-		}
246
+        }
185 247
 
186
-		echo '</table>';
248
+        return $this->locale;
187 249
 
188 250
     }
189 251
 
190 252
     /**
191
-	 * Get country locale if localized.
192
-	 *
193
-	 * @return array
194
-	 */
195
-	public function get_country_locale() {
196
-
197
-		if ( empty( $this->locale ) ) {
198
-
199
-			// Locale information to be used - only those that are not 'Sort Code'.
200
-			$this->locale = apply_filters(
201
-				'getpaid_get_bank_transfer_locale',
202
-				array(
203
-					'AU' => array(
204
-						'sortcode' => array(
205
-							'label' => __( 'BSB', 'invoicing' ),
206
-						),
207
-					),
208
-					'CA' => array(
209
-						'sortcode' => array(
210
-							'label' => __( 'Bank transit number', 'invoicing' ),
211
-						),
212
-					),
213
-					'IN' => array(
214
-						'sortcode' => array(
215
-							'label' => __( 'IFSC', 'invoicing' ),
216
-						),
217
-					),
218
-					'IT' => array(
219
-						'sortcode' => array(
220
-							'label' => __( 'Branch sort', 'invoicing' ),
221
-						),
222
-					),
223
-					'NZ' => array(
224
-						'sortcode' => array(
225
-							'label' => __( 'Bank code', 'invoicing' ),
226
-						),
227
-					),
228
-					'SE' => array(
229
-						'sortcode' => array(
230
-							'label' => __( 'Bank code', 'invoicing' ),
231
-						),
232
-					),
233
-					'US' => array(
234
-						'sortcode' => array(
235
-							'label' => __( 'Routing number', 'invoicing' ),
236
-						),
237
-					),
238
-					'ZA' => array(
239
-						'sortcode' => array(
240
-							'label' => __( 'Branch code', 'invoicing' ),
241
-						),
242
-					),
243
-				)
244
-			);
245
-
246
-		}
247
-
248
-		return $this->locale;
249
-
250
-	}
251
-
252
-	/**
253
-	 * Filters the gateway settings.
254
-	 *
255
-	 * @param array $admin_settings
256
-	 */
257
-	public function admin_settings( $admin_settings ) {
253
+     * Filters the gateway settings.
254
+     *
255
+     * @param array $admin_settings
256
+     */
257
+    public function admin_settings( $admin_settings ) {
258 258
 
259 259
         $admin_settings['bank_transfer_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
260
-		$admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
260
+        $admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
261 261
 
262
-		$locale  = $this->get_country_locale();
262
+        $locale  = $this->get_country_locale();
263 263
 
264
-		// Get sortcode label in the $locale array and use appropriate one.
265
-		$country  = wpinv_default_billing_country();
266
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
264
+        // Get sortcode label in the $locale array and use appropriate one.
265
+        $country  = wpinv_default_billing_country();
266
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
267 267
 
268
-		$admin_settings['bank_transfer_ac_name'] = array(
268
+        $admin_settings['bank_transfer_ac_name'] = array(
269 269
             'type' => 'text',
270 270
             'id'   => 'bank_transfer_ac_name',
271 271
             'name' => __( 'Account Name', 'invoicing' ),
272
-		);
272
+        );
273 273
 
274
-		$admin_settings['bank_transfer_ac_no'] = array(
274
+        $admin_settings['bank_transfer_ac_no'] = array(
275 275
             'type' => 'text',
276 276
             'id'   => 'bank_transfer_ac_no',
277 277
             'name' => __( 'Account Number', 'invoicing' ),
278
-		);
278
+        );
279 279
 
280
-		$admin_settings['bank_transfer_bank_name'] = array(
280
+        $admin_settings['bank_transfer_bank_name'] = array(
281 281
             'type' => 'text',
282 282
             'id'   => 'bank_transfer_bank_name',
283 283
             'name' => __( 'Bank Name', 'invoicing' ),
284
-		);
284
+        );
285 285
 
286
-		$admin_settings['bank_transfer_ifsc'] = array(
286
+        $admin_settings['bank_transfer_ifsc'] = array(
287 287
             'type' => 'text',
288 288
             'id'   => 'bank_transfer_ifsc',
289 289
             'name' => __( 'IFSC Code', 'invoicing' ),
290
-		);
290
+        );
291 291
 
292
-		$admin_settings['bank_transfer_iban'] = array(
292
+        $admin_settings['bank_transfer_iban'] = array(
293 293
             'type' => 'text',
294 294
             'id'   => 'bank_transfer_iban',
295 295
             'name' => __( 'IBAN', 'invoicing' ),
296
-		);
296
+        );
297 297
 
298
-		$admin_settings['bank_transfer_bic'] = array(
298
+        $admin_settings['bank_transfer_bic'] = array(
299 299
             'type' => 'text',
300 300
             'id'   => 'bank_transfer_bic',
301 301
             'name' => __( 'BIC/Swift Code', 'invoicing' ),
302
-		);
302
+        );
303 303
 
304
-		$admin_settings['bank_transfer_sort_code'] = array(
305
-			'type' => 'text',
306
-			'id'   => 'bank_transfer_sort_code',
307
-			'name' => $sortcode,
308
-		);
304
+        $admin_settings['bank_transfer_sort_code'] = array(
305
+            'type' => 'text',
306
+            'id'   => 'bank_transfer_sort_code',
307
+            'name' => $sortcode,
308
+        );
309 309
 
310
-		$admin_settings['bank_transfer_info'] = array(
310
+        $admin_settings['bank_transfer_info'] = array(
311 311
             'id'   => 'bank_transfer_info',
312 312
             'name' => __( 'Instructions', 'invoicing' ),
313 313
             'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
             'rows' => 5
318 318
         );
319 319
 
320
-		return $admin_settings;
321
-	}
320
+        return $admin_settings;
321
+    }
322 322
 
323
-	/**
324
-	 * Processes invoice addons.
325
-	 *
326
-	 * @param WPInv_Invoice $invoice
327
-	 * @param GetPaid_Form_Item[] $items
328
-	 * @return WPInv_Invoice
329
-	 */
330
-	public function process_addons( $invoice, $items ) {
323
+    /**
324
+     * Processes invoice addons.
325
+     *
326
+     * @param WPInv_Invoice $invoice
327
+     * @param GetPaid_Form_Item[] $items
328
+     * @return WPInv_Invoice
329
+     */
330
+    public function process_addons( $invoice, $items ) {
331 331
 
332 332
         foreach ( $items as $item ) {
333 333
             $invoice->add_item( $item );
@@ -335,70 +335,70 @@  discard block
 block discarded – undo
335 335
 
336 336
         $invoice->recalculate_total();
337 337
         $invoice->save();
338
-	}
338
+    }
339 339
 
340
-	/**
341
-	 * (Maybe) renews a bank transfer subscription profile.
342
-	 *
343
-	 *
340
+    /**
341
+     * (Maybe) renews a bank transfer subscription profile.
342
+     *
343
+     *
344 344
      * @param WPInv_Subscription $subscription
345
-	 */
346
-	public function maybe_renew_subscription( $subscription ) {
345
+     */
346
+    public function maybe_renew_subscription( $subscription ) {
347 347
 
348 348
         // Ensure its our subscription && it's active.
349 349
         if ( $this->id == $subscription->get_gateway() && $subscription->has_status( 'active trialling' ) ) {
350
-			$subscription->create_payment();
350
+            $subscription->create_payment();
351 351
         }
352 352
 
353 353
     }
354 354
 
355
-	/**
356
-	 * Process a bank transfer payment.
357
-	 *
358
-	 *
355
+    /**
356
+     * Process a bank transfer payment.
357
+     *
358
+     *
359 359
      * @param WPInv_Invoice $invoice
360
-	 */
361
-	public function invoice_paid( $invoice ) {
360
+     */
361
+    public function invoice_paid( $invoice ) {
362 362
 
363
-		// Abort if not paid by bank transfer.
364
-		if ( $this->id !== $invoice->get_gateway() || ! $invoice->is_recurring() ) {
365
-			return;
366
-		}
363
+        // Abort if not paid by bank transfer.
364
+        if ( $this->id !== $invoice->get_gateway() || ! $invoice->is_recurring() ) {
365
+            return;
366
+        }
367 367
 
368
-		// Is it a parent payment?
369
-		if ( 0 == $invoice->get_parent_id() ) {
368
+        // Is it a parent payment?
369
+        if ( 0 == $invoice->get_parent_id() ) {
370 370
 
371
-			// (Maybe) activate subscriptions.
372
-			$subscriptions = getpaid_get_invoice_subscriptions( $invoice );
371
+            // (Maybe) activate subscriptions.
372
+            $subscriptions = getpaid_get_invoice_subscriptions( $invoice );
373 373
 
374
-			if ( ! empty( $subscriptions ) ) {
375
-				$subscriptions = is_array( $subscriptions ) ? $subscriptions : array( $subscriptions );
374
+            if ( ! empty( $subscriptions ) ) {
375
+                $subscriptions = is_array( $subscriptions ) ? $subscriptions : array( $subscriptions );
376 376
 
377
-				foreach ( $subscriptions as $subscription ) {
378
-					if ( $subscription->exists() ) {
379
-						$duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() );
380
-						$expiry   = date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) );
377
+                foreach ( $subscriptions as $subscription ) {
378
+                    if ( $subscription->exists() ) {
379
+                        $duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() );
380
+                        $expiry   = date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) );
381 381
 
382
-						$subscription->set_next_renewal_date( $expiry );
383
-						$subscription->set_date_created( current_time( 'mysql' ) );
384
-						$subscription->set_profile_id( 'bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id() );
385
-						$subscription->activate();
386
-					}
387
-				}
382
+                        $subscription->set_next_renewal_date( $expiry );
383
+                        $subscription->set_date_created( current_time( 'mysql' ) );
384
+                        $subscription->set_profile_id( 'bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id() );
385
+                        $subscription->activate();
386
+                    }
387
+                }
388 388
 
389
-			}
389
+            }
390 390
 
391
-		} else {
391
+        } else {
392 392
 
393
-			$subscription = getpaid_get_subscription( $invoice->get_subscription_id() );
393
+            $subscription = getpaid_get_subscription( $invoice->get_subscription_id() );
394 394
 
395
-			// Renew the subscription.
396
-			if ( $subscription && $subscription->exists() ) {
397
-				$subscription->add_payment( array(), $invoice );
398
-				$subscription->renew();
399
-			}
395
+            // Renew the subscription.
396
+            if ( $subscription && $subscription->exists() ) {
397
+                $subscription->add_payment( array(), $invoice );
398
+                $subscription->renew();
399
+            }
400 400
 
401
-		}
401
+        }
402 402
 
403 403
     }
404 404
 
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 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
  * Bank transfer Payment Gateway class.
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @var array
26 26
 	 */
27
-	protected $supports = array( 'subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups' );
27
+	protected $supports = array('subscription', 'addons', 'single_subscription_group', 'multiple_subscription_groups');
28 28
 
29 29
     /**
30 30
 	 * Payment method order.
@@ -39,17 +39,17 @@  discard block
 block discarded – undo
39 39
 	public function __construct() {
40 40
         parent::__construct();
41 41
 
42
-        $this->title                = __( 'Direct bank transfer', 'invoicing' );
43
-        $this->method_title         = __( 'Bank transfer', 'invoicing' );
44
-        $this->checkout_button_text = __( 'Proceed', 'invoicing' );
45
-        $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
42
+        $this->title                = __('Direct bank transfer', 'invoicing');
43
+        $this->method_title         = __('Bank transfer', 'invoicing');
44
+        $this->checkout_button_text = __('Proceed', 'invoicing');
45
+        $this->instructions         = apply_filters('wpinv_bank_instructions', $this->get_option('info'));
46 46
 
47
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
48
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
49
-		add_action( 'wpinv_pdf_content_billing', array( $this, 'thankyou_page' ), 11 );
50
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
51
-		add_action( 'getpaid_should_renew_subscription', array( $this, 'maybe_renew_subscription' ) );
52
-		add_action( 'getpaid_invoice_status_publish', array( $this, 'invoice_paid' ), 20 );
47
+		add_action('wpinv_receipt_end', array($this, 'thankyou_page'));
48
+		add_action('getpaid_invoice_line_items', array($this, 'thankyou_page'), 40);
49
+		add_action('wpinv_pdf_content_billing', array($this, 'thankyou_page'), 11);
50
+		add_action('wpinv_email_invoice_details', array($this, 'email_instructions'), 10, 3);
51
+		add_action('getpaid_should_renew_subscription', array($this, 'maybe_renew_subscription'));
52
+		add_action('getpaid_invoice_status_publish', array($this, 'invoice_paid'), 20);
53 53
 
54 54
     }
55 55
 
@@ -61,23 +61,23 @@  discard block
 block discarded – undo
61 61
 	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
62 62
 	 * @return array
63 63
 	 */
64
-	public function process_payment( $invoice, $submission_data, $submission ) {
64
+	public function process_payment($invoice, $submission_data, $submission) {
65 65
 
66 66
         // Add a transaction id.
67
-        $invoice->set_transaction_id( $invoice->generate_key('bt_') );
67
+        $invoice->set_transaction_id($invoice->generate_key('bt_'));
68 68
 
69 69
         // Set it as pending payment.
70
-        if ( ! $invoice->needs_payment() ) {
70
+        if (!$invoice->needs_payment()) {
71 71
             $invoice->mark_paid();
72
-        } else if ( ! $invoice->is_paid() ) {
73
-            $invoice->set_status( 'wpi-onhold' );
72
+        } else if (!$invoice->is_paid()) {
73
+            $invoice->set_status('wpi-onhold');
74 74
         }
75 75
 
76 76
         // Save it.
77 77
         $invoice->save();
78 78
 
79 79
         // Send to the success page.
80
-        wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) );
80
+        wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key()));
81 81
 
82 82
     }
83 83
 
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @param WPInv_Invoice $invoice Invoice.
88 88
 	 */
89
-	public function thankyou_page( $invoice ) {
89
+	public function thankyou_page($invoice) {
90 90
 
91
-        if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
91
+        if ('bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) {
92 92
 
93 93
 			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
94 94
 
95
-            if ( ! empty( $this->instructions ) ) {
96
-                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
95
+            if (!empty($this->instructions)) {
96
+                echo wp_kses_post(wpautop(wptexturize($this->instructions)));
97 97
 			}
98 98
 
99
-			$this->bank_details( $invoice );
99
+			$this->bank_details($invoice);
100 100
 
101 101
 			echo '</div>';
102 102
 
@@ -111,17 +111,17 @@  discard block
 block discarded – undo
111 111
 	 * @param string     $email_type Email format: plain text or HTML.
112 112
 	 * @param bool     $sent_to_admin Sent to admin.
113 113
 	 */
114
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
114
+	public function email_instructions($invoice, $email_type, $sent_to_admin) {
115 115
 
116
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
116
+		if (!$sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) {
117 117
 
118 118
 			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
119 119
 
120
-			if ( $this->instructions ) {
121
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
120
+			if ($this->instructions) {
121
+				echo wp_kses_post(wpautop(wptexturize($this->instructions)) . PHP_EOL);
122 122
             }
123 123
 
124
-			$this->bank_details( $invoice );
124
+			$this->bank_details($invoice);
125 125
 
126 126
 			echo '</div>';
127 127
 
@@ -134,51 +134,51 @@  discard block
 block discarded – undo
134 134
 	 *
135 135
 	 * @param WPInv_Invoice $invoice Invoice.
136 136
 	 */
137
-	protected function bank_details( $invoice ) {
137
+	protected function bank_details($invoice) {
138 138
 
139 139
 		// Get the invoice country and country $locale.
140 140
 		$country = $invoice->get_country();
141 141
 		$locale  = $this->get_country_locale();
142 142
 
143 143
 		// Get sortcode label in the $locale array and use appropriate one.
144
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
144
+		$sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing');
145 145
 
146 146
         $bank_fields = array(
147
-            'ac_name'     => __( 'Account Name', 'invoicing' ),
148
-            'ac_no'       => __( 'Account Number', 'invoicing' ),
149
-            'bank_name'   => __( 'Bank Name', 'invoicing' ),
150
-            'ifsc'        => __( 'IFSC code', 'invoicing' ),
151
-            'iban'        => __( 'IBAN', 'invoicing' ),
152
-            'bic'         => __( 'BIC/Swift code', 'invoicing' ),
147
+            'ac_name'     => __('Account Name', 'invoicing'),
148
+            'ac_no'       => __('Account Number', 'invoicing'),
149
+            'bank_name'   => __('Bank Name', 'invoicing'),
150
+            'ifsc'        => __('IFSC code', 'invoicing'),
151
+            'iban'        => __('IBAN', 'invoicing'),
152
+            'bic'         => __('BIC/Swift code', 'invoicing'),
153 153
             'sort_code'   => $sortcode,
154 154
         );
155 155
 
156 156
         $bank_info = array();
157 157
 
158
-        foreach ( $bank_fields as $field => $label ) {
159
-            $value = $this->get_option( $field );
158
+        foreach ($bank_fields as $field => $label) {
159
+            $value = $this->get_option($field);
160 160
 
161
-            if ( ! empty( $value ) ) {
162
-                $bank_info[$field] = array( 'label' => $label, 'value' => $value );
161
+            if (!empty($value)) {
162
+                $bank_info[$field] = array('label' => $label, 'value' => $value);
163 163
             }
164 164
 
165 165
         }
166 166
 
167
-        $bank_info = apply_filters( 'wpinv_bank_info', $bank_info );
167
+        $bank_info = apply_filters('wpinv_bank_info', $bank_info);
168 168
 
169
-        if ( empty( $bank_info ) ) {
169
+        if (empty($bank_info)) {
170 170
             return;
171 171
         }
172 172
 
173
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
173
+		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters('wpinv_receipt_bank_details_title', __('Bank Details', 'invoicing')) . '</h3>' . PHP_EOL;
174 174
 
175 175
 		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
176 176
 
177
-		foreach ( $bank_info as $key => $data ) {
177
+		foreach ($bank_info as $key => $data) {
178 178
 
179
-			$key   = sanitize_html_class( $key );
180
-			$label = wp_kses_post( $data['label'] );
181
-			$value = wp_kses_post( wptexturize( $data['value'] ) );
179
+			$key   = sanitize_html_class($key);
180
+			$label = wp_kses_post($data['label']);
181
+			$value = wp_kses_post(wptexturize($data['value']));
182 182
 
183 183
 			echo "<tr class='getpaid-bank-transfer-$key'><th class='font-weight-bold'>$label</th><td class='w-75'>$value</td></tr>" . PHP_EOL;
184 184
 		}
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	public function get_country_locale() {
196 196
 
197
-		if ( empty( $this->locale ) ) {
197
+		if (empty($this->locale)) {
198 198
 
199 199
 			// Locale information to be used - only those that are not 'Sort Code'.
200 200
 			$this->locale = apply_filters(
@@ -202,42 +202,42 @@  discard block
 block discarded – undo
202 202
 				array(
203 203
 					'AU' => array(
204 204
 						'sortcode' => array(
205
-							'label' => __( 'BSB', 'invoicing' ),
205
+							'label' => __('BSB', 'invoicing'),
206 206
 						),
207 207
 					),
208 208
 					'CA' => array(
209 209
 						'sortcode' => array(
210
-							'label' => __( 'Bank transit number', 'invoicing' ),
210
+							'label' => __('Bank transit number', 'invoicing'),
211 211
 						),
212 212
 					),
213 213
 					'IN' => array(
214 214
 						'sortcode' => array(
215
-							'label' => __( 'IFSC', 'invoicing' ),
215
+							'label' => __('IFSC', 'invoicing'),
216 216
 						),
217 217
 					),
218 218
 					'IT' => array(
219 219
 						'sortcode' => array(
220
-							'label' => __( 'Branch sort', 'invoicing' ),
220
+							'label' => __('Branch sort', 'invoicing'),
221 221
 						),
222 222
 					),
223 223
 					'NZ' => array(
224 224
 						'sortcode' => array(
225
-							'label' => __( 'Bank code', 'invoicing' ),
225
+							'label' => __('Bank code', 'invoicing'),
226 226
 						),
227 227
 					),
228 228
 					'SE' => array(
229 229
 						'sortcode' => array(
230
-							'label' => __( 'Bank code', 'invoicing' ),
230
+							'label' => __('Bank code', 'invoicing'),
231 231
 						),
232 232
 					),
233 233
 					'US' => array(
234 234
 						'sortcode' => array(
235
-							'label' => __( 'Routing number', 'invoicing' ),
235
+							'label' => __('Routing number', 'invoicing'),
236 236
 						),
237 237
 					),
238 238
 					'ZA' => array(
239 239
 						'sortcode' => array(
240
-							'label' => __( 'Branch code', 'invoicing' ),
240
+							'label' => __('Branch code', 'invoicing'),
241 241
 						),
242 242
 					),
243 243
 				)
@@ -254,51 +254,51 @@  discard block
 block discarded – undo
254 254
 	 *
255 255
 	 * @param array $admin_settings
256 256
 	 */
257
-	public function admin_settings( $admin_settings ) {
257
+	public function admin_settings($admin_settings) {
258 258
 
259
-        $admin_settings['bank_transfer_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
260
-		$admin_settings['bank_transfer_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
259
+        $admin_settings['bank_transfer_desc']['std'] = __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing');
260
+		$admin_settings['bank_transfer_active']['desc'] = __('Enable bank transfer', 'invoicing');
261 261
 
262
-		$locale  = $this->get_country_locale();
262
+		$locale = $this->get_country_locale();
263 263
 
264 264
 		// Get sortcode label in the $locale array and use appropriate one.
265 265
 		$country  = wpinv_default_billing_country();
266
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
266
+		$sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing');
267 267
 
268 268
 		$admin_settings['bank_transfer_ac_name'] = array(
269 269
             'type' => 'text',
270 270
             'id'   => 'bank_transfer_ac_name',
271
-            'name' => __( 'Account Name', 'invoicing' ),
271
+            'name' => __('Account Name', 'invoicing'),
272 272
 		);
273 273
 
274 274
 		$admin_settings['bank_transfer_ac_no'] = array(
275 275
             'type' => 'text',
276 276
             'id'   => 'bank_transfer_ac_no',
277
-            'name' => __( 'Account Number', 'invoicing' ),
277
+            'name' => __('Account Number', 'invoicing'),
278 278
 		);
279 279
 
280 280
 		$admin_settings['bank_transfer_bank_name'] = array(
281 281
             'type' => 'text',
282 282
             'id'   => 'bank_transfer_bank_name',
283
-            'name' => __( 'Bank Name', 'invoicing' ),
283
+            'name' => __('Bank Name', 'invoicing'),
284 284
 		);
285 285
 
286 286
 		$admin_settings['bank_transfer_ifsc'] = array(
287 287
             'type' => 'text',
288 288
             'id'   => 'bank_transfer_ifsc',
289
-            'name' => __( 'IFSC Code', 'invoicing' ),
289
+            'name' => __('IFSC Code', 'invoicing'),
290 290
 		);
291 291
 
292 292
 		$admin_settings['bank_transfer_iban'] = array(
293 293
             'type' => 'text',
294 294
             'id'   => 'bank_transfer_iban',
295
-            'name' => __( 'IBAN', 'invoicing' ),
295
+            'name' => __('IBAN', 'invoicing'),
296 296
 		);
297 297
 
298 298
 		$admin_settings['bank_transfer_bic'] = array(
299 299
             'type' => 'text',
300 300
             'id'   => 'bank_transfer_bic',
301
-            'name' => __( 'BIC/Swift Code', 'invoicing' ),
301
+            'name' => __('BIC/Swift Code', 'invoicing'),
302 302
 		);
303 303
 
304 304
 		$admin_settings['bank_transfer_sort_code'] = array(
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
 
310 310
 		$admin_settings['bank_transfer_info'] = array(
311 311
             'id'   => 'bank_transfer_info',
312
-            'name' => __( 'Instructions', 'invoicing' ),
313
-            'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
312
+            'name' => __('Instructions', 'invoicing'),
313
+            'desc' => __('Instructions that will be added to the thank you page and emails.', 'invoicing'),
314 314
             'type' => 'textarea',
315
-            'std'  => __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ),
315
+            'std'  => __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'),
316 316
             'cols' => 50,
317 317
             'rows' => 5
318 318
         );
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
 	 * @param GetPaid_Form_Item[] $items
328 328
 	 * @return WPInv_Invoice
329 329
 	 */
330
-	public function process_addons( $invoice, $items ) {
330
+	public function process_addons($invoice, $items) {
331 331
 
332
-        foreach ( $items as $item ) {
333
-            $invoice->add_item( $item );
332
+        foreach ($items as $item) {
333
+            $invoice->add_item($item);
334 334
         }
335 335
 
336 336
         $invoice->recalculate_total();
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
 	 *
344 344
      * @param WPInv_Subscription $subscription
345 345
 	 */
346
-	public function maybe_renew_subscription( $subscription ) {
346
+	public function maybe_renew_subscription($subscription) {
347 347
 
348 348
         // Ensure its our subscription && it's active.
349
-        if ( $this->id == $subscription->get_gateway() && $subscription->has_status( 'active trialling' ) ) {
349
+        if ($this->id == $subscription->get_gateway() && $subscription->has_status('active trialling')) {
350 350
 			$subscription->create_payment();
351 351
         }
352 352
 
@@ -358,30 +358,30 @@  discard block
 block discarded – undo
358 358
 	 *
359 359
      * @param WPInv_Invoice $invoice
360 360
 	 */
361
-	public function invoice_paid( $invoice ) {
361
+	public function invoice_paid($invoice) {
362 362
 
363 363
 		// Abort if not paid by bank transfer.
364
-		if ( $this->id !== $invoice->get_gateway() || ! $invoice->is_recurring() ) {
364
+		if ($this->id !== $invoice->get_gateway() || !$invoice->is_recurring()) {
365 365
 			return;
366 366
 		}
367 367
 
368 368
 		// Is it a parent payment?
369
-		if ( 0 == $invoice->get_parent_id() ) {
369
+		if (0 == $invoice->get_parent_id()) {
370 370
 
371 371
 			// (Maybe) activate subscriptions.
372
-			$subscriptions = getpaid_get_invoice_subscriptions( $invoice );
372
+			$subscriptions = getpaid_get_invoice_subscriptions($invoice);
373 373
 
374
-			if ( ! empty( $subscriptions ) ) {
375
-				$subscriptions = is_array( $subscriptions ) ? $subscriptions : array( $subscriptions );
374
+			if (!empty($subscriptions)) {
375
+				$subscriptions = is_array($subscriptions) ? $subscriptions : array($subscriptions);
376 376
 
377
-				foreach ( $subscriptions as $subscription ) {
378
-					if ( $subscription->exists() ) {
379
-						$duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() );
380
-						$expiry   = date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) );
377
+				foreach ($subscriptions as $subscription) {
378
+					if ($subscription->exists()) {
379
+						$duration = strtotime($subscription->get_expiration()) - strtotime($subscription->get_date_created());
380
+						$expiry   = date('Y-m-d H:i:s', (current_time('timestamp') + $duration));
381 381
 
382
-						$subscription->set_next_renewal_date( $expiry );
383
-						$subscription->set_date_created( current_time( 'mysql' ) );
384
-						$subscription->set_profile_id( 'bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id() );
382
+						$subscription->set_next_renewal_date($expiry);
383
+						$subscription->set_date_created(current_time('mysql'));
384
+						$subscription->set_profile_id('bt_sub_' . $invoice->get_id() . '_' . $subscription->get_id());
385 385
 						$subscription->activate();
386 386
 					}
387 387
 				}
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
 
391 391
 		} else {
392 392
 
393
-			$subscription = getpaid_get_subscription( $invoice->get_subscription_id() );
393
+			$subscription = getpaid_get_subscription($invoice->get_subscription_id());
394 394
 
395 395
 			// Renew the subscription.
396
-			if ( $subscription && $subscription->exists() ) {
397
-				$subscription->add_payment( array(), $invoice );
396
+			if ($subscription && $subscription->exists()) {
397
+				$subscription->add_payment(array(), $invoice);
398 398
 				$subscription->renew();
399 399
 			}
400 400
 
Please login to merge, or discard this patch.