Passed
Pull Request — master (#835)
by Kiran
10:45
created
includes/admin/class-getpaid-post-types-admin.php 1 patch
Spacing   +252 added lines, -252 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,16 +98,16 @@  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 ( wpinv_get_default_payment_form() === $post->ID ) {
109
-				unset( $actions['trash'] );
110
-				unset( $actions['inline hide-if-no-js'] );
108
+			if (wpinv_get_default_payment_form() === $post->ID) {
109
+				unset($actions['trash']);
110
+				unset($actions['inline hide-if-no-js']);
111 111
 			}
112 112
 
113 113
 			$actions['duplicate'] = sprintf(
@@ -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
 			$actions['reset'] = sprintf(
@@ -141,17 +141,17 @@  discard block
 block discarded – undo
141 141
 						'getpaid-nonce'
142 142
 					)
143 143
 				),
144
-				esc_html( __( 'Reset Stats', 'invoicing' ) )
144
+				esc_html(__('Reset Stats', 'invoicing'))
145 145
 			);
146 146
 		}
147 147
 
148 148
 		// Link to item payment form.
149
-		if ( 'wpi_item' == $post->post_type ) {
150
-			if ( getpaid_item_type_supports( get_post_meta( $post->ID, '_wpinv_type', true ), 'buy_now' ) ) {
149
+		if ('wpi_item' == $post->post_type) {
150
+			if (getpaid_item_type_supports(get_post_meta($post->ID, '_wpinv_type', true), 'buy_now')) {
151 151
 				$actions['buy'] = sprintf(
152 152
 					'<a href="%1$s">%2$s</a>',
153
-					esc_url( getpaid_embed_url( false, $post->ID . '|0' ) ),
154
-					esc_html( __( 'Buy', 'invoicing' ) )
153
+					esc_url(getpaid_embed_url(false, $post->ID . '|0')),
154
+					esc_html(__('Buy', 'invoicing'))
155 155
 				);
156 156
 			}
157 157
 		}
@@ -167,28 +167,28 @@  discard block
 block discarded – undo
167 167
 	 * @param WP_Post $post
168 168
      * @return array $actions actions without edit option
169 169
      */
170
-    public static function filter_invoice_row_actions( $actions, $post ) {
170
+    public static function filter_invoice_row_actions($actions, $post) {
171 171
 
172
-        if ( getpaid_is_invoice_post_type( $post->post_type ) ) {
172
+        if (getpaid_is_invoice_post_type($post->post_type)) {
173 173
 
174 174
 			$actions = array();
175
-			$invoice = new WPInv_Invoice( $post );
175
+			$invoice = new WPInv_Invoice($post);
176 176
 
177 177
 			$actions['edit'] = sprintf(
178 178
 				'<a href="%1$s">%2$s</a>',
179
-				esc_url( get_edit_post_link( $invoice->get_id() ) ),
180
-				esc_html( __( 'Edit', 'invoicing' ) )
179
+				esc_url(get_edit_post_link($invoice->get_id())),
180
+				esc_html(__('Edit', 'invoicing'))
181 181
 			);
182 182
 
183
-			if ( ! $invoice->is_draft() ) {
183
+			if (!$invoice->is_draft()) {
184 184
 
185 185
 				$actions['view'] = sprintf(
186 186
 					'<a href="%1$s">%2$s</a>',
187
-					esc_url( $invoice->get_view_url() ),
187
+					esc_url($invoice->get_view_url()),
188 188
 					sprintf(
189 189
 						// translators: %s is the invoice type
190
-						esc_html__( 'View %s', 'invoicing' ),
191
-						getpaid_get_post_type_label( $invoice->get_post_type(), false )
190
+						esc_html__('View %s', 'invoicing'),
191
+						getpaid_get_post_type_label($invoice->get_post_type(), false)
192 192
 					)
193 193
 				);
194 194
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 							'getpaid-nonce'
207 207
 						)
208 208
 					),
209
-					esc_html( __( 'Send to Customer', 'invoicing' ) )
209
+					esc_html(__('Send to Customer', 'invoicing'))
210 210
 				);
211 211
 
212 212
 			}
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 						'getpaid-nonce'
226 226
 					)
227 227
 				),
228
-				esc_html( __( 'Duplicate', 'invoicing' ) )
228
+				esc_html(__('Duplicate', 'invoicing'))
229 229
 			);
230 230
 
231 231
         }
@@ -236,59 +236,59 @@  discard block
 block discarded – undo
236 236
 	/**
237 237
 	 * Returns an array of invoice table columns.
238 238
 	 */
