Passed
Push — master ( 70e9e5...4d2757 )
by Brian
05:23
created
templates/payment-forms/elements/items.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-if ( empty( $form->get_items() ) ) {
12
+if (empty($form->get_items())) {
13 13
     return;
14 14
 }
15 15
 
16
-if ( ! empty( $GLOBALS['getpaid_force_checkbox'] ) ) {
16
+if (!empty($GLOBALS['getpaid_force_checkbox'])) {
17 17
     $items_type = 'checkbox';
18 18
 }
19 19
 
20
-if ( empty( $items_type ) ) {
20
+if (empty($items_type)) {
21 21
     $items_type = 'total';
22 22
 }
23 23
 
24
-switch( $items_type ) {
24
+switch ($items_type) {
25 25
     case 'radio':
26
-        wpinv_get_template( 'payment-forms/variations/radio.php', compact( 'form', 'items_type' ) );
26
+        wpinv_get_template('payment-forms/variations/radio.php', compact('form', 'items_type'));
27 27
         break;
28 28
     case 'checkbox':
29
-        wpinv_get_template( 'payment-forms/variations/checkbox.php', compact( 'form', 'items_type' ) );
29
+        wpinv_get_template('payment-forms/variations/checkbox.php', compact('form', 'items_type'));
30 30
         break;
31 31
     case 'select':
32
-        wpinv_get_template( 'payment-forms/variations/select.php', compact( 'form', 'items_type' ) );
32
+        wpinv_get_template('payment-forms/variations/select.php', compact('form', 'items_type'));
33 33
         break;
34 34
 }
35 35
 
36 36
 // Display the cart totals.
37
-if ( ! empty( $hide_cart ) ) {
37
+if (!empty($hide_cart)) {
38 38
     echo '<div class="d-none">';
39 39
 }
40 40
 
41 41
 // Display the cart totals.
42
-wpinv_get_template( 'payment-forms/cart.php', compact( 'form', 'items_type' ) );
42
+wpinv_get_template('payment-forms/cart.php', compact('form', 'items_type'));
43 43
 
44
-if ( ! empty( $hide_cart ) ) {
44
+if (!empty($hide_cart)) {
45 45
     echo '</div>';
46 46
 }
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-address.php 1 patch
Spacing   +100 added lines, -100 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,14 +21,14 @@  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 );
28
-        $customer = $invoice->exists() ? $invoice->get_user_id( 'edit' ) : get_current_user_id();
29
-        $customer = new WP_User( $customer );
30
-        $display  = sprintf( _x( '%1$s (%2$s)', 'user dropdown', 'invoicing' ), $customer->display_name, $customer->user_email );
31
-        wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' );
27
+        $invoice  = new WPInv_Invoice($post);
28
+        $customer = $invoice->exists() ? $invoice->get_user_id('edit') : get_current_user_id();
29
+        $customer = new WP_User($customer);
30
+        $display  = sprintf(_x('%1$s (%2$s)', 'user dropdown', 'invoicing'), $customer->display_name, $customer->user_email);
31
+        wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce');
32 32
 
33 33
         ?>
34 34
 
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
                         <div class="col-12 col-sm-6">
44 44
                             <div id="getpaid-invoice-user-id-wrapper" class="form-group">
45 45
                                 <div>
46
-                                    <label for="post_author_override"><?php _e( 'Customer', 'invoicing' );?></label>
46
+                                    <label for="post_author_override"><?php _e('Customer', 'invoicing'); ?></label>
47 47
                                 </div>
48 48
                                 <div>
49
-                                    <select name="post_author_override" id="wpinv_post_author_override" class="getpaid-customer-search form-control regular-text" data-placeholder="<?php esc_attr_e( 'Search for a customer by email or name', 'invoicing' ); ?>">
50
-                                        <option selected="selected" value="<?php echo (int) $customer->ID; ?>"><?php echo esc_html( $display ); ?> </option>)
49
+                                    <select name="post_author_override" id="wpinv_post_author_override" class="getpaid-customer-search form-control regular-text" data-placeholder="<?php esc_attr_e('Search for a customer by email or name', 'invoicing'); ?>">
50
+                                        <option selected="selected" value="<?php echo (int) $customer->ID; ?>"><?php echo esc_html($display); ?> </option>)
51 51
                                     </select>
52 52
                                 </div>
53 53
                             </div>
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                                             'type'        => 'text',
61 61
                                             'id'          => 'getpaid-invoice-new-user-email',
62 62
                                             'name'        => 'wpinv_email',
63
-                                            'label'       => __( 'Email', 'invoicing' ) . '<span class="required">*</span>',
63
+                                            'label'       => __('Email', 'invoicing') . '<span class="required">*</span>',
64 64
                                             'label_type'  => 'vertical',
65 65
                                             'placeholder' => '[email protected]',
66 66
                                             'class'       => 'form-control-sm',
@@ -70,18 +70,18 @@  discard block
 block discarded – undo
70 70
                             </div>
71 71
                         </div>
72 72
                         <div class="col-12 col-sm-6 form-group mt-sm-4">
73
-                            <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?>
73
+                            <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?>
74 74
                                 <a id="getpaid-invoice-fill-user-details" class="button button-small button-secondary" href="javascript:void(0)">
75 75
                                     <i aria-hidden="true" class="fa fa-refresh"></i>
76
-                                    <?php _e( 'Fill User Details', 'invoicing' );?>
76
+                                    <?php _e('Fill User Details', 'invoicing'); ?>
77 77
                                 </a>
78 78
                                 <a id="getpaid-invoice-create-new-user-button" class="button button-small button-secondary" href="javascript:void(0)">
79 79
                                     <i aria-hidden="true" class="fa fa-plus"></i>
80
-                                    <?php _e( 'Add New User', 'invoicing' );?>
80
+                                    <?php _e('Add New User', 'invoicing'); ?>
81 81
                                 </a>
82 82
                                 <a id="getpaid-invoice-cancel-create-new-user" class="button button-small button-secondary d-none" href="javascript:void(0)">
83 83
                                     <i aria-hidden="true" class="fa fa-close"></i>
84
-                                    <?php _e( 'Cancel', 'invoicing' );?>
84
+                                    <?php _e('Cancel', 'invoicing'); ?>
85 85
                                 </a>
86 86
                             <?php endif; ?>
87 87
                         </div>
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
                                         'type'        => 'text',
95 95
                                         'id'          => 'wpinv_first_name',
96 96
                                         'name'        => 'wpinv_first_name',
97
-                                        'label'       => __( 'First Name', 'invoicing' ),
97
+                                        'label'       => __('First Name', 'invoicing'),
98 98
                                         'label_type'  => 'vertical',
99 99
                                         'placeholder' => '',
100 100
                                         'class'       => 'form-control-sm',
101
-                                        'value'       => $invoice->get_first_name( 'edit' ),
101
+                                        'value'       => $invoice->get_first_name('edit'),
102 102
                                     )
103 103
                                 );
104 104
                             ?>
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
                                         'type'        => 'text',
111 111
                                         'id'          => 'wpinv_last_name',
112 112
                                         'name'        => 'wpinv_last_name',
113
-                                        'label'       => __( 'Last Name', 'invoicing' ),
113
+                                        'label'       => __('Last Name', 'invoicing'),
114 114
                                         'label_type'  => 'vertical',
115 115
                                         'placeholder' => '',
116 116
                                         'class'       => 'form-control-sm',
117
-                                        'value'       => $invoice->get_last_name( 'edit' ),
117
+                                        'value'       => $invoice->get_last_name('edit'),
118 118
                                     )
119 119
                                 );
120 120
                             ?>
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
                                         'type'        => 'text',
130 130
                                         'id'          => 'wpinv_company',
131 131
                                         'name'        => 'wpinv_company',
132
-                                        'label'       => __( 'Company', 'invoicing' ),
132
+                                        'label'       => __('Company', 'invoicing'),
133 133
                                         'label_type'  => 'vertical',
134 134
                                         'placeholder' => '',
135 135
                                         'class'       => 'form-control-sm',
136
-                                        'value'       => $invoice->get_company( 'edit' ),
136
+                                        'value'       => $invoice->get_company('edit'),
137 137
                                     )
138 138
                                 );
139 139
                             ?>
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
                                         'type'        => 'text',
146 146
                                         'id'          => 'wpinv_vat_number',
147 147
                                         'name'        => 'wpinv_vat_number',
148
-                                        'label'       => __( 'Vat Number', 'invoicing' ),
148
+                                        'label'       => __('Vat Number', 'invoicing'),
149 149
                                         'label_type'  => 'vertical',
150 150
                                         'placeholder' => '',
151 151
                                         'class'       => 'form-control-sm getpaid-recalculate-prices-on-change',
152
-                                        'value'       => $invoice->get_vat_number( 'edit' ),
152
+                                        'value'       => $invoice->get_vat_number('edit'),
153 153
                                     )
154 154
                                 );
155 155
                             ?>
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
                                         'type'        => 'text',
165 165
                                         'id'          => 'wpinv_address',
166 166
                                         'name'        => 'wpinv_address',
167
-                                        'label'       => __( 'Address', 'invoicing' ),
167
+                                        'label'       => __('Address', 'invoicing'),
168 168
                                         'label_type'  => 'vertical',
169 169
                                         'placeholder' => '',
170 170
                                         'class'       => 'form-control-sm',
171
-                                        'value'       => $invoice->get_address( 'edit' ),
171
+                                        'value'       => $invoice->get_address('edit'),
172 172
                                     )
173 173
                                 );
174 174
                             ?>
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
                                         'type'        => 'text',
181 181
                                         'id'          => 'wpinv_city',
182 182
                                         'name'        => 'wpinv_city',
183
-                                        'label'       => __( 'City', 'invoicing' ),
183
+                                        'label'       => __('City', 'invoicing'),
184 184
                                         'label_type'  => 'vertical',
185 185
                                         'placeholder' => '',
186 186
                                         'class'       => 'form-control-sm',
187
-                                        'value'       => $invoice->get_city( 'edit' ),
187
+                                        'value'       => $invoice->get_city('edit'),
188 188
                                     )
189 189
                                 );
190 190
                             ?>
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
                                     array(
199 199
                                         'id'          => 'wpinv_country',
200 200
                                         'name'        => 'wpinv_country',
201
-                                        'label'       => __( 'Country', 'invoicing' ),
201
+                                        'label'       => __('Country', 'invoicing'),
202 202
                                         'label_type'  => 'vertical',
203
-                                        'placeholder' => __( 'Choose a country', 'invoicing' ),
203
+                                        'placeholder' => __('Choose a country', 'invoicing'),
204 204
                                         'class'       => 'form-control-sm getpaid-recalculate-prices-on-change',
205
-                                        'value'       => $invoice->get_country( 'edit' ),
205
+                                        'value'       => $invoice->get_country('edit'),
206 206
                                         'options'     => wpinv_get_country_list(),
207 207
                                         'data-allow-clear' => 'false',
208 208
                                         'select2'          => true,
@@ -213,20 +213,20 @@  discard block
 block discarded – undo
213 213
                         <div class="col-12 col-sm-6">
214 214
                             <?php
215 215
 
216
-                                $states = wpinv_get_country_states( $invoice->get_country( 'edit' ) );
216
+                                $states = wpinv_get_country_states($invoice->get_country('edit'));
217 217
 
218
-                                if ( empty( $states ) ) {
218
+                                if (empty($states)) {
219 219
 
220 220
                                     echo aui()->input(
221 221
                                         array(
222 222
                                             'type'        => 'text',
223 223
                                             'id'          => 'wpinv_state',
224 224
                                             'name'        => 'wpinv_state',
225
-                                            'label'       => __( 'State', 'invoicing' ),
225
+                                            'label'       => __('State', 'invoicing'),
226 226
                                             'label_type'  => 'vertical',
227 227
                                             'placeholder' => '',
228 228
                                             'class'       => 'form-control-sm',
229
-                                            'value'       => $invoice->get_state( 'edit' ),
229
+                                            'value'       => $invoice->get_state('edit'),
230 230
                                         )
231 231
                                     );
232 232
 
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
                                         array(
237 237
                                             'id'          => 'wpinv_state',
238 238
                                             'name'        => 'wpinv_state',
239
-                                            'label'       => __( 'State', 'invoicing' ),
239
+                                            'label'       => __('State', 'invoicing'),
240 240
                                             'label_type'  => 'vertical',
241
-                                            'placeholder' => __( 'Select a state', 'invoicing' ),
241
+                                            'placeholder' => __('Select a state', 'invoicing'),
242 242
                                             'class'       => 'form-control-sm',
243
-                                            'value'       => $invoice->get_state( 'edit' ),
243
+                                            'value'       => $invoice->get_state('edit'),
244 244
                                             'options'     => $states,
245 245
                                             'data-allow-clear' => 'false',
246 246
                                             'select2'          => true,
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
                                         'type'        => 'text',
262 262
                                         'id'          => 'wpinv_zip',
263 263
                                         'name'        => 'wpinv_zip',
264
-                                        'label'       => __( 'Zip / Postal Code', 'invoicing' ),
264
+                                        'label'       => __('Zip / Postal Code', 'invoicing'),
265 265
                                         'label_type'  => 'vertical',
266 266
                                         'placeholder' => '',
267 267
                                         'class'       => 'form-control-sm',
268
-                                        'value'       => $invoice->get_zip( 'edit' ),
268
+                                        'value'       => $invoice->get_zip('edit'),
269 269
                                     )
270 270
                                 );
271 271
                             ?>
@@ -277,19 +277,19 @@  discard block
 block discarded – undo
277 277
                                         'type'        => 'text',
278 278
                                         'id'          => 'wpinv_phone',
279 279
                                         'name'        => 'wpinv_phone',
280
-                                        'label'       => __( 'Phone', 'invoicing' ),
280
+                                        'label'       => __('Phone', 'invoicing'),
281 281
                                         'label_type'  => 'vertical',
282 282
                                         'placeholder' => '',
283 283
                                         'class'       => 'form-control-sm',
284
-                                        'value'       => $invoice->get_phone( 'edit' ),
284
+                                        'value'       => $invoice->get_phone('edit'),
285 285
                                     )
286 286
                                 );
287 287
                             ?>
288 288
                         </div>
289 289
                     </div>
290 290
 
291
-                    <?php if ( ! apply_filters( 'getpaid_use_new_invoice_items_metabox', false ) ) : ?>
292
-                        <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?>
291
+                    <?php if (!apply_filters('getpaid_use_new_invoice_items_metabox', false)) : ?>
292
+                        <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?>
293 293
 
294 294
                         <div class="row">
295 295
                             <div class="col-12 col-sm-6">
@@ -298,14 +298,14 @@  discard block
 block discarded – undo
298 298
                                         array(
299 299
                                             'id'          => 'wpinv_template',
300 300
                                             'name'        => 'wpinv_template',
301
-                                            'label'       => __( 'Template', 'invoicing' ),
301
+                                            'label'       => __('Template', 'invoicing'),
302 302
                                             'label_type'  => 'vertical',
303
-                                            'placeholder' => __( 'Choose a template', 'invoicing' ),
303
+                                            'placeholder' => __('Choose a template', 'invoicing'),
304 304
                                             'class'       => 'form-control-sm',
305
-                                            'value'       => $invoice->get_template( 'edit' ),
305
+                                            'value'       => $invoice->get_template('edit'),
306 306
                                             'options'     => array(
307
-                                                'quantity' => __( 'Quantity', 'invoicing' ),
308
-                                                'hours'    => __( 'Hours', 'invoicing' ),
307
+                                                'quantity' => __('Quantity', 'invoicing'),
308
+                                                'hours'    => __('Hours', 'invoicing'),
309 309
                                                 //'amount'   => __( 'Amount Only', 'invoicing' ),
310 310
                                             ),
311 311
                                             'data-allow-clear' => 'false',
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
                                         array(
323 323
                                             'id'          => 'wpinv_currency',
324 324
                                             'name'        => 'wpinv_currency',
325
-                                            'label'       => __( 'Currency', 'invoicing' ),
325
+                                            'label'       => __('Currency', 'invoicing'),
326 326
                                             'label_type'  => 'vertical',
327
-                                            'placeholder' => __( 'Select Invoice Currency', 'invoicing' ),
327
+                                            'placeholder' => __('Select Invoice Currency', 'invoicing'),
328 328
                                             'class'       => 'form-control-sm getpaid-recalculate-prices-on-change',
329
-                                            'value'       => $invoice->get_currency( 'edit' ),
329
+                                            'value'       => $invoice->get_currency('edit'),
330 330
                                             'required'    => false,
331 331
                                             'data-allow-clear' => 'false',
332 332
                                             'select2'          => true,
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
                             </div>
339 339
                         </div>
340 340
 
341
-                        <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?>
341
+                        <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?>
342 342
                     <?php endif; ?>
343 343
 
344 344
                     <div class="row">
@@ -349,18 +349,18 @@  discard block
 block discarded – undo
349 349
                                         'type'        => 'text',
350 350
                                         'id'          => 'wpinv_company_id',
351 351
                                         'name'        => 'wpinv_company_id',
352
-                                        'label'       => __( 'Company ID', 'invoicing' ),
352
+                                        'label'       => __('Company ID', 'invoicing'),
353 353
                                         'label_type'  => 'vertical',
354 354
                                         'placeholder' => '',
355 355
                                         'class'       => 'form-control-sm',
356
-                                        'value'       => $invoice->get_company_id( 'edit' ),
356
+                                        'value'       => $invoice->get_company_id('edit'),
357 357
                                     )
358 358
                                 );
359 359
                             ?>
360 360
                         </div>
361 361
                     </div>
362 362
 
363
-                    <?php do_action( 'getpaid_after_metabox_invoice_address', $invoice ); ?>
363
+                    <?php do_action('getpaid_after_metabox_invoice_address', $invoice); ?>
364 364
             </div>
365 365
         <?php
366 366
     }
@@ -370,51 +370,51 @@  discard block
 block discarded – undo
370 370
 	 *
371 371
 	 * @param int $post_id
372 372
 	 */
