Passed
Push — master ( 299d1d...443279 )
by Brian
04:51
created
templates/payment-forms-admin/previews/paragraph.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 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
 
Please login to merge, or discard this patch.
templates/payment-forms-admin/previews/pay_button.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 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
 
Please login to merge, or discard this patch.
includes/payments/class-getpaid-payment-forms.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Payment forms controller class
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 	public function __construct() {
20 20
 
21 21
 		// Update a payment form's revenue whenever an invoice is paid for or refunded.
22
-		add_action( 'getpaid_invoice_payment_status_changed', array( $this, 'increment_form_revenue' ) );
23
-		add_action( 'getpaid_invoice_payment_status_reversed', array( $this, 'decrease_form_revenue' ) );
22
+		add_action('getpaid_invoice_payment_status_changed', array($this, 'increment_form_revenue'));
23
+		add_action('getpaid_invoice_payment_status_reversed', array($this, 'decrease_form_revenue'));
24 24
 
25 25
 		// Sync form amount whenever invoice statuses change.
26
-		add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_failed_amount' ), 10, 3 );
27
-		add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_refunded_amount' ), 10, 3 );
28
-		add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_cancelled_amount' ), 10, 3 );
26
+		add_action('getpaid_invoice_status_changed', array($this, 'update_form_failed_amount'), 10, 3);
27
+		add_action('getpaid_invoice_status_changed', array($this, 'update_form_refunded_amount'), 10, 3);
28
+		add_action('getpaid_invoice_status_changed', array($this, 'update_form_cancelled_amount'), 10, 3);
29 29
 
30 30
 	}
31 31
 
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @param WPInv_Invoice $invoice
36 36
 	 */
