Passed
Push — master ( b3b246...bcec86 )
by Brian
05:30
created
includes/data/sample-payment-form.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 return array(
14 14
 
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
         'placeholder' => '[email protected]',
18 18
         'value'       => '',
19
-        'label'       => __( 'Billing Email', 'invoicing' ),
19
+        'label'       => __('Billing Email', 'invoicing'),
20 20
         'description' => '',
21 21
         'required'    => true,
22 22
         'id'          => 'mmdwqzpox',
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     ),
39 39
 
40 40
     array(
41
-        'text'    => __( 'Select Payment Method', 'invoicing' ),
41
+        'text'    => __('Select Payment Method', 'invoicing'),
42 42
         'id'          => 'gtscicd',
43 43
         'name'        => 'gtscicd',
44 44
         'type'        => 'gateway_select',
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 
51 51
         'value'       =>'',
52 52
         'class'       => 'btn-primary',
53
-        'label'       => __( 'Pay Now »', 'invoicing' ),
54
-        'description' => __( 'By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing' ),
53
+        'label'       => __('Pay Now »', 'invoicing'),
54
+        'description' => __('By continuing with your payment, you are agreeing to our privacy policy and terms of service.', 'invoicing'),
55 55
         'id'          => 'rtqljyy',
56 56
         'name'        => 'rtqljyy',
57 57
         'type'        => 'pay_button',
Please login to merge, or discard this patch.
templates/payment-forms/elements/pay_button.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 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 = empty( $class ) ? 'btn-primary' : sanitize_html_class( $class );
12
+$class = empty($class) ? 'btn-primary' : sanitize_html_class($class);
13 13
 echo aui()->input(
14 14
     array(
15
-        'name'       => esc_attr( $id ),
16
-        'id'         => esc_attr( $id ) . uniqid( '_' ),
17
-        'value'      => empty( $label ) ? __( 'Proceed to Pay »', 'invoicing' ) : esc_attr( $label ),
18
-        'help_text'  => empty( $description ) ? '' : wp_kses_post( $description ),
15
+        'name'       => esc_attr($id),
16
+        'id'         => esc_attr($id) . uniqid('_'),
17
+        'value'      => empty($label) ? __('Proceed to Pay »', 'invoicing') : esc_attr($label),
18
+        'help_text'  => empty($description) ? '' : wp_kses_post($description),
19 19
         'type'       => 'submit',
20 20
         'class'      => 'getpaid-payment-form-submit btn btn-block submit-button ' . $class,
21 21
     )
Please login to merge, or discard this patch.
templates/payment-forms/elements/radio.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 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
 echo aui()->radio(
13 13
     array(
14
-        'name'       => esc_attr( $id ),
15
-        'id'         => esc_attr( $id ) . uniqid( '_' ),
16
-        'required'   => ! empty( $required ),
17
-        'label'      => empty( $label ) ? '' : wp_kses_post( $label ),
14
+        'name'       => esc_attr($id),
15
+        'id'         => esc_attr($id) . uniqid('_'),
16
+        'required'   => !empty($required),
17
+        'label'      => empty($label) ? '' : wp_kses_post($label),
18 18
         'label_type' => 'vertical',
19 19
         'inline'     => false,
20
-        'options'    => empty( $options ) ? array() : array_combine( $options, $options ),
21
-        'help_text'  => empty( $description ) ? '' : wp_kses_post( $description ),
20
+        'options'    => empty($options) ? array() : array_combine($options, $options),
21
+        'help_text'  => empty($description) ? '' : wp_kses_post($description),
22 22
     )
23 23
 );
Please login to merge, or discard this patch.
templates/payment-forms/elements/price_select.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -7,32 +7,32 @@  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
 // Ensure that we have options.
13
-if ( empty( $options ) ) {
13
+if (empty($options)) {
14 14
     return;
15 15
 }
16 16
 
17 17
 // Prepare price options.
18
-$options = getpaid_convert_price_string_to_options( $options );
18
+$options = getpaid_convert_price_string_to_options($options);
19 19
 
20 20
 // Prepare id.
21
-$id = esc_attr( $id );
21
+$id = esc_attr($id);
22 22
 
23
-$select_type = empty( $select_type ) ? 'select' : $select_type;
23
+$select_type = empty($select_type) ? 'select' : $select_type;
24 24
 
25 25
 // Item select;
26
-if ( $select_type == 'select' ) {
26
+if ($select_type == 'select') {
27 27
     echo aui()->select(
28 28
         array(
29 29
             'name'       => $id,
30
-            'id'         => $id . uniqid( '_' ),
31
-            'placeholder'=> empty( $placeholder ) ? '' : esc_attr( $placeholder ),
32
-            'label'      => empty( $label ) ? '' : sanitize_text_field( $label ),
30
+            'id'         => $id . uniqid('_'),
31
+            'placeholder'=> empty($placeholder) ? '' : esc_attr($placeholder),
32
+            'label'      => empty($label) ? '' : sanitize_text_field($label),
33 33
             'label_type' => 'vertical',
34 34
             'class'      => 'getpaid-price-select-dropdown',
35
-            'help_text'  => empty( $description ) ? '' : wp_kses_post( $description ),
35
+            'help_text'  => empty($description) ? '' : wp_kses_post($description),
36 36
             'options'    => $options,
37 37
         )
38 38
     );
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 }
41 41
 
42 42
 // Item radios;
43
-if ( $select_type == 'radios' ) {
43
+if ($select_type == 'radios') {
44 44
     echo aui()->radio(
45 45
         array(
46
-            'name'       => esc_attr( $id ),
47
-            'id'         => esc_attr( $id ) . uniqid( '_' ),
48
-            'label'      => empty( $label ) ? '' : sanitize_text_field( $label ),
46
+            'name'       => esc_attr($id),
47
+            'id'         => esc_attr($id) . uniqid('_'),
48
+            'label'      => empty($label) ? '' : sanitize_text_field($label),
49 49
             'label_type' => 'vertical',
50 50
             'class'      => 'getpaid-price-select-radio',
51 51
             'inline'     => false,
52 52
             'options'    => $options,
53
-            'help_text'  => empty( $description ) ? '' : wp_kses_post( $description ),
53
+            'help_text'  => empty($description) ? '' : wp_kses_post($description),
54 54
         )
55 55
     );
56 56
     return;
@@ -58,32 +58,32 @@  discard block
 block discarded – undo
58 58
 
59 59
 
60 60
 // Display the label.
61
-if ( ! empty( $label ) && $select_type != 'select' ) {
62
-    $label = sanitize_text_field( $label );
61
+if (!empty($label) && $select_type != 'select') {
62
+    $label = sanitize_text_field($label);
63 63
     echo "<label>$label</label>";
64 64
 }
65 65
 
66 66
 // Item buttons;
67
-if ( $select_type == 'buttons' || $select_type == 'circles' ) {
67
+if ($select_type == 'buttons' || $select_type == 'circles') {
68 68
 
69 69
     $class = 'getpaid-price-buttons';
70 70
 
71
-    if ( $select_type == 'circles' ) {
71
+    if ($select_type == 'circles') {
72 72
         $class .= ' getpaid-price-circles';
73 73
     }
74 74
     echo "<div class='$class'>";
75 75
 
76 76
     $processed = 0;
77
-    foreach ( $options as $price => $label ) {
78
-        $label   = sanitize_text_field( $label );
79
-        $price   = esc_attr( $price );
80
-        $_id     = $id . uniqid( '_' );
81
-        $checked = checked( $processed, 0, false );
82
-        $processed ++;
77
+    foreach ($options as $price => $label) {
78
+        $label   = sanitize_text_field($label);
79
+        $price   = esc_attr($price);
80
+        $_id     = $id . uniqid('_');
81
+        $checked = checked($processed, 0, false);
82
+        $processed++;
83 83
 
84 84
         $class = 'rounded';
85 85
 
86
-        if ( $select_type == 'circles' ) {
86
+        if ($select_type == 'circles') {
87 87
             $class = '';
88 88
         }
89 89
         echo "
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
 }
100 100
 
101 101
 // Item checkboxes;
102
-if ( $select_type == 'checkboxes' ) {
102
+if ($select_type == 'checkboxes') {
103 103
     echo '<div class="form-group">';
104 104
 
105 105
     $processed = 0;
106
-    foreach ( $options as $price => $label ) {
107
-        $label   = sanitize_text_field( $label );
108
-        $price   = esc_attr( $price );
109
-        $checked = checked( $processed, 0, false );
110
-        $processed ++;
106
+    foreach ($options as $price => $label) {
107
+        $label   = sanitize_text_field($label);
108
+        $price   = esc_attr($price);
109
+        $checked = checked($processed, 0, false);
110
+        $processed++;
111 111
         echo "
112 112
             <label class='d-block'>
113 113
                 <input type='checkbox' class='getpaid-price-select-checkbox' name='{$id}[]' value='$price' $checked />
@@ -120,6 +120,6 @@  discard block
 block discarded – undo
120 120
 
121 121
 }
122 122
 
123
-if ( ! empty( $description ) ) {
123
+if (!empty($description)) {
124 124
     echo "<small class='form-text text-muted'>$description</small>";
125 125
 }
Please login to merge, or discard this patch.
templates/payment-forms/variations/select.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  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
 // Prepare the selectable items.
13 13
 $selectable = array();
14
-foreach ( $form->get_items() as $item ) {
15
-    if ( ! $item->is_required ) {
16
-        $selectable[$item->get_id()] = $item->get_name() . ' &mdash; ' . wpinv_price( wpinv_format_amount( $item->get_initial_price() ) );
14
+foreach ($form->get_items() as $item) {
15
+    if (!$item->is_required) {
16
+        $selectable[$item->get_id()] = $item->get_name() . ' &mdash; ' . wpinv_price(wpinv_format_amount($item->get_initial_price()));
17 17
     }
18 18
 }
19 19
 
20
-if ( empty( $selectable ) ) {
20
+if (empty($selectable)) {
21 21
     return;
22 22
 }
23 23
 
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 echo aui()->select(
28 28
     array(
29 29
         'name'       => 'getpaid-payment-form-selected-item',
30
-        'id'         => 'getpaid-payment-form-selected-item' . uniqid( '_' ),
30
+        'id'         => 'getpaid-payment-form-selected-item' . uniqid('_'),
31 31
         'required'   => true,
32
-        'label'      => __( 'Select Item', 'invoicing' ),
32
+        'label'      => __('Select Item', 'invoicing'),
33 33
         'label_type' => 'vertical',
34 34
         'inline'     => false,
35 35
         'options'    => $selectable,
Please login to merge, or discard this patch.
templates/payment-forms/variations/radio.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  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
 // Prepare the selectable items.
13 13
 $selectable = array();
14
-foreach ( $form->get_items() as $item ) {
15
-    if ( ! $item->is_required ) {
16
-        $selectable[$item->get_id()] = $item->get_name() . ' &mdash; ' . wpinv_price( wpinv_format_amount( $item->get_initial_price() ) );
14
+foreach ($form->get_items() as $item) {
15
+    if (!$item->is_required) {
16
+        $selectable[$item->get_id()] = $item->get_name() . ' &mdash; ' . wpinv_price(wpinv_format_amount($item->get_initial_price()));
17 17
     }
18 18
 }
19 19
 
20
-if ( empty( $selectable ) ) {
20
+if (empty($selectable)) {
21 21
     return;
22 22
 }
23 23
 
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 echo aui()->radio(
28 28
     array(
29 29
         'name'       => 'getpaid-payment-form-selected-item',
30
-        'id'         => 'getpaid-payment-form-selected-item' . uniqid( '_' ),
30
+        'id'         => 'getpaid-payment-form-selected-item' . uniqid('_'),
31 31
         'required'   => true,
32
-        'label'      => __( 'Select Item', 'invoicing' ),
32
+        'label'      => __('Select Item', 'invoicing'),
33 33
         'label_type' => 'vertical',
34 34
         'inline'     => false,
35 35
         'options'    => $selectable,
Please login to merge, or discard this patch.
templates/payment-forms/variations/checkbox.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,29 +7,29 @@
 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
 // Prepare the selectable items.
13 13
 $selectable = array();
14
-foreach ( $form->get_items() as $item ) {
15
-    if ( ! $item->is_required ) {
16
-        $selectable[$item->get_id()] = $item->get_name() . ' &mdash; ' . wpinv_price( wpinv_format_amount( $item->get_initial_price() ) );
14
+foreach ($form->get_items() as $item) {
15
+    if (!$item->is_required) {
16
+        $selectable[$item->get_id()] = $item->get_name() . ' &mdash; ' . wpinv_price(wpinv_format_amount($item->get_initial_price()));
17 17
     }
18 18
 }
19 19
 
20
-if ( empty( $selectable ) ) {
20
+if (empty($selectable)) {
21 21
     return;
22 22
 }
23 23
 
24 24
 echo '<div class="getpaid-payment-form-items-checkbox form-group">';
25 25
 
26
-foreach ( $selectable as $item_id => $item_name ) {
26
+foreach ($selectable as $item_id => $item_name) {
27 27
 
28 28
     echo aui()->input(
29 29
         array(
30 30
             'type'       => 'checkbox',
31 31
             'name'       => 'getpaid-payment-form-selected-item',
32
-            'id'         => 'getpaid-payment-form-selected-item' . uniqid( '_' ) . $item_id,
32
+            'id'         => 'getpaid-payment-form-selected-item' . uniqid('_') . $item_id,
33 33
             'label'      => $item_name,
34 34
             'value'      => $item_id,
35 35
             'no_wrap'    => true,
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-details.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if (!defined('ABSPATH')) {
11 11
 	exit; // Exit if accessed directly
12 12
 }
13 13
 
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
 	 *
22 22
 	 * @param WP_Post $post
23 23
 	 */
24
-    public static function output( $post ) {
24
+    public static function output($post) {
25 25
 
26 26
         // Prepare the invoice.
27
-        $invoice = new WPInv_Invoice( $post );
27
+        $invoice = new WPInv_Invoice($post);
28 28
 
29 29
         // Nonce field.
30
-        wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ) ;
30
+        wp_nonce_field('wpinv_details', 'wpinv_details_nonce');
31 31
 
32 32
 
33 33
         ?>
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 
47 47
                 <div class="bsui" style="margin-top: 1.5rem" id="gdmbx2-metabox-wpinv_details">
48 48
 
49
-                    <?php if ( ! $invoice->is_draft() ) : ?>
49
+                    <?php if (!$invoice->is_draft()) : ?>
50 50
                         <div class="form-group">
51
-                            <strong><?php _e( 'Viewed by Customer:', 'invoicing' );?></strong>
52
-                            <?php ( $invoice->get_is_viewed() ) ? _e( 'Yes', 'invoicing' ) : _e( 'No', 'invoicing' ); ?>
51
+                            <strong><?php _e('Viewed by Customer:', 'invoicing'); ?></strong>
52
+                            <?php ($invoice->get_is_viewed()) ? _e('Yes', 'invoicing') : _e('No', 'invoicing'); ?>
53 53
                         </div>
54 54
                     <?php endif; ?>
55 55
 
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
                                 'type'        => 'datepicker',
62 62
                                 'id'          => 'wpinv_date_created',
63 63
                                 'name'        => 'date_created',
64
-                                'label'       => __( 'Invoice Date:', 'invoicing' ) . getpaid_get_help_tip( __( 'The date this invoice was created. This allows you to backdate an invoice.', 'invoicing' ) ),
64
+                                'label'       => __('Invoice Date:', 'invoicing') . getpaid_get_help_tip(__('The date this invoice was created. This allows you to backdate an invoice.', 'invoicing')),
65 65
                                 'label_type'  => 'vertical',
66 66
                                 'placeholder' => 'YYYY-MM-DD 00:00',
67 67
                                 'class'       => 'form-control-sm',
68
-                                'value'       => $invoice->get_date_created( 'edit' ),
68
+                                'value'       => $invoice->get_date_created('edit'),
69 69
                                 'extra_attributes' => array(
70 70
                                     'data-enable-time' => 'true',
71 71
                                     'data-time_24hr'   => 'true',
@@ -76,37 +76,37 @@  discard block
 block discarded – undo
76 76
                         );
77 77
 
78 78
                         // Due date.
79
-                        if ( $invoice->is_type( 'invoice' ) && wpinv_get_option( 'overdue_active' ) && ( $invoice->needs_payment() || $invoice->is_draft() ) ) {
79
+                        if ($invoice->is_type('invoice') && wpinv_get_option('overdue_active') && ($invoice->needs_payment() || $invoice->is_draft())) {
80 80
 
81 81
                             echo aui()->input(
82 82
                                 array(
83 83
                                     'type'        => 'text',
84 84
                                     'id'          => 'wpinv_due_date',
85 85
                                     'name'        => 'wpinv_due_date',
86
-                                    'label'       => __( 'Due Date:', 'invoicing' ) . getpaid_get_help_tip( __( 'Leave blank to disable automated reminder emails for this invoice.', 'invoicing' ) ),
86
+                                    'label'       => __('Due Date:', 'invoicing') . getpaid_get_help_tip(__('Leave blank to disable automated reminder emails for this invoice.', 'invoicing')),
87 87
                                     'label_type'  => 'vertical',
88
-                                    'placeholder' => __( 'No due date', 'invoicing' ),
88
+                                    'placeholder' => __('No due date', 'invoicing'),
89 89
                                     'class'       => 'form-control-sm',
90
-                                    'value'       => $invoice->get_due_date( 'edit' ),
90
+                                    'value'       => $invoice->get_due_date('edit'),
91 91
                                 )
92 92
                             );
93 93
 
94 94
                         }
95 95
 
96
-                        do_action( 'wpinv_meta_box_details_after_due_date', $invoice->get_id() );
96
+                        do_action('wpinv_meta_box_details_after_due_date', $invoice->get_id());
97 97
                         
98 98
                         // Status.
99 99
                         echo aui()->select(
100 100
                             array(
101 101
                                 'id'               => 'wpinv_status',
102 102
                                 'name'             => 'wpinv_status',
103
-                                'label'            => __( 'Invoice Status:', 'invoicing' ),
103
+                                'label'            => __('Invoice Status:', 'invoicing'),
104 104
                                 'label_type'       => 'vertical',
105
-                                'placeholder'      => __( 'Select Status', 'invoicing' ),
106
-                                'value'            => $invoice->get_status( 'edit' ),
105
+                                'placeholder'      => __('Select Status', 'invoicing'),
106
+                                'value'            => $invoice->get_status('edit'),
107 107
                                 'select2'          => true,
108 108
                                 'data-allow-clear' => 'false',
109
-                                'options'          => wpinv_get_invoice_statuses( true )
109
+                                'options'          => wpinv_get_invoice_statuses(true)
110 110
                             )
111 111
                         );
112 112
 
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
                                 'type'        => 'text',
117 117
                                 'id'          => 'wpinv_number',
118 118
                                 'name'        => 'wpinv_number',
119
-                                'label'       => __( 'Invoice Number:', 'invoicing' ) . getpaid_get_help_tip( __( 'Each invoice number must be unique.', 'invoicing' ) ),
119
+                                'label'       => __('Invoice Number:', 'invoicing') . getpaid_get_help_tip(__('Each invoice number must be unique.', 'invoicing')),
120 120
                                 'label_type'  => 'vertical',
121
-                                'placeholder' => __( 'Autogenerate', 'invoicing' ),
121
+                                'placeholder' => __('Autogenerate', 'invoicing'),
122 122
                                 'class'       => 'form-control-sm',
123
-                                'value'       => $invoice->get_number( 'edit' ),
123
+                                'value'       => $invoice->get_number('edit'),
124 124
                             )
125 125
                         );
126 126
 
@@ -130,25 +130,25 @@  discard block
 block discarded – undo
130 130
                                 'type'        => 'text',
131 131
                                 'id'          => 'wpinv_cc',
132 132
                                 'name'        => 'wpinv_cc',
133
-                                'label'       => __( 'Email CC:', 'invoicing' ) . getpaid_get_help_tip( __( 'Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing' ) ),
133
+                                'label'       => __('Email CC:', 'invoicing') . getpaid_get_help_tip(__('Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing')),
134 134
                                 'label_type'  => 'vertical',
135
-                                'placeholder' => __( '[email protected], [email protected]', 'invoicing' ),
135
+                                'placeholder' => __('[email protected], [email protected]', 'invoicing'),
136 136
                                 'class'       => 'form-control-sm',
137
-                                'value'       => $invoice->get_email_cc( 'edit' ),
137
+                                'value'       => $invoice->get_email_cc('edit'),
138 138
                             )
139 139
                         );
140 140
 
141
-                        do_action( 'wpinv_meta_box_details_inner', $invoice->get_id() );
141
+                        do_action('wpinv_meta_box_details_inner', $invoice->get_id());
142 142
 
143 143
                         // Disable taxes.
144
-                        if ( wpinv_use_taxes() && ! ( $invoice->is_paid() || $invoice->is_refunded() ) ) {
144
+                        if (wpinv_use_taxes() && !($invoice->is_paid() || $invoice->is_refunded())) {
145 145
 
146 146
                             echo aui()->input(
147 147
                                 array(
148 148
                                     'id'          => 'wpinv_taxable',
149 149
                                     'name'        => 'disable_taxes',
150 150
                                     'type'        => 'checkbox',
151
-                                    'label'       => __( 'Disable taxes', 'invoicing' ),
151
+                                    'label'       => __('Disable taxes', 'invoicing'),
152 152
                                     'value'       => '1',
153 153
                                     'checked'     => (bool) $invoice->get_disable_taxes(),
154 154
                                 )
@@ -157,17 +157,17 @@  discard block
 block discarded – undo
157 157
                         }
158 158
 
159 159
                         // Apply a discount.
160
-                        if ( $invoice->get_discount_code( 'edit' ) ) {
160
+                        if ($invoice->get_discount_code('edit')) {
161 161
 
162 162
                             echo aui()->input(
163 163
                                 array(
164 164
                                     'type'        => 'text',
165 165
                                     'id'          => 'wpinv_discount_code',
166 166
                                     'name'        => 'wpinv_discount_code',
167
-                                    'label'       => __( 'Discount Code:', 'invoicing' ),
167
+                                    'label'       => __('Discount Code:', 'invoicing'),
168 168
                                     'label_type'  => 'vertical',
169 169
                                     'class'       => 'form-control-sm',
170
-                                    'value'       => $invoice->get_discount_code( 'edit' ),
170
+                                    'value'       => $invoice->get_discount_code('edit'),
171 171
                                     'extra_attributes' => array(
172 172
                                         'onclick'  => 'this.select();',
173 173
                                         'readonly' => 'true',
Please login to merge, or discard this patch.
includes/wpinv-user-functions.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly
3
-if ( ! defined( 'ABSPATH' ) ) exit;
3
+if (!defined('ABSPATH')) exit;
4 4
 
5
-function wpinv_get_users_invoices( $user = 0, $number = 20, $pagination = false, $status = 'publish', $orderby = 'ID', $order = 'DESC' ) {
6
-    if ( empty( $user ) ) {
5
+function wpinv_get_users_invoices($user = 0, $number = 20, $pagination = false, $status = 'publish', $orderby = 'ID', $order = 'DESC') {
6
+    if (empty($user)) {
7 7
         $user = get_current_user_id();
8 8
     }
9 9
 
10
-    if ( empty( $user ) ) {
10
+    if (empty($user)) {
11 11
         return false;
12 12
     }
13 13
 
14
-    $args = apply_filters( 'wpinv_get_users_invoices_args', array( 'user' => $user, 'limit' => $number, 'status' => $status, 'paginate' => $pagination, 'orderby' => $orderby, 'order' => $order ) );
14
+    $args = apply_filters('wpinv_get_users_invoices_args', array('user' => $user, 'limit' => $number, 'status' => $status, 'paginate' => $pagination, 'orderby' => $orderby, 'order' => $order));
15 15
     
16
-    return wpinv_get_invoices( $args );
16
+    return wpinv_get_invoices($args);
17 17
 }
18 18
 
19
-function wpinv_dropdown_users( $args = '' ) {
19
+function wpinv_dropdown_users($args = '') {
20 20
     $defaults = array(
21 21
         'show_option_all' => '', 'show_option_none' => '', 'hide_if_only_one_author' => '',
22 22
         'orderby' => 'display_name', 'order' => 'ASC',
@@ -27,18 +27,18 @@  discard block
 block discarded – undo
27 27
         'option_none_value' => -1
28 28
     );
29 29
 
30
-    $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0;
30
+    $defaults['selected'] = is_author() ? get_query_var('author') : 0;
31 31
 
32
-    $r = wp_parse_args( $args, $defaults );
32
+    $r = wp_parse_args($args, $defaults);
33 33
 
34
-    $query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who' ) );
34
+    $query_args = wp_array_slice_assoc($r, array('blog_id', 'include', 'exclude', 'orderby', 'order', 'who'));
35 35
 
36
-    $fields = array( 'ID', 'user_login', 'user_email' );
36
+    $fields = array('ID', 'user_login', 'user_email');
37 37
 
38
-    $show = ! empty( $r['show'] ) ? $r['show'] : 'display_name';
39
-    if ( 'display_name_with_login' === $show ) {
38
+    $show = !empty($r['show']) ? $r['show'] : 'display_name';
39
+    if ('display_name_with_login' === $show) {
40 40
         $fields[] = 'display_name';
41
-    } else if ( 'display_name_with_email' === $show ) {
41
+    } else if ('display_name_with_email' === $show) {
42 42
         $fields[] = 'display_name';
43 43
     } else {
44 44
         $fields[] = $show;
@@ -50,99 +50,99 @@  discard block
 block discarded – undo
50 50
     $show_option_none = $r['show_option_none'];
51 51
     $option_none_value = $r['option_none_value'];
52 52
 
53
-    $query_args = apply_filters( 'wpinv_dropdown_users_args', $query_args, $r );
53
+    $query_args = apply_filters('wpinv_dropdown_users_args', $query_args, $r);
54 54
 
55
-    $users = get_users( $query_args );
55
+    $users = get_users($query_args);
56 56
 
57 57
     $output = '';
58
-    if ( ! empty( $users ) && ( empty( $r['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) {
59
-        $name = esc_attr( $r['name'] );
60
-        if ( $r['multi'] && ! $r['id'] ) {
58
+    if (!empty($users) && (empty($r['hide_if_only_one_author']) || count($users) > 1)) {
59
+        $name = esc_attr($r['name']);
60
+        if ($r['multi'] && !$r['id']) {
61 61
             $id = '';
62 62
         } else {
63
-            $id = $r['id'] ? " id='" . esc_attr( $r['id'] ) . "'" : " id='$name'";
63
+            $id = $r['id'] ? " id='" . esc_attr($r['id']) . "'" : " id='$name'";
64 64
         }
65 65
         $output = "<select name='{$name}'{$id} class='" . $r['class'] . "'>\n";
66 66
 
67
-        if ( $show_option_all ) {
67
+        if ($show_option_all) {
68 68
             $output .= "\t<option value='0'>$show_option_all</option>\n";
69 69
         }
70 70
 
71
-        if ( $show_option_none ) {
72
-            $_selected = selected( $option_none_value, $r['selected'], false );
73
-            $output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$_selected>$show_option_none</option>\n";
71
+        if ($show_option_none) {
72
+            $_selected = selected($option_none_value, $r['selected'], false);
73
+            $output .= "\t<option value='" . esc_attr($option_none_value) . "'$_selected>$show_option_none</option>\n";
74 74
         }
75 75
 
76
-        if ( $r['include_selected'] && ( $r['selected'] > 0 ) ) {
76
+        if ($r['include_selected'] && ($r['selected'] > 0)) {
77 77
             $found_selected = false;
78 78
             $r['selected'] = (int) $r['selected'];
79
-            foreach ( (array) $users as $user ) {
79
+            foreach ((array) $users as $user) {
80 80
                 $user->ID = (int) $user->ID;
81
-                if ( $user->ID === $r['selected'] ) {
81
+                if ($user->ID === $r['selected']) {
82 82
                     $found_selected = true;
83 83
                 }
84 84
             }
85 85
 
86
-            if ( ! $found_selected ) {
87
-                $users[] = get_userdata( $r['selected'] );
86
+            if (!$found_selected) {
87
+                $users[] = get_userdata($r['selected']);
88 88
             }
89 89
         }
90 90
 
91
-        foreach ( (array) $users as $user ) {
92
-            if ( 'display_name_with_login' === $show ) {
91
+        foreach ((array) $users as $user) {
92
+            if ('display_name_with_login' === $show) {
93 93
                 /* translators: 1: display name, 2: user_login */
94
-                $display = sprintf( _x( '%1$s (%2$s)', 'user dropdown' ), $user->display_name, $user->user_login );
95
-            } elseif ( 'display_name_with_email' === $show ) {
94
+                $display = sprintf(_x('%1$s (%2$s)', 'user dropdown'), $user->display_name, $user->user_login);
95
+            } elseif ('display_name_with_email' === $show) {
96 96
                 /* translators: 1: display name, 2: user_email */
97
-                if ( $user->display_name == $user->user_email ) {
97
+                if ($user->display_name == $user->user_email) {
98 98
                     $display = $user->display_name;
99 99
                 } else {
100
-                    $display = sprintf( _x( '%1$s (%2$s)', 'user dropdown' ), $user->display_name, $user->user_email );
100
+                    $display = sprintf(_x('%1$s (%2$s)', 'user dropdown'), $user->display_name, $user->user_email);
101 101
                 }
102
-            } elseif ( ! empty( $user->$show ) ) {
102
+            } elseif (!empty($user->$show)) {
103 103
                 $display = $user->$show;
104 104
             } else {
105 105
                 $display = '(' . $user->user_login . ')';
106 106
             }
107 107
 
108
-            $_selected = selected( $user->ID, $r['selected'], false );
109
-            $output .= "\t<option value='$user->ID'$_selected>" . esc_html( $display ) . "</option>\n";
108
+            $_selected = selected($user->ID, $r['selected'], false);
109
+            $output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n";
110 110
         }
111 111
 
112 112
         $output .= "</select>";
113 113
     }
114 114
 
115
-    $html = apply_filters( 'wpinv_dropdown_users', $output );
115
+    $html = apply_filters('wpinv_dropdown_users', $output);
116 116
 
117
-    if ( $r['echo'] ) {
117
+    if ($r['echo']) {
118 118
         echo $html;
119 119
     }
120 120
     return $html;
121 121
 }
122 122
 
123
-function wpinv_guest_redirect( $redirect_to, $user_id = 0 ) {
124
-    if ( (int)wpinv_get_option( 'guest_checkout' ) && $user_id > 0 ) {
125
-        wpinv_login_user( $user_id );
123
+function wpinv_guest_redirect($redirect_to, $user_id = 0) {
124
+    if ((int) wpinv_get_option('guest_checkout') && $user_id > 0) {
125
+        wpinv_login_user($user_id);
126 126
     } else {
127
-        $redirect_to = wp_login_url( $redirect_to );
127
+        $redirect_to = wp_login_url($redirect_to);
128 128
     }
129 129
     
130
-    $redirect_to = apply_filters( 'wpinv_invoice_link_guest_redirect', $redirect_to, $user_id );
130
+    $redirect_to = apply_filters('wpinv_invoice_link_guest_redirect', $redirect_to, $user_id);
131 131
     
132
-    wp_redirect( $redirect_to );
132
+    wp_redirect($redirect_to);
133 133
 }
134 134
 
135
-function wpinv_login_user( $user_id ) {
136
-    if ( is_user_logged_in() ) {
135
+function wpinv_login_user($user_id) {
136
+    if (is_user_logged_in()) {
137 137
         return true;
138 138
     }
139 139
     
140
-    $user = get_user_by( 'id', $user_id );
140
+    $user = get_user_by('id', $user_id);
141 141
     
142
-    if ( !empty( $user ) && !is_wp_error( $user ) && !empty( $user->user_login ) ) {
143
-        wp_set_current_user( $user_id, $user->user_login );
144
-        wp_set_auth_cookie( $user_id );
145
-        do_action( 'wp_login', $user->user_login );
142
+    if (!empty($user) && !is_wp_error($user) && !empty($user->user_login)) {
143
+        wp_set_current_user($user_id, $user->user_login);
144
+        wp_set_auth_cookie($user_id);
145
+        do_action('wp_login', $user->user_login);
146 146
         
147 147
         return true;
148 148
     }
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
  * @return string capability to check against
158 158
  * @param string $capalibilty Optional. The alternative capability to check against.
159 159
  */
160
-function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) {
160
+function wpinv_get_capability($capalibilty = 'manage_invoicing') {
161 161
 
162
-	if ( current_user_can( 'manage_options' ) ) {
162
+	if (current_user_can('manage_options')) {
163 163
 		return 'manage_options';
164 164
 	};
165 165
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
  * @return bool
174 174
  */
175 175
 function wpinv_current_user_can_manage_invoicing() {
176
-    return current_user_can( wpinv_get_capability() );
176
+    return current_user_can(wpinv_get_capability());
177 177
 }
178 178
 
179 179
 /**
@@ -182,17 +182,17 @@  discard block
 block discarded – undo
182 182
  * @since 1.0.19
183 183
  * @return int|WP_Error
184 184
  */
185
-function wpinv_create_user( $email ) {
185
+function wpinv_create_user($email) {
186 186
 
187 187
     // Prepare user values.
188 188
 	$args = array(
189
-		'user_login' => wpinv_generate_user_name( $email ),
189
+		'user_login' => wpinv_generate_user_name($email),
190 190
 		'user_pass'  => wp_generate_password(),
191 191
 		'user_email' => $email,
192 192
         'role'       => 'subscriber',
193 193
     );
194 194
 
195
-    return wp_insert_user( $args );
195
+    return wp_insert_user($args);
196 196
 
197 197
 }
198 198
 
@@ -202,22 +202,22 @@  discard block
 block discarded – undo
202 202
  * @since 1.0.19
203 203
  * @return bool|WP_User
204 204
  */
205
-function wpinv_generate_user_name( $prefix = '' ) {
205
+function wpinv_generate_user_name($prefix = '') {
206 206
 
207 207
     // If prefix is an email, retrieve the part before the email.
208
-	$prefix = strtok( $prefix, '@' );
208
+	$prefix = strtok($prefix, '@');
209 209
 
210 210
 	// Trim to 4 characters max.
211
-	$prefix = sanitize_user( $prefix );
211
+	$prefix = sanitize_user($prefix);
212 212
 
213
-	$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
214
-	if ( empty( $prefix ) || in_array( strtolower( $prefix ), array_map( 'strtolower', $illegal_logins ), true ) ) {
213
+	$illegal_logins = (array) apply_filters('illegal_user_logins', array());
214
+	if (empty($prefix) || in_array(strtolower($prefix), array_map('strtolower', $illegal_logins), true)) {
215 215
 		$prefix = 'gtp';
216 216
 	}
217 217
 
218
-	$username = $prefix . '_' . zeroise( wp_rand( 0, 9999 ), 4 );
219
-	if ( username_exists( $username ) ) {
220
-		return wpinv_generate_user_name( $username );
218
+	$username = $prefix . '_' . zeroise(wp_rand(0, 9999), 4);
219
+	if (username_exists($username)) {
220
+		return wpinv_generate_user_name($username);
221 221
 	}
222 222
 
223 223
     return $username;
Please login to merge, or discard this patch.