Passed
Push — master ( 393c0e...73f2f1 )
by Brian
10:40
created
templates/invoice/invoice-meta.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,50 +7,50 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$class = ! is_singular( 'page' ) ? 'px-1' : '';
12
+$class = !is_singular('page') ? 'px-1' : '';
13 13
 ?>
14 14
 
15
-        <?php do_action( 'getpaid_before_invoice_meta', $invoice ); ?>
15
+        <?php do_action('getpaid_before_invoice_meta', $invoice); ?>
16 16
         <div class="getpaid-invoice-meta-data">
17 17
 
18
-            <?php do_action( 'getpaid_before_invoice_meta_table', $invoice ); ?>
18
+            <?php do_action('getpaid_before_invoice_meta_table', $invoice); ?>
19 19
             <table class="table table-bordered">
20 20
                 <tbody>
21 21
 
22
-                    <?php do_action( 'getpaid_before_invoice_meta_rows', $invoice ); ?>
23
-                    <?php foreach ( $meta as $key => $data ) : ?>
22
+                    <?php do_action('getpaid_before_invoice_meta_rows', $invoice); ?>
23
+                    <?php foreach ($meta as $key => $data) : ?>
24 24
 
25
-                        <?php if ( ! empty( $data['value'] ) ) : ?>
25
+                        <?php if (!empty($data['value'])) : ?>
26 26
 
27
-                            <?php do_action( "getpaid_before_invoice_meta_$key", $invoice, $data ); ?>
27
+                            <?php do_action("getpaid_before_invoice_meta_$key", $invoice, $data); ?>
28 28
 
29
-                            <tr class="getpaid-invoice-meta-<?php echo esc_attr( $key ); ?>">
29
+                            <tr class="getpaid-invoice-meta-<?php echo esc_attr($key); ?>">
30 30
 
31
-                                <th class="<?php echo esc_attr( $class ); ?> font-weight-bold" style="width: 40%">
32
-                                    <?php echo esc_html( $data['label'] ); ?>
31
+                                <th class="<?php echo esc_attr($class); ?> font-weight-bold" style="width: 40%">
32
+                                    <?php echo esc_html($data['label']); ?>
33 33
                                 </th>
34 34
 
35
-                                <td class="<?php echo esc_attr( $class ); ?> <?php echo 'invoice_total' === $key ? 'font-weight-bold' : 'font-weight-normal'; ?> text-break" style="width: 60%">
36
-                                    <span class="getpaid-invoice-meta-<?php echo esc_attr( $key ); ?>-value"><?php echo wp_kses_post( $data['value'] ); ?></span>
35
+                                <td class="<?php echo esc_attr($class); ?> <?php echo 'invoice_total' === $key ? 'font-weight-bold' : 'font-weight-normal'; ?> text-break" style="width: 60%">
36
+                                    <span class="getpaid-invoice-meta-<?php echo esc_attr($key); ?>-value"><?php echo wp_kses_post($data['value']); ?></span>
37 37
                                 </td>
38 38
 
39 39
                             </tr>
40 40
 
41
-                            <?php do_action( "getpaid_after_invoice_meta_$key", $invoice, $data ); ?>
41
+                            <?php do_action("getpaid_after_invoice_meta_$key", $invoice, $data); ?>
42 42
 
43 43
                         <?php endif; ?>
44 44
 
45 45
                     <?php endforeach; ?>
46
-                    <?php do_action( 'getpaid_after_invoice_meta_rows', $invoice ); ?>
46
+                    <?php do_action('getpaid_after_invoice_meta_rows', $invoice); ?>
47 47
 
48 48
                 </tbody>
49 49
             </table>
50
-            <?php do_action( 'getpaid_after_invoice_meta_table', $invoice ); ?>
50
+            <?php do_action('getpaid_after_invoice_meta_table', $invoice); ?>
51 51
 
52 52
 
53 53
         </div>
54
-        <?php do_action( 'getpaid_after_invoice_meta', $invoice ); ?>
54
+        <?php do_action('getpaid_after_invoice_meta', $invoice); ?>
55 55
 
56 56
 <?php
Please login to merge, or discard this patch.
templates/invoice/line-totals.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -39,40 +39,40 @@
 block discarded – undo
39 39
                                 if ( 'tax' === $key ) {
40 40
                                     wpinv_the_price( $invoice->get_total_tax(), $invoice->get_currency() );
41 41
 
42
-								if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) {
42
+                                if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) {
43 43
 
44
-									$taxes = $invoice->get_total_tax();
45
-									if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) {
46
-										echo ' <em class="text-muted small">';
47
-										_x( '(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing' );
48
-										echo '</em>';
44
+                                    $taxes = $invoice->get_total_tax();
45
+                                    if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) {
46
+                                        echo ' <em class="text-muted small">';
47
+                                        _x( '(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing' );
48
+                                        echo '</em>';
49 49
                                     }
50 50
 }
51 51
 }
52 52
 
53 53
                                 // Total Fee.
54 54
                                 if ( 'fee' === $key ) {
55
-								wpinv_the_price( $invoice->get_total_fees(), $invoice->get_currency() );
55
+                                wpinv_the_price( $invoice->get_total_fees(), $invoice->get_currency() );
56 56
                                 }
57 57
 
58 58
                                 // Total discount.
59 59
                                 if ( 'discount' === $key ) {
60
-								wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() );
60
+                                wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() );
61 61
                                 }
62 62
 
63 63
                                 // Shipping.
64 64
                                 if ( 'shipping' === $key ) {
65
-								wpinv_the_price( $invoice->get_shipping(), $invoice->get_currency() );
65
+                                wpinv_the_price( $invoice->get_shipping(), $invoice->get_currency() );
66 66
                                 }
67 67
 
68 68
                                 // Sub total.
69 69
                                 if ( 'subtotal' === $key ) {
70
-								wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() );
70
+                                wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() );
71 71
                                 }
72 72
 
73 73
                                 // Total.
74 74
                                 if ( 'total' === $key ) {
75
-								wpinv_the_price( $invoice->get_total(), $invoice->get_currency() );
75
+                                wpinv_the_price( $invoice->get_total(), $invoice->get_currency() );
76 76
                                 }
77 77
 
78 78
                                 // Fires when printing a cart total.
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,26 +9,26 @@  discard block
 block discarded – undo
9 9
  * @var WPInv_Invoice $invoice
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14 14
 // Totals rows.
15
-$totals = getpaid_invoice_totals_rows( $invoice );
15
+$totals = getpaid_invoice_totals_rows($invoice);
16 16
 
17
-do_action( 'getpaid_before_invoice_line_totals', $invoice, $totals );
17
+do_action('getpaid_before_invoice_line_totals', $invoice, $totals);
18 18
 
19 19
 ?>
20 20
 <div class='getpaid-invoice-line-totals'>
21 21
     <div class="row">
22 22
         <div class="col-12 offset-sm-6 col-sm-6 border-sm-left pl-sm-0">
23 23
 
24
-            <?php foreach ( $totals as $key => $label ) : ?>
24
+            <?php foreach ($totals as $key => $label) : ?>
25 25
 
26
-                <div class="getpaid-invoice-line-totals-col <?php echo esc_attr( $key ); ?>">
26
+                <div class="getpaid-invoice-line-totals-col <?php echo esc_attr($key); ?>">
27 27
 
28 28
                     <div class="form-row row">
29 29
 
30 30
                         <div class="col-8 getpaid-invoice-line-totals-label">