373
-	public static function save( $post_id ) {
373
+	public static function save($post_id) {
374 374
 
375 375
         // Prepare the invoice.
376
-        $invoice = new WPInv_Invoice( $post_id );
376
+        $invoice = new WPInv_Invoice($post_id);
377 377
 
378 378
         // Load new data.
379 379
         $invoice->set_props(
380 380
 			array(
381
-                'template'             => isset( $_POST['wpinv_template'] ) ? wpinv_clean( $_POST['wpinv_template'] ) : null,
382
-                'email_cc'             => isset( $_POST['wpinv_cc'] ) ? wpinv_clean( $_POST['wpinv_cc'] ) : null,
383
-                'disable_taxes'        => isset( $_POST['disable_taxes'] ),
384
-                'currency'             => isset( $_POST['wpinv_currency'] ) ? wpinv_clean( $_POST['wpinv_currency'] ) : null,
385
-                'gateway'              => ( $invoice->needs_payment() && isset( $_POST['wpinv_gateway'] ) ) ? wpinv_clean( $_POST['wpinv_gateway'] ) : null,
386
-                'address'              => isset( $_POST['wpinv_address'] ) ? wpinv_clean( $_POST['wpinv_address'] ) : null,
387
-                'vat_number'           => isset( $_POST['wpinv_vat_number'] ) ? wpinv_clean( $_POST['wpinv_vat_number'] ) : null,
388
-                'company'              => isset( $_POST['wpinv_company'] ) ? wpinv_clean( $_POST['wpinv_company'] ) : null,
389
-                'company_id'           => isset( $_POST['wpinv_company_id'] ) ? wpinv_clean( $_POST['wpinv_company_id'] ) : null,
390
-                'zip'                  => isset( $_POST['wpinv_zip'] ) ? wpinv_clean( $_POST['wpinv_zip'] ) : null,
391
-                'state'                => isset( $_POST['wpinv_state'] ) ? wpinv_clean( $_POST['wpinv_state'] ) : null,
392
-                'city'                 => isset( $_POST['wpinv_city'] ) ? wpinv_clean( $_POST['wpinv_city'] ) : null,
393
-                'country'              => isset( $_POST['wpinv_country'] ) ? wpinv_clean( $_POST['wpinv_country'] ) : null,
394
-                'phone'                => isset( $_POST['wpinv_phone'] ) ? wpinv_clean( $_POST['wpinv_phone'] ) : null,
395
-                'first_name'           => isset( $_POST['wpinv_first_name'] ) ? wpinv_clean( $_POST['wpinv_first_name'] ) : null,
396
-                'last_name'            => isset( $_POST['wpinv_last_name'] ) ? wpinv_clean( $_POST['wpinv_last_name'] ) : null,
397
-                'author'               => isset( $_POST['post_author_override'] ) ? wpinv_clean( $_POST['post_author_override'] ) : null,
398
-                'date_created'         => isset( $_POST['date_created'] ) ? wpinv_clean( $_POST['date_created'] ) : null,
399
-                'date_completed'       => isset( $_POST['wpinv_date_completed'] ) ? wpinv_clean( $_POST['wpinv_date_completed'] ) : null,
400
-                'due_date'             => isset( $_POST['wpinv_due_date'] ) ? wpinv_clean( $_POST['wpinv_due_date'] ) : null,
401
-                'number'               => isset( $_POST['wpinv_number'] ) ? wpinv_clean( $_POST['wpinv_number'] ) : null,
402
-                'status'               => isset( $_POST['wpinv_status'] ) ? wpinv_clean( $_POST['wpinv_status'] ) : null,
381
+                'template'             => isset($_POST['wpinv_template']) ? wpinv_clean($_POST['wpinv_template']) : null,
382
+                'email_cc'             => isset($_POST['wpinv_cc']) ? wpinv_clean($_POST['wpinv_cc']) : null,
383
+                'disable_taxes'        => isset($_POST['disable_taxes']),
384
+                'currency'             => isset($_POST['wpinv_currency']) ? wpinv_clean($_POST['wpinv_currency']) : null,
385
+                'gateway'              => ($invoice->needs_payment() && isset($_POST['wpinv_gateway'])) ? wpinv_clean($_POST['wpinv_gateway']) : null,
386
+                'address'              => isset($_POST['wpinv_address']) ? wpinv_clean($_POST['wpinv_address']) : null,
387
+                'vat_number'           => isset($_POST['wpinv_vat_number']) ? wpinv_clean($_POST['wpinv_vat_number']) : null,
388
+                'company'              => isset($_POST['wpinv_company']) ? wpinv_clean($_POST['wpinv_company']) : null,
389
+                'company_id'           => isset($_POST['wpinv_company_id']) ? wpinv_clean($_POST['wpinv_company_id']) : null,
390
+                'zip'                  => isset($_POST['wpinv_zip']) ? wpinv_clean($_POST['wpinv_zip']) : null,
391
+                'state'                => isset($_POST['wpinv_state']) ? wpinv_clean($_POST['wpinv_state']) : null,
392
+                'city'                 => isset($_POST['wpinv_city']) ? wpinv_clean($_POST['wpinv_city']) : null,
393
+                'country'              => isset($_POST['wpinv_country']) ? wpinv_clean($_POST['wpinv_country']) : null,
394
+                'phone'                => isset($_POST['wpinv_phone']) ? wpinv_clean($_POST['wpinv_phone']) : null,
395
+                'first_name'           => isset($_POST['wpinv_first_name']) ? wpinv_clean($_POST['wpinv_first_name']) : null,
396
+                'last_name'            => isset($_POST['wpinv_last_name']) ? wpinv_clean($_POST['wpinv_last_name']) : null,
397
+                'author'               => isset($_POST['post_author_override']) ? wpinv_clean($_POST['post_author_override']) : null,
398
+                'date_created'         => isset($_POST['date_created']) ? wpinv_clean($_POST['date_created']) : null,
399
+                'date_completed'       => isset($_POST['wpinv_date_completed']) ? wpinv_clean($_POST['wpinv_date_completed']) : null,
400
+                'due_date'             => isset($_POST['wpinv_due_date']) ? wpinv_clean($_POST['wpinv_due_date']) : null,
401
+                'number'               => isset($_POST['wpinv_number']) ? wpinv_clean($_POST['wpinv_number']) : null,
402
+                'status'               => isset($_POST['wpinv_status']) ? wpinv_clean($_POST['wpinv_status']) : null,
403 403
 			)
404 404
         );
405 405
 
406 406
         // Discount code.
407
-        if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
407
+        if (!$invoice->is_paid() && !$invoice->is_refunded()) {
408 408
 
409
-            if ( isset( $_POST['wpinv_discount_code'] ) ) {
410
-                $invoice->set_discount_code( wpinv_clean( $_POST['wpinv_discount_code'] ) );
409
+            if (isset($_POST['wpinv_discount_code'])) {
410
+                $invoice->set_discount_code(wpinv_clean($_POST['wpinv_discount_code']));
411 411
             }
412 412
 
413
-            $discount = new WPInv_Discount( $invoice->get_discount_code() );
414
-            if ( $discount->exists() ) {
415
-                $invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) );
413
+            $discount = new WPInv_Discount($invoice->get_discount_code());
414
+            if ($discount->exists()) {
415
+                $invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount));
416 416
             } else {
417
-                $invoice->remove_discount( 'discount_code' );
417
+                $invoice->remove_discount('discount_code');
418 418
             }
419 419
 
420 420
             // Recalculate totals.
@@ -423,17 +423,17 @@  discard block
 block discarded – undo
423 423
         }
424 424
 
425 425
         // If we're creating a new user...