239
-	public static function invoice_columns( $columns ) {
239
+	public static function invoice_columns($columns) {
240 240
 
241 241
 		$columns = array(
242 242
 			'cb'           => $columns['cb'],
243
-			'number'       => __( 'Invoice', 'invoicing' ),
244
-			'customer'     => __( 'Customer', 'invoicing' ),
245
-			'invoice_date' => __( 'Created', 'invoicing' ),
246
-			'payment_date' => __( 'Completed', 'invoicing' ),
247
-			'amount'       => __( 'Amount', 'invoicing' ),
248
-			'recurring'    => __( 'Recurring', 'invoicing' ),
249
-			'status'       => __( 'Status', 'invoicing' ),
243
+			'number'       => __('Invoice', 'invoicing'),
244
+			'customer'     => __('Customer', 'invoicing'),
245
+			'invoice_date' => __('Created', 'invoicing'),
246
+			'payment_date' => __('Completed', 'invoicing'),
247
+			'amount'       => __('Amount', 'invoicing'),
248
+			'recurring'    => __('Recurring', 'invoicing'),
249
+			'status'       => __('Status', 'invoicing'),
250 250
 		);
251 251
 
252
-		return apply_filters( 'wpi_invoice_table_columns', $columns );
252
+		return apply_filters('wpi_invoice_table_columns', $columns);
253 253
 	}
254 254
 
255 255
 	/**
256 256
 	 * Displays invoice table columns.
257 257
 	 */
258
-	public static function display_invoice_columns( $column_name, $post_id ) {
258
+	public static function display_invoice_columns($column_name, $post_id) {
259 259
 
260
-		$invoice = new WPInv_Invoice( $post_id );
260
+		$invoice = new WPInv_Invoice($post_id);
261 261
 
262
-		switch ( $column_name ) {
262
+		switch ($column_name) {
263 263
 
264 264
 			case 'invoice_date':
265
-				$date_time = esc_attr( $invoice->get_created_date() );
266
-				$date      = esc_html( getpaid_format_date_value( $date_time, '&mdash;', true ) );
267
-				echo wp_kses_post( "<span title='$date_time'>$date</span>" );
265
+				$date_time = esc_attr($invoice->get_created_date());
266
+				$date      = esc_html(getpaid_format_date_value($date_time, '&mdash;', true));
267
+				echo wp_kses_post("<span title='$date_time'>$date</span>");
268 268
 				break;
269 269
 
270 270
 			case 'payment_date':
271
-				if ( $invoice->is_paid() || $invoice->is_refunded() ) {
272
-					$date_time = esc_attr( $invoice->get_completed_date() );
273
-					$date      = esc_html( getpaid_format_date_value( $date_time, '&mdash;', true ) );
274
-					echo wp_kses_post( "<span title='$date_time'>$date</span>" );
271
+				if ($invoice->is_paid() || $invoice->is_refunded()) {
272
+					$date_time = esc_attr($invoice->get_completed_date());
273
+					$date      = esc_html(getpaid_format_date_value($date_time, '&mdash;', true));
274
+					echo wp_kses_post("<span title='$date_time'>$date</span>");
275 275
 
276
-					if ( $_gateway = $invoice->get_gateway() ) {
277
-						$gateway_label = wpinv_get_gateway_admin_label( $_gateway );
276
+					if ($_gateway = $invoice->get_gateway()) {
277
+						$gateway_label = wpinv_get_gateway_admin_label($_gateway);
278 278
 
279
-						if ( $transaction_url = $invoice->get_transaction_url() ) {
280
-							$gateway_label = '<a href="' . esc_url( $transaction_url ) . '" target="_blank" title="' . esc_attr__( 'Open transaction link', 'invoicing' ) . '">' . $gateway_label . '</a>';
279
+						if ($transaction_url = $invoice->get_transaction_url()) {
280
+							$gateway_label = '<a href="' . esc_url($transaction_url) . '" target="_blank" title="' . esc_attr__('Open transaction link', 'invoicing') . '">' . $gateway_label . '</a>';
281 281
 						}
282 282
 
283
-						$gateway = '<small class="meta bsui"><span class="fs-xs text-muted fst-normal">' . wp_sprintf( _x( 'Via %s', 'Paid via gateway', 'invoicing' ), $gateway_label ) . '</span></small>';
283
+						$gateway = '<small class="meta bsui"><span class="fs-xs text-muted fst-normal">' . wp_sprintf(_x('Via %s', 'Paid via gateway', 'invoicing'), $gateway_label) . '</span></small>';
284 284
 					} else {
285 285
 						$gateway = '';
286 286
 					}
287 287
 
288
-					$gateway = apply_filters( 'getpaid_admin_invoices_list_table_gateway', $gateway, $invoice );
288
+					$gateway = apply_filters('getpaid_admin_invoices_list_table_gateway', $gateway, $invoice);
289 289
 
290
-					if ( $gateway ) {
291
-						echo wp_kses_post( $gateway ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
290
+					if ($gateway) {
291
+						echo wp_kses_post($gateway); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
292 292
 					}
293 293
 				} else {
294 294
 					echo '&mdash;';
@@ -298,60 +298,60 @@  discard block
 block discarded – undo
298 298
 
299 299
 			case 'amount':
300 300
 				$amount = $invoice->get_total();
301
-				$formated_amount = wp_kses_post( wpinv_price( $amount, $invoice->get_currency() ) );
301
+				$formated_amount = wp_kses_post(wpinv_price($amount, $invoice->get_currency()));
302 302
 
303
-				if ( $invoice->is_refunded() ) {
304
-					$refunded_amount = wpinv_price( 0, $invoice->get_currency() );
305
-					echo wp_kses_post( "<del>$formated_amount</del>&nbsp;<ins>$refunded_amount</ins>" );
303
+				if ($invoice->is_refunded()) {
304
+					$refunded_amount = wpinv_price(0, $invoice->get_currency());
305
+					echo wp_kses_post("<del>$formated_amount</del>&nbsp;<ins>$refunded_amount</ins>");
306 306
 				} else {
307 307
 
308 308
 					$discount = $invoice->get_total_discount();
309 309
 
310
-					if ( ! empty( $discount ) ) {
311
-						$new_amount = wpinv_price( $amount + $discount, $invoice->get_currency() );
312
-						echo wp_kses_post( "<del>$new_amount</del>&nbsp;<ins>$formated_amount</ins>" );
310
+					if (!empty($discount)) {
311
+						$new_amount = wpinv_price($amount + $discount, $invoice->get_currency());
312
+						echo wp_kses_post("<del>$new_amount</del>&nbsp;<ins>$formated_amount</ins>");
313 313
 					} else {
314
-						echo wp_kses_post( $formated_amount );
314
+						echo wp_kses_post($formated_amount);
315 315
 					}
316 316
 				}
317 317
 
318 318
 				break;
319 319
 
320 320
 			case 'status':
321
-				$status = esc_html( $invoice->get_status() );
321
+				$status = esc_html($invoice->get_status());
322 322
 
323 323
 				// If it is paid, show the gateway title.
324
-				if ( $invoice->is_paid() ) {
325
-					$gateway = esc_html( $invoice->get_gateway_title() );
326
-					$gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), esc_html( $gateway ) );
324
+				if ($invoice->is_paid()) {
325
+					$gateway = esc_html($invoice->get_gateway_title());
326
+					$gateway = wp_sprintf(esc_attr__('Paid via %s', 'invoicing'), esc_html($gateway));
327 327
 
328
-					echo wp_kses_post( "<span class='bsui wpi-help-tip getpaid-invoice-statuss $status' title='$gateway'><span class='fs-base'>" . $invoice->get_status_label_html() . "</span></span>" );
328
+					echo wp_kses_post("<span class='bsui wpi-help-tip getpaid-invoice-statuss $status' title='$gateway'><span class='fs-base'>" . $invoice->get_status_label_html() . "</span></span>");
329 329
 				} else {
330
-					echo wp_kses_post( "<span class='bsui getpaid-invoice-statuss $status'><span class='fs-base'>" . $invoice->get_status_label_html() . "</span></span>" );
330
+					echo wp_kses_post("<span class='bsui getpaid-invoice-statuss $status'><span class='fs-base'>" . $invoice->get_status_label_html() . "</span></span>");
331 331
 				}
332 332
 
333 333
 				// If it is not paid, display the overdue and view status.
334
-				if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
334
+				if (!$invoice->is_paid() && !$invoice->is_refunded()) {
335 335
 
336 336
 					// Invoice view status.
337
-					if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) {
338
-						echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="' . esc_attr__( 'Viewed by Customer', 'invoicing' ) . '"></i>';
337
+					if (wpinv_is_invoice_viewed($invoice->get_id())) {
338
+						echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="' . esc_attr__('Viewed by Customer', 'invoicing') . '"></i>';
339 339
 					} else {
340
-						echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="' . esc_attr__( 'Not Viewed by Customer', 'invoicing' ) . '"></i>';
340
+						echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="' . esc_attr__('Not Viewed by Customer', 'invoicing') . '"></i>';
341 341
 					}
342 342
 
343 343
 					// Display the overview status.
344
-					if ( wpinv_get_option( 'overdue_active' ) ) {
344
+					if (wpinv_get_option('overdue_active')) {
345 345
 						$due_date = $invoice->get_due_date();
346
-						$fomatted = getpaid_format_date( $due_date );
346
+						$fomatted = getpaid_format_date($due_date);
347 347
 
348
-						if ( ! empty( $fomatted ) ) {
348
+						if (!empty($fomatted)) {
349 349
 							$date = wp_sprintf(
350 350
 								// translators: %s is the due date.
351
-								__( 'Due %s', 'invoicing' ),
351
+								__('Due %s', 'invoicing'),
352 352
 								$fomatted
353 353
 							);
354
-							echo wp_kses_post( "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>" );
354
+							echo wp_kses_post("<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>");
355 355
 						}
356 356
 					}
357 357
 				}
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 				break;
360 360
 
361 361
 			case 'recurring':
362
-				if ( $invoice->is_recurring() ) {
362
+				if ($invoice->is_recurring()) {
363 363
 					echo '<i class="fa fa-check" style="color:#43850a;"></i>';
364 364
 				} else {
365 365
 					echo '<i class="fa fa-times" style="color:#616161;"></i>';
@@ -367,26 +367,26 @@  discard block
 block discarded – undo
367 367
 				break;
368 368
 
369 369
 			case 'number':
370
-				$edit_link       = esc_url( get_edit_post_link( $invoice->get_id() ) );
371
-				$invoice_number  = esc_html( $invoice->get_number() );
372
-				$invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' );
370
+				$edit_link       = esc_url(get_edit_post_link($invoice->get_id()));
371
+				$invoice_number  = esc_html($invoice->get_number());
372
+				$invoice_details = esc_attr__('View Invoice Details', 'invoicing');
373 373
 
374
-				echo wp_kses_post( "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>" );
374
+				echo wp_kses_post("<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>");
375 375
 
376
-				do_action( 'getpaid_admin_table_invoice_number_column', $invoice );
376
+				do_action('getpaid_admin_table_invoice_number_column', $invoice);
377 377
 				break;
378 378
 
379 379
 			case 'customer':
380 380
 				$customer_name = $invoice->get_user_full_name();
381 381
 
382
-				if ( empty( $customer_name ) ) {
382
+				if (empty($customer_name)) {
383 383
 					$customer_name = $invoice->get_email();
384 384
 				}
385 385
 
386
-				if ( ! empty( $customer_name ) ) {
387
-					$customer_details = esc_attr__( 'View Customer Details', 'invoicing' );
388
-					$view_link        = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) );
389
-					echo wp_kses_post( "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>" );
386
+				if (!empty($customer_name)) {
387
+					$customer_details = esc_attr__('View Customer Details', 'invoicing');
388
+					$view_link        = esc_url(add_query_arg('user_id', $invoice->get_user_id(), admin_url('user-edit.php')));
389
+					echo wp_kses_post("<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>");
390 390
 				} else {
391 391
 					echo '<div>&mdash;</div>';
392 392
 				}
@@ -400,19 +400,19 @@  discard block
 block discarded – undo
400 400
 	/**
401 401
 	 * Displays invoice bulk actions.
402 402
 	 */
403
-	public static function invoice_bulk_actions( $actions ) {
404
-		$actions['resend-invoice'] = __( 'Send to Customer', 'invoicing' );
403
+	public static function invoice_bulk_actions($actions) {
404
+		$actions['resend-invoice'] = __('Send to Customer', 'invoicing');
405 405
 		return $actions;
406 406
 	}
407 407
 
408 408
 	/**
409 409
 	 * Processes invoice bulk actions.
410 410
 	 */
411
-	public static function handle_invoice_bulk_actions( $redirect_url, $action, $post_ids ) {
411
+	public static function handle_invoice_bulk_actions($redirect_url, $action, $post_ids) {
412 412
 
413
-		if ( 'resend-invoice' === $action ) {
414
-			foreach ( $post_ids as $post_id ) {
415
-				getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $post_id ), true );
413
+		if ('resend-invoice' === $action) {
414
+			foreach ($post_ids as $post_id) {
415
+				getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($post_id), true);
416 416
 			}
417 417
 		}
418 418
 
@@ -423,49 +423,49 @@  discard block
 block discarded – undo
423 423
 	/**
424 424
 	 * Returns an array of payment forms table columns.
425 425
 	 */
426
-	public static function payment_form_columns( $columns ) {
426
+	public static function payment_form_columns($columns) {
427 427
 
428 428
 		$columns = array(
429 429
 			'cb'        => $columns['cb'],
430
-			'title'     => __( 'Name', 'invoicing' ),
431
-			'shortcode' => __( 'Shortcode', 'invoicing' ),
432
-			'earnings'  => __( 'Revenue', 'invoicing' ),
433
-			'refunds'   => __( 'Refunded', 'invoicing' ),
434
-			'items'     => __( 'Items', 'invoicing' ),
435
-			'date'      => __( 'Date', 'invoicing' ),
430
+			'title'     => __('Name', 'invoicing'),
431
+			'shortcode' => __('Shortcode', 'invoicing'),
432
+			'earnings'  => __('Revenue', 'invoicing'),
433
+			'refunds'   => __('Refunded', 'invoicing'),
434
+			'items'     => __('Items', 'invoicing'),
435
+			'date'      => __('Date', 'invoicing'),
436 436
 		);
437 437
 
438
-		return apply_filters( 'wpi_payment_form_table_columns', $columns );
438
+		return apply_filters('wpi_payment_form_table_columns', $columns);
439 439
 
440 440
 	}
441 441
 
442 442
 	/**
443 443
 	 * Displays payment form table columns.
444 444
 	 */
445
-	public static function display_payment_form_columns( $column_name, $post_id ) {
445
+	public static function display_payment_form_columns($column_name, $post_id) {
446 446
 
447 447
 		// Retrieve the payment form.
448
-		$form = new GetPaid_Payment_Form( $post_id );
448
+		$form = new GetPaid_Payment_Form($post_id);
449 449
 
450
-		switch ( $column_name ) {
450
+		switch ($column_name) {
451 451
 
452 452
 			case 'earnings':
453
-				echo wp_kses_post( wpinv_price( $form->get_earned() ) );
453
+				echo wp_kses_post(wpinv_price($form->get_earned()));
454 454
 				break;
455 455
 
456 456
 			case 'refunds':
457
-				echo wp_kses_post( wpinv_price( $form->get_refunded() ) );
457
+				echo wp_kses_post(wpinv_price($form->get_refunded()));
458 458
 				break;
459 459
 
460 460
 			case 'refunds':
461
-				echo wp_kses_post( wpinv_price( $form->get_refunded() ) );
461
+				echo wp_kses_post(wpinv_price($form->get_refunded()));
462 462
 				break;
463 463
 
464 464
 			case 'shortcode':
465
-				if ( $form->is_default() ) {
465
+				if ($form->is_default()) {
466 466
 					echo '&mdash;';
467 467
 				} else {
468
-					echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>';
468
+					echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr($form->get_id()) . ']" style="width: 100%;" readonly/>';
469 469
 				}
470 470
 
471 471
 				break;
@@ -473,28 +473,28 @@  discard block
 block discarded – undo
473 473
 			case 'items':
474 474
 				$items = $form->get_items();
475 475
 
476
-				if ( $form->is_default() || empty( $items ) ) {
476
+				if ($form->is_default() || empty($items)) {
477 477
 					echo '&mdash;';
478 478
 					return;
479 479
 				}
480 480
 
481 481
 				$_items = array();
482 482
 
483
-				foreach ( $items as $item ) {
483
+				foreach ($items as $item) {
484 484
 					$url = $item->get_edit_url();
485 485
 
486
-					if ( empty( $url ) ) {
487
-						$_items[] = esc_html( $item->get_name() );
486
+					if (empty($url)) {
487
+						$_items[] = esc_html($item->get_name());
488 488
 					} else {
489 489
 						$_items[] = sprintf(
490 490
 							'<a href="%s">%s</a>',
491
-							esc_url( $url ),
492
-							esc_html( $item->get_name() )
491
+							esc_url($url),
492
+							esc_html($item->get_name())
493 493
 						);
494 494
 					}
495 495
 }
496 496
 
497
-				echo wp_kses_post( implode( '<br>', $_items ) );
497
+				echo wp_kses_post(implode('<br>', $_items));
498 498
 
499 499
 				break;
500 500
 
@@ -505,10 +505,10 @@  discard block
 block discarded – undo
505 505
 	/**
506 506
 	 * Filters post states.
507 507
 	 */
508
-	public static function filter_payment_form_state( $post_states, $post ) {
508
+	public static function filter_payment_form_state($post_states, $post) {
509 509
 
510
-		if ( 'wpi_payment_form' === $post->post_type && wpinv_get_default_payment_form() === $post->ID ) {
511
-			$post_states['default_form'] = __( 'Default Payment Form', 'invoicing' );
510
+		if ('wpi_payment_form' === $post->post_type && wpinv_get_default_payment_form() === $post->ID) {
511
+			$post_states['default_form'] = __('Default Payment Form', 'invoicing');
512 512
 		}
513 513
 
514 514
 		return $post_states;
@@ -518,35 +518,35 @@  discard block
 block discarded – undo
518 518
 	/**
519 519
 	 * Returns an array of coupon table columns.
520 520
 	 */
521
-	public static function discount_columns( $columns ) {
521
+	public static function discount_columns($columns) {
522 522
 
523 523
 		$columns = array(
524 524
 			'cb'          => $columns['cb'],
525
-			'title'       => __( 'Name', 'invoicing' ),
526
-			'code'        => __( 'Code', 'invoicing' ),
527
-			'amount'      => __( 'Amount', 'invoicing' ),
528
-			'usage'       => __( 'Usage / Limit', 'invoicing' ),
529
-			'start_date'  => __( 'Start Date', 'invoicing' ),
530
-			'expiry_date' => __( 'Expiry Date', 'invoicing' ),
525
+			'title'       => __('Name', 'invoicing'),
526
+			'code'        => __('Code', 'invoicing'),
527
+			'amount'      => __('Amount', 'invoicing'),
528
+			'usage'       => __('Usage / Limit', 'invoicing'),
529
+			'start_date'  => __('Start Date', 'invoicing'),
530
+			'expiry_date' => __('Expiry Date', 'invoicing'),
531 531
 		);
532 532
 
533
-		return apply_filters( 'wpi_discount_table_columns', $columns );
533
+		return apply_filters('wpi_discount_table_columns', $columns);
534 534
 	}
535 535
 
536 536
 	/**
537 537
 	 * Filters post states.
538 538
 	 */
539
-	public static function filter_discount_state( $post_states, $post ) {
539
+	public static function filter_discount_state($post_states, $post) {
540 540
 
541
-		if ( 'wpi_discount' === $post->post_type ) {
541
+		if ('wpi_discount' === $post->post_type) {
542 542
 
543
-			$discount = new WPInv_Discount( $post );
543
+			$discount = new WPInv_Discount($post);
544 544
 
545 545
 			$status = $discount->is_expired() ? 'expired' : $discount->get_status();
546 546
 
547
-			if ( 'publish' !== $status ) {
547
+			if ('publish' !== $status) {
548 548
 				return array(
549
-					'discount_status' => wpinv_discount_status( $status ),
549
+					'discount_status' => wpinv_discount_status($status),
550 550
 				);
551 551
 			}
552 552
 
@@ -561,30 +561,30 @@  discard block
 block discarded – undo
561 561
 	/**
562 562
 	 * Returns an array of items table columns.
563 563
 	 */
564
-	public static function item_columns( $columns ) {
564
+	public static function item_columns($columns) {
565 565
 
566 566
 		$columns = array(
567 567
 			'cb'        => $columns['cb'],
568
-			'title'     => __( 'Name', 'invoicing' ),
569
-			'price'     => __( 'Price', 'invoicing' ),
570
-			'vat_rule'  => __( 'Tax Rule', 'invoicing' ),
571
-			'vat_class' => __( 'Tax Class', 'invoicing' ),
572
-			'type'      => __( 'Type', 'invoicing' ),
573
-			'shortcode' => __( 'Shortcode', 'invoicing' ),
568
+			'title'     => __('Name', 'invoicing'),
569
+			'price'     => __('Price', 'invoicing'),
570
+			'vat_rule'  => __('Tax Rule', 'invoicing'),
571
+			'vat_class' => __('Tax Class', 'invoicing'),
572
+			'type'      => __('Type', 'invoicing'),
573
+			'shortcode' => __('Shortcode', 'invoicing'),
574 574
 		);
575 575
 
576
-		if ( ! wpinv_use_taxes() ) {
577
-			unset( $columns['vat_rule'] );
578
-			unset( $columns['vat_class'] );
576
+		if (!wpinv_use_taxes()) {
577
+			unset($columns['vat_rule']);
578
+			unset($columns['vat_class']);
579 579
 		}
580 580
 
581
-		return apply_filters( 'wpi_item_table_columns', $columns );
581
+		return apply_filters('wpi_item_table_columns', $columns);
582 582
 	}
583 583
 
584 584
 	/**
585 585
 	 * Returns an array of sortable items table columns.
586 586
 	 */
587
-	public static function sortable_item_columns( $columns ) {
587
+	public static function sortable_item_columns($columns) {
588 588
 
589 589
 		return array_merge(
590 590
 			$columns,
@@ -601,45 +601,45 @@  discard block
 block discarded – undo
601 601
 	/**
602 602
 	 * Displays items table columns.
603 603
 	 */
604
-	public static function display_item_columns( $column_name, $post_id ) {
604
+	public static function display_item_columns($column_name, $post_id) {
605 605
 
606
-		$item = new WPInv_Item( $post_id );
606
+		$item = new WPInv_Item($post_id);
607 607
 
608
-		switch ( $column_name ) {
608
+		switch ($column_name) {
609 609
 
610 610
 			case 'price':
611
-				if ( ! $item->is_recurring() ) {
612
-					echo wp_kses_post( $item->get_the_price() );
611
+				if (!$item->is_recurring()) {
612
+					echo wp_kses_post($item->get_the_price());
613 613
 					break;
614 614
 				}
615 615
 
616 616
 				$price = wp_sprintf(
617
-					__( '%1$s / %2$s', 'invoicing' ),
617
+					__('%1$s / %2$s', 'invoicing'),
618 618
 					$item->get_the_price(),
619
-					getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' )
619
+					getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '')
620 620
 				);
621 621
 
622
-				if ( $item->get_the_price() == $item->get_the_initial_price() ) {
623
-					echo wp_kses_post( $price );
622
+				if ($item->get_the_price() == $item->get_the_initial_price()) {
623
+					echo wp_kses_post($price);
624 624
 					break;
625 625
 				}
626 626
 
627
-				echo wp_kses_post( $item->get_the_initial_price() );
627
+				echo wp_kses_post($item->get_the_initial_price());
628 628
 
629
-				echo '<span class="meta">' . wp_sprintf( esc_html__( 'then %s', 'invoicing' ), wp_kses_post( $price ) ) . '</span>';
629
+				echo '<span class="meta">' . wp_sprintf(esc_html__('then %s', 'invoicing'), wp_kses_post($price)) . '</span>';
630 630
 				break;
631 631
 
632 632
 			case 'vat_rule':
633
-				echo wp_kses_post( getpaid_get_tax_rule_label( $item->get_vat_rule() ) );
633
+				echo wp_kses_post(getpaid_get_tax_rule_label($item->get_vat_rule()));
634 634
 				break;
635 635
 
636 636
 			case 'vat_class':
637
-				echo wp_kses_post( getpaid_get_tax_class_label( $item->get_vat_class() ) );
637
+				echo wp_kses_post(getpaid_get_tax_class_label($item->get_vat_class()));
638 638
 				break;
639 639
 
640 640
 			case 'shortcode':
641
-				if ( $item->is_type( array( '', 'fee', 'custom' ) ) ) {
642
-					echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
641
+				if ($item->is_type(array('', 'fee', 'custom'))) {
642
+					echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr($item->get_id()) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
643 643
 				} else {
644 644
 					echo '&mdash;';
645 645
 				}
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 				break;
648 648
 
649 649
 			case 'type':
650
-				echo wp_kses_post( wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>' );
650
+				echo wp_kses_post(wpinv_item_type($item->get_id()) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>');
651 651
 				break;
652 652
 
653 653
 		}
@@ -657,21 +657,21 @@  discard block
 block discarded – undo
657 657
 	/**
658 658
 	 * Lets users filter items using taxes.
659 659
 	 */
660
-	public static function add_item_filters( $post_type ) {
660
+	public static function add_item_filters($post_type) {
661 661
 
662 662
 		// Abort if we're not dealing with items.
663
-		if ( 'wpi_item' !== $post_type ) {
663
+		if ('wpi_item' !== $post_type) {
664 664
 			return;
665 665
 		}
666 666
 
667 667
 		// Filter by vat rules.
668
-		if ( wpinv_use_taxes() ) {
668
+		if (wpinv_use_taxes()) {
669 669
 
670 670
 			// Sanitize selected vat rule.
671 671
 			$vat_rule   = '';
672 672
 			$vat_rules  = getpaid_get_tax_rules();
673
-			if ( isset( $_GET['vat_rule'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
674
-				$vat_rule   = sanitize_text_field( $_GET['vat_rule'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
673
+			if (isset($_GET['vat_rule'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
674
+				$vat_rule = sanitize_text_field($_GET['vat_rule']); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
675 675
 			}
676 676
 
677 677
 			// Filter by VAT rule.
@@ -679,13 +679,13 @@  discard block
 block discarded – undo
679 679
 				array(
680 680
 					'options'          => array_merge(
681 681
 						array(
682
-							'' => __( 'All Tax Rules', 'invoicing' ),
682
+							'' => __('All Tax Rules', 'invoicing'),
683 683
 						),
684 684
 						$vat_rules
685 685
 					),
686 686
 					'name'             => 'vat_rule',
687 687
 					'id'               => 'vat_rule',
688
-					'selected'         => in_array( $vat_rule, array_keys( $vat_rules ), true ) ? $vat_rule : '',
688
+					'selected'         => in_array($vat_rule, array_keys($vat_rules), true) ? $vat_rule : '',
689 689
 					'show_option_all'  => false,
690 690
 					'show_option_none' => false,
691 691
 				)
@@ -696,21 +696,21 @@  discard block
 block discarded – undo
696 696
 			// Sanitize selected vat rule.
697 697
 			$vat_class   = '';
698 698
 			$vat_classes = getpaid_get_tax_classes();
699
-			if ( isset( $_GET['vat_class'] ) ) {  // phpcs:ignore WordPress.Security.NonceVerification.Recommended
700
-				$vat_class   = sanitize_text_field( $_GET['vat_class'] );  // phpcs:ignore WordPress.Security.NonceVerification.Recommended
699
+			if (isset($_GET['vat_class'])) {  // phpcs:ignore WordPress.Security.NonceVerification.Recommended
700
+				$vat_class = sanitize_text_field($_GET['vat_class']); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
701 701
 			}
702 702
 
703 703
 			wpinv_html_select(
704 704
 				array(
705 705
 					'options'          => array_merge(
706 706
 						array(
707
-							'' => __( 'All Tax Classes', 'invoicing' ),
707
+							'' => __('All Tax Classes', 'invoicing'),
708 708
 						),
709 709
 						$vat_classes
710 710
 					),
711 711
 					'name'             => 'vat_class',
712 712
 					'id'               => 'vat_class',
713
-					'selected'         => in_array( $vat_class, array_keys( $vat_classes ), true ) ? $vat_class : '',
713
+					'selected'         => in_array($vat_class, array_keys($vat_classes), true) ? $vat_class : '',
714 714
 					'show_option_all'  => false,
715 715
 					'show_option_none' => false,
716 716
 				)
@@ -719,22 +719,22 @@  discard block
 block discarded – undo
719 719
 		}
720 720
 
721 721
 		// Filter by item type.
722
-		$type   = '';
723
-		if ( isset( $_GET['type'] ) ) {  // phpcs:ignore WordPress.Security.NonceVerification.Recommended
724
-			$type   = sanitize_text_field( $_GET['type'] );  // phpcs:ignore WordPress.Security.NonceVerification.Recommended
722
+		$type = '';
723
+		if (isset($_GET['type'])) {  // phpcs:ignore WordPress.Security.NonceVerification.Recommended
724
+			$type = sanitize_text_field($_GET['type']); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
725 725
 		}
726 726
 
727 727
 		wpinv_html_select(
728 728
 			array(
729 729
 				'options'          => array_merge(
730 730
 					array(
731
-						'' => __( 'All item types', 'invoicing' ),
731
+						'' => __('All item types', 'invoicing'),
732 732
 					),
733 733
 					wpinv_get_item_types()
734 734
 				),
735 735
 				'name'             => 'type',
736 736
 				'id'               => 'type',
737
-				'selected'         => in_array( $type, wpinv_item_types(), true ) ? $type : '',
737
+				'selected'         => in_array($type, wpinv_item_types(), true) ? $type : '',
738 738
 				'show_option_all'  => false,
739 739
 				'show_option_none' => false,
740 740
 			)
@@ -745,45 +745,45 @@  discard block
 block discarded – undo
745 745
 	/**
746 746
 	 * Filters the item query.
747 747
 	 */
748
-	public static function filter_item_query( $query ) {
748
+	public static function filter_item_query($query) {
749 749
 
750 750
 		// modify the query only if it admin and main query.
751
-		if ( ! ( is_admin() && $query->is_main_query() ) ) {
751
+		if (!(is_admin() && $query->is_main_query())) {
752 752
 			return $query;
753 753
 		}
754 754
 
755 755
 		// we want to modify the query for our items.
756
-		if ( empty( $query->query['post_type'] ) || 'wpi_item' !== $query->query['post_type'] ) {
756
+		if (empty($query->query['post_type']) || 'wpi_item' !== $query->query['post_type']) {
757 757
 			return $query;
758 758
 		}
759 759
 
760
-		if ( empty( $query->query_vars['meta_query'] ) ) {
760
+		if (empty($query->query_vars['meta_query'])) {
761 761
 			$query->query_vars['meta_query'] = array();
762 762
 		}
763 763
 
764 764
 		// Filter vat rule type
765
-        if ( ! empty( $_GET['vat_rule'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
765
+        if (!empty($_GET['vat_rule'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
766 766
             $query->query_vars['meta_query'][] = array(
767 767
                 'key'     => '_wpinv_vat_rule',
768
-                'value'   => sanitize_text_field( $_GET['vat_rule'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended
768
+                'value'   => sanitize_text_field($_GET['vat_rule']), // phpcs:ignore WordPress.Security.NonceVerification.Recommended
769 769
                 'compare' => '=',
770 770
             );
771 771
         }
772 772
 
773 773
         // Filter vat class
774
-        if ( ! empty( $_GET['vat_class'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
774
+        if (!empty($_GET['vat_class'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
775 775
             $query->query_vars['meta_query'][] = array(
776 776
                 'key'     => '_wpinv_vat_class',
777
-                'value'   => sanitize_text_field( $_GET['vat_class'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended
777
+                'value'   => sanitize_text_field($_GET['vat_class']), // phpcs:ignore WordPress.Security.NonceVerification.Recommended
778 778
                 'compare' => '=',
779 779
             );
780 780
         }
781 781
 
782 782
         // Filter item type
783
-        if ( ! empty( $_GET['type'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
783
+        if (!empty($_GET['type'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
784 784
             $query->query_vars['meta_query'][] = array(
785 785
                 'key'     => '_wpinv_type',
786
-                'value'   => sanitize_text_field( $_GET['type'] ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended
786
+                'value'   => sanitize_text_field($_GET['type']), // phpcs:ignore WordPress.Security.NonceVerification.Recommended
787 787
                 'compare' => '=',
788 788
             );
789 789
 		}
@@ -797,15 +797,15 @@  discard block
 block discarded – undo
797 797
 	/**
798 798
 	 * Reorders items.
799 799
 	 */
800
-	public static function reorder_items( $vars ) {
800
+	public static function reorder_items($vars) {
801 801
 		global $typenow;
802 802
 
803
-		if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) {
803
+		if ('wpi_item' !== $typenow || empty($vars['orderby'])) {
804 804
 			return $vars;
805 805
 		}
806 806
 
807 807
 		// By item type.
808
-		if ( 'type' === $vars['orderby'] ) {
808
+		if ('type' === $vars['orderby']) {
809 809
 			return array_merge(
810 810
 				$vars,
811 811
 				array(
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 		}
817 817
 
818 818
 		// By vat class.
819
-		if ( 'vat_class' === $vars['orderby'] ) {
819
+		if ('vat_class' === $vars['orderby']) {
820 820
 			return array_merge(
821 821
 				$vars,
822 822
 				array(
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 		}
828 828
 
829 829
 		// By vat rule.
830
-		if ( 'vat_rule' === $vars['orderby'] ) {
830
+		if ('vat_rule' === $vars['orderby']) {
831 831
 			return array_merge(
832 832
 				$vars,
833 833
 				array(
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 		}
839 839
 
840 840
 		// By price.
841
-		if ( 'price' === $vars['orderby'] ) {
841
+		if ('price' === $vars['orderby']) {
842 842
 			return array_merge(
843 843
 				$vars,
844 844
 				array(
@@ -855,27 +855,27 @@  discard block
 block discarded – undo
855 855
 	/**
856 856
 	 * Fired when deleting a post.
857 857
 	 */
858
-	public static function delete_post( $post_id ) {
858
+	public static function delete_post($post_id) {
859 859
 
860
-		switch ( get_post_type( $post_id ) ) {
860
+		switch (get_post_type($post_id)) {
861 861
 
862 862
 			case 'wpi_item':
863
-				do_action( 'getpaid_before_delete_item', new WPInv_Item( $post_id ) );
863
+				do_action('getpaid_before_delete_item', new WPInv_Item($post_id));
864 864
 				break;
865 865
 
866 866
 			case 'wpi_payment_form':
867
-				do_action( 'getpaid_before_delete_payment_form', new GetPaid_Payment_Form( $post_id ) );
867
+				do_action('getpaid_before_delete_payment_form', new GetPaid_Payment_Form($post_id));
868 868
 				break;
869 869
 
870 870
 			case 'wpi_discount':
871
-				do_action( 'getpaid_before_delete_discount', new WPInv_Discount( $post_id ) );
871
+				do_action('getpaid_before_delete_discount', new WPInv_Discount($post_id));
872 872
 				break;
873 873
 
874 874
 			case 'wpi_invoice':
875
-				$invoice = new WPInv_Invoice( $post_id );
876
-				do_action( 'getpaid_before_delete_invoice', $invoice );
877
-				$invoice->get_data_store()->delete_items( $invoice );
878
-				$invoice->get_data_store()->delete_special_fields( $invoice );
875
+				$invoice = new WPInv_Invoice($post_id);
876
+				do_action('getpaid_before_delete_invoice', $invoice);
877
+				$invoice->get_data_store()->delete_items($invoice);
878
+				$invoice->get_data_store()->delete_special_fields($invoice);
879 879
 				break;
880 880
 		}
881 881
 	}
@@ -888,28 +888,28 @@  discard block
 block discarded – undo
888 888
      *
889 889
      * @return mixed
890 890
      */
891
-    public static function add_display_post_states( $post_states, $post ) {
891
+    public static function add_display_post_states($post_states, $post) {
892 892
 
893
-        if ( wpinv_get_option( 'success_page', 0 ) == $post->ID ) {
894
-            $post_states['getpaid_success_page'] = __( 'GetPaid Receipt Page', 'invoicing' );
893
+        if (wpinv_get_option('success_page', 0) == $post->ID) {
894
+            $post_states['getpaid_success_page'] = __('GetPaid Receipt Page', 'invoicing');
895 895
         }
896 896
 
897
-		foreach ( getpaid_get_invoice_post_types() as $post_type => $label ) {
897
+		foreach (getpaid_get_invoice_post_types() as $post_type => $label) {
898 898
 
899
-			if ( wpinv_get_option( "{$post_type}_history_page", 0 ) == $post->ID ) {
900
-				$post_states[ "getpaid_{$post_type}_history_page" ] = sprintf(
901
-					__( 'GetPaid %s History Page', 'invoicing' ),
899
+			if (wpinv_get_option("{$post_type}_history_page", 0) == $post->ID) {
900
+				$post_states["getpaid_{$post_type}_history_page"] = sprintf(
901
+					__('GetPaid %s History Page', 'invoicing'),
902 902
 					$label
903 903
 				);
904 904
 			}
905 905
 }
906 906
 
907
-		if ( wpinv_get_option( 'invoice_subscription_page', 0 ) == $post->ID ) {
908
-            $post_states['getpaid_invoice_subscription_page'] = __( 'GetPaid Subscription Page', 'invoicing' );
907
+		if (wpinv_get_option('invoice_subscription_page', 0) == $post->ID) {
908
+            $post_states['getpaid_invoice_subscription_page'] = __('GetPaid Subscription Page', 'invoicing');
909 909
         }
910 910
 
911
-		if ( wpinv_get_option( 'checkout_page', 0 ) == $post->ID ) {
912
-            $post_states['getpaid_checkout_page'] = __( 'GetPaid Checkout Page', 'invoicing' );
911
+		if (wpinv_get_option('checkout_page', 0) == $post->ID) {
912
+            $post_states['getpaid_checkout_page'] = __('GetPaid Checkout Page', 'invoicing');
913 913
         }
914 914
 
915 915
         return $post_states;
Please login to merge, or discard this patch.