31
-                            <?php echo esc_html( $label ); ?>
31
+                            <?php echo esc_html($label); ?>
32 32
                         </div>
33 33
 
34 34
                         <div class="col-4 getpaid-invoice-line-totals-value pl-0">
@@ -36,47 +36,47 @@  discard block
 block discarded – undo
36 36
                             <?php
37 37
 
38 38
                                 // Total tax.
39
-                                if ( 'tax' === $key ) {
40
-                                    wpinv_the_price( $invoice->get_total_tax(), $invoice->get_currency() );
39
+                                if ('tax' === $key) {
40
+                                    wpinv_the_price($invoice->get_total_tax(), $invoice->get_currency());
41 41
 
42
-								if ( wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) {
42
+								if (wpinv_use_taxes() && !$invoice->get_disable_taxes()) {
43 43
 
44 44
 									$taxes = $invoice->get_total_tax();
45
-									if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) {
45
+									if (empty($taxes) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction($invoice->get_country())) {
46 46
 										echo ' <em class="text-muted small">';
47
-										_x( '(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing' );
47
+										_x('(Reverse charged)', 'This is a legal term for reverse charging tax in the EU', 'invoicing');
48 48
 										echo '</em>';
49 49
                                     }
50 50
 }
51 51
 }
52 52
 
53 53
                                 // Total Fee.
54
-                                if ( 'fee' === $key ) {
55
-								wpinv_the_price( $invoice->get_total_fees(), $invoice->get_currency() );
54
+                                if ('fee' === $key) {
55
+								wpinv_the_price($invoice->get_total_fees(), $invoice->get_currency());
56 56
                                 }
57 57
 
58 58
                                 // Total discount.
59
-                                if ( 'discount' === $key ) {
60
-								wpinv_the_price( $invoice->get_total_discount(), $invoice->get_currency() );
59
+                                if ('discount' === $key) {
60
+								wpinv_the_price($invoice->get_total_discount(), $invoice->get_currency());
61 61
                                 }
62 62
 
63 63
                                 // Shipping.
64
-                                if ( 'shipping' === $key ) {
65
-								wpinv_the_price( $invoice->get_shipping(), $invoice->get_currency() );
64
+                                if ('shipping' === $key) {
65
+								wpinv_the_price($invoice->get_shipping(), $invoice->get_currency());
66 66
                                 }
67 67
 
68 68
                                 // Sub total.
69
-                                if ( 'subtotal' === $key ) {
70
-								wpinv_the_price( $invoice->get_subtotal(), $invoice->get_currency() );
69
+                                if ('subtotal' === $key) {
70
+								wpinv_the_price($invoice->get_subtotal(), $invoice->get_currency());
71 71
                                 }
72 72
 
73 73
                                 // Total.
74
-                                if ( 'total' === $key ) {
75
-								wpinv_the_price( $invoice->get_total(), $invoice->get_currency() );
74
+                                if ('total' === $key) {
75
+								wpinv_the_price($invoice->get_total(), $invoice->get_currency());
76 76
                                 }
77 77
 
78 78
                                 // Fires when printing a cart total.
79
-                                do_action( "getpaid_invoice_cart_totals_$key", $invoice );
79
+                                do_action("getpaid_invoice_cart_totals_$key", $invoice);
80 80
 
81 81
                             ?>
82 82
 
@@ -90,4 +90,4 @@  discard block
 block discarded – undo
90 90
     </div>
91 91
 </div> <!-- end .getpaid-invoice-line-totals -->
92 92
 
93
-<?php do_action( 'getpaid_after_invoice_line_totals', $invoice, $totals ); ?>
93
+<?php do_action('getpaid_after_invoice_line_totals', $invoice, $totals); ?>
Please login to merge, or discard this patch.
includes/admin/class-wpinv-customers-table.php 2 patches
Indentation   +368 added lines, -368 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 // Load WP_List_Table if not loaded
13 13
 if ( ! class_exists( 'WP_List_Table' ) ) {
14
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
14
+    require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
15 15
 }
16 16
 
17 17
 /**
@@ -23,375 +23,375 @@  discard block
 block discarded – undo
23 23
  */
24 24
 class WPInv_Customers_Table extends WP_List_Table {
25 25
 
26
-	/**
27
-	 * @var int Number of items per page
28
-	 * @since 1.0.19
29
-	 */
30
-	public $per_page = 10;
31
-
32
-	/**
33
-	 * @var int Number of items
34
-	 * @since 1.0.19
35
-	 */
36
-	public $total = 0;
37
-
38
-	/**
39
-	 * Get things started
40
-	 *
41
-	 * @since 1.0.19
42
-	 * @see WP_List_Table::__construct()
43
-	 */
44
-	public function __construct() {
45
-
46
-		// Set parent defaults
47
-		parent::__construct(
26
+    /**
27
+     * @var int Number of items per page
28
+     * @since 1.0.19
29
+     */
30
+    public $per_page = 10;
31
+
32
+    /**
33
+     * @var int Number of items
34
+     * @since 1.0.19
35
+     */
36
+    public $total = 0;
37
+
38
+    /**
39
+     * Get things started
40
+     *
41
+     * @since 1.0.19
42
+     * @see WP_List_Table::__construct()
43
+     */
44
+    public function __construct() {
45
+
46
+        // Set parent defaults
47
+        parent::__construct(
48 48
             array(
49
-				'singular' => 'id',
50
-				'plural'   => 'ids',
51
-				'ajax'     => false,
49
+                'singular' => 'id',
50
+                'plural'   => 'ids',
51
+                'ajax'     => false,
52 52
             )
53 53
         );
54 54
 
55
-	}
56
-
57
-	/**
58
-	 * Gets the name of the primary column.
59
-	 *
60
-	 * @since 1.0.19
61
-	 * @access protected
62
-	 *
63
-	 * @return string Name of the primary column.
64
-	 */
65
-	protected function get_primary_column_name() {
66
-		return 'name';
67
-	}
68
-
69
-	/**
70
-	 * This function renders most of the columns in the list table.
71
-	 *
72
-	 * @since 1.0.19
73
-	 *
74
-	 * @param WP_User $item
75
-	 * @param string $column_name The name of the column
76
-	 *
77
-	 * @return string Column Name
78
-	 */
79
-	public function column_default( $item, $column_name ) {
80
-		$value = esc_html( get_user_meta( $item->ID, '_wpinv_' . $column_name, true ) );
81
-		return apply_filters( 'wpinv_customers_table_column' . $column_name, $value, $item );
82
-	}
83
-
84
-	/**
85
-	 * Displays the country column.
86
-	 *
87
-	 * @since 1.0.19
88
-	 *
89
-	 * @param WP_User $user
90
-	 *
91
-	 * @return string Column Name
92
-	 */
93
-	public function column_country( $user ) {
94
-		$country = wpinv_sanitize_country( $user->_wpinv_country );
95
-		if ( $country ) {
96
-			$country = wpinv_country_name( $country );
97
-		}
98
-		return esc_html( $country );
99
-	}
100
-
101
-	/**
102
-	 * Displays the state column.
103
-	 *
104
-	 * @since 1.0.19
105
-	 *
106
-	 * @param WP_User $user
107
-	 *
108
-	 * @return string Column Name
109
-	 */
110
-	public function column_state( $user ) {
111
-		$country = wpinv_sanitize_country( $user->_wpinv_country );
112
-		$state   = $user->_wpinv_state;
113
-		if ( $state ) {
114
-			$state = wpinv_state_name( $state, $country );
115
-		}
116
-
117
-		return esc_html( $state );
118
-	}
119
-
120
-	/**
121
-	 * Displays the signup column.
122
-	 *
123
-	 * @since 1.0.19
124
-	 *
125
-	 * @param WP_User $user
126
-	 *
127
-	 * @return string Column Name
128
-	 */
129
-	public function column_signup( $user ) {
130
-		return getpaid_format_date_value( $user->user_registered );
131
-	}
132
-
133
-	/**
134
-	 * Displays the total spent column.
135
-	 *
136
-	 * @since 1.0.19
137
-	 *
138
-	 * @param WP_User $user
139
-	 *
140
-	 * @return string Column Name
141
-	 */
142
-	public function column_total( $user ) {
143
-		return wpinv_price( $this->column_total_raw( $user ) );
144
-	}
145
-
146
-	/**
147
-	 * Displays the total spent column.
148
-	 *
149
-	 * @since 1.0.19
150
-	 *
151
-	 * @param WP_User $user
152
-	 *
153
-	 * @return float
154
-	 */
155
-	public function column_total_raw( $user ) {
156
-
157
-		$args = array(
158
-			'data'           => array(
159
-
160
-				'total' => array(
161
-					'type'     => 'invoice_data',
162
-					'function' => 'SUM',
163
-					'name'     => 'total_sales',
164
-				),
165
-
166
-			),
167
-			'where'          => array(
168
-
169
-				'author' => array(
170
-					'type'     => 'post_data',
171
-					'value'    => absint( $user->ID ),
172
-					'key'      => 'posts.post_author',
173
-					'operator' => '=',
174
-				),
175
-
176
-			),
177
-			'query_type'     => 'get_var',
178
-			'invoice_status' => array( 'wpi-renewal', 'wpi-processing', 'publish' ),
179
-		);
180
-
181
-		return wpinv_round_amount( GetPaid_Reports_Helper::get_invoice_report_data( $args ) );
182
-
183
-	}
184
-
185
-	/**
186
-	 * Displays the total spent column.
187
-	 *
188
-	 * @since 1.0.19
189
-	 *
190
-	 * @param WP_User $user
191
-	 *
192
-	 * @return string Column Name
193
-	 */
194
-	public function column_invoices( $user ) {
195
-
196
-		$args = array(
197
-			'data'           => array(
198
-
199
-				'ID' => array(
200
-					'type'     => 'post_data',
201
-					'function' => 'COUNT',
202
-					'name'     => 'count',
203
-					'distinct' => true,
204
-				),
205
-
206
-			),
207
-			'where'          => array(
208
-
209
-				'author' => array(
210
-					'type'     => 'post_data',
211
-					'value'    => absint( $user->ID ),
212
-					'key'      => 'posts.post_author',
213
-					'operator' => '=',
214
-				),
215
-
216
-			),
217
-			'query_type'     => 'get_var',
218
-			'invoice_status' => array_keys( wpinv_get_invoice_statuses() ),
219
-		);
220
-
221
-		$value = absint( GetPaid_Reports_Helper::get_invoice_report_data( $args ) );
222
-		$url   = add_query_arg( array( 'post_type' => 'wpi_invoice', 'author' => $user->ID ), admin_url( 'edit.php' ) );
223
-		return empty( $value ) ? '0' : '<a href="' . esc_url( $url ) . '">' . absint( $value ) . '</a>';
224
-
225
-	}
226
-
227
-	/**
228
-	 * Generates content for a single row of the table
229
-	 * @since 1.0.19
230
-	 *
231
-	 * @param int $item The user id.
232
-	 */
233
-	public function single_row( $item ) {
234
-		$item = get_user_by( 'id', $item );
235
-
236
-		if ( empty( $item ) ) {
237
-			return;
238
-		}
239
-
240
-		echo '<tr>';
241
-		$this->single_row_columns( $item );
242
-		echo '</tr>';
243
-	}
244
-
245
-	/**
246
-	 * Displays the customers name
247
-	 *
248
-	 * @param  WP_User $customer customer.
249
-	 * @return string
250
-	 */
251
-	public function column_name( $customer ) {
252
-
253
-		// Customer view URL.
254
-		$view_url    = esc_url( add_query_arg( 'user_id', $customer->ID, admin_url( 'user-edit.php' ) ) );
255
-		$row_actions = $this->row_actions(
256
-			array(
257
-				'view' => '<a href="' . $view_url . '#getpaid-fieldset-billing">' . __( 'Edit Details', 'invoicing' ) . '</a>',
258
-			)
259
-		);
260
-
261
-		// Get user's address.
262
-		$address = wpinv_get_user_address( $customer->ID );
263
-
264
-		// Customer email address.
265
-		$email       = sanitize_email( $customer->user_email );
266
-
267
-		// Customer's avatar.
268
-		$avatar = esc_url( get_avatar_url( $email ) );
269
-		$avatar = "<img src='$avatar' height='32' width='32'/>";
270
-
271
-		// Customer's name.
272
-		$name   = esc_html( "{$address['first_name']} {$address['last_name']}" );
273
-
274
-		if ( empty( trim( $name ) ) ) {
275
-			$name = esc_html( $address['display_name'] );
276
-		}
277
-
278
-		if ( ! empty( $name ) ) {
279
-			$name = "<div style='overflow: hidden;height: 18px;'>$name</div>";
280
-		}
281
-
282
-		$email = "<div class='row-title'><a href='$view_url'>$email</a></div>";
283
-
284
-		return "<div style='display: flex;'><div>$avatar</div><div style='margin-left: 10px;'>$name<strong>$email</strong>$row_actions</div></div>";
285
-
286
-	}
287
-
288
-	/**
289
-	 * Retrieve the table columns
290
-	 *
291
-	 * @since 1.0.19
292
-	 * @return array $columns Array of all the list table columns
293
-	 */
294
-	public function get_columns() {
295
-
296
-		$columns = array(
297
-			'name'     => __( 'Name', 'invoicing' ),
298
-			'country'  => __( 'Country', 'invoicing' ),
299
-			'state'    => __( 'State', 'invoicing' ),
300
-			'city'     => __( 'City', 'invoicing' ),
301
-			'zip'      => __( 'ZIP', 'invoicing' ),
302
-			'address'  => __( 'Address', 'invoicing' ),
303
-			'phone'    => __( 'Phone', 'invoicing' ),
304
-			'company'  => __( 'Company', 'invoicing' ),
305
-			'invoices' => __( 'Invoices', 'invoicing' ),
306
-			'total'    => __( 'Total Spend', 'invoicing' ),
307
-			'signup'   => __( 'Date created', 'invoicing' ),
308
-		);
309
-		return apply_filters( 'wpinv_customers_table_columns', $columns );
310
-
311
-	}
312
-
313
-	/**
314
-	 * Retrieve the current page number
315
-	 *
316
-	 * @since 1.0.19
317
-	 * @return int Current page number
318
-	 */
319
-	public function get_paged() {
320
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
321
-	}
322
-
323
-	/**
324
-	 * Returns bulk actions.
325
-	 *
326
-	 * @since 1.0.19
327
-	 * @return void
328
-	 */
329
-	public function bulk_actions( $which = '' ) {
330
-		return array();
331
-	}
332
-
333
-	/**
334
-	 *  Prepares the display query
335
-	 */
336
-	public function prepare_query() {
337
-		global $wpdb;
338
-
339
-		$post_types = '';
340
-
341
-		foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
342
-			$post_types .= $wpdb->prepare( 'post_type=%s OR ', $post_type );
343
-		}
344
-
345
-		$post_types = rtrim( $post_types, ' OR' );
346
-
347
-		// Maybe search.
348
-		if ( ! empty( $_POST['s'] ) ) {
349
-			$users = get_users(
350
-				array(
351
-					'search'         => '*' . sanitize_text_field( urldecode( $_POST['s'] ) ) . '*',
352
-					'search_columns' => array( 'user_login', 'user_email', 'display_name' ),
353
-					'fields'         => 'ID',
354
-				)
355
-			);
356
-
357
-			$users      = implode( ', ', $users );
358
-			$post_types = "($post_types) AND ( post_author IN ( $users ) )";
359
-		}
360
-
361
-		// Users with invoices.
362
-    	$customers = $wpdb->get_col(
363
-			$wpdb->prepare(
364
-				"SELECT DISTINCT( post_author ) FROM $wpdb->posts WHERE $post_types LIMIT %d,%d",
365
-				$this->get_paged() * 10 - 10,
366
-				$this->per_page
367
-			)
368
-		);
369
-
370
-		$this->items = $customers;
371
-		$this->total = (int) $wpdb->get_var( "SELECT COUNT( DISTINCT( post_author ) ) FROM $wpdb->posts WHERE $post_types" );
372
-
373
-	}
374
-
375
-	/**
376
-	 * Setup the final data for the table
377
-	 *
378
-	 * @since 1.0.19
379
-	 * @return void
380
-	 */
381
-	public function prepare_items() {
382
-		$columns               = $this->get_columns();
383
-		$hidden                = array(); // No hidden columns
384
-		$sortable              = $this->get_sortable_columns();
385
-		$this->_column_headers = array( $columns, $hidden, $sortable );
386
-		$this->prepare_query();
387
-
388
-		$this->set_pagination_args(
389
-			array(
390
-				'total_items' => $this->total,
391
-				'per_page'    => $this->per_page,
392
-				'total_pages' => ceil( $this->total / $this->per_page ),
393
-			)
394
-		);
395
-
396
-	}
55
+    }
56
+
57
+    /**
58
+     * Gets the name of the primary column.
59
+     *
60
+     * @since 1.0.19
61
+     * @access protected
62
+     *
63
+     * @return string Name of the primary column.
64
+     */
65
+    protected function get_primary_column_name() {
66
+        return 'name';
67
+    }
68
+
69
+    /**
70
+     * This function renders most of the columns in the list table.
71
+     *
72
+     * @since 1.0.19
73
+     *
74
+     * @param WP_User $item
75
+     * @param string $column_name The name of the column
76
+     *
77
+     * @return string Column Name
78
+     */
79
+    public function column_default( $item, $column_name ) {
80
+        $value = esc_html( get_user_meta( $item->ID, '_wpinv_' . $column_name, true ) );
81
+        return apply_filters( 'wpinv_customers_table_column' . $column_name, $value, $item );
82
+    }
83
+
84
+    /**
85
+     * Displays the country column.
86
+     *
87
+     * @since 1.0.19
88
+     *
89
+     * @param WP_User $user
90
+     *
91
+     * @return string Column Name
92
+     */
93
+    public function column_country( $user ) {
94
+        $country = wpinv_sanitize_country( $user->_wpinv_country );
95
+        if ( $country ) {
96
+            $country = wpinv_country_name( $country );
97
+        }
98
+        return esc_html( $country );
99
+    }
100
+
101
+    /**
102
+     * Displays the state column.
103
+     *
104
+     * @since 1.0.19
105
+     *
106
+     * @param WP_User $user
107
+     *
108
+     * @return string Column Name
109
+     */
110
+    public function column_state( $user ) {
111
+        $country = wpinv_sanitize_country( $user->_wpinv_country );
112
+        $state   = $user->_wpinv_state;
113
+        if ( $state ) {
114
+            $state = wpinv_state_name( $state, $country );
115
+        }
116
+
117
+        return esc_html( $state );
118
+    }
119
+
120
+    /**
121
+     * Displays the signup column.
122
+     *
123
+     * @since 1.0.19
124
+     *
125
+     * @param WP_User $user
126
+     *
127
+     * @return string Column Name
128
+     */
129
+    public function column_signup( $user ) {
130
+        return getpaid_format_date_value( $user->user_registered );
131
+    }
132
+
133
+    /**
134
+     * Displays the total spent column.
135
+     *
136
+     * @since 1.0.19
137
+     *
138
+     * @param WP_User $user
139
+     *
140
+     * @return string Column Name
141
+     */
142
+    public function column_total( $user ) {
143
+        return wpinv_price( $this->column_total_raw( $user ) );
144
+    }
145
+
146
+    /**
147
+     * Displays the total spent column.
148
+     *
149
+     * @since 1.0.19
150
+     *
151
+     * @param WP_User $user
152
+     *
153
+     * @return float
154
+     */
155
+    public function column_total_raw( $user ) {
156
+
157
+        $args = array(
158
+            'data'           => array(
159
+
160
+                'total' => array(
161
+                    'type'     => 'invoice_data',
162
+                    'function' => 'SUM',
163
+                    'name'     => 'total_sales',
164
+                ),
165
+
166
+            ),
167
+            'where'          => array(
168
+
169
+                'author' => array(
170
+                    'type'     => 'post_data',
171
+                    'value'    => absint( $user->ID ),
172
+                    'key'      => 'posts.post_author',
173
+                    'operator' => '=',
174
+                ),
175
+
176
+            ),
177
+            'query_type'     => 'get_var',
178
+            'invoice_status' => array( 'wpi-renewal', 'wpi-processing', 'publish' ),
179
+        );
180
+
181
+        return wpinv_round_amount( GetPaid_Reports_Helper::get_invoice_report_data( $args ) );
182
+
183
+    }
184
+
185
+    /**
186
+     * Displays the total spent column.
187
+     *
188
+     * @since 1.0.19
189
+     *
190
+     * @param WP_User $user
191
+     *
192
+     * @return string Column Name
193
+     */
194
+    public function column_invoices( $user ) {
195
+
196
+        $args = array(
197
+            'data'           => array(
198
+
199
+                'ID' => array(
200
+                    'type'     => 'post_data',
201
+                    'function' => 'COUNT',
202
+                    'name'     => 'count',
203
+                    'distinct' => true,
204
+                ),
205
+
206
+            ),
207
+            'where'          => array(
208
+
209
+                'author' => array(
210
+                    'type'     => 'post_data',
211
+                    'value'    => absint( $user->ID ),
212
+                    'key'      => 'posts.post_author',
213
+                    'operator' => '=',
214
+                ),
215
+
216
+            ),
217
+            'query_type'     => 'get_var',
218
+            'invoice_status' => array_keys( wpinv_get_invoice_statuses() ),
219
+        );
220
+
221
+        $value = absint( GetPaid_Reports_Helper::get_invoice_report_data( $args ) );
222
+        $url   = add_query_arg( array( 'post_type' => 'wpi_invoice', 'author' => $user->ID ), admin_url( 'edit.php' ) );
223
+        return empty( $value ) ? '0' : '<a href="' . esc_url( $url ) . '">' . absint( $value ) . '</a>';
224
+
225
+    }
226
+
227
+    /**
228
+     * Generates content for a single row of the table
229
+     * @since 1.0.19
230
+     *
231
+     * @param int $item The user id.
232
+     */
233
+    public function single_row( $item ) {
234
+        $item = get_user_by( 'id', $item );
235
+
236
+        if ( empty( $item ) ) {
237
+            return;
238
+        }
239
+
240
+        echo '<tr>';
241
+        $this->single_row_columns( $item );
242
+        echo '</tr>';
243
+    }
244
+
245
+    /**
246
+     * Displays the customers name
247
+     *
248
+     * @param  WP_User $customer customer.
249
+     * @return string
250
+     */
251
+    public function column_name( $customer ) {
252
+
253
+        // Customer view URL.
254
+        $view_url    = esc_url( add_query_arg( 'user_id', $customer->ID, admin_url( 'user-edit.php' ) ) );
255
+        $row_actions = $this->row_actions(
256
+            array(
257
+                'view' => '<a href="' . $view_url . '#getpaid-fieldset-billing">' . __( 'Edit Details', 'invoicing' ) . '</a>',
258
+            )
259
+        );
260
+
261
+        // Get user's address.
262
+        $address = wpinv_get_user_address( $customer->ID );
263
+
264
+        // Customer email address.
265
+        $email       = sanitize_email( $customer->user_email );
266
+
267
+        // Customer's avatar.
268
+        $avatar = esc_url( get_avatar_url( $email ) );
269
+        $avatar = "<img src='$avatar' height='32' width='32'/>";
270
+
271
+        // Customer's name.
272
+        $name   = esc_html( "{$address['first_name']} {$address['last_name']}" );
273
+
274
+        if ( empty( trim( $name ) ) ) {
275
+            $name = esc_html( $address['display_name'] );
276
+        }
277
+
278
+        if ( ! empty( $name ) ) {
279
+            $name = "<div style='overflow: hidden;height: 18px;'>$name</div>";
280
+        }
281
+
282
+        $email = "<div class='row-title'><a href='$view_url'>$email</a></div>";
283
+
284
+        return "<div style='display: flex;'><div>$avatar</div><div style='margin-left: 10px;'>$name<strong>$email</strong>$row_actions</div></div>";
285
+
286
+    }
287
+
288
+    /**
289
+     * Retrieve the table columns
290
+     *
291
+     * @since 1.0.19
292
+     * @return array $columns Array of all the list table columns
293
+     */
294
+    public function get_columns() {
295
+
296
+        $columns = array(
297
+            'name'     => __( 'Name', 'invoicing' ),
298
+            'country'  => __( 'Country', 'invoicing' ),
299
+            'state'    => __( 'State', 'invoicing' ),
300
+            'city'     => __( 'City', 'invoicing' ),
301
+            'zip'      => __( 'ZIP', 'invoicing' ),
302
+            'address'  => __( 'Address', 'invoicing' ),
303
+            'phone'    => __( 'Phone', 'invoicing' ),
304
+            'company'  => __( 'Company', 'invoicing' ),
305
+            'invoices' => __( 'Invoices', 'invoicing' ),
306
+            'total'    => __( 'Total Spend', 'invoicing' ),
307
+            'signup'   => __( 'Date created', 'invoicing' ),
308
+        );
309
+        return apply_filters( 'wpinv_customers_table_columns', $columns );
310
+
311
+    }
312
+
313
+    /**
314
+     * Retrieve the current page number
315
+     *
316
+     * @since 1.0.19
317
+     * @return int Current page number
318
+     */
319
+    public function get_paged() {
320
+        return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
321
+    }
322
+
323
+    /**
324
+     * Returns bulk actions.
325
+     *
326
+     * @since 1.0.19
327
+     * @return void
328
+     */
329
+    public function bulk_actions( $which = '' ) {
330
+        return array();
331
+    }
332
+
333
+    /**
334
+     *  Prepares the display query
335
+     */
336
+    public function prepare_query() {
337
+        global $wpdb;
338
+
339
+        $post_types = '';
340
+
341
+        foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
342
+            $post_types .= $wpdb->prepare( 'post_type=%s OR ', $post_type );
343
+        }
344
+
345
+        $post_types = rtrim( $post_types, ' OR' );
346
+
347
+        // Maybe search.
348
+        if ( ! empty( $_POST['s'] ) ) {
349
+            $users = get_users(
350
+                array(
351
+                    'search'         => '*' . sanitize_text_field( urldecode( $_POST['s'] ) ) . '*',
352
+                    'search_columns' => array( 'user_login', 'user_email', 'display_name' ),
353
+                    'fields'         => 'ID',
354
+                )
355
+            );
356
+
357
+            $users      = implode( ', ', $users );
358
+            $post_types = "($post_types) AND ( post_author IN ( $users ) )";
359
+        }
360
+
361
+        // Users with invoices.
362
+        $customers = $wpdb->get_col(
363
+            $wpdb->prepare(
364
+                "SELECT DISTINCT( post_author ) FROM $wpdb->posts WHERE $post_types LIMIT %d,%d",
365
+                $this->get_paged() * 10 - 10,
366
+                $this->per_page
367
+            )
368
+        );
369
+
370
+        $this->items = $customers;
371
+        $this->total = (int) $wpdb->get_var( "SELECT COUNT( DISTINCT( post_author ) ) FROM $wpdb->posts WHERE $post_types" );
372
+
373
+    }
374
+
375
+    /**
376
+     * Setup the final data for the table
377
+     *
378
+     * @since 1.0.19
379
+     * @return void
380
+     */
381
+    public function prepare_items() {
382
+        $columns               = $this->get_columns();
383
+        $hidden                = array(); // No hidden columns
384
+        $sortable              = $this->get_sortable_columns();
385
+        $this->_column_headers = array( $columns, $hidden, $sortable );
386
+        $this->prepare_query();
387
+
388
+        $this->set_pagination_args(
389
+            array(
390
+                'total_items' => $this->total,
391
+                'per_page'    => $this->per_page,
392
+                'total_pages' => ceil( $this->total / $this->per_page ),
393
+            )
394
+        );
395
+
396
+    }
397 397
 }
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@  discard block
 block discarded – undo
5 5
  */
6 6
 
7 7
 // Exit if accessed directly
8
-if ( ! defined( 'ABSPATH' ) ) {
8
+if (!defined('ABSPATH')) {
9 9
 exit;
10 10
 }
11 11
 
12 12
 // Load WP_List_Table if not loaded
13
-if ( ! class_exists( 'WP_List_Table' ) ) {
13
+if (!class_exists('WP_List_Table')) {
14 14
 	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
15 15
 }
16 16
 
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @return string Column Name
78 78
 	 */
79
-	public function column_default( $item, $column_name ) {
80
-		$value = esc_html( get_user_meta( $item->ID, '_wpinv_' . $column_name, true ) );
81
-		return apply_filters( 'wpinv_customers_table_column' . $column_name, $value, $item );
79
+	public function column_default($item, $column_name) {
80
+		$value = esc_html(get_user_meta($item->ID, '_wpinv_' . $column_name, true));
81
+		return apply_filters('wpinv_customers_table_column' . $column_name, $value, $item);
82 82
 	}
83 83
 
84 84
 	/**
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return string Column Name
92 92
 	 */
93
-	public function column_country( $user ) {
94
-		$country = wpinv_sanitize_country( $user->_wpinv_country );
95
-		if ( $country ) {
96
-			$country = wpinv_country_name( $country );
93
+	public function column_country($user) {
94
+		$country = wpinv_sanitize_country($user->_wpinv_country);
95
+		if ($country) {
96
+			$country = wpinv_country_name($country);
97 97
 		}
98
-		return esc_html( $country );
98
+		return esc_html($country);
99 99
 	}
100 100
 
101 101
 	/**
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return string Column Name
109 109
 	 */
110
-	public function column_state( $user ) {
111
-		$country = wpinv_sanitize_country( $user->_wpinv_country );
110
+	public function column_state($user) {
111
+		$country = wpinv_sanitize_country($user->_wpinv_country);
112 112
 		$state   = $user->_wpinv_state;
113
-		if ( $state ) {
114
-			$state = wpinv_state_name( $state, $country );
113
+		if ($state) {
114
+			$state = wpinv_state_name($state, $country);
115 115
 		}
116 116
 
117
-		return esc_html( $state );
117
+		return esc_html($state);
118 118
 	}
119 119
 
120 120
 	/**
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @return string Column Name
128 128
 	 */
129
-	public function column_signup( $user ) {
130
-		return getpaid_format_date_value( $user->user_registered );
129
+	public function column_signup($user) {
130
+		return getpaid_format_date_value($user->user_registered);
131 131
 	}
132 132
 
133 133
 	/**
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 	 *
140 140
 	 * @return string Column Name
141 141
 	 */
142
-	public function column_total( $user ) {
143
-		return wpinv_price( $this->column_total_raw( $user ) );
142
+	public function column_total($user) {
143
+		return wpinv_price($this->column_total_raw($user));
144 144
 	}
145 145
 
146 146
 	/**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @return float
154 154
 	 */
155
-	public function column_total_raw( $user ) {
155
+	public function column_total_raw($user) {
156 156
 
157 157
 		$args = array(
158 158
 			'data'           => array(
@@ -168,17 +168,17 @@  discard block
 block discarded – undo
168 168
 
169 169
 				'author' => array(
170 170
 					'type'     => 'post_data',
171
-					'value'    => absint( $user->ID ),
171
+					'value'    => absint($user->ID),
172 172
 					'key'      => 'posts.post_author',
173 173
 					'operator' => '=',
174 174
 				),
175 175
 
176 176
 			),
177 177
 			'query_type'     => 'get_var',
178
-			'invoice_status' => array( 'wpi-renewal', 'wpi-processing', 'publish' ),
178
+			'invoice_status' => array('wpi-renewal', 'wpi-processing', 'publish'),
179 179
 		);
180 180
 
181
-		return wpinv_round_amount( GetPaid_Reports_Helper::get_invoice_report_data( $args ) );
181
+		return wpinv_round_amount(GetPaid_Reports_Helper::get_invoice_report_data($args));
182 182
 
183 183
 	}
184 184
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @return string Column Name
193 193
 	 */
194
-	public function column_invoices( $user ) {
194
+	public function column_invoices($user) {
195 195
 
196 196
 		$args = array(
197 197
 			'data'           => array(
@@ -208,19 +208,19 @@  discard block
 block discarded – undo
208 208
 
209 209
 				'author' => array(
210 210
 					'type'     => 'post_data',
211
-					'value'    => absint( $user->ID ),
211
+					'value'    => absint($user->ID),
212 212
 					'key'      => 'posts.post_author',
213 213
 					'operator' => '=',
214 214
 				),
215 215
 
216 216
 			),
217 217
 			'query_type'     => 'get_var',
218
-			'invoice_status' => array_keys( wpinv_get_invoice_statuses() ),
218
+			'invoice_status' => array_keys(wpinv_get_invoice_statuses()),
219 219
 		);
220 220
 
221
-		$value = absint( GetPaid_Reports_Helper::get_invoice_report_data( $args ) );
222
-		$url   = add_query_arg( array( 'post_type' => 'wpi_invoice', 'author' => $user->ID ), admin_url( 'edit.php' ) );
223
-		return empty( $value ) ? '0' : '<a href="' . esc_url( $url ) . '">' . absint( $value ) . '</a>';
221
+		$value = absint(GetPaid_Reports_Helper::get_invoice_report_data($args));
222
+		$url   = add_query_arg(array('post_type' => 'wpi_invoice', 'author' => $user->ID), admin_url('edit.php'));
223
+		return empty($value) ? '0' : '<a href="' . esc_url($url) . '">' . absint($value) . '</a>';
224 224
 
225 225
 	}
226 226
 
@@ -230,15 +230,15 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @param int $item The user id.
232 232
 	 */
233
-	public function single_row( $item ) {
234
-		$item = get_user_by( 'id', $item );
233
+	public function single_row($item) {
234
+		$item = get_user_by('id', $item);
235 235
 
236
-		if ( empty( $item ) ) {
236
+		if (empty($item)) {
237 237
 			return;
238 238
 		}
239 239
 
240 240
 		echo '<tr>';
241
-		$this->single_row_columns( $item );
241
+		$this->single_row_columns($item);
242 242
 		echo '</tr>';
243 243
 	}
244 244
 
@@ -248,34 +248,34 @@  discard block
 block discarded – undo
248 248
 	 * @param  WP_User $customer customer.
249 249
 	 * @return string
250 250
 	 */
251
-	public function column_name( $customer ) {
251
+	public function column_name($customer) {
252 252
 
253 253
 		// Customer view URL.
254
-		$view_url    = esc_url( add_query_arg( 'user_id', $customer->ID, admin_url( 'user-edit.php' ) ) );
254
+		$view_url    = esc_url(add_query_arg('user_id', $customer->ID, admin_url('user-edit.php')));
255 255
 		$row_actions = $this->row_actions(
256 256
 			array(
257
-				'view' => '<a href="' . $view_url . '#getpaid-fieldset-billing">' . __( 'Edit Details', 'invoicing' ) . '</a>',
257
+				'view' => '<a href="' . $view_url . '#getpaid-fieldset-billing">' . __('Edit Details', 'invoicing') . '</a>',
258 258
 			)
259 259
 		);
260 260
 
261 261
 		// Get user's address.
262
-		$address = wpinv_get_user_address( $customer->ID );
262
+		$address = wpinv_get_user_address($customer->ID);
263 263
 
264 264
 		// Customer email address.
265
-		$email       = sanitize_email( $customer->user_email );
265
+		$email = sanitize_email($customer->user_email);
266 266
 
267 267
 		// Customer's avatar.
268
-		$avatar = esc_url( get_avatar_url( $email ) );
268
+		$avatar = esc_url(get_avatar_url($email));
269 269
 		$avatar = "<img src='$avatar' height='32' width='32'/>";
270 270
 
271 271
 		// Customer's name.
272
-		$name   = esc_html( "{$address['first_name']} {$address['last_name']}" );
272
+		$name   = esc_html("{$address['first_name']} {$address['last_name']}");
273 273
 
274
-		if ( empty( trim( $name ) ) ) {
275
-			$name = esc_html( $address['display_name'] );
274
+		if (empty(trim($name))) {
275
+			$name = esc_html($address['display_name']);
276 276
 		}
277 277
 
278
-		if ( ! empty( $name ) ) {
278
+		if (!empty($name)) {
279 279
 			$name = "<div style='overflow: hidden;height: 18px;'>$name</div>";
280 280
 		}
281 281
 
@@ -294,19 +294,19 @@  discard block
 block discarded – undo
294 294
 	public function get_columns() {
295 295
 
296 296
 		$columns = array(
297
-			'name'     => __( 'Name', 'invoicing' ),
298
-			'country'  => __( 'Country', 'invoicing' ),
299
-			'state'    => __( 'State', 'invoicing' ),
300
-			'city'     => __( 'City', 'invoicing' ),
301
-			'zip'      => __( 'ZIP', 'invoicing' ),
302
-			'address'  => __( 'Address', 'invoicing' ),
303
-			'phone'    => __( 'Phone', 'invoicing' ),
304
-			'company'  => __( 'Company', 'invoicing' ),
305
-			'invoices' => __( 'Invoices', 'invoicing' ),
306
-			'total'    => __( 'Total Spend', 'invoicing' ),
307
-			'signup'   => __( 'Date created', 'invoicing' ),
297
+			'name'     => __('Name', 'invoicing'),
298
+			'country'  => __('Country', 'invoicing'),
299
+			'state'    => __('State', 'invoicing'),
300
+			'city'     => __('City', 'invoicing'),
301
+			'zip'      => __('ZIP', 'invoicing'),
302
+			'address'  => __('Address', 'invoicing'),
303
+			'phone'    => __('Phone', 'invoicing'),
304
+			'company'  => __('Company', 'invoicing'),
305
+			'invoices' => __('Invoices', 'invoicing'),
306
+			'total'    => __('Total Spend', 'invoicing'),
307
+			'signup'   => __('Date created', 'invoicing'),
308 308
 		);
309
-		return apply_filters( 'wpinv_customers_table_columns', $columns );
309
+		return apply_filters('wpinv_customers_table_columns', $columns);
310 310
 
311 311
 	}
312 312
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 * @return int Current page number
318 318
 	 */
319 319
 	public function get_paged() {
320
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
320
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
321 321
 	}
322 322
 
323 323
 	/**
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	 * @since 1.0.19
327 327
 	 * @return void
328 328
 	 */
329
-	public function bulk_actions( $which = '' ) {
329
+	public function bulk_actions($which = '') {
330 330
 		return array();
331 331
 	}
332 332
 
@@ -338,23 +338,23 @@  discard block
 block discarded – undo
338 338
 
339 339
 		$post_types = '';
340 340
 
341
-		foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
342
-			$post_types .= $wpdb->prepare( 'post_type=%s OR ', $post_type );
341
+		foreach (array_keys(getpaid_get_invoice_post_types()) as $post_type) {
342
+			$post_types .= $wpdb->prepare('post_type=%s OR ', $post_type);
343 343
 		}
344 344
 
345
-		$post_types = rtrim( $post_types, ' OR' );
345
+		$post_types = rtrim($post_types, ' OR');
346 346
 
347 347
 		// Maybe search.
348
-		if ( ! empty( $_POST['s'] ) ) {
348
+		if (!empty($_POST['s'])) {
349 349
 			$users = get_users(
350 350
 				array(
351
-					'search'         => '*' . sanitize_text_field( urldecode( $_POST['s'] ) ) . '*',
352
-					'search_columns' => array( 'user_login', 'user_email', 'display_name' ),
351
+					'search'         => '*' . sanitize_text_field(urldecode($_POST['s'])) . '*',
352
+					'search_columns' => array('user_login', 'user_email', 'display_name'),
353 353
 					'fields'         => 'ID',
354 354
 				)
355 355
 			);
356 356
 
357
-			$users      = implode( ', ', $users );
357
+			$users      = implode(', ', $users);
358 358
 			$post_types = "($post_types) AND ( post_author IN ( $users ) )";
359 359
 		}
360 360
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 		);
369 369
 
370 370
 		$this->items = $customers;
371
-		$this->total = (int) $wpdb->get_var( "SELECT COUNT( DISTINCT( post_author ) ) FROM $wpdb->posts WHERE $post_types" );
371
+		$this->total = (int) $wpdb->get_var("SELECT COUNT( DISTINCT( post_author ) ) FROM $wpdb->posts WHERE $post_types");
372 372
 
373 373
 	}
374 374
 
@@ -382,14 +382,14 @@  discard block
 block discarded – undo
382 382
 		$columns               = $this->get_columns();
383 383
 		$hidden                = array(); // No hidden columns
384 384
 		$sortable              = $this->get_sortable_columns();
385
-		$this->_column_headers = array( $columns, $hidden, $sortable );
385
+		$this->_column_headers = array($columns, $hidden, $sortable);
386 386
 		$this->prepare_query();
387 387
 
388 388
 		$this->set_pagination_args(
389 389
 			array(
390 390
 				'total_items' => $this->total,
391 391
 				'per_page'    => $this->per_page,
392
-				'total_pages' => ceil( $this->total / $this->per_page ),
392
+				'total_pages' => ceil($this->total / $this->per_page),
393 393
 			)
394 394
 		);
395 395
 
Please login to merge, or discard this patch.
templates/payment-forms/elements/pay_button.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,20 +7,20 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$class = empty( $class ) ? 'btn-primary' : sanitize_html_class( $class );
13
-$label = empty( $label ) ? esc_attr__( 'Pay %price% »', 'invoicing' ) : esc_attr( $label );
14
-$free  = empty( $free ) ? esc_attr__( 'Continue »', 'invoicing' ) : esc_attr( $free );
12
+$class = empty($class) ? 'btn-primary' : sanitize_html_class($class);
13
+$label = empty($label) ? esc_attr__('Pay %price% »', 'invoicing') : esc_attr($label);
14
+$free  = empty($free) ? esc_attr__('Continue »', 'invoicing') : esc_attr($free);
15 15
 
16
-do_action( 'getpaid_before_payment_form_pay_button', $form );
16
+do_action('getpaid_before_payment_form_pay_button', $form);
17 17
 
18 18
 aui()->input(
19 19
     array(
20
-        'name'             => esc_attr( $id ),
21
-        'id'               => esc_attr( $element_id ),
20
+        'name'             => esc_attr($id),
21
+        'id'               => esc_attr($element_id),
22 22
         'value'            => $label,
23
-        'help_text'        => empty( $description ) ? '' : wp_kses_post( $description ),
23
+        'help_text'        => empty($description) ? '' : wp_kses_post($description),
24 24
         'type'             => 'submit',
25 25
         'class'            => 'getpaid-payment-form-submit btn btn-block submit-button ' . $class,
26 26
         'extra_attributes' => array(
@@ -31,4 +31,4 @@  discard block
 block discarded – undo
31 31
     true
32 32
 );
33 33
 
34
-do_action( 'getpaid_after_payment_form_pay_button', $form );
34
+do_action('getpaid_after_payment_form_pay_button', $form);
Please login to merge, or discard this patch.
templates/payment-forms/elements/checkbox.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$label       = empty( $label ) ? '' : wp_kses_post( $label );
13
-$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
12
+$label       = empty($label) ? '' : wp_kses_post($label);
13
+$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label));
14 14
 
15
-if ( ! empty( $required ) ) {
15
+if (!empty($required)) {
16 16
     $label .= "<span class='text-danger'> *</span>";
17 17
 }
18 18
 
19 19
 aui()->input(
20 20
     array(
21 21
         'type'      => 'checkbox',
22
-        'name'      => esc_attr( $id ),
23
-        'id'        => esc_attr( $element_id ),
24
-        'required'  => ! empty( $required ),
22
+        'name'      => esc_attr($id),
23
+        'id'        => esc_attr($element_id),
24
+        'required'  => !empty($required),
25 25
         'label'     => $label,
26
-        'value'     => esc_attr__( 'Yes', 'invoicing' ),
27
-        'help_text' => empty( $description ) ? '' : wp_kses_post( $description ),
26
+        'value'     => esc_attr__('Yes', 'invoicing'),
27
+        'help_text' => empty($description) ? '' : wp_kses_post($description),
28 28
         'class'     => 'w-auto ' . $label_class,
29 29
     ),
30 30
     true
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-description.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -13,25 +13,25 @@
 block discarded – undo
13 13
  */
14 14
 class GetPaid_Meta_Box_Description {
15 15
 
16
-	/**
17
-	 * Output the metabox.
18
-	 *
19
-	 * @param WP_Post $post Post object.
20
-	 */
21
-	public static function output( $post ) {
16
+    /**
17
+     * Output the metabox.
18
+     *
19
+     * @param WP_Post $post Post object.
20
+     */
21
+    public static function output( $post ) {
22 22
 
23
-		$settings = array(
24
-			'textarea_name' => 'excerpt',
25
-			'quicktags'     => array( 'buttons' => 'em,strong,link' ),
26
-			'teeny'         => true,
27
-			'media_buttons' => false,
28
-			'tinymce'       => array(
29
-				'theme_advanced_buttons1' => 'bold,italic,strikethrough,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,separator,undo,redo,separator',
30
-				'theme_advanced_buttons2' => '',
31
-			),
32
-			'editor_css'    => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;}</style>',
33
-		);
23
+        $settings = array(
24
+            'textarea_name' => 'excerpt',
25
+            'quicktags'     => array( 'buttons' => 'em,strong,link' ),
26
+            'teeny'         => true,
27
+            'media_buttons' => false,
28
+            'tinymce'       => array(
29
+                'theme_advanced_buttons1' => 'bold,italic,strikethrough,separator,justifyleft,justifycenter,justifyright,separator,link,unlink,separator,undo,redo,separator',
30
+                'theme_advanced_buttons2' => '',
31
+            ),
32
+            'editor_css'    => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;}</style>',
33
+        );
34 34
 
35
-		wp_editor( htmlspecialchars_decode( $post->post_excerpt, ENT_QUOTES ), 'excerpt', apply_filters( 'getpaid_description_editor_settings', $settings ) );
36
-	}
35
+        wp_editor( htmlspecialchars_decode( $post->post_excerpt, ENT_QUOTES ), 'excerpt', apply_filters( 'getpaid_description_editor_settings', $settings ) );
36
+    }
37 37
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  *
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * GetPaid_Meta_Box_Description Class.
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @param WP_Post $post Post object.
20 20
 	 */
21
-	public static function output( $post ) {
21
+	public static function output($post) {
22 22
 
23 23
 		$settings = array(
24 24
 			'textarea_name' => 'excerpt',
25
-			'quicktags'     => array( 'buttons' => 'em,strong,link' ),
25
+			'quicktags'     => array('buttons' => 'em,strong,link'),
26 26
 			'teeny'         => true,
27 27
 			'media_buttons' => false,
28 28
 			'tinymce'       => array(
@@ -32,6 +32,6 @@  discard block
 block discarded – undo
32 32
 			'editor_css'    => '<style>#wp-excerpt-editor-container .wp-editor-area{height:175px; width:100%;}</style>',
33 33
 		);
34 34
 
35
-		wp_editor( htmlspecialchars_decode( $post->post_excerpt, ENT_QUOTES ), 'excerpt', apply_filters( 'getpaid_description_editor_settings', $settings ) );
35
+		wp_editor(htmlspecialchars_decode($post->post_excerpt, ENT_QUOTES), 'excerpt', apply_filters('getpaid_description_editor_settings', $settings));
36 36
 	}
37 37
 }
Please login to merge, or discard this patch.
templates/payment-forms/elements/time.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$label = empty( $label ) ? '' : wp_kses_post( $label );
13
-$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
12
+$label = empty($label) ? '' : wp_kses_post($label);
13
+$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label));
14 14
 
15
-if ( ! empty( $required ) ) {
15
+if (!empty($required)) {
16 16
     $label .= "<span class='text-danger'> *</span>";
17 17
 }
18 18
 
19 19
 aui()->input(
20 20
     array(
21
-        'name'        => esc_attr( $id ),
22
-        'id'          => esc_attr( $element_id ),
23
-        'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
24
-        'required'    => ! empty( $required ),
21
+        'name'        => esc_attr($id),
22
+        'id'          => esc_attr($element_id),
23
+        'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder),
24
+        'required'    => !empty($required),
25 25
         'label'       => $label,
26 26
         'label_type'  => 'vertical',
27
-        'help_text'   => empty( $description ) ? '' : wp_kses_post( $description ),
27
+        'help_text'   => empty($description) ? '' : wp_kses_post($description),
28 28
         'type'        => 'time',
29 29
         'class'       => $label_class,
30 30
         'value'       => $query_value,
Please login to merge, or discard this patch.
templates/payment-forms/elements/textarea.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,24 +7,24 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$label = empty( $label ) ? '' : wp_kses_post( $label );
13
-$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
12
+$label = empty($label) ? '' : wp_kses_post($label);
13
+$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label));
14 14
 
15
-if ( ! empty( $required ) ) {
15
+if (!empty($required)) {
16 16
     $label .= "<span class='text-danger'> *</span>";
17 17
 }
18 18
 
19 19
 aui()->textarea(
20 20
     array(
21
-        'name'        => esc_attr( $id ),
22
-        'id'          => esc_attr( $element_id ),
23
-        'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
24
-        'required'    => ! empty( $required ),
21
+        'name'        => esc_attr($id),
22
+        'id'          => esc_attr($element_id),
23
+        'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder),
24
+        'required'    => !empty($required),
25 25
         'label'       => $label,
26 26
         'label_type'  => 'vertical',
27
-        'help_text'   => empty( $description ) ? '' : wp_kses_post( $description ),
27
+        'help_text'   => empty($description) ? '' : wp_kses_post($description),
28 28
         'class'       => $label_class,
29 29
         'value'       => $query_value,
30 30
     ),
Please login to merge, or discard this patch.
templates/payment-forms/elements/select.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,25 +7,25 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12
-$label = empty( $label ) ? '' : wp_kses_post( $label );
13
-$label_class = sanitize_key( preg_replace( '/[^A-Za-z0-9_-]/', '-', $label ) );
12
+$label = empty($label) ? '' : wp_kses_post($label);
13
+$label_class = sanitize_key(preg_replace('/[^A-Za-z0-9_-]/', '-', $label));
14 14
 
15
-if ( ! empty( $required ) ) {
15
+if (!empty($required)) {
16 16
     $label .= "<span class='text-danger'> *</span>";
17 17
 }
18 18
 
19 19
 aui()->select(
20 20
     array(
21
-        'name'        => esc_attr( $id ),
22
-        'id'          => esc_attr( $element_id ),
23
-        'placeholder' => empty( $placeholder ) ? '' : esc_attr( $placeholder ),
24
-        'required'    => ! empty( $required ),
21
+        'name'        => esc_attr($id),
22
+        'id'          => esc_attr($element_id),
23
+        'placeholder' => empty($placeholder) ? '' : esc_attr($placeholder),
24
+        'required'    => !empty($required),
25 25
         'label'       => $label,
26 26
         'label_type'  => 'vertical',
27
-        'help_text'   => empty( $description ) ? '' : wp_kses_post( $description ),
28
-        'options'     => empty( $options ) ? array() : array_combine( $options, $options ),
27
+        'help_text'   => empty($description) ? '' : wp_kses_post($description),
28
+        'options'     => empty($options) ? array() : array_combine($options, $options),
29 29
         'class'       => $label_class,
30 30
         'value'       => $query_value,
31 31
     ),
Please login to merge, or discard this patch.