37
-	public function increment_form_revenue( $invoice ) {
37
+	public function increment_form_revenue($invoice) {
38 38
 
39
-		$form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
40
-		if ( $form->get_id() ) {
41
-			$form->set_earned( $form->get_earned() + $invoice->get_total() );
39
+		$form = new GetPaid_Payment_Form($invoice->get_payment_form());
40
+		if ($form->get_id()) {
41
+			$form->set_earned($form->get_earned() + $invoice->get_total());
42 42
 			$form->save();
43 43
 		}
44 44
 
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @param WPInv_Invoice $invoice
51 51
 	 */
52
-	public function decrease_form_revenue( $invoice ) {
52
+	public function decrease_form_revenue($invoice) {
53 53
 
54
-		$form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
55
-		if ( $form->get_id() ) {
56
-			$form->set_earned( $form->get_earned() - $invoice->get_total() );
54
+		$form = new GetPaid_Payment_Form($invoice->get_payment_form());
55
+		if ($form->get_id()) {
56
+			$form->set_earned($form->get_earned() - $invoice->get_total());
57 57
 			$form->save();
58 58
 		}
59 59
 
@@ -66,20 +66,20 @@  discard block
 block discarded – undo
66 66
 	 * @param string $from
67 67
 	 * @param string $to
68 68
 	 */
69
-	public function update_form_failed_amount( $invoice, $from, $to ) {
69
+	public function update_form_failed_amount($invoice, $from, $to) {
70 70
 
71
-		$form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
72
-		if ( $form->get_id() ) {
71
+		$form = new GetPaid_Payment_Form($invoice->get_payment_form());
72
+		if ($form->get_id()) {
73 73
 			return;
74 74
 		}
75 75
 
76
-		if ( 'wpi-failed' == $from ) {
77
-			$form->set_failed( $form->get_failed() - $invoice->get_total() );
76
+		if ('wpi-failed' == $from) {
77
+			$form->set_failed($form->get_failed() - $invoice->get_total());
78 78
 			$form->save();
79 79
 		}
80 80
 
81
-		if ( 'wpi-failed' == $to ) {
82
-			$form->set_failed( $form->get_failed() + $invoice->get_total() );
81
+		if ('wpi-failed' == $to) {
82
+			$form->set_failed($form->get_failed() + $invoice->get_total());
83 83
 			$form->save();
84 84
 		}
85 85
 
@@ -92,20 +92,20 @@  discard block
 block discarded – undo
92 92
 	 * @param string $from
93 93
 	 * @param string $to
94 94
 	 */
95
-	public function update_form_refunded_amount( $invoice, $from, $to ) {
95
+	public function update_form_refunded_amount($invoice, $from, $to) {
96 96
 
97
-		$form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
98
-		if ( $form->get_id() ) {
97
+		$form = new GetPaid_Payment_Form($invoice->get_payment_form());
98
+		if ($form->get_id()) {
99 99
 			return;
100 100
 		}
101 101
 
102
-		if ( 'wpi-refunded' == $from ) {
103
-			$form->set_refunded( $form->get_refunded() - $invoice->get_total() );
102
+		if ('wpi-refunded' == $from) {
103
+			$form->set_refunded($form->get_refunded() - $invoice->get_total());
104 104
 			$form->save();
105 105
 		}
106 106
 
107
-		if ( 'wpi-refunded' == $to ) {
108
-			$form->set_refunded( $form->get_refunded() + $invoice->get_total() );
107
+		if ('wpi-refunded' == $to) {
108
+			$form->set_refunded($form->get_refunded() + $invoice->get_total());
109 109
 			$form->save();
110 110
 		}
111 111
 
@@ -118,20 +118,20 @@  discard block
 block discarded – undo
118 118
 	 * @param string $from
119 119
 	 * @param string $to
120 120
 	 */
121
-	public function update_form_cancelled_amount( $invoice, $from, $to ) {
121
+	public function update_form_cancelled_amount($invoice, $from, $to) {
122 122
 
123
-		$form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
124
-		if ( $form->get_id() ) {
123
+		$form = new GetPaid_Payment_Form($invoice->get_payment_form());
124
+		if ($form->get_id()) {
125 125
 			return;
126 126
 		}
127 127
 
128
-		if ( 'wpi-cancelled' == $from ) {
129
-			$form->set_cancelled( $form->get_cancelled() - $invoice->get_total() );
128
+		if ('wpi-cancelled' == $from) {
129
+			$form->set_cancelled($form->get_cancelled() - $invoice->get_total());
130 130
 			$form->save();
131 131
 		}
132 132
 
133
-		if ( 'wpi-cancelled' == $to ) {
134
-			$form->set_cancelled( $form->get_cancelled() + $invoice->get_total() );
133
+		if ('wpi-cancelled' == $to) {
134
+			$form->set_cancelled($form->get_cancelled() + $invoice->get_total());
135 135
 			$form->save();
136 136
 		}
137 137
 
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-discount-details.php 1 patch
Spacing   +96 added lines, -96 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,24 +21,24 @@  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 discount.
27
-        $discount = new WPInv_Discount( $post );
27
+        $discount = new WPInv_Discount($post);
28 28
 
29 29
         // Nonce field.
30
-        wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' );
30
+        wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce');
31 31
 
32
-        do_action( 'wpinv_discount_form_top', $discount );
32
+        do_action('wpinv_discount_form_top', $discount);
33 33
 
34 34
         // Set the currency position.
35 35
         $position = wpinv_currency_position();
36 36
 
37
-        if ( $position == 'left_space' ) {
37
+        if ($position == 'left_space') {
38 38
             $position = 'left';
39 39
         }
40 40
 
41
-        if ( $position == 'right_space' ) {
41
+        if ($position == 'right_space') {
42 42
             $position = 'right';
43 43
         }
44 44
 
@@ -52,66 +52,66 @@  discard block
 block discarded – undo
52 52
         </style>
53 53
         <div class='bsui' style='max-width: 600px;padding-top: 10px;'>
54 54
 
55
-            <?php do_action( 'wpinv_discount_form_first', $discount ); ?>
55
+            <?php do_action('wpinv_discount_form_first', $discount); ?>
56 56
 
57
-            <?php do_action( 'wpinv_discount_form_before_code', $discount ); ?>
57
+            <?php do_action('wpinv_discount_form_before_code', $discount); ?>
58 58
             <div class="form-group row">
59 59
                 <label for="wpinv_discount_code" class="col-sm-3 col-form-label">
60
-                    <?php _e( 'Discount Code', 'invoicing' );?>
60
+                    <?php _e('Discount Code', 'invoicing'); ?>
61 61
                 </label>
62 62
                 <div class="col-sm-8">
63 63
                     <div class="row">
64 64
                         <div class="col-sm-12 form-group">
65
-                            <input type="text" value="<?php echo esc_attr( $discount->get_code( 'edit' ) ); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" />
65
+                            <input type="text" value="<?php echo esc_attr($discount->get_code('edit')); ?>" placeholder="SUMMER_SALE" name="wpinv_discount_code" id="wpinv_discount_code" style="width: 100%;" />
66 66
                         </div>
67 67
                         <div class="col-sm-12">
68 68
                             <?php
69
-                                do_action( 'wpinv_discount_form_before_single_use', $discount );
69
+                                do_action('wpinv_discount_form_before_single_use', $discount);
70 70
 
71 71
                                 echo aui()->input(
72 72
                                     array(
73 73
                                         'id'          => 'wpinv_discount_single_use',
74 74
                                         'name'        => 'wpinv_discount_single_use',
75 75
                                         'type'        => 'checkbox',
76
-                                        'label'       => __( 'Each customer can only use this discount once', 'invoicing' ),
76
+                                        'label'       => __('Each customer can only use this discount once', 'invoicing'),
77 77
                                         'value'       => '1',
78 78
                                         'checked'     => $discount->is_single_use(),
79 79
                                     )
80 80
                                 );
81 81
 
82
-                                do_action( 'wpinv_discount_form_single_use', $discount );
82
+                                do_action('wpinv_discount_form_single_use', $discount);
83 83
                             ?>
84 84
                         </div>
85 85
                         <div class="col-sm-12">
86 86
                             <?php
87
-                                do_action( 'wpinv_discount_form_before_recurring', $discount );
87
+                                do_action('wpinv_discount_form_before_recurring', $discount);
88 88
 
89 89
                                 echo aui()->input(
90 90
                                     array(
91 91
                                         'id'          => 'wpinv_discount_recurring',
92 92
                                         'name'        => 'wpinv_discount_recurring',
93 93
                                         'type'        => 'checkbox',
94
-                                        'label'       => __( 'Apply this discount to all recurring payments for subscriptions', 'invoicing' ),
94
+                                        'label'       => __('Apply this discount to all recurring payments for subscriptions', 'invoicing'),
95 95
                                         'value'       => '1',
96 96
                                         'checked'     => $discount->is_recurring(),
97 97
                                     )
98 98
                                 );
99 99
 
100
-                                do_action( 'wpinv_discount_form_recurring', $discount );
100
+                                do_action('wpinv_discount_form_recurring', $discount);
101 101
                             ?>
102 102
                         </div>
103 103
                     </div>
104 104
                 </div>
105 105
                 <div class="col-sm-1 pt-2 pl-0">
106
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter a discount code such as 10OFF.', 'invoicing' ); ?>"></span>
106
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter a discount code such as 10OFF.', 'invoicing'); ?>"></span>
107 107
                 </div>
108 108
             </div>
109
-            <?php do_action( 'wpinv_discount_form_code', $discount ); ?>
109
+            <?php do_action('wpinv_discount_form_code', $discount); ?>
110 110
 
111
-            <?php do_action( 'wpinv_discount_form_before_type', $discount ); ?>
111
+            <?php do_action('wpinv_discount_form_before_type', $discount); ?>
112 112
             <div class="form-group row">
113 113
                 <label for="wpinv_discount_type" class="col-sm-3 col-form-label">
114
-                    <?php _e( 'Discount Type', 'invoicing' );?>
114
+                    <?php _e('Discount Type', 'invoicing'); ?>
115 115
                 </label>
116 116
                 <div class="col-sm-8">
117 117
                     <?php
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
                             array(
120 120
                                 'id'               => 'wpinv_discount_type',
121 121
                                 'name'             => 'wpinv_discount_type',
122
-                                'label'            => __( 'Discount Type', 'invoicing' ),
123
-                                'placeholder'      => __( 'Select Discount Type', 'invoicing' ),
124
-                                'value'            => $discount->get_type( 'edit' ),
122
+                                'label'            => __('Discount Type', 'invoicing'),
123
+                                'placeholder'      => __('Select Discount Type', 'invoicing'),
124
+                                'value'            => $discount->get_type('edit'),
125 125
                                 'select2'          => true,
126 126
                                 'data-allow-clear' => 'false',
127 127
                                 'options'          => wpinv_get_discount_types()
@@ -130,19 +130,19 @@  discard block
 block discarded – undo
130 130
                     ?>
131 131
                 </div>
132 132
                 <div class="col-sm-1 pt-2 pl-0">
133
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Discount type.', 'invoicing' ); ?>"></span>
133
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Discount type.', 'invoicing'); ?>"></span>
134 134
                 </div>
135 135
             </div>
136
-            <?php do_action( 'wpinv_discount_form_type', $discount ); ?>
136
+            <?php do_action('wpinv_discount_form_type', $discount); ?>
137 137
 
138
-            <?php do_action( 'wpinv_discount_form_before_amount', $discount ); ?>
139
-            <div class="form-group row <?php echo esc_attr( $discount->get_type( 'edit' ) ); ?>" id="wpinv_discount_amount_wrap">
138
+            <?php do_action('wpinv_discount_form_before_amount', $discount); ?>
139
+            <div class="form-group row <?php echo esc_attr($discount->get_type('edit')); ?>" id="wpinv_discount_amount_wrap">
140 140
                 <label for="wpinv_discount_amount" class="col-sm-3 col-form-label">
141
-                    <?php _e( 'Discount Amount', 'invoicing' );?>
141
+                    <?php _e('Discount Amount', 'invoicing'); ?>
142 142
                 </label>
143 143
                 <div class="col-sm-8">
144 144
                     <div class="input-group input-group-sm">
145
-                        <?php if( 'left' == $position ) : ?>
145
+                        <?php if ('left' == $position) : ?>
146 146
                             <div class="input-group-prepend left wpinv-if-flat">
147 147
                                 <span class="input-group-text">
148 148
                                     <?php echo wpinv_currency_symbol(); ?>
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
                             </div>
151 151
                         <?php endif; ?>
152 152
 
153
-                        <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr( $discount->get_amount( 'edit' ) ); ?>" placeholder="0" class="form-control">
153
+                        <input type="text" name="wpinv_discount_amount" id="wpinv_discount_amount" value="<?php echo esc_attr($discount->get_amount('edit')); ?>" placeholder="0" class="form-control">
154 154
 
155
-                        <?php if( 'right' == $position ) : ?>
155
+                        <?php if ('right' == $position) : ?>
156 156
                             <div class="input-group-prepend left wpinv-if-flat">
157 157
                                 <span class="input-group-text">
158 158
                                     <?php echo wpinv_currency_symbol(); ?>
@@ -165,15 +165,15 @@  discard block
 block discarded – undo
165 165
                     </div>
166 166
                 </div>
167 167
                 <div class="col-sm-1 pt-2 pl-0">
168
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Enter the discount value. Ex: 10', 'invoicing' ); ?>"></span>
168
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Enter the discount value. Ex: 10', 'invoicing'); ?>"></span>
169 169
                 </div>
170 170
             </div>
171
-            <?php do_action( 'wpinv_discount_form_amount', $discount ); ?>
171
+            <?php do_action('wpinv_discount_form_amount', $discount); ?>
172 172
 
173
-            <?php do_action( 'wpinv_discount_form_before_items', $discount ); ?>
173
+            <?php do_action('wpinv_discount_form_before_items', $discount); ?>
174 174
             <div class="form-group row">
175 175
                 <label for="wpinv_discount_items" class="col-sm-3 col-form-label">
176
-                    <?php _e( 'Items', 'invoicing' );?>
176
+                    <?php _e('Items', 'invoicing'); ?>
177 177
                 </label>
178 178
                 <div class="col-sm-8">
179 179
                     <?php
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
                             array(
182 182
                                 'id'               => 'wpinv_discount_items',
183 183
                                 'name'             => 'wpinv_discount_items[]',
184
-                                'label'            => __( 'Items', 'invoicing' ),
185
-                                'placeholder'      => __( 'Select Items', 'invoicing' ),
186
-                                'value'            => $discount->get_items( 'edit' ),
184
+                                'label'            => __('Items', 'invoicing'),
185
+                                'placeholder'      => __('Select Items', 'invoicing'),
186
+                                'value'            => $discount->get_items('edit'),
187 187
                                 'select2'          => true,
188 188
                                 'multiple'         => true,
189 189
                                 'data-allow-clear' => 'false',
@@ -193,15 +193,15 @@  discard block
 block discarded – undo
193 193
                     ?>
194 194
                 </div>
195 195
                 <div class="col-sm-1 pt-2 pl-0">
196
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing' ); ?>"></span>
196
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select the items that are allowed to use this discount or leave blank to use this discount all items.', 'invoicing'); ?>"></span>
197 197
                 </div>
198 198
             </div>
199
-            <?php do_action( 'wpinv_discount_form_items', $discount ); ?>
199
+            <?php do_action('wpinv_discount_form_items', $discount); ?>
200 200
 
201
-            <?php do_action( 'wpinv_discount_form_before_excluded_items', $discount ); ?>
201
+            <?php do_action('wpinv_discount_form_before_excluded_items', $discount); ?>
202 202
             <div class="form-group row">
203 203
                 <label for="wpinv_discount_excluded_items" class="col-sm-3 col-form-label">
204
-                    <?php _e( 'Excluded Items', 'invoicing' );?>
204
+                    <?php _e('Excluded Items', 'invoicing'); ?>
205 205
                 </label>
206 206
                 <div class="col-sm-8">
207 207
                     <?php
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
                             array(
210 210
                                 'id'               => 'wpinv_discount_excluded_items',
211 211
                                 'name'             => 'wpinv_discount_excluded_items[]',
212
-                                'label'            => __( 'Excluded Items', 'invoicing' ),
213
-                                'placeholder'      => __( 'Select Items', 'invoicing' ),
214
-                                'value'            => $discount->get_excluded_items( 'edit' ),
212
+                                'label'            => __('Excluded Items', 'invoicing'),
213
+                                'placeholder'      => __('Select Items', 'invoicing'),
214
+                                'value'            => $discount->get_excluded_items('edit'),
215 215
                                 'select2'          => true,
216 216
                                 'multiple'         => true,
217 217
                                 'data-allow-clear' => 'false',
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
                     ?>
222 222
                 </div>
223 223
                 <div class="col-sm-1 pt-2 pl-0">
224
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Select all the items that are not allowed to use this discount.', 'invoicing' ); ?>"></span>
224
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Select all the items that are not allowed to use this discount.', 'invoicing'); ?>"></span>
225 225
                 </div>
226 226
             </div>
227
-            <?php do_action( 'wpinv_discount_form_excluded_items', $discount ); ?>
227
+            <?php do_action('wpinv_discount_form_excluded_items', $discount); ?>
228 228
 
229
-            <?php do_action( 'wpinv_discount_form_before_start', $discount ); ?>
229
+            <?php do_action('wpinv_discount_form_before_start', $discount); ?>
230 230
             <div class="form-group row">
231 231
                 <label for="wpinv_discount_start" class="col-sm-3 col-form-label">
232
-                    <?php _e( 'Start Date', 'invoicing' );?>
232
+                    <?php _e('Start Date', 'invoicing'); ?>
233 233
                 </label>
234 234
                 <div class="col-sm-8">
235 235
                     <?php
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
                                 'type'        => 'datepicker',
239 239
                                 'id'          => 'wpinv_discount_start',
240 240
                                 'name'        => 'wpinv_discount_start',
241
-                                'label'       => __( 'Start Date', 'invoicing' ),
241
+                                'label'       => __('Start Date', 'invoicing'),
242 242
                                 'placeholder' => 'YYYY-MM-DD 00:00',
243 243
                                 'class'       => 'form-control-sm',
244
-                                'value'       => $discount->get_start_date( 'edit' ),
244
+                                'value'       => $discount->get_start_date('edit'),
245 245
                                 'extra_attributes' => array(
246 246
                                     'data-enable-time' => 'true',
247 247
                                     'data-time_24hr'   => 'true',
@@ -252,15 +252,15 @@  discard block
 block discarded – undo
252 252
                     ?>
253 253
                 </div>
254 254
                 <div class="col-sm-1 pt-2 pl-0">
255
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing' ); ?>"></span>
255
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('For no start date, leave blank. If entered, the discount can only be used after or on this date.', 'invoicing'); ?>"></span>
256 256
                 </div>
257 257
             </div>
258
-            <?php do_action( 'wpinv_discount_form_start', $discount ); ?>
258
+            <?php do_action('wpinv_discount_form_start', $discount); ?>
259 259
 
260
-            <?php do_action( 'wpinv_discount_form_before_expiration', $discount ); ?>
260
+            <?php do_action('wpinv_discount_form_before_expiration', $discount); ?>
261 261
             <div class="form-group row">
262 262
                 <label for="wpinv_discount_expiration" class="col-sm-3 col-form-label">
263
-                    <?php _e( 'Expiration Date', 'invoicing' );?>
263
+                    <?php _e('Expiration Date', 'invoicing'); ?>
264 264
                 </label>
265 265
                 <div class="col-sm-8">
266 266
                     <?php
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
                                 'type'        => 'datepicker',
270 270
                                 'id'          => 'wpinv_discount_expiration',
271 271
                                 'name'        => 'wpinv_discount_expiration',
272
-                                'label'       => __( 'Expiration Date', 'invoicing' ),
272
+                                'label'       => __('Expiration Date', 'invoicing'),
273 273
                                 'placeholder' => 'YYYY-MM-DD 00:00',
274 274
                                 'class'       => 'form-control-sm',
275
-                                'value'       => $discount->get_end_date( 'edit' ),
275
+                                'value'       => $discount->get_end_date('edit'),
276 276
                                 'extra_attributes' => array(
277 277
                                     'data-enable-time' => 'true',
278 278
                                     'data-time_24hr'   => 'true',
@@ -285,27 +285,27 @@  discard block
 block discarded – undo
285 285
                     ?>
286 286
                 </div>
287 287
                 <div class="col-sm-1 pt-2 pl-0">
288
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the date after which the discount will expire.', 'invoicing' ); ?>"></span>
288
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the date after which the discount will expire.', 'invoicing'); ?>"></span>
289 289
                 </div>
290 290
             </div>
291
-            <?php do_action( 'wpinv_discount_form_expiration', $discount ); ?>
291
+            <?php do_action('wpinv_discount_form_expiration', $discount); ?>
292 292
 
293
-            <?php do_action( 'wpinv_discount_form_before_min_total', $discount ); ?>
293
+            <?php do_action('wpinv_discount_form_before_min_total', $discount); ?>
294 294
             <div class="form-group row">
295 295
                 <label for="wpinv_discount_min_total" class="col-sm-3 col-form-label">
296
-                    <?php _e( 'Minimum Amount', 'invoicing' );?>
296
+                    <?php _e('Minimum Amount', 'invoicing'); ?>
297 297
                 </label>
298 298
                 <div class="col-sm-8">
299 299
                     <div class="input-group input-group-sm">
300
-                        <?php if( 'left' == $position ) : ?>
300
+                        <?php if ('left' == $position) : ?>
301 301
                             <div class="input-group-prepend">
302 302
                                 <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span>
303 303
                             </div>
304 304
                         <?php endif; ?>
305 305
 
306
-                        <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr( $discount->get_minimum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No minimum', 'invoicing' ); ?>" class="form-control">
306
+                        <input type="text" name="wpinv_discount_min_total" id="wpinv_discount_min_total" value="<?php echo esc_attr($discount->get_minimum_total('edit')); ?>" placeholder="<?php esc_attr_e('No minimum', 'invoicing'); ?>" class="form-control">
307 307
 
308
-                        <?php if( 'left' != $position ) : ?>
308
+                        <?php if ('left' != $position) : ?>
309 309
                             <div class="input-group-append">
310 310
                                 <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span>
311 311
                             </div>
@@ -313,27 +313,27 @@  discard block
 block discarded – undo
313 313
                     </div>
314 314
                 </div>
315 315
                 <div class="col-sm-1 pt-2 pl-0">
316
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing' ); ?>"></span>
316
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the minimum amount (including taxes) required to use this discount.', 'invoicing'); ?>"></span>
317 317
                 </div>
318 318
             </div>
319
-            <?php do_action( 'wpinv_discount_form_min_total', $discount ); ?>
319
+            <?php do_action('wpinv_discount_form_min_total', $discount); ?>
320 320
 
321
-            <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?>
321
+            <?php do_action('wpinv_discount_form_before_max_total', $discount); ?>
322 322
             <div class="form-group row">
323 323
                 <label for="wpinv_discount_max_total" class="col-sm-3 col-form-label">
324
-                    <?php _e( 'Maximum Amount', 'invoicing' );?>
324
+                    <?php _e('Maximum Amount', 'invoicing'); ?>
325 325
                 </label>
326 326
                 <div class="col-sm-8">
327 327
                     <div class="input-group input-group-sm">
328
-                        <?php if( 'left' == $position ) : ?>
328
+                        <?php if ('left' == $position) : ?>
329 329
                             <div class="input-group-prepend">
330 330
                                 <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span>
331 331
                             </div>
332 332
                         <?php endif; ?>
333 333
 
334
-                        <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr( $discount->get_maximum_total( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'No maximum', 'invoicing' ); ?>" class="form-control">
334
+                        <input type="text" name="wpinv_discount_max_total" id="wpinv_discount_max_total" value="<?php echo esc_attr($discount->get_maximum_total('edit')); ?>" placeholder="<?php esc_attr_e('No maximum', 'invoicing'); ?>" class="form-control">
335 335
 
336
-                        <?php if( 'left' != $position ) : ?>
336
+                        <?php if ('left' != $position) : ?>
337 337
                             <div class="input-group-append">
338 338
                                 <span class="input-group-text"><?php echo wpinv_currency_symbol(); ?></span>
339 339
                             </div>
@@ -341,30 +341,30 @@  discard block
 block discarded – undo
341 341
                     </div>
342 342
                 </div>
343 343
                 <div class="col-sm-1 pt-2 pl-0">
344
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing' ); ?>"></span>
344
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum amount (including taxes) allowed when using this discount.', 'invoicing'); ?>"></span>
345 345
                 </div>
346 346
             </div>
347
-            <?php do_action( 'wpinv_discount_form_before_max_total', $discount ); ?>
347
+            <?php do_action('wpinv_discount_form_before_max_total', $discount); ?>
348 348
 
349
-            <?php do_action( 'wpinv_discount_form_before_max_uses', $discount ); ?>
349
+            <?php do_action('wpinv_discount_form_before_max_uses', $discount); ?>
350 350
             <div class="form-group row">
351 351
                 <label for="wpinv_discount_max_uses" class="col-sm-3 col-form-label">
352
-                    <?php _e( 'Maximum Uses', 'invoicing' );?>
352
+                    <?php _e('Maximum Uses', 'invoicing'); ?>
353 353
                 </label>
354 354
                 <div class="col-sm-8">
355
-                    <input type="text" value="<?php echo esc_attr( $discount->get_max_uses( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'Unlimited', 'invoicing' ); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" />
355
+                    <input type="text" value="<?php echo esc_attr($discount->get_max_uses('edit')); ?>" placeholder="<?php esc_attr_e('Unlimited', 'invoicing'); ?>" name="wpinv_discount_max_uses" id="wpinv_discount_max_uses" style="width: 100%;" />
356 356
                 </div>
357 357
                 <div class="col-sm-1 pt-2 pl-0">
358
-                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Optionally set the maximum number of times that this discount code can be used.', 'invoicing' ); ?>"></span>
358
+                    <span class="wpi-help-tip dashicons dashicons-editor-help" title="<?php esc_attr_e('Optionally set the maximum number of times that this discount code can be used.', 'invoicing'); ?>"></span>
359 359
                 </div>
360 360
             </div>
361
-            <?php do_action( 'wpinv_discount_form_max_uses', $discount ); ?>
361
+            <?php do_action('wpinv_discount_form_max_uses', $discount); ?>
362 362
 
363
-            <?php do_action( 'wpinv_discount_form_last', $discount ); ?>
363
+            <?php do_action('wpinv_discount_form_last', $discount); ?>
364 364
 
365 365
         </div>
366 366
         <?php
367
-        do_action( 'wpinv_discount_form_bottom', $post );
367
+        do_action('wpinv_discount_form_bottom', $post);
368 368
     }
369 369
 
370 370
     /**
@@ -372,30 +372,30 @@  discard block
 block discarded – undo
372 372
 	 *
373 373
 	 * @param int $post_id
374 374
 	 */
375
-	public static function save( $post_id ) {
375
+	public static function save($post_id) {
376 376
 
377 377
         // Prepare the discount.
378
-        $discount = new WPInv_Discount( $post_id );
378
+        $discount = new WPInv_Discount($post_id);
379 379
 
380 380
         // Load new data.
381 381
         $discount->set_props(
382 382
 			array(
383
-				'code'                 => isset( $_POST['wpinv_discount_code'] ) ? $_POST['wpinv_discount_code'] : null,
384
-				'amount'               => isset( $_POST['wpinv_discount_amount'] ) ? $_POST['wpinv_discount_amount'] : null,
385
-				'start'                => isset( $_POST['wpinv_discount_start'] ) ? wpinv_clean( $_POST['wpinv_discount_start'] ) : null,
386
-				'expiration'           => isset( $_POST['wpinv_discount_expiration'] ) ? wpinv_clean( $_POST['wpinv_discount_expiration'] ) : null,
387
-				'is_single_use'        => isset( $_POST['wpinv_discount_single_use'] ),
388
-                'type'                 => isset( $_POST['wpinv_discount_type'] ) ? $_POST['wpinv_discount_type'] : null,
389
-				'is_recurring'         => isset( $_POST['wpinv_discount_recurring'] ),
390
-				'items'                => isset( $_POST['wpinv_discount_items'] ) ? $_POST['wpinv_discount_items'] : array(),
391
-				'excluded_items'       => isset( $_POST['wpinv_discount_excluded_items'] ) ? $_POST['wpinv_discount_excluded_items'] : array(),
392
-				'max_uses'             => isset( $_POST['wpinv_discount_max_uses'] ) ? $_POST['wpinv_discount_max_uses'] : null,
393
-				'min_total'            => isset( $_POST['wpinv_discount_min_total'] ) ? $_POST['wpinv_discount_min_total'] : null,
394
-				'max_total'            => isset( $_POST['wpinv_discount_max_total'] ) ? $_POST['wpinv_discount_max_total'] : null,
383
+				'code'                 => isset($_POST['wpinv_discount_code']) ? $_POST['wpinv_discount_code'] : null,
384
+				'amount'               => isset($_POST['wpinv_discount_amount']) ? $_POST['wpinv_discount_amount'] : null,
385
+				'start'                => isset($_POST['wpinv_discount_start']) ? wpinv_clean($_POST['wpinv_discount_start']) : null,
386
+				'expiration'           => isset($_POST['wpinv_discount_expiration']) ? wpinv_clean($_POST['wpinv_discount_expiration']) : null,
387
+				'is_single_use'        => isset($_POST['wpinv_discount_single_use']),
388
+                'type'                 => isset($_POST['wpinv_discount_type']) ? $_POST['wpinv_discount_type'] : null,
389
+				'is_recurring'         => isset($_POST['wpinv_discount_recurring']),
390
+				'items'                => isset($_POST['wpinv_discount_items']) ? $_POST['wpinv_discount_items'] : array(),
391
+				'excluded_items'       => isset($_POST['wpinv_discount_excluded_items']) ? $_POST['wpinv_discount_excluded_items'] : array(),
392
+				'max_uses'             => isset($_POST['wpinv_discount_max_uses']) ? $_POST['wpinv_discount_max_uses'] : null,
393
+				'min_total'            => isset($_POST['wpinv_discount_min_total']) ? $_POST['wpinv_discount_min_total'] : null,
394
+				'max_total'            => isset($_POST['wpinv_discount_max_total']) ? $_POST['wpinv_discount_max_total'] : null,
395 395
 			)
396 396
         );
397 397
 
398 398
 		$discount->save();
399
-		do_action( 'getpaid_discount_metabox_save', $post_id, $discount );
399
+		do_action('getpaid_discount_metabox_save', $post_id, $discount);
400 400
 	}
401 401
 }
Please login to merge, or discard this patch.
includes/payments/class-getpaid-payment-form-submission-fees.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Payment form submission fees class
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param GetPaid_Payment_Form_Submission $submission
31 31
 	 */
32
-	public function __construct( $submission ) {
32
+	public function __construct($submission) {
33 33
 
34 34
 		// Process any existing invoice fees.
35
-		if ( $submission->has_invoice() ) {
35
+		if ($submission->has_invoice()) {
36 36
 			$this->fees = $submission->get_invoice()->get_fees();
37 37
 		}
38 38
 
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 		$data         = $submission->get_data();
41 41
 		$payment_form = $submission->get_payment_form();
42 42
 
43
-		foreach ( $payment_form->get_elements() as $element ) {
43
+		foreach ($payment_form->get_elements() as $element) {
44 44
 
45
-			if ( 'price_input' == $element['type'] ) {
46
-				$this->process_price_input( $element, $data );
45
+			if ('price_input' == $element['type']) {
46
+				$this->process_price_input($element, $data);
47 47
 			}
48 48
 
49
-			if ( 'price_select' == $element['type'] ) {
50
-				$this->process_price_select( $element, $data );
49
+			if ('price_select' == $element['type']) {
50
+				$this->process_price_select($element, $data);
51 51
 			}
52 52
 
53 53
 		}
@@ -60,21 +60,21 @@  discard block
 block discarded – undo
60 60
 	 * @param array $element
61 61
 	 * @param array $data
62 62
 	 */
63
-	public function process_price_input( $element, $data ) {
63
+	public function process_price_input($element, $data) {
64 64
 
65 65
 		// Abort if not passed.
66
-		if ( empty( $data[ $element['id'] ] ) ) {
66
+		if (empty($data[$element['id']])) {
67 67
 			return;
68 68
 		}
69 69
 
70
-		$amount  = (float) wpinv_sanitize_amount( $data[ $element['id'] ] );
71
-		$minimum = empty( $element['minimum'] ) ? 0 : (float) wpinv_sanitize_amount( $element['minimum'] );
70
+		$amount  = (float) wpinv_sanitize_amount($data[$element['id']]);
71
+		$minimum = empty($element['minimum']) ? 0 : (float) wpinv_sanitize_amount($element['minimum']);
72 72
 
73
-		if ( $amount < $minimum ) {
74
-			throw new Exception( sprintf( __( 'The minimum allowed amount is %s', 'invoicing' ), $minimum ) );
73
+		if ($amount < $minimum) {
74
+			throw new Exception(sprintf(__('The minimum allowed amount is %s', 'invoicing'), $minimum));
75 75
 		}
76 76
 
77
-		$this->fees[ $element['label'] ] = array(
77
+		$this->fees[$element['label']] = array(
78 78
 			'name'          => $element['label'],
79 79
 			'initial_fee'   => $amount,
80 80
 			'recurring_fee' => 0,
@@ -88,27 +88,27 @@  discard block
 block discarded – undo
88 88
 	 * @param array $element
89 89
 	 * @param array $data
90 90
 	 */
91
-	public function process_price_select( $element, $data ) {
91
+	public function process_price_select($element, $data) {
92 92
 
93 93
 		// Abort if not passed.
94
-		if ( empty( $data[ $element['id'] ] ) ) {
94
+		if (empty($data[$element['id']])) {
95 95
 			return;
96 96
 		}
97 97
 
98
-		$options  = getpaid_convert_price_string_to_options( $element['options'] );
99
-		$selected = wpinv_parse_list( $data[ $element['id'] ] );
98
+		$options  = getpaid_convert_price_string_to_options($element['options']);
99
+		$selected = wpinv_parse_list($data[$element['id']]);
100 100
 		$total    = 0;
101 101
 
102
-		foreach ( $selected as $price ) {
102
+		foreach ($selected as $price) {
103 103
 
104
-			if ( ! isset( $options[ $price ] ) ) {
105
-				throw new Exception( __( 'You have selected an invalid amount', 'invoicing' ) );
104
+			if (!isset($options[$price])) {
105
+				throw new Exception(__('You have selected an invalid amount', 'invoicing'));
106 106
 			}
107 107
 
108
-			$total += (float) wpinv_sanitize_amount( $price );
108
+			$total += (float) wpinv_sanitize_amount($price);
109 109
 		}
110 110
 
111
-		$this->fees[ $element['label'] ] = array(
111
+		$this->fees[$element['label']] = array(
112 112
 			'name'          => $element['label'],
113 113
 			'initial_fee'   => $total,
114 114
 			'recurring_fee' => 0,
Please login to merge, or discard this patch.
includes/payments/class-getpaid-payment-form-submission-discount.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Payment form submission discount class
@@ -25,28 +25,28 @@  discard block
 block discarded – undo
25 25
 	 * @param float                           $initial_total
26 26
 	 * @param float                           $recurring_total
27 27
 	 */
28
-	public function __construct( $submission, $initial_total, $recurring_total ) {
28
+	public function __construct($submission, $initial_total, $recurring_total) {
29 29
 
30 30
 		// Process any existing invoice discounts.
31
-		if ( $submission->has_invoice() ) {
31
+		if ($submission->has_invoice()) {
32 32
 			$this->discounts = $submission->get_invoice()->get_discounts();
33 33
 		}
34 34
 
35 35
 		// Do we have a discount?
36
-		$discount = $submission->get_field( 'discount' );
36
+		$discount = $submission->get_field('discount');
37 37
 
38
-		if ( empty( $discount ) ) {
38
+		if (empty($discount)) {
39 39
 
40
-			if ( isset( $this->discounts['discount_code'] ) ) {
41
-				unset( $this->discounts['discount_code'] );
40
+			if (isset($this->discounts['discount_code'])) {
41
+				unset($this->discounts['discount_code']);
42 42
 			}
43 43
 
44 44
 			return;
45 45
 		}
46 46
 
47 47
 		// Processes the discount code.
48
-		$amount = max( $initial_total, $recurring_total );
49
-		$this->process_discount( $submission, $discount, $amount );
48
+		$amount = max($initial_total, $recurring_total);
49
+		$this->process_discount($submission, $discount, $amount);
50 50
 
51 51
 	}
52 52
 
@@ -57,29 +57,29 @@  discard block
 block discarded – undo
57 57
 	 * @param string                          $discount
58 58
 	 * @param float                           $amount
59 59
 	 */
60
-	public function process_discount( $submission, $discount, $amount ) {
60
+	public function process_discount($submission, $discount, $amount) {
61 61
 
62 62
 		// Fetch the discount.
63
-		$discount = new WPInv_Discount( $discount );
63
+		$discount = new WPInv_Discount($discount);
64 64
 
65 65
 		// Ensure it is active.
66
-        if ( ! $this->is_discount_active( $discount ) ) {
67
-			throw new Exception( __( 'Invalid or expired discount code', 'invoicing' ) );
66
+        if (!$this->is_discount_active($discount)) {
67
+			throw new Exception(__('Invalid or expired discount code', 'invoicing'));
68 68
 		}
69 69
 
70 70
 		// Exceeded limit.
71
-		if ( $discount->has_exceeded_limit() ) {
72
-			throw new Exception( __( 'This discount code has been used up', 'invoicing' ) );
71
+		if ($discount->has_exceeded_limit()) {
72
+			throw new Exception(__('This discount code has been used up', 'invoicing'));
73 73
 		}
74 74
 
75 75
 		// Validate usages.
76
-		$this->validate_single_use_discount( $submission, $discount );
76
+		$this->validate_single_use_discount($submission, $discount);
77 77
 
78 78
 		// Validate amount.
79
-		$this->validate_discount_amount( $submission, $discount, $amount );
79
+		$this->validate_discount_amount($submission, $discount, $amount);
80 80
 
81 81
 		// Save the discount.
82
-		$this->discounts['discount_code'] = $this->calculate_discount( $submission, $discount );
82
+		$this->discounts['discount_code'] = $this->calculate_discount($submission, $discount);
83 83
 	}
84 84
 
85 85
 	/**
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 	 * @param WPInv_Discount                  $discount
89 89
 	 * @return bool
90 90
 	 */
91
-	public function is_discount_active(  $discount ) {
92
-		return $discount->exists() && $discount->is_active() && $discount->has_started() && ! $discount->is_expired();
91
+	public function is_discount_active($discount) {
92
+		return $discount->exists() && $discount->is_active() && $discount->has_started() && !$discount->is_expired();
93 93
 	}
94 94
 
95 95
 	/**
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 	 * @param string $email
99 99
 	 * @return int|string|false
100 100
 	 */
101
-	public function get_user_id_or_email( $email ) {
101
+	public function get_user_id_or_email($email) {
102 102
 
103
-		if ( is_user_logged_in() ) {
103
+		if (is_user_logged_in()) {
104 104
 			return get_current_user_id();
105 105
 		}
106 106
 
107
-		return empty( $email ) ? false : sanitize_email( $email );
107
+		return empty($email) ? false : sanitize_email($email);
108 108
 	}
109 109
 
110 110
 	/**
@@ -113,23 +113,23 @@  discard block
 block discarded – undo
113 113
 	 * @param GetPaid_Payment_Form_Submission $submission
114 114
 	 * @param WPInv_Discount                  $discount
115 115
 	 */
116
-	public function validate_single_use_discount( $submission, $discount ) {
116
+	public function validate_single_use_discount($submission, $discount) {
117 117
 
118 118
 		// Abort if it is not a single use discount.
119
-		if ( ! $discount->is_single_use() ) {
119
+		if (!$discount->is_single_use()) {
120 120
 			return;
121 121
 		}
122 122
 
123 123
 		// Ensure there is a valid billing email.
124
-		$user = $this->get_user_id_or_email( $submission->get_billing_email() );
124
+		$user = $this->get_user_id_or_email($submission->get_billing_email());
125 125
 
126
-		if ( empty( $user ) ) {
127
-			throw new Exception( __( 'You need to either log in or enter your billing email before applying this discount', 'invoicing' ) );
126
+		if (empty($user)) {
127
+			throw new Exception(__('You need to either log in or enter your billing email before applying this discount', 'invoicing'));
128 128
 		}
129 129
 
130 130
 		// Has the user used this discount code before?
131
-		if ( ! $discount->is_valid_for_user( $user ) ) {
132
-			throw new Exception( __( 'You have already used this discount', 'invoicing' ) );
131
+		if (!$discount->is_valid_for_user($user)) {
132
+			throw new Exception(__('You have already used this discount', 'invoicing'));
133 133
 		}
134 134
 
135 135
 	}
@@ -141,18 +141,18 @@  discard block
 block discarded – undo
141 141
 	 * @param WPInv_Discount         $discount
142 142
 	 * @param float                  $amount
143 143
 	 */
144
-	public function validate_discount_amount( $submission, $discount, $amount ) {
144
+	public function validate_discount_amount($submission, $discount, $amount) {
145 145
 
146 146
 		// Validate minimum amount.
147
-		if ( ! $discount->is_minimum_amount_met( $amount ) ) {
148
-			$min = wpinv_price( $discount->get_minimum_total(), $submission->get_currency() );
149
-			throw new Exception( sprintf( __( 'The minimum total for using this discount is %s', 'invoicing' ), $min ) );
147
+		if (!$discount->is_minimum_amount_met($amount)) {
148
+			$min = wpinv_price($discount->get_minimum_total(), $submission->get_currency());
149
+			throw new Exception(sprintf(__('The minimum total for using this discount is %s', 'invoicing'), $min));
150 150
 		}
151 151
 
152 152
 		// Validate the maximum amount.
153
-		if ( ! $discount->is_maximum_amount_met( $amount ) ) {
154
-			$max = wpinv_price( $discount->get_maximum_total(), $submission->get_currency() );
155
-			throw new Exception( sprintf( __( 'The maximum total for using this discount is %s', 'invoicing' ), $max ) );
153
+		if (!$discount->is_maximum_amount_met($amount)) {
154
+			$max = wpinv_price($discount->get_maximum_total(), $submission->get_currency());
155
+			throw new Exception(sprintf(__('The maximum total for using this discount is %s', 'invoicing'), $max));
156 156
 		}
157 157
 
158 158
 	}
@@ -166,24 +166,24 @@  discard block
 block discarded – undo
166 166
 	 * @param WPInv_Discount                  $discount
167 167
 	 * @return array
168 168
 	 */
169
-	public function calculate_discount( $submission, $discount ) {
169
+	public function calculate_discount($submission, $discount) {
170 170
 
171 171
 		$initial_discount   = 0;
172 172
 		$recurring_discount = 0;
173 173
 
174
-		foreach ( $submission->get_items() as $item ) {
174
+		foreach ($submission->get_items() as $item) {
175 175
 
176 176
 			// Abort if it is not valid for this item.
177
-			if ( ! $discount->is_valid_for_items( array( $item->get_id() ) ) ) {
177
+			if (!$discount->is_valid_for_items(array($item->get_id()))) {
178 178
 				continue;
179 179
 			}
180 180
 
181 181
 			// Calculate the initial amount...
182
-			$initial_discount += $discount->get_discounted_amount( $item->get_sub_total() );
182
+			$initial_discount += $discount->get_discounted_amount($item->get_sub_total());
183 183
 
184 184
 			// ... and maybe the recurring amount.
185
-			if ( $item->is_recurring() && $discount->is_recurring() ) {
186
-				$recurring_discount += $discount->get_discounted_amount( $item->get_recurring_sub_total() );
185
+			if ($item->is_recurring() && $discount->is_recurring()) {
186
+				$recurring_discount += $discount->get_discounted_amount($item->get_recurring_sub_total());
187 187
 			}
188 188
 
189 189
 		}
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/alert.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@
 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
 
14 14
 <div class='form-group'>
15 15
     <label class="d-block">
16
-        <span><?php esc_html_e( 'Alert Text', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Alert Text', 'invoicing'); ?></span>
17 17
         <textarea v-model='active_form_element.text' class='form-control' rows='3'></textarea>
18 18
     </label>
19 19
 </div>
20 20
 
21 21
 <div class='form-group form-check'>
22 22
     <input :id="active_form_element.id + '_edit_dismissible'" v-model='active_form_element.dismissible' type='checkbox' class='form-check-input' />
23
-    <label class='form-check-label' :for="active_form_element.id + '_edit_dismissible'"><?php esc_html_e( 'Is Dismissible?', 'invoicing' ); ?></label>
23
+    <label class='form-check-label' :for="active_form_element.id + '_edit_dismissible'"><?php esc_html_e('Is Dismissible?', 'invoicing'); ?></label>
24 24
 </div>
25 25
 
26 26
 <div class='form-group'>
27
-    <label :for="active_form_element.id + '_edit_type'"><?php esc_html_e( 'Alert Type', 'invoicing' ) ?></label>
27
+    <label :for="active_form_element.id + '_edit_type'"><?php esc_html_e('Alert Type', 'invoicing') ?></label>
28 28
     <select class='form-control custom-select' :id="active_form_element.id + '_edit_type'" v-model='active_form_element.class'>
29
-        <option value='alert-primary'><?php esc_html_e( 'Primary', 'invoicing' ); ?></option>
30
-        <option value='alert-secondary'><?php esc_html_e( 'Secondary', 'invoicing' ); ?></option>
31
-        <option value='alert-success'><?php esc_html_e( 'Success', 'invoicing' ); ?></option>
32
-        <option value='alert-danger'><?php esc_html_e( 'Danger', 'invoicing' ); ?></option>
33
-        <option value='alert-warning'><?php esc_html_e( 'Warning', 'invoicing' ); ?></option>
34
-        <option value='alert-info'><?php esc_html_e( 'Info', 'invoicing' ); ?></option>
35
-        <option value='alert-light'><?php esc_html_e( 'Light', 'invoicing' ); ?></option>
36
-        <option value='alert-dark'><?php esc_html_e( 'Dark', 'invoicing' ); ?></option>
37
-        <option value='alert-link'><?php esc_html_e( 'Link', 'invoicing' ); ?></option>
29
+        <option value='alert-primary'><?php esc_html_e('Primary', 'invoicing'); ?></option>
30
+        <option value='alert-secondary'><?php esc_html_e('Secondary', 'invoicing'); ?></option>
31
+        <option value='alert-success'><?php esc_html_e('Success', 'invoicing'); ?></option>
32
+        <option value='alert-danger'><?php esc_html_e('Danger', 'invoicing'); ?></option>
33
+        <option value='alert-warning'><?php esc_html_e('Warning', 'invoicing'); ?></option>
34
+        <option value='alert-info'><?php esc_html_e('Info', 'invoicing'); ?></option>
35
+        <option value='alert-light'><?php esc_html_e('Light', 'invoicing'); ?></option>
36
+        <option value='alert-dark'><?php esc_html_e('Dark', 'invoicing'); ?></option>
37
+        <option value='alert-link'><?php esc_html_e('Link', 'invoicing'); ?></option>
38 38
     </select>
39 39
 </div>
Please login to merge, or discard this patch.
templates/payment-forms/elements/price_input.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,30 +7,30 @@
 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
 // Set the currency position.
13 13
 $position = wpinv_currency_position();
14 14
 
15
-if ( $position == 'left_space' ) {
15
+if ($position == 'left_space') {
16 16
     $position = 'left';
17 17
 }
18 18
 
19
-if ( $position == 'right_space' ) {
19
+if ($position == 'right_space') {
20 20
     $position = 'right';
21 21
 }
22 22
 
23 23
 echo aui()->input(
24 24
     array(
25
-        'name'              => esc_attr( $id ),
26
-        'id'                => esc_attr( $id ) . uniqid( '_' ),
27
-        'placeholder'       => empty( $placeholder ) ? wpinv_format_amount(0) : wpinv_format_amount( $placeholder ),
28
-        'value'             => empty( $value ) ? wpinv_format_amount(0) : wpinv_format_amount( $value ),
29
-        'label'             => empty( $label ) ? '' : wp_kses_post( $label ),
25
+        'name'              => esc_attr($id),
26
+        'id'                => esc_attr($id) . uniqid('_'),
27
+        'placeholder'       => empty($placeholder) ? wpinv_format_amount(0) : wpinv_format_amount($placeholder),
28
+        'value'             => empty($value) ? wpinv_format_amount(0) : wpinv_format_amount($value),
29
+        'label'             => empty($label) ? '' : wp_kses_post($label),
30 30
         'label_type'        => 'vertical',
31
-        'help_text'         => empty( $description ) ? '' : wp_kses_post( $description ),
32
-        'input_group_right' => $position == 'right' ? wpinv_currency_symbol( $form->get_currency() ) : '',
33
-        'input_group_left'  => $position == 'left' ? wpinv_currency_symbol( $form->get_currency() ) : '',
31
+        'help_text'         => empty($description) ? '' : wp_kses_post($description),
32
+        'input_group_right' => $position == 'right' ? wpinv_currency_symbol($form->get_currency()) : '',
33
+        'input_group_left'  => $position == 'left' ? wpinv_currency_symbol($form->get_currency()) : '',
34 34
         'class'             => 'getpaid-refresh-on-change',
35 35
     )
36 36
 );
Please login to merge, or discard this patch.
includes/admin/class-wpinv-subscriptions-list-table.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
  * Displays a list of all subscriptions rules
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) exit;
6
+if (!defined('ABSPATH')) exit;
7 7
 
8
-if ( ! class_exists( 'WP_List_Table' ) ) {
8
+if (!class_exists('WP_List_Table')) {
9 9
 	include_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
10 10
 }
11 11
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 		$this->prepare_query();
80 80
 
81
-		$this->base_url = remove_query_arg( 'status' );
81
+		$this->base_url = remove_query_arg('status');
82 82
 
83 83
 	}
84 84
 
@@ -91,21 +91,21 @@  discard block
 block discarded – undo
91 91
 		$query = array(
92 92
 			'number'  => $this->per_page,
93 93
 			'paged'   => $this->get_paged(),
94
-			'status'  => ( isset( $_GET['status'] ) && array_key_exists( $_GET['status'], getpaid_get_subscription_statuses() ) ) ? $_GET['status'] : 'all',
95
-			'orderby' => ( isset( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'id',
96
-			'order'   => ( isset( $_GET['order'] ) ) ? $_GET['order'] : 'DESC',
94
+			'status'  => (isset($_GET['status']) && array_key_exists($_GET['status'], getpaid_get_subscription_statuses())) ? $_GET['status'] : 'all',
95
+			'orderby' => (isset($_GET['orderby'])) ? $_GET['orderby'] : 'id',
96
+			'order'   => (isset($_GET['order'])) ? $_GET['order'] : 'DESC',
97 97
 		);
98 98
 
99 99
 		// Prepare class properties.
100
-		$this->query               = new GetPaid_Subscriptions_Query( $query );
100
+		$this->query               = new GetPaid_Subscriptions_Query($query);
101 101
 		$this->total_count         = $this->query->get_total();
102 102
 		$this->current_total_count = $this->query->get_total();
103 103
 		$this->items               = $this->query->get_results();
104
-		$this->status_counts       = getpaid_get_subscription_status_counts( $query );
104
+		$this->status_counts       = getpaid_get_subscription_status_counts($query);
105 105
 
106
-		if ( 'all' != $query['status'] ) {
107
-			unset( $query['status'] );
108
-			$this->total_count   = getpaid_get_subscriptions( $query, 'count' );
106
+		if ('all' != $query['status']) {
107
+			unset($query['status']);
108
+			$this->total_count = getpaid_get_subscriptions($query, 'count');
109 109
 		}
110 110
 
111 111
 	}
@@ -122,26 +122,26 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function get_views() {
124 124
 
125
-		$current  = isset( $_GET['status'] ) ? $_GET['status'] : 'all';
125
+		$current  = isset($_GET['status']) ? $_GET['status'] : 'all';
126 126
 		$views    = array(
127 127
 
128 128
 			'all' => sprintf(
129 129
 				'<a href="%s" %s>%s&nbsp;<span class="count">(%d)</span></a>',
130
-				esc_url( add_query_arg( 'status', false, $this->base_url ) ),
130
+				esc_url(add_query_arg('status', false, $this->base_url)),
131 131
 				$current === 'all' ? ' class="current"' : '',
132
-				__('All','invoicing' ),
132
+				__('All', 'invoicing'),
133 133
 				$this->total_count
134 134
 			)
135 135
 
136 136
 		);
137 137
 
138
-		foreach ( array_filter( $this->status_counts ) as $status => $count ) {
138
+		foreach (array_filter($this->status_counts) as $status => $count) {
139 139
 
140
-			$views[ $status ] = sprintf(
140
+			$views[$status] = sprintf(
141 141
 				'<a href="%s" %s>%s&nbsp;<span class="count">(%d)</span></a>',
142
-				esc_url( add_query_arg( 'status', urlencode( $status ), $this->base_url ) ),
142
+				esc_url(add_query_arg('status', urlencode($status), $this->base_url)),
143 143
 				$current === $status ? ' class="current"' : '',
144
-				sanitize_text_field( getpaid_get_subscription_status_label( $status ) ),
144
+				sanitize_text_field(getpaid_get_subscription_status_label($status)),
145 145
 				$count
146 146
 			);
147 147
 
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 * @since       1.0.0
159 159
 	 * @return      string
160 160
 	 */
161
-	public function column_default( $item, $column_name ) {
162
-		return apply_filters( "getpaid_subscriptions_table_column_$column_name", $item->$column_name );
161
+	public function column_default($item, $column_name) {
162
+		return apply_filters("getpaid_subscriptions_table_column_$column_name", $item->$column_name);
163 163
 	}
164 164
 
165 165
 	/**
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 * @param WPInv_Subscription $item
169 169
 	 * @return string
170 170
 	 */
171
-	public function column_cb( $item ) {
172
-		return sprintf( '<input type="checkbox" name="id[]" value="%s" />', esc_html( $item->get_id() ) );
171
+	public function column_cb($item) {
172
+		return sprintf('<input type="checkbox" name="id[]" value="%s" />', esc_html($item->get_id()));
173 173
 	}
174 174
 
175 175
 	/**
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @since       1.0.0
180 180
 	 * @return      string
181 181
 	 */
182
-	public function column_status( $item ) {
182
+	public function column_status($item) {
183 183
 		return $item->get_status_label_html();
184 184
 	}
185 185
 
@@ -190,46 +190,46 @@  discard block
 block discarded – undo
190 190
 	 * @since       1.0.0
191 191
 	 * @return      string
192 192
 	 */
193
-	public function column_subscription( $item ) {
193
+	public function column_subscription($item) {
194 194
 
195
-		$username = __( '(Missing User)', 'invoicing' );
195
+		$username = __('(Missing User)', 'invoicing');
196 196
 
197
-		$user = get_userdata( $item->get_customer_id() );
198
-		if ( $user ) {
197
+		$user = get_userdata($item->get_customer_id());
198
+		if ($user) {
199 199
 
200 200
 			$username = sprintf(
201 201
 				'<a href="user-edit.php?user_id=%s">%s</a>',
202
-				absint( $user->ID ),
203
-				! empty( $user->display_name ) ? sanitize_text_field( $user->display_name ) : sanitize_email( $user->user_email )
202
+				absint($user->ID),
203
+				!empty($user->display_name) ? sanitize_text_field($user->display_name) : sanitize_email($user->user_email)
204 204
 			);
205 205
 
206 206
 		}
207 207
 
208 208
 		// translators: $1: is opening link, $2: is subscription id number, $3: is closing link tag, $4: is user's name
209 209
 		$column_content = sprintf(
210
-			_x( '%1$s#%2$s%3$s for %4$s', 'Subscription title on admin table. (e.g.: #211 for John Doe)', 'invoicing' ),
211
-			'<a href="' . esc_url( admin_url( 'admin.php?page=wpinv-subscriptions&id=' . absint( $item->get_id() ) ) ) . '">',
212
-			'<strong>' . esc_attr( $item->get_id() ) . '</strong>', '</a>',
210
+			_x('%1$s#%2$s%3$s for %4$s', 'Subscription title on admin table. (e.g.: #211 for John Doe)', 'invoicing'),
211
+			'<a href="' . esc_url(admin_url('admin.php?page=wpinv-subscriptions&id=' . absint($item->get_id()))) . '">',
212
+			'<strong>' . esc_attr($item->get_id()) . '</strong>', '</a>',
213 213
 			$username
214 214
 		);
215 215
 
216 216
 		$row_actions = array();
217 217
 
218 218
 		// View subscription.
219
-		$view_url    = esc_url( add_query_arg( 'id', $item->get_id(), admin_url( 'admin.php?page=wpinv-subscriptions' ) ));
220
-		$row_actions['view'] = '<a href="' . $view_url . '">' . __( 'View Subscription', 'invoicing' ) . '</a>';
219
+		$view_url    = esc_url(add_query_arg('id', $item->get_id(), admin_url('admin.php?page=wpinv-subscriptions')));
220
+		$row_actions['view'] = '<a href="' . $view_url . '">' . __('View Subscription', 'invoicing') . '</a>';
221 221
 
222 222
 		// View invoice.
223
-		$invoice = get_post( $item->get_parent_invoice_id() );
223
+		$invoice = get_post($item->get_parent_invoice_id());
224 224
 
225
-		if ( ! empty( $invoice ) ) {
226
-			$view_url    = get_edit_post_link( $invoice );
227
-			$row_actions['invoice'] = '<a href="' . $view_url . '">' . __( 'View Invoice', 'invoicing' ) . '</a>';
225
+		if (!empty($invoice)) {
226
+			$view_url = get_edit_post_link($invoice);
227
+			$row_actions['invoice'] = '<a href="' . $view_url . '">' . __('View Invoice', 'invoicing') . '</a>';
228 228
 		}
229 229
 
230
-		$row_actions = $this->row_actions( apply_filters( 'getpaid_subscription_table_row_actions', $row_actions, $item ) );
230
+		$row_actions = $this->row_actions(apply_filters('getpaid_subscription_table_row_actions', $row_actions, $item));
231 231
 
232
-		return "<strong>$column_content</strong>" . $this->column_amount( $item ) . $row_actions;
232
+		return "<strong>$column_content</strong>" . $this->column_amount($item) . $row_actions;
233 233
 	}
234 234
 
235 235
 	/**
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 	 * @since       1.0.0
240 240
 	 * @return      string
241 241
 	 */
242
-	public function column_renewal_date( $item ) {
243
-		return getpaid_format_date_value( $item->get_expiration() );
242
+	public function column_renewal_date($item) {
243
+		return getpaid_format_date_value($item->get_expiration());
244 244
 	}
245 245
 
246 246
 	/**
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 * @since       1.0.0
251 251
 	 * @return      string
252 252
 	 */
253
-	public function column_start_date( $item ) {
254
-		return getpaid_format_date_value( $item->get_date_created() );
253
+	public function column_start_date($item) {
254
+		return getpaid_format_date_value($item->get_date_created());
255 255
 	}
256 256
 
257 257
 	/**
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
 	 * @since       1.0.19
262 262
 	 * @return      string
263 263
 	 */
264
-	public function column_amount( $item ) {
265
-		$amount = getpaid_get_formatted_subscription_amount( $item );
264
+	public function column_amount($item) {
265
+		$amount = getpaid_get_formatted_subscription_amount($item);
266 266
 		return "<span class='text-muted form-text mt-2 mb-2'>$amount</span>";
267 267
 	}
268 268
 
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
 	 * @since       1.0.0
274 274
 	 * @return      string
275 275
 	 */
276
-	public function column_renewals( $item ) {
276
+	public function column_renewals($item) {
277 277
 		$max_bills = $item->get_bill_times();
278
-		return $item->get_times_billed() . ' / ' . ( empty( $max_bills ) ? "&infin;" : $max_bills );
278
+		return $item->get_times_billed() . ' / ' . (empty($max_bills) ? "&infin;" : $max_bills);
279 279
 	}
280 280
 
281 281
 	/**
@@ -285,16 +285,16 @@  discard block
 block discarded – undo
285 285
 	 * @since       1.0.0
286 286
 	 * @return      string
287 287
 	 */
288
-	public function column_item( $item ) {
289
-		$_item = get_post( $item->get_product_id() );
288
+	public function column_item($item) {
289
+		$_item = get_post($item->get_product_id());
290 290
 
291
-		if ( ! empty( $_item ) ) {
292
-			$link = get_edit_post_link( $_item );
293
-			$link = esc_url( $link );
294
-			$name = esc_html( get_the_title( $_item ) );
291
+		if (!empty($_item)) {
292
+			$link = get_edit_post_link($_item);
293
+			$link = esc_url($link);
294
+			$name = esc_html(get_the_title($_item));
295 295
 			return "<a href='$link'>$name</a>";
296 296
 		} else {
297
-			return sprintf( __( 'Item #%s', 'invoicing' ), $item->get_product_id() );
297
+			return sprintf(__('Item #%s', 'invoicing'), $item->get_product_id());
298 298
 		}
299 299
 
300 300
 	}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	 * @return      int
306 306
 	 */
307 307
 	public function get_paged() {
308
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
308
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
309 309
 	}
310 310
 
311 311
 	/**
@@ -318,13 +318,13 @@  discard block
 block discarded – undo
318 318
 		$hidden   = array();
319 319
 		$sortable = $this->get_sortable_columns();
320 320
 
321
-		$this->_column_headers = array( $columns, $hidden, $sortable );
321
+		$this->_column_headers = array($columns, $hidden, $sortable);
322 322
 
323 323
 		$this->set_pagination_args(
324 324
 			array(
325 325
 			'total_items' => $this->current_total_count,
326 326
 			'per_page'    => $this->per_page,
327
-			'total_pages' => ceil( $this->current_total_count / $this->per_page )
327
+			'total_pages' => ceil($this->current_total_count / $this->per_page)
328 328
 			)
329 329
 		);
330 330
 	}
@@ -334,18 +334,18 @@  discard block
 block discarded – undo
334 334
 	 *
335 335
 	 * @return array
336 336
 	 */
337
-	public function get_columns(){
337
+	public function get_columns() {
338 338
 		$columns = array(
339 339
 			'cb'                => '<input type="checkbox" />',
340
-			'subscription'      => __( 'Subscription', 'invoicing' ),
341
-			'start_date'        => __( 'Start Date', 'invoicing' ),
342
-			'renewal_date'      => __( 'Next Payment', 'invoicing' ),
343
-			'renewals'          => __( 'Payments', 'invoicing' ),
344
-			'item'              => __( 'Item', 'invoicing' ),
345
-			'status'            => __( 'Status', 'invoicing' ),
340
+			'subscription'      => __('Subscription', 'invoicing'),
341
+			'start_date'        => __('Start Date', 'invoicing'),
342
+			'renewal_date'      => __('Next Payment', 'invoicing'),
343
+			'renewals'          => __('Payments', 'invoicing'),
344
+			'item'              => __('Item', 'invoicing'),
345
+			'status'            => __('Status', 'invoicing'),
346 346
 		);
347 347
 
348
-		return apply_filters( 'manage_getpaid_subscriptions_table_columns', $columns );
348
+		return apply_filters('manage_getpaid_subscriptions_table_columns', $columns);
349 349
 	}
350 350
 
351 351
 	/**
@@ -355,15 +355,15 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	public function get_sortable_columns() {
357 357
 		$sortable = array(
358
-			'subscription' => array( 'id', true ),
359
-			'start_date'   => array( 'created', true ),
360
-			'renewal_date' => array( 'expiration', true ),
361
-			'renewals'     => array( 'bill_times', true ),
362
-			'item'         => array( 'product_id', true ),
363
-			'status'       => array( 'status', true ),
358
+			'subscription' => array('id', true),
359
+			'start_date'   => array('created', true),
360
+			'renewal_date' => array('expiration', true),
361
+			'renewals'     => array('bill_times', true),
362
+			'item'         => array('product_id', true),
363
+			'status'       => array('status', true),
364 364
 		);
365 365
 
366
-		return apply_filters( 'manage_getpaid_subscriptions_sortable_table_columns', $sortable );
366
+		return apply_filters('manage_getpaid_subscriptions_sortable_table_columns', $sortable);
367 367
 	}
368 368
 
369 369
 	/**
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 * @return bool
373 373
 	 */
374 374
 	public function has_items() {
375
-		return ! empty( $this->current_total_count );
375
+		return !empty($this->current_total_count);
376 376
 	}
377 377
 
378 378
 	/**
Please login to merge, or discard this patch.