426
-        if ( ! empty( $_POST['wpinv_new_user'] ) && is_email( stripslashes( $_POST['wpinv_email'] ) ) ) {
426
+        if (!empty($_POST['wpinv_new_user']) && is_email(stripslashes($_POST['wpinv_email']))) {
427 427
 
428 428
             // Attempt to create the user.
429
-            $user = wpinv_create_user( sanitize_email( stripslashes( $_POST['wpinv_email'] ) ) );
429
+            $user = wpinv_create_user(sanitize_email(stripslashes($_POST['wpinv_email'])));
430 430
 
431 431
 
432 432
             // If successful, update the invoice author.
433
-            if ( is_numeric( $user ) ) {
434
-                $invoice->set_author( $user );
433
+            if (is_numeric($user)) {
434
+                $invoice->set_author($user);
435 435
             } else {
436
-                wpinv_error_log( $user->get_error_message(), __( 'Invoice add new user', 'invoicing' ), __FILE__, __LINE__ );
436
+                wpinv_error_log($user->get_error_message(), __('Invoice add new user', 'invoicing'), __FILE__, __LINE__);
437 437
             }
438 438
         }
439 439
 
@@ -447,24 +447,24 @@  discard block
 block discarded – undo
447 447
         $GLOBALS['wpinv_skip_invoice_notification'] = false;
448 448
 
449 449
         // (Maybe) send new user notification.
450
-        $should_send_notification = wpinv_get_option( 'disable_new_user_emails' );
451
-        if ( ! empty( $user ) && is_numeric( $user ) && apply_filters( 'getpaid_send_new_user_notification', empty( $should_send_notification ) ) ) {
452
-            wp_send_new_user_notifications( $user, 'user' );
450
+        $should_send_notification = wpinv_get_option('disable_new_user_emails');
451
+        if (!empty($user) && is_numeric($user) && apply_filters('getpaid_send_new_user_notification', empty($should_send_notification))) {
452
+            wp_send_new_user_notifications($user, 'user');
453 453
         }
454 454
 
455
-        if ( ! empty( $_POST['send_to_customer'] ) && ! $invoice->is_draft() ) {
455
+        if (!empty($_POST['send_to_customer']) && !$invoice->is_draft()) {
456 456
 
457
-            $sent = getpaid()->get( 'invoice_emails' )->user_invoice( $invoice, true );
457
+            $sent = getpaid()->get('invoice_emails')->user_invoice($invoice, true);
458 458
 
459
-            if ( $sent ) {
460
-                getpaid_admin()->show_success( __( 'Invoice was successfully sent to the customer', 'invoicing' ) );
459
+            if ($sent) {
460
+                getpaid_admin()->show_success(__('Invoice was successfully sent to the customer', 'invoicing'));
461 461
             } else {
462
-                getpaid_admin()->show_error( __( 'Could not send the invoice to the customer', 'invoicing' ) );
462
+                getpaid_admin()->show_error(__('Could not send the invoice to the customer', 'invoicing'));
463 463
             }
464 464
 
465 465
         }
466 466
 
467 467
         // Fires after an invoice is saved.
468
-		do_action( 'wpinv_invoice_metabox_saved', $invoice );
468
+		do_action('wpinv_invoice_metabox_saved', $invoice);
469 469
 	}
470 470
 }
Please login to merge, or discard this patch.
admin/meta-boxes/class-getpaid-meta-box-invoice-shipping-address.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  *
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit; // Exit if accessed directly
11 11
 }
12 12
 
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @param WP_Post $post
22 22
 	 */
23
-	public static function output( $post ) {
23
+	public static function output($post) {
24 24
 
25 25
 		// Retrieve shipping address.
26
-		$shipping_address = get_post_meta( $post->ID, 'shipping_address', true );
26
+		$shipping_address = get_post_meta($post->ID, 'shipping_address', true);
27 27
 
28 28
 		// Abort if it is invalid.
29
-		if ( ! is_array( $shipping_address ) ) {
29
+		if (!is_array($shipping_address)) {
30 30
 			return;
31 31
 		}
32 32
 
@@ -34,16 +34,16 @@  discard block
 block discarded – undo
34 34
 
35 35
 		<div class="bsui">
36 36
 
37
-			<?php foreach ( getpaid_user_address_fields() as $key => $label ) : ?>
37
+			<?php foreach (getpaid_user_address_fields() as $key => $label) : ?>
38 38
 
39
-					<?php if ( ! empty( $shipping_address[ $key ] ) ) : ?>
39
+					<?php if (!empty($shipping_address[$key])) : ?>
40 40
 
41 41
 						<div class="form-group form-row">
42 42
 							<div class="col">
43
-								<span style="font-weight: 600"><?php echo esc_html( $label ); ?>:</span>
43
+								<span style="font-weight: 600"><?php echo esc_html($label); ?>:</span>
44 44
 							</div>
45 45
 							<div class="col">
46
-								<?php echo self::prepare_for_display( $shipping_address, $key ); ?>
46
+								<?php echo self::prepare_for_display($shipping_address, $key); ?>
47 47
 							</div>
48 48
 						</div>
49 49
 
@@ -64,21 +64,21 @@  discard block
 block discarded – undo
64 64
 	 * @param string $key
65 65
 	 * @return string
66 66
 	 */
67
-	public static function prepare_for_display( $address, $key ) {
67
+	public static function prepare_for_display($address, $key) {
68 68
 
69 69
 		// Prepare the value.
70
-		$value = $address[ $key ];
70
+		$value = $address[$key];
71 71
 
72
-		if ( $key == 'country' ) {
73
-			$value = wpinv_country_name( $value );
72
+		if ($key == 'country') {
73
+			$value = wpinv_country_name($value);
74 74
 		}
75 75
 
76
-		if ( $key == 'state' ) {
77
-			$country = isset( $address[ 'country' ] ) ? $address[ 'country' ] : wpinv_get_default_country();
78
-			$value = wpinv_state_name( $value, $country );
76
+		if ($key == 'state') {
77
+			$country = isset($address['country']) ? $address['country'] : wpinv_get_default_country();
78
+			$value = wpinv_state_name($value, $country);
79 79
 		}
80 80
 
81
-		return esc_html( $value );
81
+		return esc_html($value);
82 82
 
83 83
 	}
84 84
 
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-invoice-items.php 1 patch
Spacing   +155 added lines, -155 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
 
@@ -16,82 +16,82 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class GetPaid_Meta_Box_Invoice_Items {
18 18
 
19
-    public static function get_columns( $invoice ) {
19
+    public static function get_columns($invoice) {
20 20
         $use_taxes          = $invoice->is_taxable() && wpinv_use_taxes();
21 21
         $columns            = array(
22
-            'id'     => __( 'ID', 'invoicing' ),
23
-            'title'  => __( 'Item', 'invoicing' ),
22
+            'id'     => __('ID', 'invoicing'),
23
+            'title'  => __('Item', 'invoicing'),
24 24
             'price'  => sprintf(
25 25
                 '<span class="getpaid-hide-if-hours getpaid-hide-if-quantity">%s</span>
26 26
                 <span class="getpaid-hide-if-hours hide-if-amount">%s</span>
27 27
                 <span class="getpaid-hide-if-quantity hide-if-amount">%s</span>',
28
-                __( 'Amount', 'invoicing' ),
29
-                __( 'Price', 'invoicing' ),
30
-                __( 'Rate', 'invoicing' )
28
+                __('Amount', 'invoicing'),
29
+                __('Price', 'invoicing'),
30
+                __('Rate', 'invoicing')
31 31
             ),
32 32
             'qty'    => sprintf(
33 33
                 '<span class="getpaid-hide-if-hours">%s</span><span class="getpaid-hide-if-quantity">%s</span>',
34
-                __( 'Quantity', 'invoicing' ),
35
-                __( 'Hours', 'invoicing' )
34
+                __('Quantity', 'invoicing'),
35
+                __('Hours', 'invoicing')
36 36
             ),
37
-            'total'  => __( 'Total', 'invoicing' ),
38
-            'tax'    => __( 'Tax (%)', 'invoicing' ),
37
+            'total'  => __('Total', 'invoicing'),
38
+            'tax'    => __('Tax (%)', 'invoicing'),
39 39
             'action' => '',
40 40
         );
41 41
 
42
-        if ( ! $use_taxes ) {
43
-            unset( $columns['tax'] );
42
+        if (!$use_taxes) {
43
+            unset($columns['tax']);
44 44
         }
45 45
 
46 46
         return $columns;
47 47
     }
48 48
 
49
-    public static function output( $post, $invoice = false ) {
49
+    public static function output($post, $invoice = false) {
50 50
 
51
-        if ( apply_filters( 'getpaid_use_new_invoice_items_metabox', false ) ) {
52
-            return self::output2( $post );
51
+        if (apply_filters('getpaid_use_new_invoice_items_metabox', false)) {
52
+            return self::output2($post);
53 53
         }
54 54
 
55
-        $post_id            = !empty( $post->ID ) ? $post->ID : 0;
56
-        $invoice            = $invoice instanceof WPInv_Invoice ? $invoice : new WPInv_Invoice( $post_id );
55
+        $post_id            = !empty($post->ID) ? $post->ID : 0;
56
+        $invoice            = $invoice instanceof WPInv_Invoice ? $invoice : new WPInv_Invoice($post_id);
57 57
         $use_taxes          = $invoice->is_taxable() && wpinv_use_taxes();
58
-        $item_types         = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post );
59
-        $columns            = self::get_columns( $invoice );
60
-        $cols               = count( $columns );
58
+        $item_types         = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post);
59
+        $columns            = self::get_columns($invoice);
60
+        $cols               = count($columns);
61 61
         $class              = '';
62 62
 
63
-        unset( $item_types['adv'] );
64
-        unset( $item_types['package'] );
63
+        unset($item_types['adv']);
64
+        unset($item_types['package']);
65 65
 
66
-        if ( $invoice->is_paid() ) {
66
+        if ($invoice->is_paid()) {
67 67
             $class .= ' wpinv-paid';
68 68
         }
69 69
 
70
-        if ( $invoice->is_refunded() ) {
70
+        if ($invoice->is_refunded()) {
71 71
             $class .= ' wpinv-refunded';
72 72
         }
73 73
 
74
-        if ( $invoice->is_recurring() ) {
74
+        if ($invoice->is_recurring()) {
75 75
             $class .= ' wpi-recurring';
76 76
         }
77 77
 
78 78
     ?>
79 79
 
80
-        <div class="wpinv-items-wrap<?php echo $class; ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr( $invoice->get_status() ); ?>">
80
+        <div class="wpinv-items-wrap<?php echo $class; ?>" id="wpinv_items_wrap" data-status="<?php echo esc_attr($invoice->get_status()); ?>">
81 81
             <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0">
82 82
 
83 83
                 <thead>
84 84
                     <tr>
85
-                        <?php foreach ( $columns as $key => $label ) : ?>
86
-                            <th class="<?php echo esc_attr( $key ); echo 'total' == $key || 'qty' == $key ? ' hide-if-amount' : '' ?>"><?php echo wp_kses_post( $label ); ?></th>
85
+                        <?php foreach ($columns as $key => $label) : ?>
86
+                            <th class="<?php echo esc_attr($key); echo 'total' == $key || 'qty' == $key ? ' hide-if-amount' : '' ?>"><?php echo wp_kses_post($label); ?></th>
87 87
                         <?php endforeach; ?>
88 88
                     </tr>
89 89
                 </thead>
90 90
 
91 91
                 <tbody class="wpinv-line-items">
92 92
                     <?php
93
-                        foreach ( $invoice->get_items() as $int => $item ) {
94
-                            self::output_row( $columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd' );
93
+                        foreach ($invoice->get_items() as $int => $item) {
94
+                            self::output_row($columns, $item, $invoice, $int % 2 == 0 ? 'even' : 'odd');
95 95
                         }
96 96
                     ?>
97 97
                 </tbody>
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                                             <div class="wp-clearfix">
109 109
                                                 <label class="wpi-item-name">
110 110
                                                     <span class="input-text-wrap">
111
-                                                        <input type="text" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' );?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]">
111
+                                                        <input type="text" style="width: 100%" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="wpinv-quick-item-name" name="_wpinv_quick[name]">
112 112
                                                     </span>
113 113
                                                 </label>
114 114
                                             </div>
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
                                             <div class="wp-clearfix">
117 117
                                                 <label class="wpi-item-price">
118 118
                                                     <span class="input-text-wrap">
119
-                                                    <input type="text" style="width: 200px" placeholder="<?php esc_attr_e( 'Item Price', 'invoicing' );?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]">
120
-                                                        &times; <input type="text" style="width: 140px" placeholder="<?php esc_attr_e( 'Item Quantity', 'invoicing' );?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]">
119
+                                                    <input type="text" style="width: 200px" placeholder="<?php esc_attr_e('Item Price', 'invoicing'); ?>" class="wpinv-quick-item-price" name="_wpinv_quick[price]">
120
+                                                        &times; <input type="text" style="width: 140px" placeholder="<?php esc_attr_e('Item Quantity', 'invoicing'); ?>" class="wpinv-quick-item-qty" name="_wpinv_quick[qty]">
121 121
                                                     </span>
122 122
                                                 </label>
123 123
                                             </div>
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                                             <div class="wp-clearfix">
126 126
                                                 <label class="wpi-item-name">
127 127
                                                     <span class="input-text-wrap">
128
-                                                        <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e( 'Item Description', 'invoicing' );?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea>
128
+                                                        <textarea rows="4" style="width: 100%" placeholder="<?php esc_attr_e('Item Description', 'invoicing'); ?>" class="wpinv-quick-item-description" name="_wpinv_quick[description]"></textarea>
129 129
                                                     </span>
130 130
                                                 </label>
131 131
                                             </div>
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                                             <div class="wp-clearfix">
134 134
                                                 <label class="wpi-item-type">
135 135
                                                     <span class="input-text-wrap">
136
-                                                        <?php echo wpinv_html_select( array(
136
+                                                        <?php echo wpinv_html_select(array(
137 137
                                                             'options'          => $item_types,
138 138
                                                             'name'             => '_wpinv_quick[type]',
139 139
                                                             'id'               => '_wpinv_quick_type',
@@ -141,19 +141,19 @@  discard block
 block discarded – undo
141 141
                                                             'show_option_all'  => false,
142 142
                                                             'show_option_none' => false,
143 143
                                                             'class'            => 'gdmbx2-text-medium wpinv-quick-type',
144
-                                                        ) ); ?>
144
+                                                        )); ?>
145 145
                                                     </span>
146 146
                                                 </label>
147 147
                                             </div>
148 148
 
149
-                                            <?php if ( $use_taxes ) : ?>
149
+                                            <?php if ($use_taxes) : ?>
150 150
                                                 <div class="wp-clearfix">
151 151
                                                     <label class="wpi-vat-rule">
152 152
                                                         <span class="input-text-wrap">
153 153
                                                             <?php
154
-                                                                echo wpinv_html_select( array(
154
+                                                                echo wpinv_html_select(array(
155 155
                                                                     'options'          => array_merge(
156
-                                                                        array( '' => __( 'Select VAT Rule', 'invoicing' ) ),
156
+                                                                        array('' => __('Select VAT Rule', 'invoicing')),
157 157
                                                                         getpaid_get_tax_rules()
158 158
                                                                     ),
159 159
                                                                     'name'             => '_wpinv_quick[vat_rule]',
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
                                                                     'show_option_all'  => false,
162 162
                                                                     'show_option_none' => false,
163 163
                                                                     'class'            => 'gdmbx2-text-medium wpinv-quick-vat-rule',
164
-                                                                ) );
164
+                                                                ));
165 165
                                                             ?>
166 166
                                                         </span>
167 167
                                                     </label>
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
                                                     <label class="wpi-vat-class">
171 171
                                                         <span class="input-text-wrap">
172 172
                                                             <?php
173
-                                                                echo wpinv_html_select( array(
173
+                                                                echo wpinv_html_select(array(
174 174
                                                                     'options'          => array_merge(
175
-                                                                        array( '' => __( 'Select VAT Class', 'invoicing' ) ),
175
+                                                                        array('' => __('Select VAT Class', 'invoicing')),
176 176
                                                                         getpaid_get_tax_classes()
177 177
                                                                     ),
178 178
                                                                     'name'             => '_wpinv_quick[vat_class]',
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                                                                     'show_option_all'  => false,
181 181
                                                                     'show_option_none' => false,
182 182
                                                                     'class'            => 'gdmbx2-text-medium wpinv-quick-vat-class',
183
-                                                                ) );
183
+                                                                ));
184 184
                                                             ?>
185 185
                                                         </span>
186 186
                                                     </label>
@@ -201,29 +201,29 @@  discard block
 block discarded – undo
201 201
                         </td>
202 202
                     </tr>
203 203
                     <tr class="totals">
204
-                        <td colspan="<?php echo ( $cols - 4 ); ?>"></td>
204
+                        <td colspan="<?php echo ($cols - 4); ?>"></td>
205 205
                         <td colspan="4">
206 206
                             <table cellspacing="0" cellpadding="0">
207 207
                                 <tr class="subtotal">
208
-                                    <td class="name"><?php _e( 'Sub Total:', 'invoicing' );?></td>
209
-                                    <td class="total"><?php echo wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() );?></td>
208
+                                    <td class="name"><?php _e('Sub Total:', 'invoicing'); ?></td>
209
+                                    <td class="total"><?php echo wpinv_price($invoice->get_subtotal(), $invoice->get_currency()); ?></td>
210 210
                                     <td class="action"></td>
211 211
                                 </tr>
212 212
                                 <tr class="discount">
213
-                                    <td class="name"><?php _e( 'Discount:', 'invoicing' ) ; ?></td>
214
-                                    <td class="total"><?php echo wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() );?></td>
213
+                                    <td class="name"><?php _e('Discount:', 'invoicing'); ?></td>
214
+                                    <td class="total"><?php echo wpinv_price($invoice->get_total_discount(), $invoice->get_currency()); ?></td>
215 215
                                     <td class="action"></td>
216 216
                                 </tr>
217
-                                <?php if ( $use_taxes ) : ?>
217
+                                <?php if ($use_taxes) : ?>
218 218
                                 <tr class="tax">
219
-                                    <td class="name"><?php _e( 'Tax:', 'invoicing' );?></td>
220
-                                    <td class="total"><?php echo wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() );?></td>
219
+                                    <td class="name"><?php _e('Tax:', 'invoicing'); ?></td>
220
+                                    <td class="total"><?php echo wpinv_price($invoice->get_total_tax(), $invoice->get_currency()); ?></td>
221 221
                                     <td class="action"></td>
222 222
                                 </tr>
223 223
                                 <?php endif; ?>
224 224
                                 <tr class="total">
225
-                                    <td class="name"><?php _e( 'Total:', 'invoicing' );?></td>
226
-                                    <td class="total"><?php echo wpinv_price( $invoice->get_total(), $invoice->get_currency() );?></td>
225
+                                    <td class="name"><?php _e('Total:', 'invoicing'); ?></td>
226
+                                    <td class="total"><?php echo wpinv_price($invoice->get_total(), $invoice->get_currency()); ?></td>
227 227
                                     <td class="action"></td>
228 228
                                 </tr>
229 229
                             </table>
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
             </table>
235 235
             <div class="wpinv-actions">
236 236
                 <?php
237
-                    if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
237
+                    if (!$invoice->is_paid() && !$invoice->is_refunded()) {
238 238
                         echo wpinv_item_dropdown(
239 239
                             array(
240 240
                                 'name'             => 'wpinv_invoice_item',
@@ -244,61 +244,61 @@  discard block
 block discarded – undo
244 244
                             )
245 245
                         );
246 246
 
247
-                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-add-item">' . sprintf( esc_html__( 'Add item to %s', 'invoicing' ), $invoice->get_label() ) . '</button>';
248
-                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__( 'Create new item', 'invoicing' ) . '</button>';
249
-                        echo "&nbsp;" . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__( 'Recalculate Totals', 'invoicing' ) . '</button>';
247
+                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-add-item">' . sprintf(esc_html__('Add item to %s', 'invoicing'), $invoice->get_label()) . '</button>';
248
+                        echo "&nbsp;" . '<button class="button button-primary" id="wpinv-new-item">' . esc_html__('Create new item', 'invoicing') . '</button>';
249
+                        echo "&nbsp;" . '<button class="button button-primary wpinv-flr" id="wpinv-recalc-totals">' . esc_html__('Recalculate Totals', 'invoicing') . '</button>';
250 250
 
251 251
                     }
252 252
                 ?>
253
-                <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?>
253
+                <?php do_action('wpinv_invoice_items_actions', $invoice); ?>
254 254
             </div>
255 255
         </div>
256 256
         <?php
257 257
     }
258 258
 
259
-    public static function output_row( $columns, $item, $invoice, $class='even' ) {
259
+    public static function output_row($columns, $item, $invoice, $class = 'even') {
260 260
 
261 261
     ?>
262
-        <tr class="item item-<?php echo esc_attr( $class ); ?>" data-item-id="<?php echo esc_attr( $item->get_id() ); ?>">
263
-            <?php foreach ( array_keys( $columns ) as $column ) : ?>
264
-                <td class="<?php echo esc_attr( $column ); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>">
262
+        <tr class="item item-<?php echo esc_attr($class); ?>" data-item-id="<?php echo esc_attr($item->get_id()); ?>">
263
+            <?php foreach (array_keys($columns) as $column) : ?>
264
+                <td class="<?php echo esc_attr($column); echo 'total' == $column || 'qty' == $column ? ' hide-if-amount' : '' ?>">
265 265
                     <?php
266
-                        switch ( $column ) {
266
+                        switch ($column) {
267 267
                             case 'id':
268 268
                                 echo (int) $item->get_id();
269 269
                                 break;
270 270
                             case 'title':
271 271
                                 printf(
272 272
                                     '<a href="%s" target="_blank">%s</a>',
273
-                                    get_edit_post_link( $item->get_id() ),
274
-                                    esc_html( $item->get_raw_name() )
273
+                                    get_edit_post_link($item->get_id()),
274
+                                    esc_html($item->get_raw_name())
275 275
                                 );
276 276
 
277
-                                $summary = apply_filters( 'getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice );
278
-                                if ( $summary !== '' ) {
277
+                                $summary = apply_filters('getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice);
278
+                                if ($summary !== '') {
279 279
                                     printf(
280 280
                                         '<span class="meta">%s</span>',
281
-                                        wpautop( wp_kses_post( $summary ) )
281
+                                        wpautop(wp_kses_post($summary))
282 282
                                     );
283 283
                                 }
284 284
 
285 285
                                 printf(
286 286
                                     '<input type="hidden" value="%s" name="getpaid_items[%s][name]" class="getpaid-recalculate-prices-on-change" />',
287
-                                    esc_attr( $item->get_raw_name() ),
287
+                                    esc_attr($item->get_raw_name()),
288 288
                                     (int) $item->get_id()
289 289
                                 );
290 290
 
291 291
                                 printf(
292 292
                                     '<textarea style="display: none;" name="getpaid_items[%s][description]" class="getpaid-recalculate-prices-on-change">%s</textarea>',
293 293
                                     (int) $item->get_id(),
294
-                                    esc_attr( $item->get_description() )
294
+                                    esc_attr($item->get_description())
295 295
                                 );
296 296
 
297 297
                                 break;
298 298
                             case 'price':
299 299
                                 printf(
300 300
                                     '<input type="text" value="%s" name="getpaid_items[%s][price]" style="width: 100px;" class="getpaid-admin-invoice-item-price getpaid-recalculate-prices-on-change" />',
301
-                                    esc_attr( getpaid_unstandardize_amount( $item->get_price() ) ),
301
+                                    esc_attr(getpaid_unstandardize_amount($item->get_price())),
302 302
                                     (int) $item->get_id()
303 303
                                 );
304 304
 
@@ -306,26 +306,26 @@  discard block
 block discarded – undo
306 306
                             case 'qty':
307 307
                                 printf(
308 308
                                     '<input type="text" style="width: 100px;" value="%s" name="getpaid_items[%s][quantity]" class="getpaid-admin-invoice-item-quantity getpaid-recalculate-prices-on-change" />',
309
-                                    floatval( $item->get_quantity() ),
309
+                                    floatval($item->get_quantity()),
310 310
                                     (int) $item->get_id()
311 311
                                 );
312 312
 
313 313
                                 break;
314 314
                             case 'total':
315
-                                echo wpinv_price( $item->get_sub_total(), $invoice->get_currency() );
315
+                                echo wpinv_price($item->get_sub_total(), $invoice->get_currency());
316 316
 
317 317
                                 break;
318 318
                             case 'tax':
319
-                                echo wpinv_round_amount( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) . '%';
319
+                                echo wpinv_round_amount(getpaid_get_invoice_tax_rate($invoice, $item), 2) . '%';
320 320
 
321 321
                                 break;
322 322
                             case 'action':
323
-                                if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
323
+                                if (!$invoice->is_paid() && !$invoice->is_refunded()) {
324 324
                                     echo '<i class="fa fa-trash wpinv-item-remove"></i>';
325 325
                                 }
326 326
                                 break;
327 327
                         }
328
-                        do_action( 'getpaid_admin_edit_invoice_item_' . $column, $item, $invoice );
328
+                        do_action('getpaid_admin_edit_invoice_item_' . $column, $item, $invoice);
329 329
                     ?>
330 330
                 </td>
331 331
             <?php endforeach; ?>
@@ -338,10 +338,10 @@  discard block
 block discarded – undo
338 338
 	 *
339 339
 	 * @param WP_Post $post
340 340
 	 */
341
-    public static function output2( $post ) {
341
+    public static function output2($post) {
342 342
 
343 343
         // Prepare the invoice.
344
-        $invoice = new WPInv_Invoice( $post );
344
+        $invoice = new WPInv_Invoice($post);
345 345
 
346 346
         // Invoice items.
347 347
         $items = $invoice->get_items();
@@ -349,28 +349,28 @@  discard block
 block discarded – undo
349 349
         $totals = array(
350 350
 
351 351
             'subtotal'  => array(
352
-                'label' => __( 'Items Subtotal', 'invoicing' ),
353
-                'value' => wpinv_price( $invoice->get_subtotal(), $invoice->get_currency() ),
352
+                'label' => __('Items Subtotal', 'invoicing'),
353
+                'value' => wpinv_price($invoice->get_subtotal(), $invoice->get_currency()),
354 354
             ),
355 355
 
356 356
             'discount'  => array(
357
-                'label' => __( 'Total Discount', 'invoicing' ),
358
-                'value' => wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ),
357
+                'label' => __('Total Discount', 'invoicing'),
358
+                'value' => wpinv_price($invoice->get_total_discount(), $invoice->get_currency()),
359 359
             ),
360 360
 
361 361
             'tax'       => array(
362
-                'label' => __( 'Total Tax', 'invoicing' ),
363
-                'value' => wpinv_price( $invoice->get_total_tax(), $invoice->get_currency() ),
362
+                'label' => __('Total Tax', 'invoicing'),
363
+                'value' => wpinv_price($invoice->get_total_tax(), $invoice->get_currency()),
364 364
             ),
365 365
 
366 366
             'total'     => array(
367
-                'label' => __( 'Invoice Total', 'invoicing' ),
368
-                'value' => wpinv_price( $invoice->get_total(), $invoice->get_currency() ),
367
+                'label' => __('Invoice Total', 'invoicing'),
368
+                'value' => wpinv_price($invoice->get_total(), $invoice->get_currency()),
369 369
             )
370 370
         );
371 371
 
372
-        if ( ! wpinv_use_taxes() ) {
373
-            unset( $totals['tax'] );
372
+        if (!wpinv_use_taxes()) {
373
+            unset($totals['tax']);
374 374
         }
375 375
 
376 376
         $item_args = array(
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
             'orderby'        => 'title',
379 379
             'order'          => 'ASC',
380 380
             'posts_per_page' => -1,
381
-            'post_status'    => array( 'publish' ),
381
+            'post_status'    => array('publish'),
382 382
             'meta_query'     => array(
383 383
                 array(
384 384
                     'key'       => '_wpinv_type',
@@ -402,10 +402,10 @@  discard block
 block discarded – undo
402 402
             }
403 403
         </style>
404 404
 
405
-                <div class="bsui getpaid-invoice-items-inner <?php echo empty( $items ) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem; padding: 0 12px 12px;">
405
+                <div class="bsui getpaid-invoice-items-inner <?php echo empty($items) ? 'no-items' : 'has-items'; ?> <?php echo $invoice->is_paid() || $invoice->is_refunded() ? 'not-editable' : 'editable'; ?>" style="margin-top: 1.5rem; padding: 0 12px 12px;">
406 406
 
407
-                    <?php if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) : ?>
408
-                        <?php do_action( 'wpinv_meta_box_before_invoice_template_row', $invoice->get_id() ); ?>
407
+                    <?php if (!$invoice->is_paid() && !$invoice->is_refunded()) : ?>
408
+                        <?php do_action('wpinv_meta_box_before_invoice_template_row', $invoice->get_id()); ?>
409 409
 
410 410
                         <div class="row">
411 411
                             <div class="col-12 col-sm-6">
@@ -414,15 +414,15 @@  discard block
 block discarded – undo
414 414
                                         array(
415 415
                                             'id'          => 'wpinv_template',
416 416
                                             'name'        => 'wpinv_template',
417
-                                            'label'       => __( 'Template', 'invoicing' ),
417
+                                            'label'       => __('Template', 'invoicing'),
418 418
                                             'label_type'  => 'vertical',
419
-                                            'placeholder' => __( 'Choose a template', 'invoicing' ),
419
+                                            'placeholder' => __('Choose a template', 'invoicing'),
420 420
                                             'class'       => 'form-control-sm',
421
-                                            'value'       => $invoice->get_template( 'edit' ),
421
+                                            'value'       => $invoice->get_template('edit'),
422 422
                                             'options'     => array(
423
-                                                'quantity' => __( 'Quantity', 'invoicing' ),
424
-                                                'hours'    => __( 'Hours', 'invoicing' ),
425
-                                                'amount'   => __( 'Amount Only', 'invoicing' ),
423
+                                                'quantity' => __('Quantity', 'invoicing'),
424
+                                                'hours'    => __('Hours', 'invoicing'),
425
+                                                'amount'   => __('Amount Only', 'invoicing'),
426 426
                                             ),
427 427
                                             'data-allow-clear' => 'false',
428 428
                                             'select2'          => true,
@@ -438,11 +438,11 @@  discard block
 block discarded – undo
438 438
                                         array(
439 439
                                             'id'          => 'wpinv_currency',
440 440
                                             'name'        => 'wpinv_currency',
441
-                                            'label'       => __( 'Currency', 'invoicing' ),
441
+                                            'label'       => __('Currency', 'invoicing'),
442 442
                                             'label_type'  => 'vertical',
443
-                                            'placeholder' => __( 'Select Invoice Currency', 'invoicing' ),
443
+                                            'placeholder' => __('Select Invoice Currency', 'invoicing'),
444 444
                                             'class'       => 'form-control-sm',
445
-                                            'value'       => $invoice->get_currency( 'edit' ),
445
+                                            'value'       => $invoice->get_currency('edit'),
446 446
                                             'required'    => false,
447 447
                                             'data-allow-clear' => 'false',
448 448
                                             'select2'          => true,
@@ -454,24 +454,24 @@  discard block
 block discarded – undo
454 454
                             </div>
455 455
                         </div>
456 456
 
457
-                        <?php do_action( 'wpinv_meta_box_invoice_template_row', $invoice->get_id() ); ?>
457
+                        <?php do_action('wpinv_meta_box_invoice_template_row', $invoice->get_id()); ?>
458 458
                     <?php endif; ?>
459 459
 
460 460
                     <table cellpadding="0" cellspacing="0" class="getpaid_invoice_items">
461 461
                         <thead>
462 462
                             <tr>
463
-                                <th class="getpaid-item" colspan="2"><?php _e( 'Item', 'invoicing' ) ?></th>
463
+                                <th class="getpaid-item" colspan="2"><?php _e('Item', 'invoicing') ?></th>
464 464
                                 <th class="getpaid-quantity hide-if-amount text-right">
465
-                                    <span class="getpaid-hide-if-hours"><?php _e( 'Quantity', 'invoicing' ) ?></span>
466
-                                    <span class="getpaid-hide-if-quantity"><?php _e( 'Hours', 'invoicing' ) ?></span>
465
+                                    <span class="getpaid-hide-if-hours"><?php _e('Quantity', 'invoicing') ?></span>
466
+                                    <span class="getpaid-hide-if-quantity"><?php _e('Hours', 'invoicing') ?></span>
467 467
                                 </th>
468 468
                                 <th class="getpaid-price hide-if-amount text-right">
469
-                                    <span class="getpaid-hide-if-hours"><?php _e( 'Price', 'invoicing' ) ?></span>
470
-                                    <span class="getpaid-hide-if-quantity"><?php _e( 'Rate', 'invoicing' ) ?></span>
469
+                                    <span class="getpaid-hide-if-hours"><?php _e('Price', 'invoicing') ?></span>
470
+                                    <span class="getpaid-hide-if-quantity"><?php _e('Rate', 'invoicing') ?></span>
471 471
                                 </th>
472 472
                                 <th class="getpaid-item-subtotal text-right">
473
-                                    <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php _e( 'Amount', 'invoicing' ) ?></span>
474
-                                    <span class="hide-if-amount"><?php _e( 'Total', 'invoicing' ) ?></span>
473
+                                    <span class="getpaid-hide-if-hours getpaid-hide-if-quantity"><?php _e('Amount', 'invoicing') ?></span>
474
+                                    <span class="hide-if-amount"><?php _e('Total', 'invoicing') ?></span>
475 475
                                 </th>
476 476
                                 <th class="getpaid-item-actions hide-if-not-editable" width="70px">&nbsp;</th>
477 477
                             </tr>
@@ -479,8 +479,8 @@  discard block
 block discarded – undo
479 479
 		                <tbody class="getpaid_invoice_line_items">
480 480
                             <tr class="hide-if-has-items hide-if-not-editable">
481 481
                                 <td colspan="2" class="pt-4 pb-4">
482
-                                    <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e( 'Add Existing Items', 'invoicing' ) ?></button>
483
-                                    <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e( 'Create New Item', 'invoicing' ) ?></button>
482
+                                    <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e('Add Existing Items', 'invoicing') ?></button>
483
+                                    <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e('Create New Item', 'invoicing') ?></button>
484 484
                                 </td>
485 485
                                 <td class="hide-if-amount">&nbsp;</th>
486 486
                                 <td class="hide-if-amount">&nbsp;</th>
@@ -512,11 +512,11 @@  discard block
 block discarded – undo
512 512
                             <div class="col-12 col-sm-6 offset-sm-6">
513 513
                                 <table class="getpaid-invoice-totals text-right w-100">
514 514
                                     <tbody>
515
-                                        <?php foreach ( apply_filters( 'getpaid_invoice_subtotal_rows', $totals, $invoice ) as $key => $data ) : ?>
516
-                                            <tr class="getpaid-totals-<?php echo sanitize_html_class( $key ); ?>">
517
-                                                <td class="label"><?php echo esc_html( $data['label'] ) ?>:</td>
515
+                                        <?php foreach (apply_filters('getpaid_invoice_subtotal_rows', $totals, $invoice) as $key => $data) : ?>
516
+                                            <tr class="getpaid-totals-<?php echo sanitize_html_class($key); ?>">
517
+                                                <td class="label"><?php echo esc_html($data['label']) ?>:</td>
518 518
                                                 <td width="1%"></td>
519
-                                                <td class="value"><?php echo wp_kses_post( $data['value'] ) ?></td>
519
+                                                <td class="value"><?php echo wp_kses_post($data['value']) ?></td>
520 520
                                             </tr>
521 521
                                         <?php endforeach; ?>
522 522
                                     </tbody>
@@ -529,18 +529,18 @@  discard block
 block discarded – undo
529 529
                     <div class="getpaid-invoice-item-actions hide-if-no-items hide-if-not-editable">
530 530
                         <div class="row">
531 531
                             <div class="text-left col-12 col-sm-8">
532
-                                <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e( 'Add Existing Item', 'invoicing' ) ?></button>
533
-                                <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e( 'Create New Item', 'invoicing' ) ?></button>
534
-                                <?php do_action( 'getpaid-invoice-items-actions', $invoice ); ?>
532
+                                <button type="button" class="button button-primary add-invoice-item" data-toggle="modal" data-target="#getpaid-add-items-to-invoice"><?php _e('Add Existing Item', 'invoicing') ?></button>
533
+                                <button type="button" class="button button-secondary create-invoice-item" data-toggle="modal" data-target="#getpaid-create-invoice-item"><?php _e('Create New Item', 'invoicing') ?></button>
534
+                                <?php do_action('getpaid-invoice-items-actions', $invoice); ?>
535 535
                             </div>
536 536
                             <div class="text-right col-12 col-sm-4">
537
-                                <button type="button" class="button button-primary recalculate-totals-button"><?php _e( 'Recalculate Totals', 'invoicing' ) ?></button>
537
+                                <button type="button" class="button button-primary recalculate-totals-button"><?php _e('Recalculate Totals', 'invoicing') ?></button>
538 538
                             </div>
539 539
                         </div>
540 540
                     </div>
541 541
 
542 542
                     <div class="getpaid-invoice-item-actions hide-if-editable">
543
-                        <p class="description m-2 text-right text-muted"><?php _e( 'This invoice is no longer editable', 'invoicing' ); ?></p>
543
+                        <p class="description m-2 text-right text-muted"><?php _e('This invoice is no longer editable', 'invoicing'); ?></p>
544 544
                     </div>
545 545
 
546 546
                     <!-- Add items to an invoice -->
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
                         <div class="modal-dialog modal-dialog-centered" role="document">
549 549
                             <div class="modal-content">
550 550
                                 <div class="modal-header">
551
-                                    <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php _e( "Add Item(s)", 'invoicing' ); ?></h5>
552
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>">
551
+                                    <h5 class="modal-title" id="getpaid-add-item-to-invoice-label"><?php _e("Add Item(s)", 'invoicing'); ?></h5>
552
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>">
553 553
                                         <span aria-hidden="true">&times;</span>
554 554
                                     </button>
555 555
                                 </div>
@@ -557,10 +557,10 @@  discard block
 block discarded – undo
557 557
                                     <table class="widefat">
558 558
                                         <thead>
559 559
                                             <tr>
560
-                                                <th class="pl-0 text-left"><?php _e( 'Item', 'invoicing' ) ?></th>
560
+                                                <th class="pl-0 text-left"><?php _e('Item', 'invoicing') ?></th>
561 561
                                                 <th class="pr-0 text-right hide-if-amount">
562
-                                                    <span class="getpaid-hide-if-hours"><?php _e( 'Quantity', 'invoicing' ) ?></span>
563
-                                                    <span class="getpaid-hide-if-quantity"><?php _e( 'Hours', 'invoicing' ) ?></span>
562
+                                                    <span class="getpaid-hide-if-hours"><?php _e('Quantity', 'invoicing') ?></span>
563
+                                                    <span class="getpaid-hide-if-quantity"><?php _e('Hours', 'invoicing') ?></span>
564 564
                                                 </th>
565 565
                                             </tr>
566 566
                                         </thead>
@@ -568,9 +568,9 @@  discard block
 block discarded – undo
568 568
 								            <tr>
569 569
 									            <td class="pl-0 text-left">
570 570
                                                     <select class="regular-text getpaid-add-invoice-item-select">
571
-                                                        <option value="" selected="selected" disabled><?php esc_html_e( 'Select an item…', 'invoicing' ); ?></option>
572
-                                                        <?php foreach ( get_posts( $item_args ) as $item ) : ?>
573
-                                                        <option value="<?php echo (int) $item->ID; ?>"><?php echo strip_tags( $item->post_title ); ?></option>
571
+                                                        <option value="" selected="selected" disabled><?php esc_html_e('Select an item…', 'invoicing'); ?></option>
572
+                                                        <?php foreach (get_posts($item_args) as $item) : ?>
573
+                                                        <option value="<?php echo (int) $item->ID; ?>"><?php echo strip_tags($item->post_title); ?></option>
574 574
                                                         <?php endforeach; ?>
575 575
                                                     </select>
576 576
                                                 </td>
@@ -582,8 +582,8 @@  discard block
 block discarded – undo
582 582
 						            </table>
583 583
                                 </div>
584 584
                                 <div class="modal-footer">
585
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button>
586
-                                    <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php _e( 'Add', 'invoicing' ); ?></button>
585
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button>
586
+                                    <button type="button" class="btn btn-primary getpaid-add" data-dismiss="modal"><?php _e('Add', 'invoicing'); ?></button>
587 587
                                 </div>
588 588
                             </div>
589 589
                         </div>
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
                         <div class="modal-dialog modal-dialog-centered" role="document">
595 595
                             <div class="modal-content">
596 596
                                 <div class="modal-header">
597
-                                    <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php _e( "Create Item", 'invoicing' ); ?></h5>
598
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>">
597
+                                    <h5 class="modal-title" id="getpaid-create-invoice-item-label"><?php _e("Create Item", 'invoicing'); ?></h5>
598
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>">
599 599
                                         <span aria-hidden="true">&times;</span>
600 600
                                     </button>
601 601
                                 </div>
@@ -603,27 +603,27 @@  discard block
 block discarded – undo
603 603
                                     <div class="getpaid-create-item-div">
604 604
                                         <input type="hidden" name="id" value="new" class="form-control form-control-sm item-id">
605 605
                                         <label class="form-group w-100">
606
-                                            <span><?php _e( 'Name', 'invoicing' ); ?></span>
607
-                                            <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name">
606
+                                            <span><?php _e('Name', 'invoicing'); ?></span>
607
+                                            <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name">
608 608
                                         </label>
609 609
                                         <label class="form-group w-100">
610
-                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e( 'Amount', 'invoicing' ); ?></span>
611
-                                            <span class="hide-if-amount"><?php _e( 'Price', 'invoicing' ); ?></span>
612
-                                            <input type="text" name="price" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price">
610
+                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e('Amount', 'invoicing'); ?></span>
611
+                                            <span class="hide-if-amount"><?php _e('Price', 'invoicing'); ?></span>
612
+                                            <input type="text" name="price" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price">
613 613
                                         </label>
614 614
                                         <label class="form-group w-100 hide-if-amount">
615
-                                            <span><?php _e( 'Quantity', 'invoicing' ); ?></span>
615
+                                            <span><?php _e('Quantity', 'invoicing'); ?></span>
616 616
                                             <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity">
617 617
                                         </label>
618 618
                                         <label class="form-group w-100">
619
-                                            <span><?php _e( 'Item Description', 'invoicing' ); ?></span>
620
-                                            <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea>
619
+                                            <span><?php _e('Item Description', 'invoicing'); ?></span>
620
+                                            <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea>
621 621
                                         </label>
622 622
                                     </div>
623 623
                                 </div>
624 624
                                 <div class="modal-footer">
625
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button>
626
-                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e( 'Create', 'invoicing' ); ?></button>
625
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button>
626
+                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e('Create', 'invoicing'); ?></button>
627 627
                                 </div>
628 628
                             </div>
629 629
                         </div>
@@ -634,8 +634,8 @@  discard block
 block discarded – undo
634 634
                         <div class="modal-dialog modal-dialog-centered" role="document">
635 635
                             <div class="modal-content">
636 636
                                 <div class="modal-header">
637
-                                    <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php _e( "Edit Item", 'invoicing' ); ?></h5>
638
-                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e( "Close", 'invoicing' ); ?>">
637
+                                    <h5 class="modal-title" id="getpaid-edit-invoice-item-label"><?php _e("Edit Item", 'invoicing'); ?></h5>
638
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="<?php _e("Close", 'invoicing'); ?>">
639 639
                                         <span aria-hidden="true">&times;</span>
640 640
                                     </button>
641 641
                                 </div>
@@ -643,27 +643,27 @@  discard block
 block discarded – undo
643 643
                                     <div class="getpaid-edit-item-div">
644 644
                                         <input type="hidden" name="id" class="form-control form-control-sm item-id">
645 645
                                         <label class="form-group w-100">
646
-                                            <span><?php _e( 'Name', 'invoicing' ); ?></span>
647
-                                            <input type="text" name="name" placeholder="<?php esc_attr_e( 'Item Name', 'invoicing' ); ?>" class="form-control form-control-sm item-name">
646
+                                            <span><?php _e('Name', 'invoicing'); ?></span>
647
+                                            <input type="text" name="name" placeholder="<?php esc_attr_e('Item Name', 'invoicing'); ?>" class="form-control form-control-sm item-name">
648 648
                                         </label>
649 649
                                         <label class="form-group w-100">
650
-                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e( 'Amount', 'invoicing' ); ?></span>
651
-                                            <span class="hide-if-amount"><?php _e( 'Price', 'invoicing' ); ?></span>
652
-                                            <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount( 0 ); ?>" class="form-control form-control-sm item-price">
650
+                                            <span class="getpaid-hide-if-hours getpaid-hide-if-quantity item-price"><?php _e('Amount', 'invoicing'); ?></span>
651
+                                            <span class="hide-if-amount"><?php _e('Price', 'invoicing'); ?></span>
652
+                                            <input type="text" name="price" placeholder="<?php wpinv_sanitize_amount(0); ?>" class="form-control form-control-sm item-price">
653 653
                                         </label>
654 654
                                         <label class="form-group w-100 hide-if-amount">
655
-                                            <span><?php _e( 'Quantity', 'invoicing' ); ?></span>
655
+                                            <span><?php _e('Quantity', 'invoicing'); ?></span>
656 656
                                             <input type="text" name="quantity" placeholder="1" class="form-control form-control-sm item-quantity">
657 657
                                         </label>
658 658
                                         <label class="form-group w-100">
659
-                                            <span><?php _e( 'Item Description', 'invoicing' ); ?></span>
660
-                                            <textarea name="description" placeholder="<?php esc_attr_e( 'Enter a description for this item', 'invoicing' ); ?>" class="form-control item-description"></textarea>
659
+                                            <span><?php _e('Item Description', 'invoicing'); ?></span>
660
+                                            <textarea name="description" placeholder="<?php esc_attr_e('Enter a description for this item', 'invoicing'); ?>" class="form-control item-description"></textarea>
661 661
                                         </label>
662 662
                                     </div>
663 663
                                 </div>
664 664
                                 <div class="modal-footer">
665
-                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e( 'Cancel', 'invoicing' ); ?></button>
666
-                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e( 'Save', 'invoicing' ); ?></button>
665
+                                    <button type="button" class="btn btn-secondary getpaid-cancel" data-dismiss="modal"><?php _e('Cancel', 'invoicing'); ?></button>
666
+                                    <button type="button" class="btn btn-primary getpaid-save" data-dismiss="modal"><?php _e('Save', 'invoicing'); ?></button>
667 667
                                 </div>
668 668
                             </div>
669 669
                         </div>
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-resend-invoice.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  */
7 7
 
8
-if ( ! defined( 'ABSPATH' ) ) {
8
+if (!defined('ABSPATH')) {
9 9
 	exit; // Exit if accessed directly
10 10
 }
11 11
 
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 	 *
20 20
 	 * @param WP_Post $post
21 21
 	 */
22
-    public static function output( $post ) {
22
+    public static function output($post) {
23 23
 
24 24
         // Fetch the invoice.
25
-        $invoice = new WPInv_Invoice( $post );
25
+        $invoice = new WPInv_Invoice($post);
26 26
 
27
-        do_action( 'wpinv_metabox_resend_invoice_before', $invoice );
27
+        do_action('wpinv_metabox_resend_invoice_before', $invoice);
28 28
 
29 29
         $invoice_actions = array(
30 30
             'resend-email' => array(
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
                     'getpaid-nonce',
39 39
                     'getpaid-nonce'
40 40
                 ),
41
-                'label' => __( 'Resend Invoice', 'invoicing' ),
41
+                'label' => __('Resend Invoice', 'invoicing'),
42 42
             )
43 43
         );
44 44
 
45
-        if ( $invoice->needs_payment() ) {
45
+        if ($invoice->needs_payment()) {
46 46
 
47 47
             $invoice_actions['send-reminder'] = array(
48 48
                 'url' => wp_nonce_url(
@@ -55,29 +55,29 @@  discard block
 block discarded – undo
55 55
                     'getpaid-nonce',
56 56
                     'getpaid-nonce'
57 57
                 ),
58
-                'label' => __( 'Send Reminder', 'invoicing' ),
58
+                'label' => __('Send Reminder', 'invoicing'),
59 59
             );
60 60
 
61 61
         }
62 62
 
63
-        $invoice_actions = apply_filters( 'getpaid_edit_invoice_actions', $invoice_actions, $invoice );
63
+        $invoice_actions = apply_filters('getpaid_edit_invoice_actions', $invoice_actions, $invoice);
64 64
 
65
-        foreach ( $invoice_actions as $key => $action ) {
65
+        foreach ($invoice_actions as $key => $action) {
66 66
 
67
-            if ( 'resend-email' === $key ) {
68
-                echo wpautop( __( "This will send a copy of the invoice to the customer's email address.", 'invoicing' ) );
67
+            if ('resend-email' === $key) {
68
+                echo wpautop(__("This will send a copy of the invoice to the customer's email address.", 'invoicing'));
69 69
             }
70 70
 
71 71
             printf(
72 72
                 '<p class="wpi-meta-row wpi-%s"><a href="%s" class="button button-secondary">%s</a>',
73
-                esc_attr( $key ),
74
-                esc_url( $action['url'] ),
75
-                esc_html( $action['label'] )
73
+                esc_attr($key),
74
+                esc_url($action['url']),
75
+                esc_html($action['label'])
76 76
             );
77 77
 
78 78
         }
79 79
 
80
-        do_action( 'wpinv_metabox_resend_invoice_after', $invoice );
80
+        do_action('wpinv_metabox_resend_invoice_after', $invoice);
81 81
 
82 82
     }
83 83
 
Please login to merge, or discard this patch.
includes/admin/class-wpinv-subscriptions-list-table.php 1 patch
Spacing   +82 added lines, -82 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
-				esc_html( getpaid_get_subscription_status_label( $status ) ),
144
+				esc_html(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,44 +190,44 @@  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 ) ? esc_html( $user->display_name ) : sanitize_email( $user->user_email )
202
+				absint($user->ID),
203
+				!empty($user->display_name) ? esc_html($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
-			$invoice_url            = get_edit_post_link( $invoice );
227
-			$row_actions['invoice'] = '<a href="' . $invoice_url . '">' . __( 'View Invoice', 'invoicing' ) . '</a>';
225
+		if (!empty($invoice)) {
226
+			$invoice_url            = get_edit_post_link($invoice);
227
+			$row_actions['invoice'] = '<a href="' . $invoice_url . '">' . __('View Invoice', 'invoicing') . '</a>';
228 228
 		}
229 229
 
230
-		$delete_url            = esc_url(
230
+		$delete_url = esc_url(
231 231
 			wp_nonce_url(
232 232
 				add_query_arg(
233 233
 					array(
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
 				'getpaid-nonce'
240 240
 			)
241 241
 		);
242
-		$row_actions['delete'] = '<a class="text-danger" href="' . $delete_url . '">' . __( 'Delete Subscription', 'invoicing' ) . '</a>';
242
+		$row_actions['delete'] = '<a class="text-danger" href="' . $delete_url . '">' . __('Delete Subscription', 'invoicing') . '</a>';
243 243
 
244
-		$row_actions = $this->row_actions( apply_filters( 'getpaid_subscription_table_row_actions', $row_actions, $item ) );
244
+		$row_actions = $this->row_actions(apply_filters('getpaid_subscription_table_row_actions', $row_actions, $item));
245 245
 
246
-		return "<strong>$column_content</strong>" . $this->column_amount( $item ) . $row_actions;
246
+		return "<strong>$column_content</strong>" . $this->column_amount($item) . $row_actions;
247 247
 	}
248 248
 
249 249
 	/**
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 	 * @since       1.0.0
254 254
 	 * @return      string
255 255
 	 */
256
-	public function column_renewal_date( $item ) {
257
-		return getpaid_format_date_value( $item->get_expiration() );
256
+	public function column_renewal_date($item) {
257
+		return getpaid_format_date_value($item->get_expiration());
258 258
 	}
259 259
 
260 260
 	/**
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 	 * @since       1.0.0
265 265
 	 * @return      string
266 266
 	 */
267
-	public function column_start_date( $item ) {
268
-		return getpaid_format_date_value( $item->get_date_created() );
267
+	public function column_start_date($item) {
268
+		return getpaid_format_date_value($item->get_date_created());
269 269
 	}
270 270
 
271 271
 	/**
@@ -275,8 +275,8 @@  discard block
 block discarded – undo
275 275
 	 * @since       1.0.19
276 276
 	 * @return      string
277 277
 	 */
278
-	public static function column_amount( $item ) {
279
-		$amount = getpaid_get_formatted_subscription_amount( $item );
278
+	public static function column_amount($item) {
279
+		$amount = getpaid_get_formatted_subscription_amount($item);
280 280
 		return "<span class='text-muted form-text mt-2 mb-2'>$amount</span>";
281 281
 	}
282 282
 
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
 	 * @since       1.0.0
288 288
 	 * @return      string
289 289
 	 */
290
-	public function column_renewals( $item ) {
290
+	public function column_renewals($item) {
291 291
 		$max_bills = $item->get_bill_times();
292
-		return $item->get_times_billed() . ' / ' . ( empty( $max_bills ) ? "&infin;" : $max_bills );
292
+		return $item->get_times_billed() . ' / ' . (empty($max_bills) ? "&infin;" : $max_bills);
293 293
 	}
294 294
 
295 295
 	/**
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 	 * @since       1.0.0
300 300
 	 * @return      string
301 301
 	 */
302
-	public function column_item( $item ) {
303
-		$subscription_group = getpaid_get_invoice_subscription_group( $item->get_parent_invoice_id(), $item->get_id() );
302
+	public function column_item($item) {
303
+		$subscription_group = getpaid_get_invoice_subscription_group($item->get_parent_invoice_id(), $item->get_id());
304 304
 
305
-		if ( empty( $subscription_group ) ) {
306
-			return $this->generate_item_markup( $item->get_product_id() );
305
+		if (empty($subscription_group)) {
306
+			return $this->generate_item_markup($item->get_product_id());
307 307
 		}
308 308
 
309
-		$markup = array_map( array( $this, 'generate_item_markup' ), array_keys( $subscription_group['items'] ) );
310
-		return implode( ' | ', $markup );
309
+		$markup = array_map(array($this, 'generate_item_markup'), array_keys($subscription_group['items']));
310
+		return implode(' | ', $markup);
311 311
 
312 312
 	}
313 313
 
@@ -318,16 +318,16 @@  discard block
 block discarded – undo
318 318
 	 * @since       1.0.0
319 319
 	 * @return      string
320 320
 	 */
321
-	public static function generate_item_markup( $item_id ) {
322
-		$item = get_post( $item_id );
321
+	public static function generate_item_markup($item_id) {
322
+		$item = get_post($item_id);
323 323
 
324
-		if ( ! empty( $item ) ) {
325
-			$link = get_edit_post_link( $item );
326
-			$link = esc_url( $link );
327
-			$name = esc_html( get_the_title( $item ) );
324
+		if (!empty($item)) {
325
+			$link = get_edit_post_link($item);
326
+			$link = esc_url($link);
327
+			$name = esc_html(get_the_title($item));
328 328
 			return wpinv_current_user_can_manage_invoicing() ? "<a href='$link'>$name</a>" : $name;
329 329
 		} else {
330
-			return sprintf( __( 'Item #%s', 'invoicing' ), $item_id );
330
+			return sprintf(__('Item #%s', 'invoicing'), $item_id);
331 331
 		}
332 332
 
333 333
 	}
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 	 * @return      int
339 339
 	 */
340 340
 	public function get_paged() {
341
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
341
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
342 342
 	}
343 343
 
344 344
 	/**
@@ -351,13 +351,13 @@  discard block
 block discarded – undo
351 351
 		$hidden   = array();
352 352
 		$sortable = $this->get_sortable_columns();
353 353
 
354
-		$this->_column_headers = array( $columns, $hidden, $sortable );
354
+		$this->_column_headers = array($columns, $hidden, $sortable);
355 355
 
356 356
 		$this->set_pagination_args(
357 357
 			array(
358 358
 			'total_items' => $this->current_total_count,
359 359
 			'per_page'    => $this->per_page,
360
-			'total_pages' => ceil( $this->current_total_count / $this->per_page )
360
+			'total_pages' => ceil($this->current_total_count / $this->per_page)
361 361
 			)
362 362
 		);
363 363
 	}
@@ -367,18 +367,18 @@  discard block
 block discarded – undo
367 367
 	 *
368 368
 	 * @return array
369 369
 	 */
370
-	public function get_columns(){
370
+	public function get_columns() {
371 371
 		$columns = array(
372 372
 			'cb'                => '<input type="checkbox" />',
373
-			'subscription'      => __( 'Subscription', 'invoicing' ),
374
-			'start_date'        => __( 'Start Date', 'invoicing' ),
375
-			'renewal_date'      => __( 'Next Payment', 'invoicing' ),
376
-			'renewals'          => __( 'Payments', 'invoicing' ),
377
-			'item'              => __( 'Items', 'invoicing' ),
378
-			'status'            => __( 'Status', 'invoicing' ),
373
+			'subscription'      => __('Subscription', 'invoicing'),
374
+			'start_date'        => __('Start Date', 'invoicing'),
375
+			'renewal_date'      => __('Next Payment', 'invoicing'),
376
+			'renewals'          => __('Payments', 'invoicing'),
377
+			'item'              => __('Items', 'invoicing'),
378
+			'status'            => __('Status', 'invoicing'),
379 379
 		);
380 380
 
381
-		return apply_filters( 'manage_getpaid_subscriptions_table_columns', $columns );
381
+		return apply_filters('manage_getpaid_subscriptions_table_columns', $columns);
382 382
 	}
383 383
 
384 384
 	/**
@@ -388,15 +388,15 @@  discard block
 block discarded – undo
388 388
 	 */
389 389
 	public function get_sortable_columns() {
390 390
 		$sortable = array(
391
-			'subscription' => array( 'id', true ),
392
-			'start_date'   => array( 'created', true ),
393
-			'renewal_date' => array( 'expiration', true ),
394
-			'renewals'     => array( 'bill_times', true ),
395
-			'item'         => array( 'product_id', true ),
396
-			'status'       => array( 'status', true ),
391
+			'subscription' => array('id', true),
392
+			'start_date'   => array('created', true),
393
+			'renewal_date' => array('expiration', true),
394
+			'renewals'     => array('bill_times', true),
395
+			'item'         => array('product_id', true),
396
+			'status'       => array('status', true),
397 397
 		);
398 398
 
399
-		return apply_filters( 'manage_getpaid_subscriptions_sortable_table_columns', $sortable );
399
+		return apply_filters('manage_getpaid_subscriptions_sortable_table_columns', $sortable);
400 400
 	}
401 401
 
402 402
 	/**
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 * @return bool
406 406
 	 */
407 407
 	public function has_items() {
408
-		return ! empty( $this->current_total_count );
408
+		return !empty($this->current_total_count);
409 409
 	}
410 410
 
411 411
 	/**
Please login to merge, or discard this patch.
includes/admin/class-getpaid-post-types-admin.php 1 patch
Spacing   +230 added lines, -230 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
  * Post types Admin Class
@@ -21,74 +21,74 @@  discard block
 block discarded – undo
21 21
 		GetPaid_Metaboxes::init();
22 22
 
23 23
 		// Filter the post updated messages.
24
-		add_filter( 'post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages' );
24
+		add_filter('post_updated_messages', 'GetPaid_Post_Types_Admin::post_updated_messages');
25 25
 
26 26
 		// Filter post actions.
27
-		add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2 );
28
-		add_filter( 'post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2 );
27
+		add_filter('post_row_actions', 'GetPaid_Post_Types_Admin::post_row_actions', 10, 2);
28
+		add_filter('post_row_actions', 'GetPaid_Post_Types_Admin::filter_invoice_row_actions', 90, 2);
29 29
 
30 30
 		// Invoice table columns.
31
-		add_filter( 'manage_wpi_invoice_posts_columns', array( __CLASS__, 'invoice_columns' ), 100 );
32
-		add_action( 'manage_wpi_invoice_posts_custom_column', array( __CLASS__, 'display_invoice_columns' ), 10, 2 );
33
-		add_filter( 'bulk_actions-edit-wpi_invoice', array( __CLASS__, 'invoice_bulk_actions' ) );
34
-		add_filter( 'handle_bulk_actions-edit-wpi_invoice', array( __CLASS__, 'handle_invoice_bulk_actions' ), 10, 3 );
31
+		add_filter('manage_wpi_invoice_posts_columns', array(__CLASS__, 'invoice_columns'), 100);
32
+		add_action('manage_wpi_invoice_posts_custom_column', array(__CLASS__, 'display_invoice_columns'), 10, 2);
33
+		add_filter('bulk_actions-edit-wpi_invoice', array(__CLASS__, 'invoice_bulk_actions'));
34
+		add_filter('handle_bulk_actions-edit-wpi_invoice', array(__CLASS__, 'handle_invoice_bulk_actions'), 10, 3);
35 35
 
36 36
 		// Items table columns.
37
-		add_filter( 'manage_wpi_item_posts_columns', array( __CLASS__, 'item_columns' ), 100 );
38
-		add_filter( 'manage_edit-wpi_item_sortable_columns', array( __CLASS__, 'sortable_item_columns' ), 20 );
39
-		add_action( 'manage_wpi_item_posts_custom_column', array( __CLASS__, 'display_item_columns' ), 10, 2 );
40
-		add_action( 'restrict_manage_posts', array( __CLASS__, 'add_item_filters' ), 100 );
41
-		add_action( 'parse_query', array( __CLASS__, 'filter_item_query' ), 100 );
42
-		add_action( 'request', array( __CLASS__, 'reorder_items' ), 100 );
37
+		add_filter('manage_wpi_item_posts_columns', array(__CLASS__, 'item_columns'), 100);
38
+		add_filter('manage_edit-wpi_item_sortable_columns', array(__CLASS__, 'sortable_item_columns'), 20);
39
+		add_action('manage_wpi_item_posts_custom_column', array(__CLASS__, 'display_item_columns'), 10, 2);
40
+		add_action('restrict_manage_posts', array(__CLASS__, 'add_item_filters'), 100);
41
+		add_action('parse_query', array(__CLASS__, 'filter_item_query'), 100);
42
+		add_action('request', array(__CLASS__, 'reorder_items'), 100);
43 43
 
44 44
 		// Payment forms columns.
45
-		add_filter( 'manage_wpi_payment_form_posts_columns', array( __CLASS__, 'payment_form_columns' ), 100 );
46
-		add_action( 'manage_wpi_payment_form_posts_custom_column', array( __CLASS__, 'display_payment_form_columns' ), 10, 2 );
47
-		add_filter( 'display_post_states', array( __CLASS__, 'filter_payment_form_state' ), 10, 2 );
45
+		add_filter('manage_wpi_payment_form_posts_columns', array(__CLASS__, 'payment_form_columns'), 100);
46
+		add_action('manage_wpi_payment_form_posts_custom_column', array(__CLASS__, 'display_payment_form_columns'), 10, 2);
47
+		add_filter('display_post_states', array(__CLASS__, 'filter_payment_form_state'), 10, 2);
48 48
 
49 49
 		// Discount table columns.
50
-		add_filter( 'manage_wpi_discount_posts_columns', array( __CLASS__, 'discount_columns' ), 100 );
51
-		add_filter( 'bulk_actions-edit-wpi_discount', '__return_empty_array', 100 );
50
+		add_filter('manage_wpi_discount_posts_columns', array(__CLASS__, 'discount_columns'), 100);
51
+		add_filter('bulk_actions-edit-wpi_discount', '__return_empty_array', 100);
52 52
 
53 53
 		// Deleting posts.
54
-		add_action( 'delete_post', array( __CLASS__, 'delete_post' ) );
55
-		add_filter( 'display_post_states', array( __CLASS__, 'filter_discount_state' ), 10, 2 );
54
+		add_action('delete_post', array(__CLASS__, 'delete_post'));
55
+		add_filter('display_post_states', array(__CLASS__, 'filter_discount_state'), 10, 2);
56 56
 
57
-		add_filter( 'display_post_states', array( __CLASS__, 'add_display_post_states' ), 10, 2 );
57
+		add_filter('display_post_states', array(__CLASS__, 'add_display_post_states'), 10, 2);
58 58
 	}
59 59
 
60 60
 	/**
61 61
 	 * Post updated messages.
62 62
 	 */
63
-	public static function post_updated_messages( $messages ) {
63
+	public static function post_updated_messages($messages) {
64 64
 		global $post;
65 65
 
66 66
 		$messages['wpi_discount'] = array(
67 67
 			0   => '',
68
-			1   => __( 'Discount updated.', 'invoicing' ),
69
-			2   => __( 'Custom field updated.', 'invoicing' ),
70
-			3   => __( 'Custom field deleted.', 'invoicing' ),
71
-			4   => __( 'Discount updated.', 'invoicing' ),
72
-			5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Discount restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
73
-			6   => __( 'Discount updated.', 'invoicing' ),
74
-			7   => __( 'Discount saved.', 'invoicing' ),
75
-			8   => __( 'Discount submitted.', 'invoicing' ),
76
-			9   => wp_sprintf( __( 'Discount scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
77
-			10  => __( 'Discount draft updated.', 'invoicing' ),
68
+			1   => __('Discount updated.', 'invoicing'),
69
+			2   => __('Custom field updated.', 'invoicing'),
70
+			3   => __('Custom field deleted.', 'invoicing'),
71
+			4   => __('Discount updated.', 'invoicing'),
72
+			5   => isset($_GET['revision']) ? wp_sprintf(__('Discount restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false,
73
+			6   => __('Discount updated.', 'invoicing'),
74
+			7   => __('Discount saved.', 'invoicing'),
75
+			8   => __('Discount submitted.', 'invoicing'),
76
+			9   => wp_sprintf(__('Discount scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))),
77
+			10  => __('Discount draft updated.', 'invoicing'),
78 78
 		);
79 79
 
80 80
 		$messages['wpi_payment_form'] = array(
81 81
 			0   => '',
82
-			1   => __( 'Payment Form updated.', 'invoicing' ),
83
-			2   => __( 'Custom field updated.', 'invoicing' ),
84
-			3   => __( 'Custom field deleted.', 'invoicing' ),
85
-			4   => __( 'Payment Form updated.', 'invoicing' ),
86
-			5   => isset( $_GET['revision'] ) ? wp_sprintf( __( 'Payment Form restored to revision from %s', 'invoicing' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
87
-			6   => __( 'Payment Form updated.', 'invoicing' ),
88
-			7   => __( 'Payment Form saved.', 'invoicing' ),
89
-			8   => __( 'Payment Form submitted.', 'invoicing' ),
90
-			9   => wp_sprintf( __( 'Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing' ), date_i18n( __( 'M j, Y @ G:i', 'invoicing' ), strtotime( $post->post_date ) ) ),
91
-			10  => __( 'Payment Form draft updated.', 'invoicing' ),
82
+			1   => __('Payment Form updated.', 'invoicing'),
83
+			2   => __('Custom field updated.', 'invoicing'),
84
+			3   => __('Custom field deleted.', 'invoicing'),
85
+			4   => __('Payment Form updated.', 'invoicing'),
86
+			5   => isset($_GET['revision']) ? wp_sprintf(__('Payment Form restored to revision from %s', 'invoicing'), wp_post_revision_title((int) $_GET['revision'], false)) : false,
87
+			6   => __('Payment Form updated.', 'invoicing'),
88
+			7   => __('Payment Form saved.', 'invoicing'),
89
+			8   => __('Payment Form submitted.', 'invoicing'),
90
+			9   => wp_sprintf(__('Payment Form scheduled for: <strong>%1$s</strong>.', 'invoicing'), date_i18n(__('M j, Y @ G:i', 'invoicing'), strtotime($post->post_date))),
91
+			10  => __('Payment Form draft updated.', 'invoicing'),
92 92
 		);
93 93
 
94 94
 		return $messages;
@@ -98,19 +98,19 @@  discard block
 block discarded – undo
98 98
 	/**
99 99
 	 * Post row actions.
100 100
 	 */
101
-	public static function post_row_actions( $actions, $post ) {
101
+	public static function post_row_actions($actions, $post) {
102 102
 
103
-		$post = get_post( $post );
103
+		$post = get_post($post);
104 104
 
105 105
 		// We do not want to edit the default payment form.
106
-		if ( 'wpi_payment_form' == $post->post_type ) {
106
+		if ('wpi_payment_form' == $post->post_type) {
107 107
 
108
-			if ( $post->ID == wpinv_get_default_payment_form() ) {
109
-				unset( $actions['trash'] );
110
-				unset( $actions['inline hide-if-no-js'] );
108
+			if ($post->ID == wpinv_get_default_payment_form()) {
109
+				unset($actions['trash']);
110
+				unset($actions['inline hide-if-no-js']);
111 111
 			}
112 112
 
113
-			$actions['duplicate'] =  sprintf(
113
+			$actions['duplicate'] = sprintf(
114 114
 				'<a href="%1$s">%2$s</a>',
115 115
 				esc_url(
116 116
 					wp_nonce_url(
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 						'getpaid-nonce'
125 125
 					)
126 126
 				),
127
-				esc_html( __( 'Duplicate', 'invoicing' ) )
127
+				esc_html(__('Duplicate', 'invoicing'))
128 128
 			);
129 129
 
130 130
 		}
@@ -140,31 +140,31 @@  discard block
 block discarded – undo
140 140
 	 * @param WP_Post $post
141 141
      * @return array $actions actions without edit option
142 142
      */
143
-    public static function filter_invoice_row_actions( $actions, $post ) {
143
+    public static function filter_invoice_row_actions($actions, $post) {
144 144
 
145
-        if ( getpaid_is_invoice_post_type( $post->post_type ) ) {
145
+        if (getpaid_is_invoice_post_type($post->post_type)) {
146 146
 
147 147
 			$actions = array();
148
-			$invoice = new WPInv_Invoice( $post );
148
+			$invoice = new WPInv_Invoice($post);
149 149
 
150
-			$actions['edit'] =  sprintf(
150
+			$actions['edit'] = sprintf(
151 151
 				'<a href="%1$s">%2$s</a>',
152
-				esc_url( get_edit_post_link( $invoice->get_id() ) ),
153
-				esc_html( __( 'Edit', 'invoicing' ) )
152
+				esc_url(get_edit_post_link($invoice->get_id())),
153
+				esc_html(__('Edit', 'invoicing'))
154 154
 			);
155 155
 
156
-			if ( ! $invoice->is_draft() ) {
156
+			if (!$invoice->is_draft()) {
157 157
 
158
-				$actions['view'] =  sprintf(
158
+				$actions['view'] = sprintf(
159 159
 					'<a href="%1$s">%2$s</a>',
160
-					esc_url( $invoice->get_view_url() ),
160
+					esc_url($invoice->get_view_url()),
161 161
 					sprintf(
162
-						esc_html( __( 'View %s', 'invoicing' ) ),
163
-						getpaid_get_post_type_label( $invoice->get_post_type(), false )
162
+						esc_html(__('View %s', 'invoicing')),
163
+						getpaid_get_post_type_label($invoice->get_post_type(), false)
164 164
 					)
165 165
 				);
166 166
 
167
-				$actions['send'] =  sprintf(
167
+				$actions['send'] = sprintf(
168 168
 					'<a href="%1$s">%2$s</a>',
169 169
 					esc_url(
170 170
 						wp_nonce_url(
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 							'getpaid-nonce'
179 179
 						)
180 180
 					),
181
-					esc_html( __( 'Send to Customer', 'invoicing' ) )
181
+					esc_html(__('Send to Customer', 'invoicing'))
182 182
 				);
183 183
 
184 184
 			}
@@ -191,42 +191,42 @@  discard block
 block discarded – undo
191 191
 	/**
192 192
 	 * Returns an array of invoice table columns.
193 193
 	 */
194
-	public static function invoice_columns( $columns ) {
194
+	public static function invoice_columns($columns) {
195 195
 
196 196
 		$columns = array(
197 197
 			'cb'                => $columns['cb'],
198
-			'number'            => __( 'Invoice', 'invoicing' ),
199
-			'customer'          => __( 'Customer', 'invoicing' ),
200
-			'invoice_date'      => __( 'Created', 'invoicing' ),
201
-			'payment_date'      => __( 'Completed', 'invoicing' ),
202
-			'amount'            => __( 'Amount', 'invoicing' ),
203
-			'recurring'         => __( 'Recurring', 'invoicing' ),
204
-			'status'            => __( 'Status', 'invoicing' ),
198
+			'number'            => __('Invoice', 'invoicing'),
199
+			'customer'          => __('Customer', 'invoicing'),
200
+			'invoice_date'      => __('Created', 'invoicing'),
201
+			'payment_date'      => __('Completed', 'invoicing'),
202
+			'amount'            => __('Amount', 'invoicing'),
203
+			'recurring'         => __('Recurring', 'invoicing'),
204
+			'status'            => __('Status', 'invoicing'),
205 205
 		);
206 206
 
207
-		return apply_filters( 'wpi_invoice_table_columns', $columns );
207
+		return apply_filters('wpi_invoice_table_columns', $columns);
208 208
 	}
209 209
 
210 210
 	/**
211 211
 	 * Displays invoice table columns.
212 212
 	 */
213
-	public static function display_invoice_columns( $column_name, $post_id ) {
213
+	public static function display_invoice_columns($column_name, $post_id) {
214 214
 
215
-		$invoice = new WPInv_Invoice( $post_id );
215
+		$invoice = new WPInv_Invoice($post_id);
216 216
 
217
-		switch ( $column_name ) {
217
+		switch ($column_name) {
218 218
 
219 219
 			case 'invoice_date' :
220
-				$date_time = esc_attr( $invoice->get_created_date() );
221
-				$date      = getpaid_format_date_value( $date_time, "&mdash;", true );
220
+				$date_time = esc_attr($invoice->get_created_date());
221
+				$date      = getpaid_format_date_value($date_time, "&mdash;", true);
222 222
 				echo "<span title='$date_time'>$date</span>";
223 223
 				break;
224 224
 
225 225
 			case 'payment_date' :
226 226
 
227
-				if ( $invoice->is_paid() ) {
228
-					$date_time = esc_attr( $invoice->get_completed_date() );
229
-					$date      = getpaid_format_date_value( $date_time, "&mdash;", true );
227
+				if ($invoice->is_paid()) {
228
+					$date_time = esc_attr($invoice->get_completed_date());
229
+					$date      = getpaid_format_date_value($date_time, "&mdash;", true);
230 230
 					echo "<span title='$date_time'>$date</span>";
231 231
 				} else {
232 232
 					echo "&mdash;";
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
 			case 'amount' :
238 238
 
239 239
 				$amount = $invoice->get_total();
240
-				$formated_amount = wpinv_price( $amount, $invoice->get_currency() );
240
+				$formated_amount = wpinv_price($amount, $invoice->get_currency());
241 241
 
242
-				if ( $invoice->is_refunded() ) {
243
-					$refunded_amount = wpinv_price( 0, $invoice->get_currency() );
242
+				if ($invoice->is_refunded()) {
243
+					$refunded_amount = wpinv_price(0, $invoice->get_currency());
244 244
 					echo "<del>$formated_amount</del>&nbsp;<ins>$refunded_amount</ins>";
245 245
 				} else {
246 246
 
247 247
 					$discount = $invoice->get_total_discount();
248 248
 
249
-					if ( ! empty( $discount ) ) {
250
-						$new_amount = wpinv_price( $amount + $discount, $invoice->get_currency() );
249
+					if (!empty($discount)) {
250
+						$new_amount = wpinv_price($amount + $discount, $invoice->get_currency());
251 251
 						echo "<del>$new_amount</del>&nbsp;<ins>$formated_amount</ins>";
252 252
 					} else {
253 253
 						echo $formated_amount;
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
 				break;
259 259
 
260 260
 			case 'status' :
261
-				$status       = esc_html( $invoice->get_status() );
262
-				$status_label = esc_html( $invoice->get_status_nicename() );
261
+				$status       = esc_html($invoice->get_status());
262
+				$status_label = esc_html($invoice->get_status_nicename());
263 263
 
264 264
 				// If it is paid, show the gateway title.
265
-				if ( $invoice->is_paid() ) {
266
-					$gateway = esc_html( $invoice->get_gateway_title() );
267
-					$gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), $gateway );
265
+				if ($invoice->is_paid()) {
266
+					$gateway = esc_html($invoice->get_gateway_title());
267
+					$gateway = wp_sprintf(esc_attr__('Paid via %s', 'invoicing'), $gateway);
268 268
 
269 269
 					echo "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>";
270 270
 				} else {
@@ -272,22 +272,22 @@  discard block
 block discarded – undo
272 272
 				}
273 273
 
274 274
 				// If it is not paid, display the overdue and view status.
275
-				if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
275
+				if (!$invoice->is_paid() && !$invoice->is_refunded()) {
276 276
 
277 277
 					// Invoice view status.
278
-					if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) {
279
-						echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="'. esc_attr__( 'Viewed by Customer', 'invoicing' ).'"></i>';
278
+					if (wpinv_is_invoice_viewed($invoice->get_id())) {
279
+						echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="' . esc_attr__('Viewed by Customer', 'invoicing') . '"></i>';
280 280
 					} else {
281
-						echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="'. esc_attr__( 'Not Viewed by Customer', 'invoicing' ).'"></i>';
281
+						echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="' . esc_attr__('Not Viewed by Customer', 'invoicing') . '"></i>';
282 282
 					}
283 283
 
284 284
 					// Display the overview status.
285
-					if ( wpinv_get_option( 'overdue_active' ) ) {
285
+					if (wpinv_get_option('overdue_active')) {
286 286
 						$due_date = $invoice->get_due_date();
287
-						$fomatted = getpaid_format_date( $due_date );
287
+						$fomatted = getpaid_format_date($due_date);
288 288
 
289
-						if ( ! empty( $fomatted ) ) {
290
-							$date = wp_sprintf( __( 'Due %s', 'invoicing' ), $fomatted );
289
+						if (!empty($fomatted)) {
290
+							$date = wp_sprintf(__('Due %s', 'invoicing'), $fomatted);
291 291
 							echo "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>";
292 292
 						}
293 293
 					}
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 
299 299
 			case 'recurring':
300 300
 
301
-				if ( $invoice->is_recurring() ) {
301
+				if ($invoice->is_recurring()) {
302 302
 					echo '<i class="fa fa-check" style="color:#43850a;"></i>';
303 303
 				} else {
304 304
 					echo '<i class="fa fa-times" style="color:#616161;"></i>';
@@ -307,9 +307,9 @@  discard block
 block discarded – undo
307 307
 
308 308
 			case 'number' :
309 309
 
310
-				$edit_link       = esc_url( get_edit_post_link( $invoice->get_id() ) );
311
-				$invoice_number  = esc_html( $invoice->get_number() );
312
-				$invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' );
310
+				$edit_link       = esc_url(get_edit_post_link($invoice->get_id()));
311
+				$invoice_number  = esc_html($invoice->get_number());
312
+				$invoice_details = esc_attr__('View Invoice Details', 'invoicing');
313 313
 
314 314
 				echo "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>";
315 315
 
@@ -319,13 +319,13 @@  discard block
 block discarded – undo
319 319
 	
320 320
 				$customer_name = $invoice->get_user_full_name();
321 321
 	
322
-				if ( empty( $customer_name ) ) {
322
+				if (empty($customer_name)) {
323 323
 					$customer_name = $invoice->get_email();
324 324
 				}
325 325
 	
326
-				if ( ! empty( $customer_name ) ) {
327
-					$customer_details = esc_attr__( 'View Customer Details', 'invoicing' );
328
-					$view_link        = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) );
326
+				if (!empty($customer_name)) {
327
+					$customer_details = esc_attr__('View Customer Details', 'invoicing');
328
+					$view_link        = esc_url(add_query_arg('user_id', $invoice->get_user_id(), admin_url('user-edit.php')));
329 329
 					echo "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>";
330 330
 				} else {
331 331
 					echo '<div>&mdash;</div>';
@@ -340,27 +340,27 @@  discard block
 block discarded – undo
340 340
 	/**
341 341
 	 * Displays invoice bulk actions.
342 342
 	 */
343
-	public static function invoice_bulk_actions( $actions ) {
344
-		$actions['resend-invoice'] = __( 'Send to Customer', 'invoicing' );
343
+	public static function invoice_bulk_actions($actions) {
344
+		$actions['resend-invoice'] = __('Send to Customer', 'invoicing');
345 345
 		return $actions;
346 346
 	}
347 347
 
348 348
 	/**
349 349
 	 * Processes invoice bulk actions.
350 350
 	 */
351
-	public static function handle_invoice_bulk_actions( $redirect_url, $action, $post_ids ) {
351
+	public static function handle_invoice_bulk_actions($redirect_url, $action, $post_ids) {
352 352
 
353
-		if ( $action == 'resend-invoice' ) {
353
+		if ($action == 'resend-invoice') {
354 354
 
355 355
 			$success = false;
356
-			foreach ( $post_ids as $post_id ) {
357
-				$success = getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $post_id ), true );
356
+			foreach ($post_ids as $post_id) {
357
+				$success = getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($post_id), true);
358 358
 			}
359 359
 
360
-			if ( $success ) {
361
-				getpaid_admin()->show_success( __( 'Invoices were successfully sent', 'invoicing' ) );
360
+			if ($success) {
361
+				getpaid_admin()->show_success(__('Invoices were successfully sent', 'invoicing'));
362 362
 			} else {
363
-				getpaid_admin()->show_error( __( 'Could not send some invoices', 'invoicing' ) );
363
+				getpaid_admin()->show_error(__('Could not send some invoices', 'invoicing'));
364 364
 			}
365 365
 
366 366
 		}
@@ -372,50 +372,50 @@  discard block
 block discarded – undo
372 372
 	/**
373 373
 	 * Returns an array of payment forms table columns.
374 374
 	 */
375
-	public static function payment_form_columns( $columns ) {
375
+	public static function payment_form_columns($columns) {
376 376
 
377 377
 		$columns = array(
378 378
 			'cb'                => $columns['cb'],
379
-			'title'             => __( 'Name', 'invoicing' ),
380
-			'shortcode'         => __( 'Shortcode', 'invoicing' ),
381
-			'earnings'          => __( 'Revenue', 'invoicing' ),
382
-			'refunds'           => __( 'Refunded', 'invoicing' ),
383
-			'items'             => __( 'Items', 'invoicing' ),
384
-			'date'              => __( 'Date', 'invoicing' ),
379
+			'title'             => __('Name', 'invoicing'),
380
+			'shortcode'         => __('Shortcode', 'invoicing'),
381
+			'earnings'          => __('Revenue', 'invoicing'),
382
+			'refunds'           => __('Refunded', 'invoicing'),
383
+			'items'             => __('Items', 'invoicing'),
384
+			'date'              => __('Date', 'invoicing'),
385 385
 		);
386 386
 
387
-		return apply_filters( 'wpi_payment_form_table_columns', $columns );
387
+		return apply_filters('wpi_payment_form_table_columns', $columns);
388 388
 
389 389
 	}
390 390
 
391 391
 	/**
392 392
 	 * Displays payment form table columns.
393 393
 	 */
394
-	public static function display_payment_form_columns( $column_name, $post_id ) {
394
+	public static function display_payment_form_columns($column_name, $post_id) {
395 395
 
396 396
 		// Retrieve the payment form.
397
-		$form = new GetPaid_Payment_Form( $post_id );
397
+		$form = new GetPaid_Payment_Form($post_id);
398 398
 
399
-		switch ( $column_name ) {
399
+		switch ($column_name) {
400 400
 
401 401
 			case 'earnings' :
402
-				echo wpinv_price( $form->get_earned() );
402
+				echo wpinv_price($form->get_earned());
403 403
 				break;
404 404
 
405 405
 			case 'refunds' :
406
-				echo wpinv_price( $form->get_refunded() );
406
+				echo wpinv_price($form->get_refunded());
407 407
 				break;
408 408
 
409 409
 			case 'refunds' :
410
-				echo wpinv_price( $form->get_refunded() );
410
+				echo wpinv_price($form->get_refunded());
411 411
 				break;
412 412
 
413 413
 			case 'shortcode' :
414 414
 
415
-				if ( $form->is_default() ) {
415
+				if ($form->is_default()) {
416 416
 					echo '&mdash;';
417 417
 				} else {
418
-					echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>';
418
+					echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr($form->get_id()) . ']" style="width: 100%;" readonly/>';
419 419
 				}
420 420
 
421 421
 				break;
@@ -424,29 +424,29 @@  discard block
 block discarded – undo
424 424
 
425 425
 				$items = $form->get_items();
426 426
 
427
-				if ( $form->is_default() || empty( $items ) ) {
427
+				if ($form->is_default() || empty($items)) {
428 428
 					echo '&mdash;';
429 429
 					return;
430 430
 				}
431 431
 
432 432
 				$_items = array();
433 433
 
434
-				foreach ( $items as $item ) {
434
+				foreach ($items as $item) {
435 435
 					$url = $item->get_edit_url();
436 436
 
437
-					if ( empty( $url ) ) {
438
-						$_items[] = esc_html( $item->get_name() );
437
+					if (empty($url)) {
438
+						$_items[] = esc_html($item->get_name());
439 439
 					} else {
440 440
 						$_items[] = sprintf(
441 441
 							'<a href="%s">%s</a>',
442
-							esc_url( $url ),
443
-							esc_html( $item->get_name() )
442
+							esc_url($url),
443
+							esc_html($item->get_name())
444 444
 						);
445 445
 					}
446 446
 
447 447
 				}
448 448
 
449
-				echo implode( '<br>', $_items );
449
+				echo implode('<br>', $_items);
450 450
 
451 451
 				break;
452 452
 
@@ -457,10 +457,10 @@  discard block
 block discarded – undo
457 457
 	/**
458 458
 	 * Filters post states.
459 459
 	 */
460
-	public static function filter_payment_form_state( $post_states, $post ) {
460
+	public static function filter_payment_form_state($post_states, $post) {
461 461
 
462
-		if ( 'wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID ) {
463
-			$post_states[ 'default_form' ] = __( 'Default Payment Form', 'invoicing' );
462
+		if ('wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID) {
463
+			$post_states['default_form'] = __('Default Payment Form', 'invoicing');
464 464
 		}
465 465
 	
466 466
 		return $post_states;
@@ -470,35 +470,35 @@  discard block
 block discarded – undo
470 470
 	/**
471 471
 	 * Returns an array of coupon table columns.
472 472
 	 */
473
-	public static function discount_columns( $columns ) {
473
+	public static function discount_columns($columns) {
474 474
 
475 475
 		$columns = array(
476 476
 			'cb'                => $columns['cb'],
477
-			'title'             => __( 'Name', 'invoicing' ),
478
-			'code'              => __( 'Code', 'invoicing' ),
479
-			'amount'            => __( 'Amount', 'invoicing' ),
480
-			'usage'             => __( 'Usage / Limit', 'invoicing' ),
481
-			'start_date'        => __( 'Start Date', 'invoicing' ),
482
-			'expiry_date'       => __( 'Expiry Date', 'invoicing' ),
477
+			'title'             => __('Name', 'invoicing'),
478
+			'code'              => __('Code', 'invoicing'),
479
+			'amount'            => __('Amount', 'invoicing'),
480
+			'usage'             => __('Usage / Limit', 'invoicing'),
481
+			'start_date'        => __('Start Date', 'invoicing'),
482
+			'expiry_date'       => __('Expiry Date', 'invoicing'),
483 483
 		);
484 484
 
485
-		return apply_filters( 'wpi_discount_table_columns', $columns );
485
+		return apply_filters('wpi_discount_table_columns', $columns);
486 486
 	}
487 487
 
488 488
 	/**
489 489
 	 * Filters post states.
490 490
 	 */
491
-	public static function filter_discount_state( $post_states, $post ) {
491
+	public static function filter_discount_state($post_states, $post) {
492 492
 
493
-		if ( 'wpi_discount' == $post->post_type ) {
493
+		if ('wpi_discount' == $post->post_type) {
494 494
 
495
-			$discount = new WPInv_Discount( $post );
495
+			$discount = new WPInv_Discount($post);
496 496
 
497 497
 			$status = $discount->is_expired() ? 'expired' : $discount->get_status();
498 498
 
499
-			if ( $status != 'publish' ) {
499
+			if ($status != 'publish') {
500 500
 				return array(
501
-					'discount_status' => wpinv_discount_status( $status ),
501
+					'discount_status' => wpinv_discount_status($status),
502 502
 				);
503 503
 			}
504 504
 
@@ -513,30 +513,30 @@  discard block
 block discarded – undo
513 513
 	/**
514 514
 	 * Returns an array of items table columns.
515 515
 	 */
516
-	public static function item_columns( $columns ) {
516
+	public static function item_columns($columns) {
517 517
 
518 518
 		$columns = array(
519 519
 			'cb'                => $columns['cb'],
520
-			'title'             => __( 'Name', 'invoicing' ),
521
-			'price'             => __( 'Price', 'invoicing' ),
522
-			'vat_rule'          => __( 'VAT rule', 'invoicing' ),
523
-			'vat_class'         => __( 'VAT class', 'invoicing' ),
524
-			'type'              => __( 'Type', 'invoicing' ),
525
-			'shortcode'         => __( 'Shortcode', 'invoicing' ),
520
+			'title'             => __('Name', 'invoicing'),
521
+			'price'             => __('Price', 'invoicing'),
522
+			'vat_rule'          => __('VAT rule', 'invoicing'),
523
+			'vat_class'         => __('VAT class', 'invoicing'),
524
+			'type'              => __('Type', 'invoicing'),
525
+			'shortcode'         => __('Shortcode', 'invoicing'),
526 526
 		);
527 527
 
528
-		if ( ! wpinv_use_taxes() ) {
529
-			unset( $columns['vat_rule'] );
530
-			unset( $columns['vat_class'] );
528
+		if (!wpinv_use_taxes()) {
529
+			unset($columns['vat_rule']);
530
+			unset($columns['vat_class']);
531 531
 		}
532 532
 
533
-		return apply_filters( 'wpi_item_table_columns', $columns );
533
+		return apply_filters('wpi_item_table_columns', $columns);
534 534
 	}
535 535
 
536 536
 	/**
537 537
 	 * Returns an array of sortable items table columns.
538 538
 	 */
539
-	public static function sortable_item_columns( $columns ) {
539
+	public static function sortable_item_columns($columns) {
540 540
 
541 541
 		return array_merge(
542 542
 			$columns,
@@ -553,49 +553,49 @@  discard block
 block discarded – undo
553 553
 	/**
554 554
 	 * Displays items table columns.
555 555
 	 */
556
-	public static function display_item_columns( $column_name, $post_id ) {
556
+	public static function display_item_columns($column_name, $post_id) {
557 557
  
558
-		$item = new WPInv_Item( $post_id );
558
+		$item = new WPInv_Item($post_id);
559 559
 
560
-		switch ( $column_name ) {
560
+		switch ($column_name) {
561 561
 
562 562
 			case 'price' :
563 563
 
564
-				if ( ! $item->is_recurring() ) {
564
+				if (!$item->is_recurring()) {
565 565
 					echo $item->get_the_price();
566 566
 					break;
567 567
 				}
568 568
 
569 569
 				$price = wp_sprintf(
570
-					__( '%s / %s', 'invoicing' ),
570
+					__('%s / %s', 'invoicing'),
571 571
 					$item->get_the_price(),
572
-					getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' )
572
+					getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '')
573 573
 				);
574 574
 
575
-				if ( $item->get_the_price() == $item->get_the_initial_price() ) {
575
+				if ($item->get_the_price() == $item->get_the_initial_price()) {
576 576
 					echo $price;
577 577
 					break;
578 578
 				}
579 579
 
580 580
 				echo $item->get_the_initial_price();
581 581
 
582
-				echo '<span class="meta">' . wp_sprintf( __( 'then %s', 'invoicing' ), $price )  .'</span>';
582
+				echo '<span class="meta">' . wp_sprintf(__('then %s', 'invoicing'), $price) . '</span>';
583 583
 				break;
584 584
 
585 585
 			case 'vat_rule' :
586
-				echo getpaid_get_tax_rule_label( $item->get_vat_rule() );
586
+				echo getpaid_get_tax_rule_label($item->get_vat_rule());
587 587
 				break;
588 588
 
589 589
 			case 'vat_class' :
590
-				echo getpaid_get_tax_class_label( $item->get_vat_class() );
590
+				echo getpaid_get_tax_class_label($item->get_vat_class());
591 591
 				break;
592 592
 
593 593
 			case 'shortcode' :
594
-				echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
594
+				echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr($item->get_id()) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
595 595
 				break;
596 596
 
597 597
 			case 'type' :
598
-				echo wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>';
598
+				echo wpinv_item_type($item->get_id()) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>';
599 599
 				break;
600 600
 
601 601
 		}
@@ -605,21 +605,21 @@  discard block
 block discarded – undo
605 605
 	/**
606 606
 	 * Lets users filter items using taxes.
607 607
 	 */
608
-	public static function add_item_filters( $post_type ) {
608
+	public static function add_item_filters($post_type) {
609 609
 
610 610
 		// Abort if we're not dealing with items.
611
-		if ( $post_type != 'wpi_item' ) {
611
+		if ($post_type != 'wpi_item') {
612 612
 			return;
613 613
 		}
614 614
 
615 615
 		// Filter by vat rules.
616
-		if ( wpinv_use_taxes() ) {
616
+		if (wpinv_use_taxes()) {
617 617
 	
618 618
 			// Sanitize selected vat rule.
619 619
 			$vat_rule   = '';
620 620
 			$vat_rules  = getpaid_get_tax_rules();
621
-			if ( isset( $_GET['vat_rule'] ) ) {
622
-				$vat_rule   =  $_GET['vat_rule'];
621
+			if (isset($_GET['vat_rule'])) {
622
+				$vat_rule = $_GET['vat_rule'];
623 623
 			}
624 624
 
625 625
 			// Filter by VAT rule.
@@ -627,13 +627,13 @@  discard block
 block discarded – undo
627 627
 				array(
628 628
 					'options'          => array_merge(
629 629
 						array(
630
-							'' => __( 'All VAT rules', 'invoicing' )
630
+							'' => __('All VAT rules', 'invoicing')
631 631
 						),
632 632
 						$vat_rules
633 633
 					),
634 634
 					'name'             => 'vat_rule',
635 635
 					'id'               => 'vat_rule',
636
-					'selected'         => in_array( $vat_rule, array_keys( $vat_rules ) ) ? $vat_rule : '',
636
+					'selected'         => in_array($vat_rule, array_keys($vat_rules)) ? $vat_rule : '',
637 637
 					'show_option_all'  => false,
638 638
 					'show_option_none' => false,
639 639
 				)
@@ -644,21 +644,21 @@  discard block
 block discarded – undo
644 644
 			// Sanitize selected vat rule.
645 645
 			$vat_class   = '';
646 646
 			$vat_classes = getpaid_get_tax_classes();
647
-			if ( isset( $_GET['vat_class'] ) ) {
648
-				$vat_class   =  $_GET['vat_class'];
647
+			if (isset($_GET['vat_class'])) {
648
+				$vat_class = $_GET['vat_class'];
649 649
 			}
650 650
 
651 651
 			echo wpinv_html_select(
652 652
 				array(
653 653
 					'options'          => array_merge(
654 654
 						array(
655
-							'' => __( 'All VAT classes', 'invoicing' )
655
+							'' => __('All VAT classes', 'invoicing')
656 656
 						),
657 657
 						$vat_classes
658 658
 					),
659 659
 					'name'             => 'vat_class',
660 660
 					'id'               => 'vat_class',
661
-					'selected'         => in_array( $vat_class, array_keys( $vat_classes ) ) ? $vat_class : '',
661
+					'selected'         => in_array($vat_class, array_keys($vat_classes)) ? $vat_class : '',
662 662
 					'show_option_all'  => false,
663 663
 					'show_option_none' => false,
664 664
 				)
@@ -667,22 +667,22 @@  discard block
 block discarded – undo
667 667
 		}
668 668
 
669 669
 		// Filter by item type.
670
-		$type   = '';
671
-		if ( isset( $_GET['type'] ) ) {
672
-			$type   =  $_GET['type'];
670
+		$type = '';
671
+		if (isset($_GET['type'])) {
672
+			$type = $_GET['type'];
673 673
 		}
674 674
 
675 675
 		echo wpinv_html_select(
676 676
 			array(
677 677
 				'options'          => array_merge(
678 678
 					array(
679
-						'' => __( 'All item types', 'invoicing' )
679
+						'' => __('All item types', 'invoicing')
680 680
 					),
681 681
 					wpinv_get_item_types()
682 682
 				),
683 683
 				'name'             => 'type',
684 684
 				'id'               => 'type',
685
-				'selected'         => in_array( $type, wpinv_item_types() ) ? $type : '',
685
+				'selected'         => in_array($type, wpinv_item_types()) ? $type : '',
686 686
 				'show_option_all'  => false,
687 687
 				'show_option_none' => false,
688 688
 			)
@@ -693,45 +693,45 @@  discard block
 block discarded – undo
693 693
 	/**
694 694
 	 * Filters the item query.
695 695
 	 */
696
-	public static function filter_item_query( $query ) {
696
+	public static function filter_item_query($query) {
697 697
 
698 698
 		// modify the query only if it admin and main query.
699
-		if ( ! ( is_admin() && $query->is_main_query() ) ){ 
699
+		if (!(is_admin() && $query->is_main_query())) { 
700 700
 			return $query;
701 701
 		}
702 702
 
703 703
 		// we want to modify the query for our items.
704
-		if ( empty( $query->query['post_type'] ) || 'wpi_item' != $query->query['post_type'] ){
704
+		if (empty($query->query['post_type']) || 'wpi_item' != $query->query['post_type']) {
705 705
 			return $query;
706 706
 		}
707 707
 
708
-		if ( empty( $query->query_vars['meta_query'] ) ) {
708
+		if (empty($query->query_vars['meta_query'])) {
709 709
 			$query->query_vars['meta_query'] = array();
710 710
 		}
711 711
 
712 712
 		// Filter vat rule type
713
-        if ( ! empty( $_GET['vat_rule'] ) ) {
713
+        if (!empty($_GET['vat_rule'])) {
714 714
             $query->query_vars['meta_query'][] = array(
715 715
                 'key'     => '_wpinv_vat_rule',
716
-                'value'   => sanitize_text_field( $_GET['vat_rule'] ),
716
+                'value'   => sanitize_text_field($_GET['vat_rule']),
717 717
                 'compare' => '='
718 718
             );
719 719
         }
720 720
 
721 721
         // Filter vat class
722
-        if ( ! empty( $_GET['vat_class'] ) ) {
722
+        if (!empty($_GET['vat_class'])) {
723 723
             $query->query_vars['meta_query'][] = array(
724 724
                 'key'     => '_wpinv_vat_class',
725
-                'value'   => sanitize_text_field( $_GET['vat_class'] ),
725
+                'value'   => sanitize_text_field($_GET['vat_class']),
726 726
                 'compare' => '='
727 727
             );
728 728
         }
729 729
 
730 730
         // Filter item type
731
-        if ( ! empty( $_GET['type'] ) ) {
731
+        if (!empty($_GET['type'])) {
732 732
             $query->query_vars['meta_query'][] = array(
733 733
                 'key'     => '_wpinv_type',
734
-                'value'   => sanitize_text_field( $_GET['type'] ),
734
+                'value'   => sanitize_text_field($_GET['type']),
735 735
                 'compare' => '='
736 736
             );
737 737
 		}
@@ -741,15 +741,15 @@  discard block
 block discarded – undo
741 741
 	/**
742 742
 	 * Reorders items.
743 743
 	 */
744
-	public static function reorder_items( $vars ) {
744
+	public static function reorder_items($vars) {
745 745
 		global $typenow;
746 746
 
747
-		if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) {
747
+		if ('wpi_item' !== $typenow || empty($vars['orderby'])) {
748 748
 			return $vars;
749 749
 		}
750 750
 
751 751
 		// By item type.
752
-		if ( 'type' == $vars['orderby'] ) {
752
+		if ('type' == $vars['orderby']) {
753 753
 			return array_merge(
754 754
 				$vars,
755 755
 				array(
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 		}
761 761
 
762 762
 		// By vat class.
763
-		if ( 'vat_class' == $vars['orderby'] ) {
763
+		if ('vat_class' == $vars['orderby']) {
764 764
 			return array_merge(
765 765
 				$vars,
766 766
 				array(
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 		}
772 772
 
773 773
 		// By vat rule.
774
-		if ( 'vat_rule' == $vars['orderby'] ) {
774
+		if ('vat_rule' == $vars['orderby']) {
775 775
 			return array_merge(
776 776
 				$vars,
777 777
 				array(
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 		}
783 783
 
784 784
 		// By price.
785
-		if ( 'price' == $vars['orderby'] ) {
785
+		if ('price' == $vars['orderby']) {
786 786
 			return array_merge(
787 787
 				$vars,
788 788
 				array(
@@ -799,27 +799,27 @@  discard block
 block discarded – undo
799 799
 	/**
800 800
 	 * Fired when deleting a post.
801 801
 	 */
802
-	public static function delete_post( $post_id ) {
802
+	public static function delete_post($post_id) {
803 803
 
804
-		switch ( get_post_type( $post_id ) ) {
804
+		switch (get_post_type($post_id)) {
805 805
 
806 806
 			case 'wpi_item' :
807
-				do_action( "getpaid_before_delete_item", new WPInv_Item( $post_id ) );
807
+				do_action("getpaid_before_delete_item", new WPInv_Item($post_id));
808 808
 				break;
809 809
 
810 810
 			case 'wpi_payment_form' :
811
-				do_action( "getpaid_before_delete_payment_form", new GetPaid_Payment_Form( $post_id ) );
811
+				do_action("getpaid_before_delete_payment_form", new GetPaid_Payment_Form($post_id));
812 812
 				break;
813 813
 
814 814
 			case 'wpi_discount' :
815
-				do_action( "getpaid_before_delete_discount", new WPInv_Discount( $post_id ) );
815
+				do_action("getpaid_before_delete_discount", new WPInv_Discount($post_id));
816 816
 				break;
817 817
 
818 818
 			case 'wpi_invoice' :
819
-				$invoice = new WPInv_Invoice( $post_id );
820
-				do_action( "getpaid_before_delete_invoice", $invoice );
821
-				$invoice->get_data_store()->delete_items( $invoice );
822
-				$invoice->get_data_store()->delete_special_fields( $invoice );
819
+				$invoice = new WPInv_Invoice($post_id);
820
+				do_action("getpaid_before_delete_invoice", $invoice);
821
+				$invoice->get_data_store()->delete_items($invoice);
822
+				$invoice->get_data_store()->delete_special_fields($invoice);
823 823
 				break;
824 824
 		}
825 825
 	}
@@ -832,29 +832,29 @@  discard block
 block discarded – undo
832 832
      *
833 833
      * @return mixed
834 834
      */
835
-    public static function add_display_post_states( $post_states, $post ) {
835
+    public static function add_display_post_states($post_states, $post) {
836 836
 
837
-        if ( wpinv_get_option( 'success_page', 0 ) == $post->ID ) {
838
-            $post_states['getpaid_success_page'] = __( 'GetPaid Receipt Page', 'invoicing' );
837
+        if (wpinv_get_option('success_page', 0) == $post->ID) {
838
+            $post_states['getpaid_success_page'] = __('GetPaid Receipt Page', 'invoicing');
839 839
         }
840 840
 
841
-		foreach ( getpaid_get_invoice_post_types() as $post_type => $label ) {
841
+		foreach (getpaid_get_invoice_post_types() as $post_type => $label) {
842 842
 
843
-			if ( wpinv_get_option( "{$post_type}_history_page", 0 ) == $post->ID ) {
843
+			if (wpinv_get_option("{$post_type}_history_page", 0) == $post->ID) {
844 844
 				$post_states["getpaid_{$post_type}_history_page"] = sprintf(
845
-					__( 'GetPaid %s History Page', 'invoicing' ),
845
+					__('GetPaid %s History Page', 'invoicing'),
846 846
 					$label
847 847
 				);
848 848
 			}
849 849
 
850 850
 		}
851 851
 		
852
-		if ( wpinv_get_option( 'invoice_subscription_page', 0 ) == $post->ID ) {
853
-            $post_states['getpaid_invoice_subscription_page'] = __( 'GetPaid Subscription Page', 'invoicing' );
852
+		if (wpinv_get_option('invoice_subscription_page', 0) == $post->ID) {
853
+            $post_states['getpaid_invoice_subscription_page'] = __('GetPaid Subscription Page', 'invoicing');
854 854
         }
855 855
 
856
-		if ( wpinv_get_option( 'checkout_page', 0 ) == $post->ID ) {
857
-            $post_states['getpaid_checkout_page'] = __( 'GetPaid Checkout Page', 'invoicing' );
856
+		if (wpinv_get_option('checkout_page', 0) == $post->ID) {
857
+            $post_states['getpaid_checkout_page'] = __('GetPaid Checkout Page', 'invoicing');
858 858
         }
859 859
 
860 860
         return $post_states;
Please login to merge, or discard this patch.
includes/admin/class-wpinv-customers-table.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@  discard block
 block discarded – undo
5 5
  */
6 6
 
7 7
 // Exit if accessed directly
8
-if ( ! defined( 'ABSPATH' ) ) exit;
8
+if (!defined('ABSPATH')) exit;
9 9
 
10 10
 // Load WP_List_Table if not loaded
11
-if ( ! class_exists( 'WP_List_Table' ) ) {
11
+if (!class_exists('WP_List_Table')) {
12 12
 	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
13 13
 }
14 14
 
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	public function __construct() {
43 43
 
44 44
 		// Set parent defaults
45
-		parent::__construct( array(
45
+		parent::__construct(array(
46 46
 			'singular' => 'id',
47 47
 			'plural'   => 'ids',
48 48
 			'ajax'     => false,
49
-		) );
49
+		));
50 50
 
51 51
 	}
52 52
 
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return string Column Name
74 74
 	 */
75
-	public function column_default( $item, $column_name ) {
76
-		$value = esc_html( get_user_meta( $item->ID, '_wpinv_' . $column_name, true ) );
77
-		return apply_filters( 'wpinv_customers_table_column' . $column_name, $value, $item );
75
+	public function column_default($item, $column_name) {
76
+		$value = esc_html(get_user_meta($item->ID, '_wpinv_' . $column_name, true));
77
+		return apply_filters('wpinv_customers_table_column' . $column_name, $value, $item);
78 78
 	}
79 79
 
80 80
 	/**
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return string Column Name
88 88
 	 */
89
-	public function column_country( $user ) {
90
-		$country = wpinv_sanitize_country( $user->_wpinv_country );
91
-		if ( $country ) {
92
-			$country = wpinv_country_name( $country );
89
+	public function column_country($user) {
90
+		$country = wpinv_sanitize_country($user->_wpinv_country);
91
+		if ($country) {
92
+			$country = wpinv_country_name($country);
93 93
 		}
94
-		return esc_html( $country );
94
+		return esc_html($country);
95 95
 	}
96 96
 
97 97
 	/**
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @return string Column Name
105 105
 	 */
106
-	public function column_state( $user ) {
107
-		$country = wpinv_sanitize_country( $user->_wpinv_country );
106
+	public function column_state($user) {
107
+		$country = wpinv_sanitize_country($user->_wpinv_country);
108 108
 		$state   = $user->_wpinv_state;
109
-		if ( $state ) {
110
-			$state = wpinv_state_name( $state, $country );
109
+		if ($state) {
110
+			$state = wpinv_state_name($state, $country);
111 111
 		}
112 112
 
113
-		return esc_html( $state );
113
+		return esc_html($state);
114 114
 	}
115 115
 
116 116
 	/**
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @return string Column Name
124 124
 	 */
125
-	public function column_signup( $user ) {
126
-		return getpaid_format_date_value( $user->user_registered );
125
+	public function column_signup($user) {
126
+		return getpaid_format_date_value($user->user_registered);
127 127
 	}
128 128
 
129 129
 	/**
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @return string Column Name
137 137
 	 */
138
-	public function column_total( $user ) {
139
-		return wpinv_price( $this->column_total_raw( $user ) );
138
+	public function column_total($user) {
139
+		return wpinv_price($this->column_total_raw($user));
140 140
 	}
141 141
 
142 142
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @return float
150 150
 	 */
151
-	public function column_total_raw( $user ) {
151
+	public function column_total_raw($user) {
152 152
 
153 153
 		$args = array(
154 154
 			'data'             => array(
@@ -164,17 +164,17 @@  discard block
 block discarded – undo
164 164
 
165 165
 				'author'       => array(
166 166
 					'type'     => 'post_data',
167
-					'value'    => absint( $user->ID ),
167
+					'value'    => absint($user->ID),
168 168
 					'key'      => 'posts.post_author',
169 169
 					'operator' => '=',
170 170
 				),
171 171
 
172 172
 			),
173 173
 			'query_type'     => 'get_var',
174
-			'invoice_status' => array( 'wpi-renewal', 'wpi-processing', 'publish' ),
174
+			'invoice_status' => array('wpi-renewal', 'wpi-processing', 'publish'),
175 175
 		);
176 176
 
177
-		return wpinv_round_amount( GetPaid_Reports_Helper::get_invoice_report_data( $args ) );
177
+		return wpinv_round_amount(GetPaid_Reports_Helper::get_invoice_report_data($args));
178 178
 
179 179
 	}
180 180
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 *
188 188
 	 * @return string Column Name
189 189
 	 */
190
-	public function column_invoices( $user ) {
190
+	public function column_invoices($user) {
191 191
 
192 192
 		$args = array(
193 193
 			'data'             => array(
@@ -204,17 +204,17 @@  discard block
 block discarded – undo
204 204
 
205 205
 				'author'       => array(
206 206
 					'type'     => 'post_data',
207
-					'value'    => absint( $user->ID ),
207
+					'value'    => absint($user->ID),
208 208
 					'key'      => 'posts.post_author',
209 209
 					'operator' => '=',
210 210
 				),
211 211
 
212 212
 			),
213 213
 			'query_type'     => 'get_var',
214
-			'invoice_status' => array_keys( wpinv_get_invoice_statuses() ),
214
+			'invoice_status' => array_keys(wpinv_get_invoice_statuses()),
215 215
 		);
216 216
 
217
-		return absint( GetPaid_Reports_Helper::get_invoice_report_data( $args ) );
217
+		return absint(GetPaid_Reports_Helper::get_invoice_report_data($args));
218 218
 
219 219
 	}
220 220
 
@@ -224,15 +224,15 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @param int $item The user id.
226 226
 	 */
227
-	public function single_row( $item ) {
228
-		$item = get_user_by( 'id', $item );
227
+	public function single_row($item) {
228
+		$item = get_user_by('id', $item);
229 229
 
230
-		if ( empty( $item ) ) {
230
+		if (empty($item)) {
231 231
 			return;
232 232
 		}
233 233
 
234 234
 		echo '<tr>';
235
-		$this->single_row_columns( $item );
235
+		$this->single_row_columns($item);
236 236
 		echo '</tr>';
237 237
 	}
238 238
 
@@ -242,30 +242,30 @@  discard block
 block discarded – undo
242 242
 	 * @param  WP_User $customer customer.
243 243
 	 * @return string
244 244
 	 */
245
-	public function column_name( $customer ) {
245
+	public function column_name($customer) {
246 246
 
247 247
 		// Customer view URL.
248
-		$view_url    = esc_url( add_query_arg( 'user_id', $customer->ID, admin_url( 'user-edit.php' ) ) );
248
+		$view_url    = esc_url(add_query_arg('user_id', $customer->ID, admin_url('user-edit.php')));
249 249
 		$row_actions = $this->row_actions(
250 250
 			array(
251
-				'view' => '<a href="' . $view_url . '#getpaid-fieldset-billing">' . __( 'Edit Details', 'invoicing' ) . '</a>',
251
+				'view' => '<a href="' . $view_url . '#getpaid-fieldset-billing">' . __('Edit Details', 'invoicing') . '</a>',
252 252
 			)
253 253
 		);
254 254
 
255 255
 		// Get user's address.
256
-		$address = wpinv_get_user_address( $customer->ID );
256
+		$address = wpinv_get_user_address($customer->ID);
257 257
 
258 258
 		// Customer email address.
259
-		$email       = sanitize_email( $customer->user_email );
259
+		$email = sanitize_email($customer->user_email);
260 260
 
261 261
 		// Customer's avatar.
262
-		$avatar = esc_url( get_avatar_url( $email ) );
262
+		$avatar = esc_url(get_avatar_url($email));
263 263
 		$avatar = "<img src='$avatar' height='32' width='32'/>";
264 264
 
265 265
 		// Customer's name.
266
-		$name   = esc_html( "{$address['first_name']} {$address['last_name']}" );
266
+		$name   = esc_html("{$address['first_name']} {$address['last_name']}");
267 267
 
268
-		if ( ! empty( $name ) ) {
268
+		if (!empty($name)) {
269 269
 			$name = "<div style='overflow: hidden;height: 18px;'>$name</div>";
270 270
 		}
271 271
 
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
 	public function get_columns() {
285 285
 
286 286
 		$columns = array(
287
-			'name'     => __( 'Name', 'invoicing' ),
288
-			'country'  => __( 'Country', 'invoicing' ),
289
-			'state'    => __( 'State', 'invoicing' ),
290
-			'city'     => __( 'City', 'invoicing' ),
291
-			'zip'      => __( 'ZIP', 'invoicing' ),
292
-			'address'  => __( 'Address', 'invoicing' ),
293
-			'phone'    => __( 'Phone', 'invoicing' ),
294
-			'company'  => __( 'Company', 'invoicing' ),
295
-			'invoices' => __( 'Invoices', 'invoicing' ),
296
-			'total'    => __( 'Total Spend', 'invoicing' ),
297
-			'signup'   => __( 'Date created', 'invoicing' ),
287
+			'name'     => __('Name', 'invoicing'),
288
+			'country'  => __('Country', 'invoicing'),
289
+			'state'    => __('State', 'invoicing'),
290
+			'city'     => __('City', 'invoicing'),
291
+			'zip'      => __('ZIP', 'invoicing'),
292
+			'address'  => __('Address', 'invoicing'),
293
+			'phone'    => __('Phone', 'invoicing'),
294
+			'company'  => __('Company', 'invoicing'),
295
+			'invoices' => __('Invoices', 'invoicing'),
296
+			'total'    => __('Total Spend', 'invoicing'),
297
+			'signup'   => __('Date created', 'invoicing'),
298 298
 		);
299
-		return apply_filters( 'wpinv_customers_table_columns', $columns );
299
+		return apply_filters('wpinv_customers_table_columns', $columns);
300 300
 
301 301
 	}
302 302
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 * @return int Current page number
308 308
 	 */
309 309
 	public function get_paged() {
310
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
310
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
311 311
 	}
312 312
 
313 313
 	/**
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 * @since 1.0.19
317 317
 	 * @return void
318 318
 	 */
319
-	public function bulk_actions( $which = '' ) {
319
+	public function bulk_actions($which = '') {
320 320
 		return array();
321 321
 	}
322 322
 
@@ -328,23 +328,23 @@  discard block
 block discarded – undo
328 328
 
329 329
 		$post_types = '';
330 330
 
331
-		foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
332
-			$post_types .= $wpdb->prepare( "post_type=%s OR ", $post_type );
331
+		foreach (array_keys(getpaid_get_invoice_post_types()) as $post_type) {
332
+			$post_types .= $wpdb->prepare("post_type=%s OR ", $post_type);
333 333
 		}
334 334
 
335
-		$post_types = rtrim( $post_types, ' OR' );
335
+		$post_types = rtrim($post_types, ' OR');
336 336
 
337 337
 		// Maybe search.
338
-		if ( ! empty( $_POST['s'] ) ) {
338
+		if (!empty($_POST['s'])) {
339 339
 			$users = get_users(
340 340
 				array(
341
-					'search'         => '*' . sanitize_text_field( urldecode( $_POST['s'] ) ) . '*',
342
-					'search_columns' => array( 'user_login', 'user_email', 'display_name' ),
341
+					'search'         => '*' . sanitize_text_field(urldecode($_POST['s'])) . '*',
342
+					'search_columns' => array('user_login', 'user_email', 'display_name'),
343 343
 					'fields'         => 'ID',
344 344
 				)
345 345
 			);
346 346
 
347
-			$users      = implode( ', ', $users );
347
+			$users      = implode(', ', $users);
348 348
 			$post_types = "($post_types) AND ( post_author IN ( $users ) )";
349 349
 		}
350 350
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 		);
359 359
 
360 360
 		$this->items = $customers;
361
-		$this->total = (int) $wpdb->get_var( "SELECT COUNT( DISTINCT( post_author ) ) FROM $wpdb->posts WHERE $post_types" );
361
+		$this->total = (int) $wpdb->get_var("SELECT COUNT( DISTINCT( post_author ) ) FROM $wpdb->posts WHERE $post_types");
362 362
 
363 363
 	}
364 364
 
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 		$columns               = $this->get_columns();
373 373
 		$hidden                = array(); // No hidden columns
374 374
 		$sortable              = $this->get_sortable_columns();
375
-		$this->_column_headers = array( $columns, $hidden, $sortable );
375
+		$this->_column_headers = array($columns, $hidden, $sortable);
376 376
 		$this->prepare_query();
377 377
 
378 378
 		$this->set_pagination_args(
379 379
 			array(
380 380
 			'total_items' => $this->total,
381 381
 			'per_page'    => $this->per_page,
382
-			'total_pages' => ceil( $this->total / $this->per_page )
382
+			'total_pages' => ceil($this->total / $this->per_page)
383 383
 			)
384 384
 		);
385 385
 
Please login to merge, or discard this patch.
includes/admin/admin-pages.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // MUST have WordPress.
3
-if ( !defined( 'WPINC' ) ) {
4
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
3
+if (!defined('WPINC')) {
4
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
5 5
 }
6 6
 
7
-add_action( 'manage_wpi_discount_posts_custom_column', 'wpinv_discount_custom_column' );
8
-function wpinv_discount_custom_column( $column ) {
7
+add_action('manage_wpi_discount_posts_custom_column', 'wpinv_discount_custom_column');
8
+function wpinv_discount_custom_column($column) {
9 9
     global $post;
10 10
 
11
-    $discount = new WPInv_Discount( $post );
11
+    $discount = new WPInv_Discount($post);
12 12
 
13
-    switch ( $column ) {
13
+    switch ($column) {
14 14
         case 'code' :
15 15
             echo $discount->get_code();
16 16
         break;
@@ -21,31 +21,31 @@  discard block
 block discarded – undo
21 21
             echo $discount->get_usage();
22 22
         break;
23 23
         case 'start_date' :
24
-            echo getpaid_format_date_value( $discount->get_start_date() );
24
+            echo getpaid_format_date_value($discount->get_start_date());
25 25
         break;
26 26
         case 'expiry_date' :
27
-            echo getpaid_format_date_value( $discount->get_expiration_date(), __( 'Never', 'invoicing' ) );
27
+            echo getpaid_format_date_value($discount->get_expiration_date(), __('Never', 'invoicing'));
28 28
         break;
29 29
     }
30 30
 }
31 31
 
32
-add_filter( 'post_row_actions', 'wpinv_post_row_actions', 90, 2 );
33
-function wpinv_post_row_actions( $actions, $post ) {
34
-    $post_type = !empty( $post->post_type ) ? $post->post_type : '';
32
+add_filter('post_row_actions', 'wpinv_post_row_actions', 90, 2);
33
+function wpinv_post_row_actions($actions, $post) {
34
+    $post_type = !empty($post->post_type) ? $post->post_type : '';
35 35
 
36
-    if ( $post_type == 'wpi_discount' ) {
37
-        $actions = wpinv_discount_row_actions( $post, $actions );
36
+    if ($post_type == 'wpi_discount') {
37
+        $actions = wpinv_discount_row_actions($post, $actions);
38 38
     }
39 39
 
40 40
     return $actions;
41 41
 }
42 42
 
43
-function wpinv_discount_row_actions( $discount, $row_actions ) {
44
-    $row_actions  = array();
45
-    $edit_link = get_edit_post_link( $discount->ID );
46
-    $row_actions['edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit', 'invoicing' ) . '</a>';
43
+function wpinv_discount_row_actions($discount, $row_actions) {
44
+    $row_actions = array();
45
+    $edit_link = get_edit_post_link($discount->ID);
46
+    $row_actions['edit'] = '<a href="' . esc_url($edit_link) . '">' . __('Edit', 'invoicing') . '</a>';
47 47
 
48
-    if ( in_array( strtolower( $discount->post_status ),  array(  'publish' ) ) ) {
48
+    if (in_array(strtolower($discount->post_status), array('publish'))) {
49 49
 
50 50
         $url = wp_nonce_url(
51 51
             add_query_arg(
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
             'getpaid-nonce',
58 58
             'getpaid-nonce'
59 59
         );
60
-		$anchor = __( 'Deactivate', 'invoicing' );
61
-		$title  = esc_attr__( 'Are you sure you want to deactivate this discount?', 'invoicing' );
60
+		$anchor = __('Deactivate', 'invoicing');
61
+		$title  = esc_attr__('Are you sure you want to deactivate this discount?', 'invoicing');
62 62
         $row_actions['deactivate'] = "<a href='$url' onclick='return confirm(\"$title\")'>$anchor</a>";
63 63
 
64
-    } else if( in_array( strtolower( $discount->post_status ),  array( 'pending', 'draft' ) ) ) {
64
+    } else if (in_array(strtolower($discount->post_status), array('pending', 'draft'))) {
65 65
 
66
-        $url    = wp_nonce_url(
66
+        $url = wp_nonce_url(
67 67
             add_query_arg(
68 68
                 array(
69 69
                     'getpaid-admin-action' => 'activate_discount',
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
             'getpaid-nonce',
74 74
             'getpaid-nonce'
75 75
         );
76
-		$anchor = __( 'Activate', 'invoicing' );
77
-		$title  = esc_attr__( 'Are you sure you want to activate this discount?', 'invoicing' );
76
+		$anchor = __('Activate', 'invoicing');
77
+		$title  = esc_attr__('Are you sure you want to activate this discount?', 'invoicing');
78 78
         $row_actions['activate'] = "<a href='$url' onclick='return confirm(\"$title\")'>$anchor</a>";
79 79
 
80 80
     }
81 81
 
82
-    $url    = esc_url(
82
+    $url = esc_url(
83 83
         wp_nonce_url(
84 84
             add_query_arg(
85 85
                 array(
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
             'getpaid-nonce'
92 92
         )
93 93
     );
94
-	$anchor = __( 'Delete', 'invoicing' );
95
-	$title  = esc_attr__( 'Are you sure you want to delete this discount?', 'invoicing' );
94
+	$anchor = __('Delete', 'invoicing');
95
+	$title  = esc_attr__('Are you sure you want to delete this discount?', 'invoicing');
96 96
     $row_actions['delete'] = "<a href='$url' onclick='return confirm(\"$title\")'>$anchor</a>";
97 97
 
98
-    $row_actions = apply_filters( 'wpinv_discount_row_actions', $row_actions, $discount );
98
+    $row_actions = apply_filters('wpinv_discount_row_actions', $row_actions, $discount);
99 99
 
100 100
     return $row_actions;
101 101
 }
@@ -103,68 +103,68 @@  discard block
 block discarded – undo
103 103
 function wpinv_restrict_manage_posts() {
104 104
     global $typenow;
105 105
 
106
-    if( 'wpi_discount' == $typenow ) {
106
+    if ('wpi_discount' == $typenow) {
107 107
         wpinv_discount_filters();
108 108
     }
109 109
 }
110
-add_action( 'restrict_manage_posts', 'wpinv_restrict_manage_posts', 10 );
110
+add_action('restrict_manage_posts', 'wpinv_restrict_manage_posts', 10);
111 111
 
112 112
 function wpinv_discount_filters() {
113 113
 
114 114
     ?>
115 115
     <select name="discount_type" id="dropdown_wpinv_discount_type">
116
-        <option value=""><?php _e( 'Show all types', 'invoicing' ); ?></option>
116
+        <option value=""><?php _e('Show all types', 'invoicing'); ?></option>
117 117
         <?php
118 118
             $types = wpinv_get_discount_types();
119 119
 
120
-            foreach ( $types as $name => $type ) {
121
-                echo '<option value="' . esc_attr( $name ) . '"';
120
+            foreach ($types as $name => $type) {
121
+                echo '<option value="' . esc_attr($name) . '"';
122 122
 
123
-                if ( isset( $_GET['discount_type'] ) )
124
-                    selected( $name, $_GET['discount_type'] );
123
+                if (isset($_GET['discount_type']))
124
+                    selected($name, $_GET['discount_type']);
125 125
 
126
-                echo '>' . esc_html__( $type, 'invoicing' ) . '</option>';
126
+                echo '>' . esc_html__($type, 'invoicing') . '</option>';
127 127
             }
128 128
         ?>
129 129
     </select>
130 130
     <?php
131 131
 }
132 132
 
133
-function wpinv_request( $vars ) {
133
+function wpinv_request($vars) {
134 134
     global $typenow, $wp_post_statuses;
135 135
 
136
-    if ( getpaid_is_invoice_post_type( $typenow ) ) {
137
-        if ( ! isset( $vars['post_status'] ) ) {
138
-            $post_statuses = wpinv_get_invoice_statuses( false, false, $typenow );
136
+    if (getpaid_is_invoice_post_type($typenow)) {
137
+        if (!isset($vars['post_status'])) {
138
+            $post_statuses = wpinv_get_invoice_statuses(false, false, $typenow);
139 139
 
140
-            foreach ( $post_statuses as $status => $value ) {
141
-                if ( isset( $wp_post_statuses[ $status ] ) && false === $wp_post_statuses[ $status ]->show_in_admin_all_list ) {
142
-                    unset( $post_statuses[ $status ] );
140
+            foreach ($post_statuses as $status => $value) {
141
+                if (isset($wp_post_statuses[$status]) && false === $wp_post_statuses[$status]->show_in_admin_all_list) {
142
+                    unset($post_statuses[$status]);
143 143
                 }
144 144
             }
145 145
 
146
-            $vars['post_status'] = array_keys( $post_statuses );
146
+            $vars['post_status'] = array_keys($post_statuses);
147 147
         }
148 148
 
149
-    } else if ( 'wpi_discount' == $typenow ) {
150
-        $meta_query = !empty( $vars['meta_query'] ) ? $vars['meta_query'] : array();
149
+    } else if ('wpi_discount' == $typenow) {
150
+        $meta_query = !empty($vars['meta_query']) ? $vars['meta_query'] : array();
151 151
         // Filter vat rule type
152
-        if ( isset( $_GET['discount_type'] ) && $_GET['discount_type'] !== '' ) {
152
+        if (isset($_GET['discount_type']) && $_GET['discount_type'] !== '') {
153 153
             $meta_query[] = array(
154 154
                     'key'   => '_wpi_discount_type',
155
-                    'value' => sanitize_key( urldecode( $_GET['discount_type'] ) ),
155
+                    'value' => sanitize_key(urldecode($_GET['discount_type'])),
156 156
                     'compare' => '='
157 157
                 );
158 158
         }
159 159
 
160
-        if ( !empty( $meta_query ) ) {
160
+        if (!empty($meta_query)) {
161 161
             $vars['meta_query'] = $meta_query;
162 162
         }
163 163
     }
164 164
 
165 165
     return $vars;
166 166
 }
167
-add_filter( 'request', 'wpinv_request' );
167
+add_filter('request', 'wpinv_request');
168 168
 
169 169
 /**
170 170
  * Create a page and store the ID in an option.
@@ -176,19 +176,19 @@  discard block
 block discarded – undo
176 176
  * @param int $post_parent (default: 0) Parent for the new page
177 177
  * @return int page ID
178 178
  */
179
-function wpinv_create_page( $slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0 ) {
179
+function wpinv_create_page($slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0) {
180 180
     global $wpdb;
181 181
 
182
-    $option_value = wpinv_get_option( $option );
182
+    $option_value = wpinv_get_option($option);
183 183
 
184
-    if ( ! empty( $option_value ) && ( $page_object = get_post( $option_value ) ) ) {
185
-        if ( 'page' === $page_object->post_type && ! in_array( $page_object->post_status, array( 'pending', 'trash', 'future', 'auto-draft' ) ) ) {
184
+    if (!empty($option_value) && ($page_object = get_post($option_value))) {
185
+        if ('page' === $page_object->post_type && !in_array($page_object->post_status, array('pending', 'trash', 'future', 'auto-draft'))) {
186 186
             // Valid page is already in place
187 187
             return $page_object->ID;
188 188
         }
189 189
     }
190 190
 
191
-    if(!empty($post_parent)){
191
+    if (!empty($post_parent)) {
192 192
         $page = get_page_by_path($post_parent);
193 193
         if ($page) {
194 194
             $post_parent = $page->ID;
@@ -197,40 +197,40 @@  discard block
 block discarded – undo
197 197
         }
198 198
     }
199 199
 
200
-    if ( strlen( $page_content ) > 0 ) {
200
+    if (strlen($page_content) > 0) {
201 201
         // Search for an existing page with the specified page content (typically a shortcode)
202
-        $valid_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) );
202
+        $valid_page_found = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' ) AND post_content LIKE %s LIMIT 1;", "%{$page_content}%"));
203 203
     } else {
204 204
         // Search for an existing page with the specified page slug
205
-        $valid_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' )  AND post_name = %s LIMIT 1;", $slug ) );
205
+        $valid_page_found = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status NOT IN ( 'pending', 'trash', 'future', 'auto-draft' )  AND post_name = %s LIMIT 1;", $slug));
206 206
     }
207 207
 
208
-    $valid_page_found = apply_filters( 'wpinv_create_page_id', $valid_page_found, $slug, $page_content );
208
+    $valid_page_found = apply_filters('wpinv_create_page_id', $valid_page_found, $slug, $page_content);
209 209
 
210
-    if ( $valid_page_found ) {
211
-        if ( $option ) {
212
-            wpinv_update_option( $option, $valid_page_found );
210
+    if ($valid_page_found) {
211
+        if ($option) {
212
+            wpinv_update_option($option, $valid_page_found);
213 213
         }
214 214
         return $valid_page_found;
215 215
     }
216 216
 
217 217
     // Search for a matching valid trashed page
218
-    if ( strlen( $page_content ) > 0 ) {
218
+    if (strlen($page_content) > 0) {
219 219
         // Search for an existing page with the specified page content (typically a shortcode)
220
-        $trashed_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) );
220
+        $trashed_page_found = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_content LIKE %s LIMIT 1;", "%{$page_content}%"));
221 221
     } else {
222 222
         // Search for an existing page with the specified page slug
223
-        $trashed_page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_name = %s LIMIT 1;", $slug ) );
223
+        $trashed_page_found = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = 'trash' AND post_name = %s LIMIT 1;", $slug));
224 224
     }
225 225
 
226
-    if ( $trashed_page_found ) {
226
+    if ($trashed_page_found) {
227 227
         $page_id   = $trashed_page_found;
228 228
         $page_data = array(
229 229
             'ID'             => $page_id,
230 230
             'post_status'    => 'publish',
231 231
             'post_parent'    => $post_parent,
232 232
         );
233
-        wp_update_post( $page_data );
233
+        wp_update_post($page_data);
234 234
     } else {
235 235
         $page_data = array(
236 236
             'post_status'    => 'publish',
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
             'post_parent'    => $post_parent,
243 243
             'comment_status' => 'closed',
244 244
         );
245
-        $page_id = wp_insert_post( $page_data );
245
+        $page_id = wp_insert_post($page_data);
246 246
     }
247 247
 
248
-    if ( $option ) {
249
-        wpinv_update_option( $option, (int) $page_id );
248
+    if ($option) {
249
+        wpinv_update_option($option, (int) $page_id);
250 250
     }
251 251
 
252 252
     return $page_id;
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
  *
260 260
  * @return array
261 261
  */
262
-function wpinv_add_aui_screens($screen_ids){
262
+function wpinv_add_aui_screens($screen_ids) {
263 263
 
264 264
     // load on these pages if set
265
-    $screen_ids = array_merge( $screen_ids, wpinv_get_screen_ids() );
265
+    $screen_ids = array_merge($screen_ids, wpinv_get_screen_ids());
266 266
 
267 267
     return $screen_ids;
268 268
 }
269
-add_filter('aui_screen_ids','wpinv_add_aui_screens');
270 269
\ No newline at end of file
270
+add_filter('aui_screen_ids', 'wpinv_add_aui_screens');
271 271
\ No newline at end of file
Please login to merge, or discard this patch.