Passed
Push — master ( 32accd...dc49db )
by Brian
05:22
created
includes/reports/class-getpaid-reports-report.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * GetPaid_Reports_Report Class.
@@ -23,26 +23,26 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->views        = array(
26
+		$this->views = array(
27 27
 
28 28
             'items'     => array(
29
-				'label' => __( 'Items', 'invoicing' ),
29
+				'label' => __('Items', 'invoicing'),
30 30
 				'class' => 'GetPaid_Reports_Report_Items',
31 31
 			),
32 32
 
33 33
 			'gateways'  => array(
34
-				'label' => __( 'Payment Methods', 'invoicing' ),
34
+				'label' => __('Payment Methods', 'invoicing'),
35 35
 				'class' => 'GetPaid_Reports_Report_Gateways',
36 36
 			),
37 37
 
38 38
 			'discounts' => array(
39
-				'label' => __( 'Discount Codes', 'invoicing' ),
39
+				'label' => __('Discount Codes', 'invoicing'),
40 40
 				'class' => 'GetPaid_Reports_Report_Discounts',
41 41
 			),
42 42
 
43 43
         );
44 44
 
45
-		$this->views        = apply_filters( 'wpinv_report_views', $this->views );
45
+		$this->views = apply_filters('wpinv_report_views', $this->views);
46 46
 
47 47
 	}
48 48
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	public function get_range() {
54 54
 		$valid_ranges = $this->get_periods();
55 55
 
56
-		if ( isset( $_GET['date_range'] ) && array_key_exists( $_GET['date_range'], $valid_ranges ) ) {
57
-			return sanitize_key( $_GET['date_range'] );
56
+		if (isset($_GET['date_range']) && array_key_exists($_GET['date_range'], $valid_ranges)) {
57
+			return sanitize_key($_GET['date_range']);
58 58
 		}
59 59
 
60 60
 		return '7_days';
@@ -68,22 +68,22 @@  discard block
 block discarded – undo
68 68
 	public function get_periods() {
69 69
 
70 70
 		$periods = array(
71
-			'today'        => __( 'Today', 'invoicing' ),
72
-			'yesterday'    => __( 'Yesterday', 'invoicing' ),
73
-			'week'         => __( 'This week', 'invoicing' ),
74
-			'last_week'    => __( 'Last week', 'invoicing' ),
75
-			'7_days'       => __( 'Last 7 days', 'invoicing' ),
76
-			'month'        => __( 'This month', 'invoicing' ),
77
-			'last_month'   => __( 'Last month', 'invoicing' ),
78
-			'30_days'      => __( 'Last 30 days', 'invoicing' ),
79
-			'quarter'      => __( 'This Quarter', 'invoicing' ),
80
-			'last_quarter' => __( 'Last Quarter', 'invoicing' ),
81
-			'year'         => __( 'This year', 'invoicing' ),
82
-			'last_year'    => __( 'Last Year', 'invoicing' ),
83
-			'custom'       => __( 'Custom Date Range', 'invoicing' ),
71
+			'today'        => __('Today', 'invoicing'),
72
+			'yesterday'    => __('Yesterday', 'invoicing'),
73
+			'week'         => __('This week', 'invoicing'),
74
+			'last_week'    => __('Last week', 'invoicing'),
75
+			'7_days'       => __('Last 7 days', 'invoicing'),
76
+			'month'        => __('This month', 'invoicing'),
77
+			'last_month'   => __('Last month', 'invoicing'),
78
+			'30_days'      => __('Last 30 days', 'invoicing'),
79
+			'quarter'      => __('This Quarter', 'invoicing'),
80
+			'last_quarter' => __('Last Quarter', 'invoicing'),
81
+			'year'         => __('This year', 'invoicing'),
82
+			'last_year'    => __('Last Year', 'invoicing'),
83
+			'custom'       => __('Custom Date Range', 'invoicing'),
84 84
 		);
85 85
 
86
-		return apply_filters( 'getpaid_earning_periods', $periods );
86
+		return apply_filters('getpaid_earning_periods', $periods);
87 87
 	}
88 88
 
89 89
 	/**
@@ -96,21 +96,21 @@  discard block
 block discarded – undo
96 96
 		?>
97 97
 
98 98
 			<form method="get" class="getpaid-filter-earnings float-right">
99
-				<?php getpaid_hidden_field( 'page', isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : 'wpinv-reports' ); ?>
100
-				<?php getpaid_hidden_field( 'tab', 'reports' ); ?>
99
+				<?php getpaid_hidden_field('page', isset($_GET['page']) ? sanitize_text_field($_GET['page']) : 'wpinv-reports'); ?>
100
+				<?php getpaid_hidden_field('tab', 'reports'); ?>
101 101
 				<select name='date_range'>
102
-					<?php foreach ( $this->get_periods() as $key => $label ) : ?>
103
-						<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $range ); ?>><?php echo esc_html( $label ); ?></option>
102
+					<?php foreach ($this->get_periods() as $key => $label) : ?>
103
+						<option value="<?php echo esc_attr($key); ?>" <?php selected($key, $range); ?>><?php echo esc_html($label); ?></option>
104 104
 					<?php endforeach; ?>
105 105
 				</select>
106 106
 				<span class="getpaid-date-range-picker <?php echo 'custom' == $range ? '' : 'd-none'; ?>">
107 107
 					<input type="text" name="from" class="getpaid-from align-middle" />
108
-						<?php esc_html_e( 'to', 'invoicing' ); ?>
108
+						<?php esc_html_e('to', 'invoicing'); ?>
109 109
 					<input type="text" name="to" class="getpaid-to align-middle" />
110 110
 				</span>
111 111
 				<button type="submit" class="button button-primary">
112 112
 					<i class="fa fa-chevron-right fa-lg"></i>
113
-					<span class="screen-reader-text"><?php esc_html_e( 'View Reports', 'invoicing' ); ?></span>
113
+					<span class="screen-reader-text"><?php esc_html_e('View Reports', 'invoicing'); ?></span>
114 114
 				</button>
115 115
 			</form>
116 116
 
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
 
160 160
 				<div class="col-12 col-md-4">
161 161
 					<div class="row getpaid-report-cards">
162
-						<?php foreach ( $this->get_cards() as $key => $card ) : ?>
162
+						<?php foreach ($this->get_cards() as $key => $card) : ?>
163 163
 							<div class="col-12 mb-4">
164 164
 
165
-								<!-- <?php echo esc_html( $card['label'] ); ?> Card -->
166
-								<div class="card p-0 m-0 shadow-none <?php echo esc_attr( $key ); ?>">
165
+								<!-- <?php echo esc_html($card['label']); ?> Card -->
166
+								<div class="card p-0 m-0 shadow-none <?php echo esc_attr($key); ?>">
167 167
 
168 168
 									<div class="card-body">
169 169
 
170 170
 										<p class="getpaid-current text-uppercase small mb-2">
171
-											<strong><?php echo esc_html( $card['label'] ); ?></strong>
172
-											<span title="<?php echo esc_attr( $card['description'] ); ?>" class="wpi-help-tip dashicons dashicons-editor-help text-muted" style="margin-top: -2px;"></span>
171
+											<strong><?php echo esc_html($card['label']); ?></strong>
172
+											<span title="<?php echo esc_attr($card['description']); ?>" class="wpi-help-tip dashicons dashicons-editor-help text-muted" style="margin-top: -2px;"></span>
173 173
 										</p>
174 174
 										<h5 class="font-weight-bold mb-0">
175 175
 											<span class="getpaid-report-card-value">
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
 										<hr>
182 182
 
183
-										<p class="getpaid-previous text-uppercase text-muted small mb-2"><strong><?php esc_html_e( 'Previous Period', 'invoicing' ); ?></strong></p>
183
+										<p class="getpaid-previous text-uppercase text-muted small mb-2"><strong><?php esc_html_e('Previous Period', 'invoicing'); ?></strong></p>
184 184
 										<h5 class="getpaid-report-card-previous-value font-weight-bold text-muted mb-0">
185 185
 											<span class="spinner is-active float-none"></span>
186 186
 										</h5>
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 									</div>
189 189
 
190 190
 								</div>
191
-								<!-- <?php echo esc_html( $card['label'] ); ?> Card -->
191
+								<!-- <?php echo esc_html($card['label']); ?> Card -->
192 192
 
193 193
 							</div>
194 194
 						<?php endforeach; ?>
@@ -213,15 +213,15 @@  discard block
 block discarded – undo
213 213
 
214 214
 		?>
215 215
 
216
-			<?php foreach ( $graphs as $key => $graph ) : ?>
216
+			<?php foreach ($graphs as $key => $graph) : ?>
217 217
 				<div class="row mb-4">
218 218
 					<div class="col-12">
219 219
 						<div class="card m-0 p-0 single-report-card" style="max-width:100%">
220 220
 							<div class="card-header">
221
-								<strong><?php echo esc_html( $graph ); ?></strong>
221
+								<strong><?php echo esc_html($graph); ?></strong>
222 222
 							</div>
223 223
 							<div class="card-body">
224
-								<canvas id="getpaid-chartjs-<?php echo esc_attr( $key ); ?>"></canvas>
224
+								<canvas id="getpaid-chartjs-<?php echo esc_attr($key); ?>"></canvas>
225 225
 							</div>
226 226
 						</div>
227 227
 					</div>
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
 	 * Retrieves the download url.
237 237
 	 *
238 238
 	 */
239
-	public function get_download_url( $graph, $file_type ) {
239
+	public function get_download_url($graph, $file_type) {
240 240
 
241 241
 		return wp_nonce_url(
242 242
 			add_query_arg(
243 243
 				array(
244 244
 					'getpaid-admin-action' => 'download_graph',
245
-					'file_type'            => urlencode( $file_type ),
246
-					'graph'                => urlencode( $graph ),
245
+					'file_type'            => urlencode($file_type),
246
+					'graph'                => urlencode($graph),
247 247
 				)
248 248
 			),
249 249
 			'getpaid-nonce',
@@ -260,27 +260,27 @@  discard block
 block discarded – undo
260 260
 
261 261
 		?>
262 262
 
263
-			<?php foreach ( $this->views as $key => $view ) : ?>
263
+			<?php foreach ($this->views as $key => $view) : ?>
264 264
 				<div class="row mb-4">
265 265
 					<div class="col-12">
266 266
 						<div class="card m-0 p-0" style="max-width:100%">
267 267
 							<div class="card-header">
268 268
 								<div class="row">
269
-									<div class="<?php echo empty( $view['disable-downloads'] ) ? 'col-9' : 'col-12'; ?>">
270
-										<strong><?php echo esc_html( $view['label'] ); ?></strong>
269
+									<div class="<?php echo empty($view['disable-downloads']) ? 'col-9' : 'col-12'; ?>">
270
+										<strong><?php echo esc_html($view['label']); ?></strong>
271 271
 									</div>
272
-									<div class="<?php echo empty( $view['disable-downloads'] ) ? 'col-3' : 'd-none'; ?>">
273
-										<a title="<?php esc_attr_e( 'Download JSON', 'invoicing' ); ?>" href="<?php echo esc_url( $this->get_download_url( $key, 'json' ) ); ?>">
272
+									<div class="<?php echo empty($view['disable-downloads']) ? 'col-3' : 'd-none'; ?>">
273
+										<a title="<?php esc_attr_e('Download JSON', 'invoicing'); ?>" href="<?php echo esc_url($this->get_download_url($key, 'json')); ?>">
274 274
 											<i class="fa fa-download text-dark" style="font-size: 16px" aria-hidden="true"></i>
275
-											<span class="screen-reader-text"><?php esc_html_e( 'Download JSON', 'invoicing' ); ?></span>
275
+											<span class="screen-reader-text"><?php esc_html_e('Download JSON', 'invoicing'); ?></span>
276 276
 										</a>
277
-										<a title="<?php esc_attr_e( 'Download CSV', 'invoicing' ); ?>" href="<?php echo esc_url( $this->get_download_url( $key, 'csv' ) ); ?>">
277
+										<a title="<?php esc_attr_e('Download CSV', 'invoicing'); ?>" href="<?php echo esc_url($this->get_download_url($key, 'csv')); ?>">
278 278
 											<i class="fa fa-file-csv text-dark" style="font-size: 16px" aria-hidden="true"></i>
279
-											<span class="screen-reader-text"><?php esc_html_e( 'Download CSV', 'invoicing' ); ?></span>
279
+											<span class="screen-reader-text"><?php esc_html_e('Download CSV', 'invoicing'); ?></span>
280 280
 										</a>
281
-										<a title="<?php esc_attr_e( 'Download XML', 'invoicing' ); ?>" href="<?php echo esc_url( $this->get_download_url( $key, 'xml' ) ); ?>">
281
+										<a title="<?php esc_attr_e('Download XML', 'invoicing'); ?>" href="<?php echo esc_url($this->get_download_url($key, 'xml')); ?>">
282 282
 											<i class="fa fa-file-code text-dark" style="font-size: 16px" aria-hidden="true"></i>
283
-											<span class="screen-reader-text"><?php esc_html_e( 'Download XML', 'invoicing' ); ?></span>
283
+											<span class="screen-reader-text"><?php esc_html_e('Download XML', 'invoicing'); ?></span>
284 284
 										</a>
285 285
 									</div>
286 286
 								</div>
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 
300 300
 		<?php
301 301
 
302
-		do_action( 'getpaid_reports_display_right', $this );
302
+		do_action('getpaid_reports_display_right', $this);
303 303
 	}
304 304
 
305 305
 	/**
@@ -310,56 +310,56 @@  discard block
 block discarded – undo
310 310
 
311 311
 		$cards = array(
312 312
 			'total_sales'         => array(
313
-				'description' => __( 'Gross sales in the period.', 'invoicing' ),
314
-				'label'       => __( 'Gross Revenue', 'invoicing' ),
313
+				'description' => __('Gross sales in the period.', 'invoicing'),
314
+				'label'       => __('Gross Revenue', 'invoicing'),
315 315
 			),
316 316
 			'net_sales'           => array(
317
-				'description' => __( 'Net sales in the period.', 'invoicing' ),
318
-				'label'       => __( 'Net Revenue', 'invoicing' ),
317
+				'description' => __('Net sales in the period.', 'invoicing'),
318
+				'label'       => __('Net Revenue', 'invoicing'),
319 319
 			),
320 320
 			'average_sales'       => array(
321
-				'description' => __( 'Average net daily/monthly sales.', 'invoicing' ),
322
-				'label'       => __( 'Avg. Net Sales', 'invoicing' ),
321
+				'description' => __('Average net daily/monthly sales.', 'invoicing'),
322
+				'label'       => __('Avg. Net Sales', 'invoicing'),
323 323
 			),
324 324
 			'average_total_sales' => array(
325
-				'description' => __( 'Average gross daily/monthly sales.', 'invoicing' ),
326
-				'label'       => __( 'Avg. Gross Sales', 'invoicing' ),
325
+				'description' => __('Average gross daily/monthly sales.', 'invoicing'),
326
+				'label'       => __('Avg. Gross Sales', 'invoicing'),
327 327
 			),
328 328
 			'total_invoices'      => array(
329
-				'description' => __( 'Number of paid invoices.', 'invoicing' ),
330
-				'label'       => __( 'Paid Invoices', 'invoicing' ),
329
+				'description' => __('Number of paid invoices.', 'invoicing'),
330
+				'label'       => __('Paid Invoices', 'invoicing'),
331 331
 			),
332 332
 			'total_items'         => array(
333
-				'description' => __( 'Number of items purchased.', 'invoicing' ),
334
-				'label'       => __( 'Purchased Items', 'invoicing' ),
333
+				'description' => __('Number of items purchased.', 'invoicing'),
334
+				'label'       => __('Purchased Items', 'invoicing'),
335 335
 			),
336 336
 			'refunded_items'      => array(
337
-				'description' => __( 'Number of items refunded.', 'invoicing' ),
338
-				'label'       => __( 'Refunded Items', 'invoicing' ),
337
+				'description' => __('Number of items refunded.', 'invoicing'),
338
+				'label'       => __('Refunded Items', 'invoicing'),
339 339
 			),
340 340
 			'total_tax'           => array(
341
-				'description' => __( 'Total charged for taxes.', 'invoicing' ),
342
-				'label'       => __( 'Tax', 'invoicing' ),
341
+				'description' => __('Total charged for taxes.', 'invoicing'),
342
+				'label'       => __('Tax', 'invoicing'),
343 343
 			),
344 344
 			'total_refunded_tax'  => array(
345
-				'description' => __( 'Total refunded for taxes.', 'invoicing' ),
346
-				'label'       => __( 'Refunded Tax', 'invoicing' ),
345
+				'description' => __('Total refunded for taxes.', 'invoicing'),
346
+				'label'       => __('Refunded Tax', 'invoicing'),
347 347
 			),
348 348
 			'total_fees'          => array(
349
-				'description' => __( 'Total fees charged.', 'invoicing' ),
350
-				'label'       => __( 'Fees', 'invoicing' ),
349
+				'description' => __('Total fees charged.', 'invoicing'),
350
+				'label'       => __('Fees', 'invoicing'),
351 351
 			),
352 352
 			'total_refunds'       => array(
353
-				'description' => __( 'Total of refunded invoices.', 'invoicing' ),
354
-				'label'       => __( 'Refunded', 'invoicing' ),
353
+				'description' => __('Total of refunded invoices.', 'invoicing'),
354
+				'label'       => __('Refunded', 'invoicing'),
355 355
 			),
356 356
 			'total_discount'      => array(
357
-				'description' => __( 'Total of discounts used.', 'invoicing' ),
358
-				'label'       => __( 'Discounted', 'invoicing' ),
357
+				'description' => __('Total of discounts used.', 'invoicing'),
358
+				'label'       => __('Discounted', 'invoicing'),
359 359
 			),
360 360
 		);
361 361
 
362
-		return apply_filters( 'wpinv_report_cards', $cards );
362
+		return apply_filters('wpinv_report_cards', $cards);
363 363
 	}
364 364
 
365 365
 
Please login to merge, or discard this patch.
templates/payment-forms/cart-item.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
  * @var GetPaid_Form_Item $item
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14
-do_action( 'getpaid_before_payment_form_cart_item', $form, $item );
14
+do_action('getpaid_before_payment_form_cart_item', $form, $item);
15 15
 
16 16
 $currency = $form->get_currency();
17
-$max_qty  = wpinv_item_max_buyable_quantity( $item->get_id() );
17
+$max_qty  = wpinv_item_max_buyable_quantity($item->get_id());
18 18
 ?>
19 19
 <div class='getpaid-payment-form-items-cart-item getpaid-<?php echo $item->is_required() ? 'required' : 'selectable'; ?> item-<?php echo (int) $item->get_id(); ?> border-bottom py-2 px-3'>
20 20
 
21 21
 	<div class="form-row align-items-center needs-validation">
22 22
 
23
-		<?php foreach ( array_keys( $columns ) as $key ) : ?>
23
+		<?php foreach (array_keys($columns) as $key) : ?>
24 24
 
25
-			<div class="<?php echo 'name' === $key ? 'col-6' : 'col'; ?> <?php echo ( in_array( $key, array( 'subtotal', 'quantity', 'tax_rate' ), true ) ) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo esc_attr( $key ); ?> getpaid-form-cart-item-<?php echo esc_attr( $key ); ?>-<?php echo (int) $item->get_id(); ?>">
25
+			<div class="<?php echo 'name' === $key ? 'col-6' : 'col'; ?> <?php echo (in_array($key, array('subtotal', 'quantity', 'tax_rate'), true)) ? 'd-none d-sm-block' : ''; ?> position-relative getpaid-form-cart-item-<?php echo esc_attr($key); ?> getpaid-form-cart-item-<?php echo esc_attr($key); ?>-<?php echo (int) $item->get_id(); ?>">
26 26
 
27 27
 				<?php
28 28
 
29 29
 					// Fires before printing a line item column.
30
-					do_action( "getpaid_form_cart_item_before_$key", $item, $form );
30
+					do_action("getpaid_form_cart_item_before_$key", $item, $form);
31 31
 
32 32
 					// Item name.
33
-					if ( 'name' === $key ) {
33
+					if ('name' === $key) {
34 34
 
35 35
 
36 36
 						ob_start();
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 						// Add an optional description.
39 39
 						$description = $item->get_description();
40 40
 
41
-						if ( ! empty( $description ) ) {
42
-							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
41
+						if (!empty($description)) {
42
+							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post($description) . '</small>';
43 43
 						}
44 44
 
45 45
 						// Price help text.
46
-						$description = getpaid_item_recurring_price_help_text( $item, $currency );
47
-						if ( $description ) {
48
-							echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
46
+						$description = getpaid_item_recurring_price_help_text($item, $currency);
47
+						if ($description) {
48
+							echo "<small class='getpaid-form-item-price-desc form-text text-muted font-italic pr-2 m-0'>" . wp_kses_post($description) . '</small>';
49 49
 						}
50 50
 
51
-						do_action( 'getpaid_payment_form_cart_item_description', $item, $form );
51
+						do_action('getpaid_payment_form_cart_item_description', $item, $form);
52 52
 
53
-						if ( wpinv_current_user_can_manage_invoicing() ) {
53
+						if (wpinv_current_user_can_manage_invoicing()) {
54 54
 
55 55
 							edit_post_link(
56
-								__( 'Edit this item.', 'invoicing' ),
56
+								__('Edit this item.', 'invoicing'),
57 57
 								'<small class="form-text text-muted">',
58 58
 								'</small>',
59 59
 								$item->get_id(),
@@ -65,30 +65,30 @@  discard block
 block discarded – undo
65 65
 						$description = ob_get_clean();
66 66
 
67 67
 						// Display the name.
68
-						$tootip = empty( $description ) ? '' : '&nbsp;<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
68
+						$tootip = empty($description) ? '' : '&nbsp;<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
69 69
 
70
-						$has_featured_image = has_post_thumbnail( $item->get_id() );
70
+						$has_featured_image = has_post_thumbnail($item->get_id());
71 71
 
72
-						if ( $has_featured_image ) {
72
+						if ($has_featured_image) {
73 73
 							echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
74 74
 							echo '<div class="getpaid-form-item-image-container mr-2">';
75
-							echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) );
75
+							echo get_the_post_thumbnail($item->get_id(), 'thumbnail', array('class' => 'getpaid-form-item-image mb-0'));
76 76
 							echo '</div>';
77 77
 							echo '<div class="getpaid-form-item-name-container">';
78 78
 						}
79 79
 
80
-						echo '<div class="mb-1 font-weight-bold">' . esc_html( $item->get_name() ) . wp_kses_post( $tootip ) . '</div>';
80
+						echo '<div class="mb-1 font-weight-bold">' . esc_html($item->get_name()) . wp_kses_post($tootip) . '</div>';
81 81
 
82
-						if ( ! empty( $description ) ) {
83
-							printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post( $description ) );
82
+						if (!empty($description)) {
83
+							printf('<span class="d-none d-sm-block getpaid-item-desc">%s</span>', wp_kses_post($description));
84 84
 						}
85 85
 
86
-						if ( $item->allows_quantities() ) {
86
+						if ($item->allows_quantities()) {
87 87
 							printf(
88 88
 								'<small class="d-sm-none text-muted form-text">%s</small>',
89 89
 								sprintf(
90 90
 									// translators: %s is the item quantity.
91
-									esc_html__( 'Qty %s', 'invoicing' ),
91
+									esc_html__('Qty %s', 'invoicing'),
92 92
 									sprintf(
93 93
 										'<input
94 94
 												type="number"
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 												max="%s"
101 101
 												>',
102 102
 										(float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(),
103
-										floatval( null !== $max_qty ? $max_qty : 1000000000000 )
103
+										floatval(null !== $max_qty ? $max_qty : 1000000000000)
104 104
 									)
105 105
 								)
106 106
 							);
@@ -109,70 +109,70 @@  discard block
 block discarded – undo
109 109
 								'<small class="d-sm-none text-muted form-text">%s</small>',
110 110
 								sprintf(
111 111
 									// translators: %s is the item quantity.
112
-									esc_html__( 'Qty %s', 'invoicing' ),
112
+									esc_html__('Qty %s', 'invoicing'),
113 113
 									(float) $item->get_quantity()
114 114
 								)
115 115
 							);
116 116
 						}
117 117
 
118
-						if ( $has_featured_image ) {
118
+						if ($has_featured_image) {
119 119
 							echo '</div>';
120 120
 							echo '</div>';
121 121
 						}
122 122
 					}
123 123
 
124 124
 					// Item price.
125
-					if ( 'price' === $key ) {
125
+					if ('price' === $key) {
126 126
 
127 127
 					// Set the currency position.
128 128
 					$position = wpinv_currency_position();
129 129
 
130
-					if ( 'left_space' === $position ) {
130
+					if ('left_space' === $position) {
131 131
 						$position = 'left';
132 132
 					}
133 133
 
134
-					if ( 'right_space' === $position ) {
134
+					if ('right_space' === $position) {
135 135
 						$position = 'right';
136 136
 					}
137 137
 
138
-					if ( $item->user_can_set_their_price() ) {
139
-						$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
138
+					if ($item->user_can_set_their_price()) {
139
+						$price            = max((float) $item->get_price(), (float) $item->get_minimum_price());
140 140
 						$minimum          = (float) $item->get_minimum_price();
141 141
 						$validate_minimum = '';
142 142
 						$class            = '';
143 143
 						$data_minimum     = '';
144 144
 
145
-						if ( $minimum > 0 ) {
145
+						if ($minimum > 0) {
146 146
 							$validate_minimum = sprintf(
147 147
 								// translators: %s is the minimum price.
148
-								esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
149
-								wp_strip_all_tags( wpinv_price( $minimum, $currency ) )
148
+								esc_attr__('The minimum allowed amount is %s', 'invoicing'),
149
+								wp_strip_all_tags(wpinv_price($minimum, $currency))
150 150
 							);
151 151
 
152 152
 							$class = 'getpaid-validate-minimum-amount';
153 153
 
154
-							$data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
154
+							$data_minimum = "data-minimum-amount='" . esc_attr(getpaid_unstandardize_amount($minimum)) . "'";
155 155
 						}
156 156
 
157 157
 						?>
158 158
 								<div class="input-group input-group-sm">
159
-								<?php if ( 'left' === $position ) : ?>
159
+								<?php if ('left' === $position) : ?>
160 160
 										<div class="input-group-prepend">
161
-											<span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
161
+											<span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
162 162
 										</div>
163 163
 									<?php endif; ?>
164 164
 
165
-									<input type="text" <?php echo wp_kses_post( $data_minimum ); ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr( getpaid_unstandardize_amount( $price ) ); ?>" placeholder="<?php echo esc_attr( getpaid_unstandardize_amount( $item->get_minimum_price() ) ); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo esc_attr( $class ); ?>" style="width: 64px; line-height: 1; min-height: 35px;">
165
+									<input type="text" <?php echo wp_kses_post($data_minimum); ?> name="getpaid-items[<?php echo (int) $item->get_id(); ?>][price]" value="<?php echo esc_attr(getpaid_unstandardize_amount($price)); ?>" placeholder="<?php echo esc_attr(getpaid_unstandardize_amount($item->get_minimum_price())); ?>" class="getpaid-item-price-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border <?php echo esc_attr($class); ?>" style="width: 64px; line-height: 1; min-height: 35px;">
166 166
 
167
-								<?php if ( ! empty( $validate_minimum ) ) : ?>
167
+								<?php if (!empty($validate_minimum)) : ?>
168 168
 										<div class="invalid-tooltip">
169
-											<?php echo wp_kses_post( $validate_minimum ); ?>
169
+											<?php echo wp_kses_post($validate_minimum); ?>
170 170
 										</div>
171 171
 									<?php endif; ?>
172 172
 
173
-								<?php if ( 'left' !== $position ) : ?>
173
+								<?php if ('left' !== $position) : ?>
174 174
 										<div class="input-group-append">
175
-											<span class="input-group-text"><?php echo wp_kses_post( wpinv_currency_symbol( $currency ) ); ?></span>
175
+											<span class="input-group-text"><?php echo wp_kses_post(wpinv_currency_symbol($currency)); ?></span>
176 176
 										</div>
177 177
 									<?php endif; ?>
178 178
 								</div>
@@ -180,24 +180,24 @@  discard block
 block discarded – undo
180 180
 							<?php
181 181
 
182 182
 						} else {
183
-						echo wp_kses_post( wpinv_price( $item->get_price(), $currency ) );
183
+						echo wp_kses_post(wpinv_price($item->get_price(), $currency));
184 184
 
185 185
 						?>
186
-								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'>
186
+								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr($item->get_price()); ?>'>
187 187
 						<?php
188 188
 						}
189 189
 
190 190
 					printf(
191 191
                         '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
192 192
 						// translators: %s is the item subtotal.
193
-                        sprintf( esc_html__( 'Subtotal: %s', 'invoicing' ), wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) ) )
193
+                        sprintf(esc_html__('Subtotal: %s', 'invoicing'), wp_kses_post(wpinv_price($item->get_sub_total(), $currency)))
194 194
                     );
195 195
 					}
196 196
 
197 197
 					// Item quantity.
198
-					if ( 'quantity' === $key ) {
198
+					if ('quantity' === $key) {
199 199
 
200
-					if ( $item->allows_quantities() ) {
200
+					if ($item->allows_quantities()) {
201 201
 						?>
202 202
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type="number" step="0.01" style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' <?php echo null !== $max_qty ? 'max="' . (float) $max_qty . '"' : ''; ?> required>
203 203
 							<?php
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 }
212 212
 
213 213
 					// Item sub total.
214
-					if ( 'subtotal' === $key ) {
215
-					echo wp_kses_post( wpinv_price( $item->get_sub_total(), $currency ) );
214
+					if ('subtotal' === $key) {
215
+					echo wp_kses_post(wpinv_price($item->get_sub_total(), $currency));
216 216
 					}
217 217
 
218
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
218
+					do_action("getpaid_payment_form_cart_item_$key", $item, $form);
219 219
 				?>
220 220
 
221 221
 			</div>
@@ -226,4 +226,4 @@  discard block
 block discarded – undo
226 226
 
227 227
 </div>
228 228
 <?php
229
-do_action( 'getpaid_payment_form_cart_item', $form, $item );
229
+do_action('getpaid_payment_form_cart_item', $form, $item);
Please login to merge, or discard this patch.
templates/invoice/line-item.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -10,104 +10,104 @@
 block discarded – undo
10 10
  * @var array $columns
11 11
  */
12 12
 
13
-defined( 'ABSPATH' ) || exit;
13
+defined('ABSPATH') || exit;
14 14
 
15
-do_action( 'getpaid_before_invoice_line_item', $invoice, $item );
15
+do_action('getpaid_before_invoice_line_item', $invoice, $item);
16 16
 
17 17
 ?>
18 18
 
19
-<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo esc_attr( $item->get_type() ); ?> border-bottom'>
19
+<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo esc_attr($item->get_type()); ?> border-bottom'>
20 20
 
21 21
 	<div class="form-row align-items-center">
22 22
 
23
-		<?php foreach ( array_keys( $columns ) as $column ) : ?>
23
+		<?php foreach (array_keys($columns) as $column) : ?>
24 24
 
25
-			<div class="<?php echo 'name' === $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr( $column ); ?>">
25
+			<div class="<?php echo 'name' === $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr($column); ?>">
26 26
 
27 27
 				<?php
28 28
 
29 29
 					// Fires before printing a line item column.
30
-					do_action( "getpaid_invoice_line_item_before_$column", $item, $invoice );
30
+					do_action("getpaid_invoice_line_item_before_$column", $item, $invoice);
31 31
 
32 32
 					// Item name.
33
-					if ( 'name' === $column ) {
33
+					if ('name' === $column) {
34 34
 
35
-						$has_featured_image = has_post_thumbnail( $item->get_id() );
35
+						$has_featured_image = has_post_thumbnail($item->get_id());
36 36
 
37
-						if ( $has_featured_image ) {
37
+						if ($has_featured_image) {
38 38
 							echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
39 39
 							echo '<div class="getpaid-form-item-image-container mr-2">';
40
-							echo get_the_post_thumbnail( $item->get_id(), 'thumbnail', array( 'class' => 'getpaid-form-item-image mb-0' ) );
40
+							echo get_the_post_thumbnail($item->get_id(), 'thumbnail', array('class' => 'getpaid-form-item-image mb-0'));
41 41
 							echo '</div>';
42 42
 							echo '<div class="getpaid-form-item-name-container">';
43 43
 						}
44 44
 
45 45
 						// Display the name.
46
-						echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>';
46
+						echo '<div class="mb-1">' . esc_html($item->get_name()) . '</div>';
47 47
 
48 48
 						// And an optional description.
49 49
 						$description = $item->get_description();
50 50
 
51
-						if ( ! empty( $description ) ) {
52
-							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
51
+						if (!empty($description)) {
52
+							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post($description) . '</small>';
53 53
 						}
54 54
 
55 55
 						// Fires before printing the line item actions.
56
-						do_action( 'getpaid_before_invoice_line_item_actions', $item, $invoice );
56
+						do_action('getpaid_before_invoice_line_item_actions', $item, $invoice);
57 57
 
58
-						$actions = apply_filters( 'getpaid-invoice-page-line-item-actions', array(), $item, $invoice );
58
+						$actions = apply_filters('getpaid-invoice-page-line-item-actions', array(), $item, $invoice);
59 59
 
60
-						if ( ! empty( $actions ) ) {
60
+						if (!empty($actions)) {
61 61
 
62
-							$sanitized  = array();
63
-							foreach ( $actions as $key => $item_action ) {
64
-								$key         = sanitize_html_class( $key );
65
-								$item_action = wp_kses_post( $item_action );
62
+							$sanitized = array();
63
+							foreach ($actions as $key => $item_action) {
64
+								$key         = sanitize_html_class($key);
65
+								$item_action = wp_kses_post($item_action);
66 66
 								$sanitized[] = "<span class='$key'>$item_action</span>";
67 67
 							}
68 68
 
69 69
 							echo "<small class='form-text getpaid-line-item-actions'>";
70
-							echo wp_kses_post( implode( ' | ', $sanitized ) );
70
+							echo wp_kses_post(implode(' | ', $sanitized));
71 71
 							echo '</small>';
72 72
 
73 73
 						}
74 74
 
75
-						if ( $has_featured_image ) {
75
+						if ($has_featured_image) {
76 76
 							echo '</div>';
77 77
 							echo '</div>';
78 78
 						}
79 79
 					}
80 80
 
81 81
 					// Item price.
82
-					if ( 'price' === $column ) {
82
+					if ('price' === $column) {
83 83
 
84 84
 					// Display the item price (or recurring price if this is a renewal invoice)
85 85
 					$price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price();
86
-					wpinv_the_price( $price, $invoice->get_currency() );
86
+					wpinv_the_price($price, $invoice->get_currency());
87 87
 
88 88
 					}
89 89
 
90 90
 					// Tax rate.
91
-					if ( 'tax_rate' === $column ) {
92
-					echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';
91
+					if ('tax_rate' === $column) {
92
+					echo floatval(round(getpaid_get_invoice_tax_rate($invoice, $item), 2)) . '%';
93 93
 					}
94 94
 
95 95
 					// Item quantity.
96
-					if ( 'quantity' === $column ) {
96
+					if ('quantity' === $column) {
97 97
 					echo (float) $item->get_quantity();
98 98
 					}
99 99
 
100 100
 					// Item sub total.
101
-					if ( 'subtotal' === $column ) {
101
+					if ('subtotal' === $column) {
102 102
 					$subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total();
103
-					wpinv_the_price( $subtotal, $invoice->get_currency() );
103
+					wpinv_the_price($subtotal, $invoice->get_currency());
104 104
 					}
105 105
 
106 106
 					// Fires when printing a line item column.
107
-					do_action( "getpaid_invoice_line_item_$column", $item, $invoice );
107
+					do_action("getpaid_invoice_line_item_$column", $item, $invoice);
108 108
 
109 109
 					// Fires after printing a line item column.
110
-					do_action( "getpaid_invoice_line_item_after_$column", $item, $invoice );
110
+					do_action("getpaid_invoice_line_item_after_$column", $item, $invoice);
111 111
 
112 112
 				?>
113 113
 
Please login to merge, or discard this patch.
includes/wpinv-helper-functions.php 1 patch
Spacing   +292 added lines, -292 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Invoicing
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Are we supporting item quantities?
@@ -20,35 +20,35 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function wpinv_get_ip() {
22 22
 
23
-    if ( isset( $_SERVER['HTTP_X_REAL_IP'] ) ) {
24
-        return sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_REAL_IP'] ) );
23
+    if (isset($_SERVER['HTTP_X_REAL_IP'])) {
24
+        return sanitize_text_field(wp_unslash($_SERVER['HTTP_X_REAL_IP']));
25 25
     }
26 26
 
27
-    if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
27
+    if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
28 28
         // Proxy servers can send through this header like this: X-Forwarded-For: client1, proxy1, proxy2
29 29
         // Make sure we always only send through the first IP in the list which should always be the client IP.
30
-        return (string) rest_is_ip_address( trim( current( preg_split( '/,/', sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) ) ) ) );
30
+        return (string) rest_is_ip_address(trim(current(preg_split('/,/', sanitize_text_field(wp_unslash($_SERVER['HTTP_X_FORWARDED_FOR']))))));
31 31
     }
32 32
 
33
-    if ( isset( $_SERVER['HTTP_CLIENT_IP'] ) ) {
34
-        return sanitize_text_field( wp_unslash( $_SERVER['HTTP_CLIENT_IP'] ) );
33
+    if (isset($_SERVER['HTTP_CLIENT_IP'])) {
34
+        return sanitize_text_field(wp_unslash($_SERVER['HTTP_CLIENT_IP']));
35 35
     }
36 36
 
37
-    if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
38
-        return sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) );
37
+    if (isset($_SERVER['REMOTE_ADDR'])) {
38
+        return sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR']));
39 39
     }
40 40
 
41 41
     return '';
42 42
 }
43 43
 
44 44
 function wpinv_get_user_agent() {
45
-    if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
46
-        $user_agent = sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] );
45
+    if (!empty($_SERVER['HTTP_USER_AGENT'])) {
46
+        $user_agent = sanitize_text_field($_SERVER['HTTP_USER_AGENT']);
47 47
     } else {
48 48
         $user_agent = '';
49 49
     }
50 50
 
51
-    return apply_filters( 'wpinv_get_user_agent', $user_agent );
51
+    return apply_filters('wpinv_get_user_agent', $user_agent);
52 52
 }
53 53
 
54 54
 /**
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
  * @param string $amount The amount to sanitize.
58 58
  * @return float
59 59
  */
60
-function getpaid_standardize_amount( $amount ) {
60
+function getpaid_standardize_amount($amount) {
61 61
 
62
-    $amount = str_replace( wpinv_thousands_separator(), '', $amount );
63
-    $amount = str_replace( wpinv_decimal_separator(), '.', $amount );
64
-    if ( is_numeric( $amount ) ) {
65
-        return floatval( $amount );
62
+    $amount = str_replace(wpinv_thousands_separator(), '', $amount);
63
+    $amount = str_replace(wpinv_decimal_separator(), '.', $amount);
64
+    if (is_numeric($amount)) {
65
+        return floatval($amount);
66 66
     }
67 67
 
68 68
     // Cast the remaining to a float.
69
-    return wpinv_round_amount( preg_replace( '/[^0-9\.\-]/', '', $amount ) );
69
+    return wpinv_round_amount(preg_replace('/[^0-9\.\-]/', '', $amount));
70 70
 
71 71
 }
72 72
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
  *
76 76
  * @param string $amount The amount to sanitize.
77 77
  */
78
-function getpaid_unstandardize_amount( $amount ) {
79
-    return str_replace( '.', wpinv_decimal_separator(), $amount );
78
+function getpaid_unstandardize_amount($amount) {
79
+    return str_replace('.', wpinv_decimal_separator(), $amount);
80 80
 }
81 81
 
82 82
 /**
@@ -84,23 +84,23 @@  discard block
 block discarded – undo
84 84
  *
85 85
  * @param string $amount The amount to sanitize.
86 86
  */
87
-function wpinv_sanitize_amount( $amount ) {
87
+function wpinv_sanitize_amount($amount) {
88 88
 
89
-    if ( is_numeric( $amount ) ) {
90
-        return floatval( $amount );
89
+    if (is_numeric($amount)) {
90
+        return floatval($amount);
91 91
     }
92 92
 
93 93
     // Separate the decimals and thousands.
94
-    $amount    = explode( wpinv_decimal_separator(), $amount );
94
+    $amount    = explode(wpinv_decimal_separator(), $amount);
95 95
 
96 96
     // Remove thousands.
97
-    $amount[0] = str_replace( wpinv_thousands_separator(), '', $amount[0] );
97
+    $amount[0] = str_replace(wpinv_thousands_separator(), '', $amount[0]);
98 98
 
99 99
     // Convert back to string.
100
-    $amount = count( $amount ) > 1 ? "{$amount[0]}.{$amount[1]}" : $amount[0];
100
+    $amount = count($amount) > 1 ? "{$amount[0]}.{$amount[1]}" : $amount[0];
101 101
 
102 102
     // Cast the remaining to a float.
103
-    return (float) preg_replace( '/[^0-9\.\-]/', '', $amount );
103
+    return (float) preg_replace('/[^0-9\.\-]/', '', $amount);
104 104
 
105 105
 }
106 106
 
@@ -110,19 +110,19 @@  discard block
 block discarded – undo
110 110
  * @param float $amount
111 111
  * @param float|string|int|null $decimals
112 112
  */
113
-function wpinv_round_amount( $amount, $decimals = null, $use_sprintf = false ) {
113
+function wpinv_round_amount($amount, $decimals = null, $use_sprintf = false) {
114 114
 
115
-    if ( $decimals === null ) {
115
+    if ($decimals === null) {
116 116
         $decimals = wpinv_decimals();
117 117
     }
118 118
 
119
-    if ( $use_sprintf ) {
120
-        $amount = sprintf( "%.{$decimals}f", (float) $amount );
119
+    if ($use_sprintf) {
120
+        $amount = sprintf("%.{$decimals}f", (float) $amount);
121 121
     } else {
122
-        $amount = round( (float) $amount, absint( $decimals ) );
122
+        $amount = round((float) $amount, absint($decimals));
123 123
     }
124 124
 
125
-    return apply_filters( 'wpinv_round_amount', $amount, $decimals );
125
+    return apply_filters('wpinv_round_amount', $amount, $decimals);
126 126
 }
127 127
 
128 128
 /**
@@ -134,32 +134,32 @@  discard block
 block discarded – undo
134 134
  * @param string|WPInv_Invoice $invoice The invoice object|post type|type
135 135
  * @return array
136 136
  */
137
-function wpinv_get_invoice_statuses( $draft = false, $trashed = false, $invoice = false ) {
137
+function wpinv_get_invoice_statuses($draft = false, $trashed = false, $invoice = false) {
138 138
 
139 139
 	$invoice_statuses = array(
140
-		'wpi-pending'    => _x( 'Pending payment', 'Invoice status', 'invoicing' ),
141
-        'publish'        => _x( 'Paid', 'Invoice status', 'invoicing' ),
142
-        'wpi-processing' => _x( 'Processing', 'Invoice status', 'invoicing' ),
143
-		'wpi-onhold'     => _x( 'On hold', 'Invoice status', 'invoicing' ),
144
-		'wpi-cancelled'  => _x( 'Cancelled', 'Invoice status', 'invoicing' ),
145
-		'wpi-refunded'   => _x( 'Refunded', 'Invoice status', 'invoicing' ),
146
-        'wpi-failed'     => _x( 'Failed', 'Invoice status', 'invoicing' ),
147
-        'wpi-renewal'    => _x( 'Renewal Payment', 'Invoice status', 'invoicing' ),
140
+		'wpi-pending'    => _x('Pending payment', 'Invoice status', 'invoicing'),
141
+        'publish'        => _x('Paid', 'Invoice status', 'invoicing'),
142
+        'wpi-processing' => _x('Processing', 'Invoice status', 'invoicing'),
143
+		'wpi-onhold'     => _x('On hold', 'Invoice status', 'invoicing'),
144
+		'wpi-cancelled'  => _x('Cancelled', 'Invoice status', 'invoicing'),
145
+		'wpi-refunded'   => _x('Refunded', 'Invoice status', 'invoicing'),
146
+        'wpi-failed'     => _x('Failed', 'Invoice status', 'invoicing'),
147
+        'wpi-renewal'    => _x('Renewal Payment', 'Invoice status', 'invoicing'),
148 148
     );
149 149
 
150
-    if ( $draft ) {
151
-        $invoice_statuses['draft'] = __( 'Draft', 'invoicing' );
150
+    if ($draft) {
151
+        $invoice_statuses['draft'] = __('Draft', 'invoicing');
152 152
     }
153 153
 
154
-    if ( $trashed ) {
155
-        $invoice_statuses['trash'] = __( 'Trash', 'invoicing' );
154
+    if ($trashed) {
155
+        $invoice_statuses['trash'] = __('Trash', 'invoicing');
156 156
     }
157 157
 
158
-    if ( $invoice instanceof WPInv_Invoice ) {
158
+    if ($invoice instanceof WPInv_Invoice) {
159 159
         $invoice = $invoice->get_post_type();
160 160
     }
161 161
 
162
-	return apply_filters( 'wpinv_statuses', $invoice_statuses, $invoice );
162
+	return apply_filters('wpinv_statuses', $invoice_statuses, $invoice);
163 163
 }
164 164
 
165 165
 /**
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
  * @param string $status The raw status
169 169
  * @param string|WPInv_Invoice $invoice The invoice object|post type|type
170 170
  */
171
-function wpinv_status_nicename( $status, $invoice = false ) {
172
-    $statuses = wpinv_get_invoice_statuses( true, true, $invoice );
173
-    $status   = isset( $statuses[ $status ] ) ? $statuses[ $status ] : $status;
171
+function wpinv_status_nicename($status, $invoice = false) {
172
+    $statuses = wpinv_get_invoice_statuses(true, true, $invoice);
173
+    $status   = isset($statuses[$status]) ? $statuses[$status] : $status;
174 174
 
175
-    return sanitize_text_field( $status );
175
+    return sanitize_text_field($status);
176 176
 }
177 177
 
178 178
 /**
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
  *
181 181
  * @param string $current
182 182
  */
183
-function wpinv_get_currency( $current = '' ) {
183
+function wpinv_get_currency($current = '') {
184 184
 
185
-    if ( empty( $current ) ) {
186
-        $current = apply_filters( 'wpinv_currency', wpinv_get_option( 'currency', 'USD' ) );
185
+    if (empty($current)) {
186
+        $current = apply_filters('wpinv_currency', wpinv_get_option('currency', 'USD'));
187 187
     }
188 188
 
189
-    return trim( strtoupper( $current ) );
189
+    return trim(strtoupper($current));
190 190
 }
191 191
 
192 192
 /**
@@ -194,25 +194,25 @@  discard block
 block discarded – undo
194 194
  *
195 195
  * @param string|null $currency The currency code. Defaults to the default currency.
196 196
  */
197
-function wpinv_currency_symbol( $currency = null ) {
197
+function wpinv_currency_symbol($currency = null) {
198 198
 
199 199
     // Prepare the currency.
200
-    $currency = empty( $currency ) ? wpinv_get_currency() : wpinv_clean( $currency );
200
+    $currency = empty($currency) ? wpinv_get_currency() : wpinv_clean($currency);
201 201
 
202 202
     // Fetch all symbols.
203 203
     $symbols = wpinv_get_currency_symbols();
204 204
 
205 205
     // Fetch this currencies symbol.
206
-    $currency_symbol = isset( $symbols[ $currency ] ) ? $symbols[ $currency ] : $currency;
206
+    $currency_symbol = isset($symbols[$currency]) ? $symbols[$currency] : $currency;
207 207
 
208 208
     // Filter the symbol.
209
-    return apply_filters( 'wpinv_currency_symbol', $currency_symbol, $currency );
209
+    return apply_filters('wpinv_currency_symbol', $currency_symbol, $currency);
210 210
 }
211 211
 
212 212
 function wpinv_currency_position() {
213
-    $position = wpinv_get_option( 'currency_position', 'left' );
213
+    $position = wpinv_get_option('currency_position', 'left');
214 214
 
215
-    return apply_filters( 'wpinv_currency_position', $position );
215
+    return apply_filters('wpinv_currency_position', $position);
216 216
 }
217 217
 
218 218
 /**
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * @param $string|null $current
222 222
  */
223
-function wpinv_thousands_separator( $current = null ) {
223
+function wpinv_thousands_separator($current = null) {
224 224
 
225
-    if ( null == $current ) {
226
-        $current = wpinv_get_option( 'thousands_separator', ',' );
225
+    if (null == $current) {
226
+        $current = wpinv_get_option('thousands_separator', ',');
227 227
     }
228 228
 
229
-    return trim( $current );
229
+    return trim($current);
230 230
 }
231 231
 
232 232
 /**
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
  *
235 235
  * @param $string|null $current
236 236
  */
237
-function wpinv_decimal_separator( $current = null ) {
237
+function wpinv_decimal_separator($current = null) {
238 238
 
239
-    if ( null == $current ) {
240
-        $current = wpinv_get_option( 'decimal_separator', '.' );
239
+    if (null == $current) {
240
+        $current = wpinv_get_option('decimal_separator', '.');
241 241
     }
242 242
 
243
-    return trim( $current );
243
+    return trim($current);
244 244
 }
245 245
 
246 246
 /**
@@ -248,27 +248,27 @@  discard block
 block discarded – undo
248 248
  *
249 249
  * @param $string|null $current
250 250
  */
251
-function wpinv_decimals( $current = null ) {
251
+function wpinv_decimals($current = null) {
252 252
 
253
-    if ( null == $current ) {
254
-        $current = wpinv_get_option( 'decimals', 2 );
253
+    if (null == $current) {
254
+        $current = wpinv_get_option('decimals', 2);
255 255
     }
256 256
 
257
-    return absint( $current );
257
+    return absint($current);
258 258
 }
259 259
 
260 260
 /**
261 261
  * Retrieves a list of all supported currencies.
262 262
  */
263 263
 function wpinv_get_currencies() {
264
-    return apply_filters( 'wpinv_currencies', wpinv_get_data( 'currencies' ) );
264
+    return apply_filters('wpinv_currencies', wpinv_get_data('currencies'));
265 265
 }
266 266
 
267 267
 /**
268 268
  * Retrieves a list of all currency symbols.
269 269
  */
270 270
 function wpinv_get_currency_symbols() {
271
-    return apply_filters( 'wpinv_currency_symbols', wpinv_get_data( 'currency-symbols' ) );
271
+    return apply_filters('wpinv_currency_symbols', wpinv_get_data('currency-symbols'));
272 272
 }
273 273
 
274 274
 /**
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	$currency_pos = wpinv_currency_position();
281 281
 	$format       = '%1$s%2$s';
282 282
 
283
-	switch ( $currency_pos ) {
283
+	switch ($currency_pos) {
284 284
 		case 'left':
285 285
 			$format = '%1$s%2$s';
286 286
 			break;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 			break;
296 296
 	}
297 297
 
298
-	return apply_filters( 'getpaid_price_format', $format, $currency_pos );
298
+	return apply_filters('getpaid_price_format', $format, $currency_pos);
299 299
 }
300 300
 
301 301
 /**
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
  * @param  string $currency Currency.
306 306
  * @return string
307 307
  */
308
-function wpinv_the_price( $amount = 0, $currency = '' ) {
309
-    echo wp_kses_post( wpinv_price( $amount, $currency ) );
308
+function wpinv_the_price($amount = 0, $currency = '') {
309
+    echo wp_kses_post(wpinv_price($amount, $currency));
310 310
 }
311 311
 
312 312
 /**
@@ -316,25 +316,25 @@  discard block
 block discarded – undo
316 316
  * @param  string $currency Currency.
317 317
  * @return string
318 318
  */
319
-function wpinv_price( $amount = 0, $currency = '' ) {
319
+function wpinv_price($amount = 0, $currency = '') {
320 320
 
321 321
     // Backwards compatibility.
322
-    $amount             = wpinv_sanitize_amount( $amount );
322
+    $amount             = wpinv_sanitize_amount($amount);
323 323
 
324 324
     // Prepare variables.
325
-    $currency           = wpinv_get_currency( $currency );
325
+    $currency           = wpinv_get_currency($currency);
326 326
     $amount             = (float) $amount;
327 327
     $unformatted_amount = $amount;
328 328
     $negative           = $amount < 0;
329
-    $amount             = apply_filters( 'getpaid_raw_amount', floatval( $negative ? $amount * -1 : $amount ) );
330
-    $amount             = wpinv_format_amount( $amount );
329
+    $amount             = apply_filters('getpaid_raw_amount', floatval($negative ? $amount * -1 : $amount));
330
+    $amount             = wpinv_format_amount($amount);
331 331
 
332 332
     // Format the amount.
333 333
     $format             = getpaid_get_price_format();
334
-    $formatted_amount   = ( $negative ? '-' : '' ) . sprintf( $format, '<span class="getpaid-currency__symbol">' . wpinv_currency_symbol( $currency ) . '</span>', $amount );
334
+    $formatted_amount   = ($negative ? '-' : '') . sprintf($format, '<span class="getpaid-currency__symbol">' . wpinv_currency_symbol($currency) . '</span>', $amount);
335 335
 
336 336
     // Filter the formatting.
337
-    return apply_filters( 'wpinv_price', $formatted_amount, $amount, $currency, $unformatted_amount );
337
+    return apply_filters('wpinv_price', $formatted_amount, $amount, $currency, $unformatted_amount);
338 338
 }
339 339
 
340 340
 /**
@@ -345,25 +345,25 @@  discard block
 block discarded – undo
345 345
  * @param  bool     $calculate Whether or not to apply separators.
346 346
  * @return string
347 347
  */
348
-function wpinv_format_amount( $amount, $decimals = null, $calculate = false ) {
348
+function wpinv_format_amount($amount, $decimals = null, $calculate = false) {
349 349
     $thousands_sep = wpinv_thousands_separator();
350 350
     $decimal_sep   = wpinv_decimal_separator();
351
-    $decimals      = wpinv_decimals( $decimals );
352
-    $amount        = wpinv_sanitize_amount( $amount );
351
+    $decimals      = wpinv_decimals($decimals);
352
+    $amount        = wpinv_sanitize_amount($amount);
353 353
 
354
-    if ( $calculate ) {
354
+    if ($calculate) {
355 355
         return $amount;
356 356
     }
357 357
 
358 358
     // Fomart the amount.
359
-    return number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
359
+    return number_format($amount, $decimals, $decimal_sep, $thousands_sep);
360 360
 }
361 361
 
362
-function wpinv_sanitize_key( $key ) {
362
+function wpinv_sanitize_key($key) {
363 363
     $raw_key = $key;
364
-    $key = preg_replace( '/[^a-zA-Z0-9_\-\.\:\/]/', '', $key );
364
+    $key = preg_replace('/[^a-zA-Z0-9_\-\.\:\/]/', '', $key);
365 365
 
366
-    return apply_filters( 'wpinv_sanitize_key', $key, $raw_key );
366
+    return apply_filters('wpinv_sanitize_key', $key, $raw_key);
367 367
 }
368 368
 
369 369
 /**
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
  *
372 372
  * @param $str the file whose extension should be retrieved.
373 373
  */
374
-function wpinv_get_file_extension( $str ) {
375
-    $filetype = wp_check_filetype( $str );
374
+function wpinv_get_file_extension($str) {
375
+    $filetype = wp_check_filetype($str);
376 376
     return $filetype['ext'];
377 377
 }
378 378
 
@@ -381,16 +381,16 @@  discard block
 block discarded – undo
381 381
  *
382 382
  * @param string $string
383 383
  */
384
-function wpinv_string_is_image_url( $string ) {
385
-    $extension = strtolower( wpinv_get_file_extension( $string ) );
386
-    return in_array( $extension, array( 'jpeg', 'jpg', 'png', 'gif', 'ico' ), true );
384
+function wpinv_string_is_image_url($string) {
385
+    $extension = strtolower(wpinv_get_file_extension($string));
386
+    return in_array($extension, array('jpeg', 'jpg', 'png', 'gif', 'ico'), true);
387 387
 }
388 388
 
389 389
 /**
390 390
  * Returns the current URL.
391 391
  */
392 392
 function wpinv_get_current_page_url() {
393
-    return esc_url( add_query_arg( array() ) );
393
+    return esc_url(add_query_arg(array()));
394 394
 }
395 395
 
396 396
 /**
@@ -400,46 +400,46 @@  discard block
 block discarded – undo
400 400
  * @param string $name  Constant name.
401 401
  * @param mixed  $value Value.
402 402
  */
403
-function getpaid_maybe_define_constant( $name, $value ) {
404
-	if ( ! defined( $name ) ) {
405
-		define( $name, $value );
403
+function getpaid_maybe_define_constant($name, $value) {
404
+	if (!defined($name)) {
405
+		define($name, $value);
406 406
 	}
407 407
 }
408 408
 
409 409
 function wpinv_get_php_arg_separator_output() {
410
-	return ini_get( 'arg_separator.output' );
410
+	return ini_get('arg_separator.output');
411 411
 }
412 412
 
413
-function wpinv_rgb_from_hex( $color ) {
414
-    $color = str_replace( '#', '', $color );
413
+function wpinv_rgb_from_hex($color) {
414
+    $color = str_replace('#', '', $color);
415 415
 
416 416
     // Convert shorthand colors to full format, e.g. "FFF" -> "FFFFFF"
417
-    $color = preg_replace( '~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color );
418
-    if ( empty( $color ) ) {
417
+    $color = preg_replace('~^(.)(.)(.)$~', '$1$1$2$2$3$3', $color);
418
+    if (empty($color)) {
419 419
         return null;
420 420
     }
421 421
 
422
-    $color = str_split( $color );
422
+    $color = str_split($color);
423 423
 
424 424
     $rgb      = array();
425
-    $rgb['R'] = hexdec( $color[0] . $color[1] );
426
-    $rgb['G'] = hexdec( $color[2] . $color[3] );
427
-    $rgb['B'] = hexdec( $color[4] . $color[5] );
425
+    $rgb['R'] = hexdec($color[0] . $color[1]);
426
+    $rgb['G'] = hexdec($color[2] . $color[3]);
427
+    $rgb['B'] = hexdec($color[4] . $color[5]);
428 428
 
429 429
     return $rgb;
430 430
 }
431 431
 
432
-function wpinv_hex_darker( $color, $factor = 30 ) {
433
-    $base  = wpinv_rgb_from_hex( $color );
432
+function wpinv_hex_darker($color, $factor = 30) {
433
+    $base  = wpinv_rgb_from_hex($color);
434 434
     $color = '#';
435 435
 
436
-    foreach ( $base as $k => $v ) {
436
+    foreach ($base as $k => $v) {
437 437
         $amount      = $v / 100;
438
-        $amount      = round( $amount * $factor );
438
+        $amount      = round($amount * $factor);
439 439
         $new_decimal = $v - $amount;
440 440
 
441
-        $new_hex_component = dechex( $new_decimal );
442
-        if ( strlen( $new_hex_component ) < 2 ) {
441
+        $new_hex_component = dechex($new_decimal);
442
+        if (strlen($new_hex_component) < 2) {
443 443
             $new_hex_component = '0' . $new_hex_component;
444 444
         }
445 445
         $color .= $new_hex_component;
@@ -448,18 +448,18 @@  discard block
 block discarded – undo
448 448
     return $color;
449 449
 }
450 450
 
451
-function wpinv_hex_lighter( $color, $factor = 30 ) {
452
-    $base  = wpinv_rgb_from_hex( $color );
451
+function wpinv_hex_lighter($color, $factor = 30) {
452
+    $base  = wpinv_rgb_from_hex($color);
453 453
     $color = '#';
454 454
 
455
-    foreach ( $base as $k => $v ) {
455
+    foreach ($base as $k => $v) {
456 456
         $amount      = 255 - $v;
457 457
         $amount      = $amount / 100;
458
-        $amount      = round( $amount * $factor );
458
+        $amount      = round($amount * $factor);
459 459
         $new_decimal = $v + $amount;
460 460
 
461
-        $new_hex_component = dechex( $new_decimal );
462
-        if ( strlen( $new_hex_component ) < 2 ) {
461
+        $new_hex_component = dechex($new_decimal);
462
+        if (strlen($new_hex_component) < 2) {
463 463
             $new_hex_component = '0' . $new_hex_component;
464 464
         }
465 465
         $color .= $new_hex_component;
@@ -468,22 +468,22 @@  discard block
 block discarded – undo
468 468
     return $color;
469 469
 }
470 470
 
471
-function wpinv_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
472
-    $hex = str_replace( '#', '', $color );
471
+function wpinv_light_or_dark($color, $dark = '#000000', $light = '#FFFFFF') {
472
+    $hex = str_replace('#', '', $color);
473 473
 
474
-    $c_r = hexdec( substr( $hex, 0, 2 ) );
475
-    $c_g = hexdec( substr( $hex, 2, 2 ) );
476
-    $c_b = hexdec( substr( $hex, 4, 2 ) );
474
+    $c_r = hexdec(substr($hex, 0, 2));
475
+    $c_g = hexdec(substr($hex, 2, 2));
476
+    $c_b = hexdec(substr($hex, 4, 2));
477 477
 
478
-    $brightness = ( ( $c_r * 299 ) + ( $c_g * 587 ) + ( $c_b * 114 ) ) / 1000;
478
+    $brightness = (($c_r * 299) + ($c_g * 587) + ($c_b * 114)) / 1000;
479 479
 
480 480
     return $brightness > 155 ? $dark : $light;
481 481
 }
482 482
 
483
-function wpinv_format_hex( $hex ) {
484
-    $hex = trim( str_replace( '#', '', $hex ) );
483
+function wpinv_format_hex($hex) {
484
+    $hex = trim(str_replace('#', '', $hex));
485 485
 
486
-    if ( strlen( $hex ) == 3 ) {
486
+    if (strlen($hex) == 3) {
487 487
         $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
488 488
     }
489 489
 
@@ -503,12 +503,12 @@  discard block
 block discarded – undo
503 503
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
504 504
  * @return string
505 505
  */
506
-function wpinv_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
507
-    if ( function_exists( 'mb_strimwidth' ) ) {
508
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
506
+function wpinv_utf8_strimwidth($str, $start, $width, $trimmaker = '', $encoding = 'UTF-8') {
507
+    if (function_exists('mb_strimwidth')) {
508
+        return mb_strimwidth($str, $start, $width, $trimmaker, $encoding);
509 509
     }
510 510
 
511
-    return wpinv_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
511
+    return wpinv_utf8_substr($str, $start, $width, $encoding) . $trimmaker;
512 512
 }
513 513
 
514 514
 /**
@@ -520,28 +520,28 @@  discard block
 block discarded – undo
520 520
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
521 521
  * @return int Returns the number of characters in string.
522 522
  */
523
-function wpinv_utf8_strlen( $str, $encoding = 'UTF-8' ) {
524
-    if ( function_exists( 'mb_strlen' ) ) {
525
-        return mb_strlen( $str, $encoding );
523
+function wpinv_utf8_strlen($str, $encoding = 'UTF-8') {
524
+    if (function_exists('mb_strlen')) {
525
+        return mb_strlen($str, $encoding);
526 526
     }
527 527
 
528
-    return strlen( $str );
528
+    return strlen($str);
529 529
 }
530 530
 
531
-function wpinv_utf8_strtolower( $str, $encoding = 'UTF-8' ) {
532
-    if ( function_exists( 'mb_strtolower' ) ) {
533
-        return mb_strtolower( $str, $encoding );
531
+function wpinv_utf8_strtolower($str, $encoding = 'UTF-8') {
532
+    if (function_exists('mb_strtolower')) {
533
+        return mb_strtolower($str, $encoding);
534 534
     }
535 535
 
536
-    return strtolower( $str );
536
+    return strtolower($str);
537 537
 }
538 538
 
539
-function wpinv_utf8_strtoupper( $str, $encoding = 'UTF-8' ) {
540
-    if ( function_exists( 'mb_strtoupper' ) ) {
541
-        return mb_strtoupper( $str, $encoding );
539
+function wpinv_utf8_strtoupper($str, $encoding = 'UTF-8') {
540
+    if (function_exists('mb_strtoupper')) {
541
+        return mb_strtoupper($str, $encoding);
542 542
     }
543 543
 
544
-    return strtoupper( $str );
544
+    return strtoupper($str);
545 545
 }
546 546
 
547 547
 /**
@@ -555,12 +555,12 @@  discard block
 block discarded – undo
555 555
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
556 556
  * @return int Returns the position of the first occurrence of search in the string.
557 557
  */
558
-function wpinv_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
559
-    if ( function_exists( 'mb_strpos' ) ) {
560
-        return mb_strpos( $str, $find, $offset, $encoding );
558
+function wpinv_utf8_strpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
559
+    if (function_exists('mb_strpos')) {
560
+        return mb_strpos($str, $find, $offset, $encoding);
561 561
     }
562 562
 
563
-    return strpos( $str, $find, $offset );
563
+    return strpos($str, $find, $offset);
564 564
 }
565 565
 
566 566
 /**
@@ -574,12 +574,12 @@  discard block
 block discarded – undo
574 574
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
575 575
  * @return int Returns the position of the last occurrence of search.
576 576
  */
577
-function wpinv_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
578
-    if ( function_exists( 'mb_strrpos' ) ) {
579
-        return mb_strrpos( $str, $find, $offset, $encoding );
577
+function wpinv_utf8_strrpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
578
+    if (function_exists('mb_strrpos')) {
579
+        return mb_strrpos($str, $find, $offset, $encoding);
580 580
     }
581 581
 
582
-    return strrpos( $str, $find, $offset );
582
+    return strrpos($str, $find, $offset);
583 583
 }
584 584
 
585 585
 /**
@@ -594,16 +594,16 @@  discard block
 block discarded – undo
594 594
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
595 595
  * @return string
596 596
  */
597
-function wpinv_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
598
-    if ( function_exists( 'mb_substr' ) ) {
599
-        if ( $length === null ) {
600
-            return mb_substr( $str, $start, wpinv_utf8_strlen( $str, $encoding ), $encoding );
597
+function wpinv_utf8_substr($str, $start, $length = null, $encoding = 'UTF-8') {
598
+    if (function_exists('mb_substr')) {
599
+        if ($length === null) {
600
+            return mb_substr($str, $start, wpinv_utf8_strlen($str, $encoding), $encoding);
601 601
         } else {
602
-            return mb_substr( $str, $start, $length, $encoding );
602
+            return mb_substr($str, $start, $length, $encoding);
603 603
         }
604 604
     }
605 605
 
606
-    return substr( $str, $start, $length );
606
+    return substr($str, $start, $length);
607 607
 }
608 608
 
609 609
 /**
@@ -615,48 +615,48 @@  discard block
 block discarded – undo
615 615
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
616 616
  * @return string The width of string.
617 617
  */
618
-function wpinv_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
619
-    if ( function_exists( 'mb_strwidth' ) ) {
620
-        return mb_strwidth( $str, $encoding );
618
+function wpinv_utf8_strwidth($str, $encoding = 'UTF-8') {
619
+    if (function_exists('mb_strwidth')) {
620
+        return mb_strwidth($str, $encoding);
621 621
     }
622 622
 
623
-    return wpinv_utf8_strlen( $str, $encoding );
623
+    return wpinv_utf8_strlen($str, $encoding);
624 624
 }
625 625
 
626
-function wpinv_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
627
-    if ( function_exists( 'mb_strlen' ) ) {
628
-        $first_letter = wpinv_utf8_strtoupper( wpinv_utf8_substr( $str, 0, 1, $encoding ), $encoding );
626
+function wpinv_utf8_ucfirst($str, $lower_str_end = false, $encoding = 'UTF-8') {
627
+    if (function_exists('mb_strlen')) {
628
+        $first_letter = wpinv_utf8_strtoupper(wpinv_utf8_substr($str, 0, 1, $encoding), $encoding);
629 629
         $str_end = '';
630 630
 
631
-        if ( $lower_str_end ) {
632
-            $str_end = wpinv_utf8_strtolower( wpinv_utf8_substr( $str, 1, wpinv_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
631
+        if ($lower_str_end) {
632
+            $str_end = wpinv_utf8_strtolower(wpinv_utf8_substr($str, 1, wpinv_utf8_strlen($str, $encoding), $encoding), $encoding);
633 633
         } else {
634
-            $str_end = wpinv_utf8_substr( $str, 1, wpinv_utf8_strlen( $str, $encoding ), $encoding );
634
+            $str_end = wpinv_utf8_substr($str, 1, wpinv_utf8_strlen($str, $encoding), $encoding);
635 635
         }
636 636
 
637 637
         return $first_letter . $str_end;
638 638
     }
639 639
 
640
-    return ucfirst( $str );
640
+    return ucfirst($str);
641 641
 }
642 642
 
643
-function wpinv_utf8_ucwords( $str, $encoding = 'UTF-8' ) {
644
-    if ( function_exists( 'mb_convert_case' ) ) {
645
-        return mb_convert_case( $str, MB_CASE_TITLE, $encoding );
643
+function wpinv_utf8_ucwords($str, $encoding = 'UTF-8') {
644
+    if (function_exists('mb_convert_case')) {
645
+        return mb_convert_case($str, MB_CASE_TITLE, $encoding);
646 646
     }
647 647
 
648
-    return ucwords( $str );
648
+    return ucwords($str);
649 649
 }
650 650
 
651
-function wpinv_period_in_days( $period, $unit ) {
652
-    $period = absint( $period );
651
+function wpinv_period_in_days($period, $unit) {
652
+    $period = absint($period);
653 653
 
654
-    if ( $period > 0 ) {
655
-        if ( in_array( strtolower( $unit ), array( 'w', 'week', 'weeks' ) ) ) {
654
+    if ($period > 0) {
655
+        if (in_array(strtolower($unit), array('w', 'week', 'weeks'))) {
656 656
             $period = $period * 7;
657
-        } elseif ( in_array( strtolower( $unit ), array( 'm', 'month', 'months' ) ) ) {
657
+        } elseif (in_array(strtolower($unit), array('m', 'month', 'months'))) {
658 658
             $period = $period * 30;
659
-        } elseif ( in_array( strtolower( $unit ), array( 'y', 'year', 'years' ) ) ) {
659
+        } elseif (in_array(strtolower($unit), array('y', 'year', 'years'))) {
660 660
             $period = $period * 365;
661 661
         }
662 662
     }
@@ -664,14 +664,14 @@  discard block
 block discarded – undo
664 664
     return $period;
665 665
 }
666 666
 
667
-function wpinv_cal_days_in_month( $calendar, $month, $year ) {
668
-    if ( function_exists( 'cal_days_in_month' ) ) {
669
-        return cal_days_in_month( $calendar, $month, $year );
667
+function wpinv_cal_days_in_month($calendar, $month, $year) {
668
+    if (function_exists('cal_days_in_month')) {
669
+        return cal_days_in_month($calendar, $month, $year);
670 670
     }
671 671
 
672 672
     // Fallback in case the calendar extension is not loaded in PHP
673 673
     // Only supports Gregorian calendar
674
-    return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
674
+    return date('t', mktime(0, 0, 0, $month, 1, $year));
675 675
 }
676 676
 
677 677
 /**
@@ -682,27 +682,27 @@  discard block
 block discarded – undo
682 682
  *
683 683
  * @return string
684 684
  */
685
-function wpi_help_tip( $tip, $allow_html = false, $is_vue = false, $echo = false ) {
685
+function wpi_help_tip($tip, $allow_html = false, $is_vue = false, $echo = false) {
686 686
 
687
-    if ( $allow_html ) {
688
-        $tip = wpi_sanitize_tooltip( $tip );
687
+    if ($allow_html) {
688
+        $tip = wpi_sanitize_tooltip($tip);
689 689
     } else {
690
-        $tip = strip_tags( $tip );
690
+        $tip = strip_tags($tip);
691 691
     }
692 692
 
693
-    if ( $is_vue ) {
693
+    if ($is_vue) {
694 694
 
695
-        if ( $echo ) {
696
-            echo '<span class="dashicons dashicons-editor-help" title="' . esc_attr( $tip ) . '"></span>';
695
+        if ($echo) {
696
+            echo '<span class="dashicons dashicons-editor-help" title="' . esc_attr($tip) . '"></span>';
697 697
         } else {
698
-            return '<span class="dashicons dashicons-editor-help" title="' . esc_attr( $tip ) . '"></span>';
698
+            return '<span class="dashicons dashicons-editor-help" title="' . esc_attr($tip) . '"></span>';
699 699
         }
700 700
 }
701 701
 
702
-    if ( $echo ) {
703
-        echo '<span class="wpi-help-tip dashicons dashicons-editor-help" title="' . esc_attr( $tip ) . '"></span>';
702
+    if ($echo) {
703
+        echo '<span class="wpi-help-tip dashicons dashicons-editor-help" title="' . esc_attr($tip) . '"></span>';
704 704
     } else {
705
-        return '<span class="wpi-help-tip dashicons dashicons-editor-help" title="' . esc_attr( $tip ) . '"></span>';
705
+        return '<span class="wpi-help-tip dashicons dashicons-editor-help" title="' . esc_attr($tip) . '"></span>';
706 706
     }
707 707
 }
708 708
 
@@ -714,9 +714,9 @@  discard block
 block discarded – undo
714 714
  * @param string $var
715 715
  * @return string
716 716
  */
717
-function wpi_sanitize_tooltip( $var ) {
717
+function wpi_sanitize_tooltip($var) {
718 718
     return wp_kses(
719
-        html_entity_decode( $var ),
719
+        html_entity_decode($var),
720 720
         array(
721 721
 			'br'     => array(),
722 722
 			'em'     => array(),
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
  */
740 740
 function wpinv_get_screen_ids() {
741 741
 
742
-    $screen_id = sanitize_title( __( 'Invoicing', 'invoicing' ) );
742
+    $screen_id = sanitize_title(__('Invoicing', 'invoicing'));
743 743
 
744 744
     $screen_ids = array(
745 745
         'toplevel_page_' . $screen_id,
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
         'gp-setup', // setup wizard
762 762
     );
763 763
 
764
-    return apply_filters( 'wpinv_screen_ids', $screen_ids );
764
+    return apply_filters('wpinv_screen_ids', $screen_ids);
765 765
 }
766 766
 
767 767
 /**
@@ -772,14 +772,14 @@  discard block
 block discarded – undo
772 772
  * @param array|string $list List of values.
773 773
  * @return array Sanitized array of values.
774 774
  */
775
-function wpinv_parse_list( $list ) {
775
+function wpinv_parse_list($list) {
776 776
 
777
-    if ( empty( $list ) ) {
777
+    if (empty($list)) {
778 778
         $list = array();
779 779
     }
780 780
 
781
-	if ( ! is_array( $list ) ) {
782
-		return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
781
+	if (!is_array($list)) {
782
+		return preg_split('/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY);
783 783
 	}
784 784
 
785 785
 	return $list;
@@ -793,16 +793,16 @@  discard block
 block discarded – undo
793 793
  * @param string $key Type of data to fetch.
794 794
  * @return mixed Fetched data.
795 795
  */
796
-function wpinv_get_data( $key ) {
796
+function wpinv_get_data($key) {
797 797
 
798 798
     // Try fetching it from the cache.
799
-    $data = wp_cache_get( "wpinv-data-$key", 'wpinv' );
800
-    if ( $data ) {
799
+    $data = wp_cache_get("wpinv-data-$key", 'wpinv');
800
+    if ($data) {
801 801
         return $data;
802 802
     }
803 803
 
804
-    $data = apply_filters( "wpinv_get_$key", include WPINV_PLUGIN_DIR . "includes/data/$key.php" );
805
-	wp_cache_set( "wpinv-data-$key", $data, 'wpinv' );
804
+    $data = apply_filters("wpinv_get_$key", include WPINV_PLUGIN_DIR . "includes/data/$key.php");
805
+	wp_cache_set("wpinv-data-$key", $data, 'wpinv');
806 806
 
807 807
 	return $data;
808 808
 }
@@ -816,10 +816,10 @@  discard block
 block discarded – undo
816 816
  * @param bool $first_empty Whether or not the first item in the list should be empty
817 817
  * @return mixed Fetched data.
818 818
  */
819
-function wpinv_maybe_add_empty_option( $options, $first_empty ) {
819
+function wpinv_maybe_add_empty_option($options, $first_empty) {
820 820
 
821
-    if ( ! empty( $options ) && $first_empty ) {
822
-        return array_merge( array( '' => '' ), $options );
821
+    if (!empty($options) && $first_empty) {
822
+        return array_merge(array('' => ''), $options);
823 823
     }
824 824
     return $options;
825 825
 
@@ -831,21 +831,21 @@  discard block
 block discarded – undo
831 831
  * @param mixed $var Data to sanitize.
832 832
  * @return string|array
833 833
  */
834
-function wpinv_clean( $var ) {
834
+function wpinv_clean($var) {
835 835
 
836
-	if ( is_array( $var ) ) {
837
-		return array_map( 'wpinv_clean', $var );
836
+	if (is_array($var)) {
837
+		return array_map('wpinv_clean', $var);
838 838
     }
839 839
 
840
-    if ( is_object( $var ) ) {
841
-		$object_vars = get_object_vars( $var );
842
-		foreach ( $object_vars as $property_name => $property_value ) {
843
-			$var->$property_name = wpinv_clean( $property_value );
840
+    if (is_object($var)) {
841
+		$object_vars = get_object_vars($var);
842
+		foreach ($object_vars as $property_name => $property_value) {
843
+			$var->$property_name = wpinv_clean($property_value);
844 844
         }
845 845
         return $var;
846 846
 	}
847 847
 
848
-    return is_string( $var ) ? sanitize_text_field( stripslashes( $var ) ) : $var;
848
+    return is_string($var) ? sanitize_text_field(stripslashes($var)) : $var;
849 849
 }
850 850
 
851 851
 /**
@@ -854,43 +854,43 @@  discard block
 block discarded – undo
854 854
  * @param string $str Data to convert.
855 855
  * @return string|array
856 856
  */
857
-function getpaid_convert_price_string_to_options( $str ) {
857
+function getpaid_convert_price_string_to_options($str) {
858 858
 
859
-	$raw_options = array_map( 'trim', explode( ',', $str ) );
860
-    $options     = array();
859
+	$raw_options = array_map('trim', explode(',', $str));
860
+    $options = array();
861 861
 
862
-    foreach ( $raw_options as $option ) {
862
+    foreach ($raw_options as $option) {
863 863
 
864
-        if ( '' == $option ) {
864
+        if ('' == $option) {
865 865
             continue;
866 866
         }
867 867
 
868
-        $option = array_map( 'trim', explode( '|', $option ) );
868
+        $option = array_map('trim', explode('|', $option));
869 869
 
870 870
         $price = null;
871 871
         $label = null;
872 872
 
873
-        if ( isset( $option[0] ) && '' != $option[0] ) {
874
-            $label  = $option[0];
873
+        if (isset($option[0]) && '' != $option[0]) {
874
+            $label = $option[0];
875 875
         }
876 876
 
877
-        if ( isset( $option[1] ) && '' != $option[1] ) {
877
+        if (isset($option[1]) && '' != $option[1]) {
878 878
             $price = $option[1];
879 879
         }
880 880
 
881
-        if ( ! isset( $price ) ) {
881
+        if (!isset($price)) {
882 882
             $price = $label;
883 883
         }
884 884
 
885
-        if ( ! isset( $price ) || ! is_numeric( $price ) ) {
885
+        if (!isset($price) || !is_numeric($price)) {
886 886
             continue;
887 887
         }
888 888
 
889
-        if ( ! isset( $label ) ) {
889
+        if (!isset($label)) {
890 890
             $label = $price;
891 891
         }
892 892
 
893
-        $options[ "$label|$price" ] = $label;
893
+        $options["$label|$price"] = $label;
894 894
     }
895 895
 
896 896
     return $options;
@@ -899,14 +899,14 @@  discard block
 block discarded – undo
899 899
 /**
900 900
  * Returns the help tip.
901 901
  */
902
-function getpaid_get_help_tip( $tip, $additional_classes = '', $echo = false ) {
902
+function getpaid_get_help_tip($tip, $additional_classes = '', $echo = false) {
903 903
     $classes = 'wpi-help-tip dashicons dashicons-editor-help ' . $additional_classes;
904
-    $tip     = esc_attr( $tip );
904
+    $tip     = esc_attr($tip);
905 905
 
906
-    if ( $echo ) {
907
-        echo '<span class="' . esc_attr( $classes ) . '" data-tip="' . esc_attr( $tip ) . '"></span>';
906
+    if ($echo) {
907
+        echo '<span class="' . esc_attr($classes) . '" data-tip="' . esc_attr($tip) . '"></span>';
908 908
     } else {
909
-        return '<span class="' . esc_attr( $classes ) . '" data-tip="' . esc_attr( $tip ) . '"></span>';
909
+        return '<span class="' . esc_attr($classes) . '" data-tip="' . esc_attr($tip) . '"></span>';
910 910
     }
911 911
 
912 912
 }
@@ -914,18 +914,18 @@  discard block
 block discarded – undo
914 914
 /**
915 915
  * Formats a date
916 916
  */
917
-function getpaid_format_date( $date, $with_time = false ) {
917
+function getpaid_format_date($date, $with_time = false) {
918 918
 
919
-    if ( empty( $date ) || $date == '0000-00-00 00:00:00' ) {
919
+    if (empty($date) || $date == '0000-00-00 00:00:00') {
920 920
         return '';
921 921
     }
922 922
 
923 923
     $format = getpaid_date_format();
924 924
 
925
-    if ( $with_time ) {
925
+    if ($with_time) {
926 926
         $format .= ' ' . getpaid_time_format();
927 927
     }
928
-    return date_i18n( $format, strtotime( $date ) );
928
+    return date_i18n($format, strtotime($date));
929 929
 
930 930
 }
931 931
 
@@ -934,9 +934,9 @@  discard block
 block discarded – undo
934 934
  *
935 935
  * @return string
936 936
  */
937
-function getpaid_format_date_value( $date, $default = '&mdash;', $with_time = false ) {
938
-    $date = getpaid_format_date( $date, $with_time );
939
-    return empty( $date ) ? $default : $date;
937
+function getpaid_format_date_value($date, $default = '&mdash;', $with_time = false) {
938
+    $date = getpaid_format_date($date, $with_time);
939
+    return empty($date) ? $default : $date;
940 940
 }
941 941
 
942 942
 /**
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
  * @return string
946 946
  */
947 947
 function getpaid_date_format() {
948
-	return apply_filters( 'getpaid_date_format', get_option( 'date_format' ) );
948
+	return apply_filters('getpaid_date_format', get_option('date_format'));
949 949
 }
950 950
 
951 951
 /**
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
  * @return string
955 955
  */
956 956
 function getpaid_time_format() {
957
-	return apply_filters( 'getpaid_time_format', get_option( 'time_format' ) );
957
+	return apply_filters('getpaid_time_format', get_option('time_format'));
958 958
 }
959 959
 
960 960
 /**
@@ -964,16 +964,16 @@  discard block
 block discarded – undo
964 964
  * @param  integer $limit Limit size in characters.
965 965
  * @return string
966 966
  */
967
-function getpaid_limit_length( $string, $limit ) {
967
+function getpaid_limit_length($string, $limit) {
968 968
     $str_limit = $limit - 3;
969 969
 
970
-	if ( function_exists( 'mb_strimwidth' ) ) {
971
-		if ( mb_strlen( $string ) > $limit ) {
972
-			$string = mb_strimwidth( $string, 0, $str_limit ) . '...';
970
+	if (function_exists('mb_strimwidth')) {
971
+		if (mb_strlen($string) > $limit) {
972
+			$string = mb_strimwidth($string, 0, $str_limit) . '...';
973 973
 		}
974 974
 	} else {
975
-		if ( strlen( $string ) > $limit ) {
976
-			$string = substr( $string, 0, $str_limit ) . '...';
975
+		if (strlen($string) > $limit) {
976
+			$string = substr($string, 0, $str_limit) . '...';
977 977
 		}
978 978
 	}
979 979
     return $string;
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
  * @since 1.0.19
988 988
  */
989 989
 function getpaid_api() {
990
-    return getpaid()->get( 'api' );
990
+    return getpaid()->get('api');
991 991
 }
992 992
 
993 993
 /**
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
  * @since 1.0.19
998 998
  */
999 999
 function getpaid_post_types() {
1000
-    return getpaid()->get( 'post_types' );
1000
+    return getpaid()->get('post_types');
1001 1001
 }
1002 1002
 
1003 1003
 /**
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
  * @since 1.0.19
1008 1008
  */
1009 1009
 function getpaid_session() {
1010
-    return getpaid()->get( 'session' );
1010
+    return getpaid()->get('session');
1011 1011
 }
1012 1012
 
1013 1013
 /**
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
  * @since 1.0.19
1018 1018
  */
1019 1019
 function getpaid_notes() {
1020
-    return getpaid()->get( 'notes' );
1020
+    return getpaid()->get('notes');
1021 1021
 }
1022 1022
 
1023 1023
 /**
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
  * @return GetPaid_Admin
1027 1027
  */
1028 1028
 function getpaid_admin() {
1029
-    return getpaid()->get( 'admin' );
1029
+    return getpaid()->get('admin');
1030 1030
 }
1031 1031
 
1032 1032
 /**
@@ -1036,8 +1036,8 @@  discard block
 block discarded – undo
1036 1036
  * @param string $base the base url
1037 1037
  * @return string
1038 1038
  */
1039
-function getpaid_get_authenticated_action_url( $action, $base = false ) {
1040
-    return wp_nonce_url( add_query_arg( 'getpaid-action', $action, $base ), 'getpaid-nonce', 'getpaid-nonce' );
1039
+function getpaid_get_authenticated_action_url($action, $base = false) {
1040
+    return wp_nonce_url(add_query_arg('getpaid-action', $action, $base), 'getpaid-nonce', 'getpaid-nonce');
1041 1041
 }
1042 1042
 
1043 1043
 /**
@@ -1045,11 +1045,11 @@  discard block
 block discarded – undo
1045 1045
  *
1046 1046
  * @return string
1047 1047
  */
1048
-function getpaid_get_post_type_label( $post_type, $plural = true ) {
1048
+function getpaid_get_post_type_label($post_type, $plural = true) {
1049 1049
 
1050
-    $post_type = get_post_type_object( $post_type );
1050
+    $post_type = get_post_type_object($post_type);
1051 1051
 
1052
-    if ( ! is_object( $post_type ) ) {
1052
+    if (!is_object($post_type)) {
1053 1053
         return null;
1054 1054
     }
1055 1055
 
@@ -1062,18 +1062,18 @@  discard block
 block discarded – undo
1062 1062
  *
1063 1063
  * @return mixed|null
1064 1064
  */
1065
-function getpaid_get_array_field( $array, $key, $secondary_key = null ) {
1065
+function getpaid_get_array_field($array, $key, $secondary_key = null) {
1066 1066
 
1067
-    if ( ! is_array( $array ) ) {
1067
+    if (!is_array($array)) {
1068 1068
         return null;
1069 1069
     }
1070 1070
 
1071
-    if ( ! empty( $secondary_key ) ) {
1072
-        $array = isset( $array[ $secondary_key ] ) ? $array[ $secondary_key ] : array();
1073
-        return getpaid_get_array_field( $array, $key );
1071
+    if (!empty($secondary_key)) {
1072
+        $array = isset($array[$secondary_key]) ? $array[$secondary_key] : array();
1073
+        return getpaid_get_array_field($array, $key);
1074 1074
     }
1075 1075
 
1076
-    return isset( $array[ $key ] ) ? $array[ $key ] : null;
1076
+    return isset($array[$key]) ? $array[$key] : null;
1077 1077
 
1078 1078
 }
1079 1079
 
@@ -1082,12 +1082,12 @@  discard block
 block discarded – undo
1082 1082
  *
1083 1083
  * @return array
1084 1084
  */
1085
-function getpaid_array_merge_if_empty( $args, $defaults ) {
1085
+function getpaid_array_merge_if_empty($args, $defaults) {
1086 1086
 
1087
-    foreach ( $defaults as $key => $value ) {
1087
+    foreach ($defaults as $key => $value) {
1088 1088
 
1089
-        if ( empty( $args[ $key ] ) ) {
1090
-            $args[ $key ] = $value;
1089
+        if (empty($args[$key])) {
1090
+            $args[$key] = $value;
1091 1091
         }
1092 1092
     }
1093 1093
 
@@ -1104,12 +1104,12 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
     $types = get_allowed_mime_types();
1106 1106
 
1107
-    if ( isset( $types['htm|html'] ) ) {
1108
-		unset( $types['htm|html'] );
1107
+    if (isset($types['htm|html'])) {
1108
+		unset($types['htm|html']);
1109 1109
 	}
1110 1110
 
1111
-    if ( isset( $types['js'] ) ) {
1112
-		unset( $types['js'] );
1111
+    if (isset($types['js'])) {
1112
+		unset($types['js']);
1113 1113
 	}
1114 1114
 
1115 1115
     return $types;
@@ -1117,34 +1117,34 @@  discard block
 block discarded – undo
1117 1117
 }
1118 1118
 
1119 1119
 
1120
-function getpaid_user_delete_invoice( $data ) {
1120
+function getpaid_user_delete_invoice($data) {
1121 1121
 
1122 1122
     // Ensure there is an invoice to delete.
1123
-    if ( empty( $data['invoice_id'] ) ) {
1123
+    if (empty($data['invoice_id'])) {
1124 1124
         return;
1125 1125
     }
1126 1126
 
1127
-    $invoice = new WPInv_Invoice( (int) $data['invoice_id'] );
1127
+    $invoice = new WPInv_Invoice((int) $data['invoice_id']);
1128 1128
 
1129 1129
     // Ensure that it exists and that it belongs to the current user.
1130
-    if ( ! $invoice->exists() || $invoice->get_customer_id() != get_current_user_id() ) {
1131
-        wpinv_set_error( 'invalid_invoice', __( 'You do not have permission to delete this invoice', 'invoicing' ) );
1130
+    if (!$invoice->exists() || $invoice->get_customer_id() != get_current_user_id()) {
1131
+        wpinv_set_error('invalid_invoice', __('You do not have permission to delete this invoice', 'invoicing'));
1132 1132
 
1133 1133
     // Can it be deleted?
1134
-    } elseif ( ! $invoice->needs_payment() ) {
1135
-        wpinv_set_error( 'cannot_delete', __( 'This invoice cannot be deleted as it has already been paid.', 'invoicing' ) );
1134
+    } elseif (!$invoice->needs_payment()) {
1135
+        wpinv_set_error('cannot_delete', __('This invoice cannot be deleted as it has already been paid.', 'invoicing'));
1136 1136
 
1137 1137
     // Delete it.
1138 1138
     } else {
1139 1139
 
1140 1140
         $invoice->delete();
1141
-        wpinv_set_error( 'delete', __( 'The invoice has been deleted.', 'invoicing' ), 'info' );
1141
+        wpinv_set_error('delete', __('The invoice has been deleted.', 'invoicing'), 'info');
1142 1142
     }
1143 1143
 
1144
-    $redirect = remove_query_arg( array( 'getpaid-action', 'getpaid-nonce', 'invoice_id' ) );
1144
+    $redirect = remove_query_arg(array('getpaid-action', 'getpaid-nonce', 'invoice_id'));
1145 1145
 
1146
-    wp_safe_redirect( $redirect );
1146
+    wp_safe_redirect($redirect);
1147 1147
     exit;
1148 1148
 
1149 1149
 }
1150
-add_action( 'getpaid_authenticated_action_delete_invoice', 'getpaid_user_delete_invoice' );
1150
+add_action('getpaid_authenticated_action_delete_invoice', 'getpaid_user_delete_invoice');
Please login to merge, or discard this patch.
includes/admin/class-getpaid-post-types-admin.php 1 patch
Spacing   +243 added lines, -243 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 ( $post->ID == wpinv_get_default_payment_form() ) {
109
-				unset( $actions['trash'] );
110
-				unset( $actions['inline hide-if-no-js'] );
108
+			if ($post->ID == wpinv_get_default_payment_form()) {
109
+				unset($actions['trash']);
110
+				unset($actions['inline hide-if-no-js']);
111 111
 			}
112 112
 
113 113
 			$actions['duplicate'] = sprintf(
@@ -124,20 +124,20 @@  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
 		}
131 131
 
132 132
 		// Link to item payment form.
133
-		if ( 'wpi_item' == $post->post_type ) {
133
+		if ('wpi_item' == $post->post_type) {
134 134
 
135
-			if ( in_array( get_post_meta( $post->ID, '_wpinv_type', true ), array( '', 'fee', 'custom' ) ) ) {
135
+			if (in_array(get_post_meta($post->ID, '_wpinv_type', true), array('', 'fee', 'custom'))) {
136 136
 
137 137
 				$actions['buy'] = sprintf(
138 138
 					'<a href="%1$s">%2$s</a>',
139
-					esc_url( getpaid_embed_url( false, $post->ID . '|0' ) ),
140
-					esc_html( __( 'Buy', 'invoicing' ) )
139
+					esc_url(getpaid_embed_url(false, $post->ID . '|0')),
140
+					esc_html(__('Buy', 'invoicing'))
141 141
 				);
142 142
 
143 143
 			}
@@ -154,27 +154,27 @@  discard block
 block discarded – undo
154 154
 	 * @param WP_Post $post
155 155
      * @return array $actions actions without edit option
156 156
      */
157
-    public static function filter_invoice_row_actions( $actions, $post ) {
157
+    public static function filter_invoice_row_actions($actions, $post) {
158 158
 
159
-        if ( getpaid_is_invoice_post_type( $post->post_type ) ) {
159
+        if (getpaid_is_invoice_post_type($post->post_type)) {
160 160
 
161 161
 			$actions = array();
162
-			$invoice = new WPInv_Invoice( $post );
162
+			$invoice = new WPInv_Invoice($post);
163 163
 
164 164
 			$actions['edit'] = sprintf(
165 165
 				'<a href="%1$s">%2$s</a>',
166
-				esc_url( get_edit_post_link( $invoice->get_id() ) ),
167
-				esc_html( __( 'Edit', 'invoicing' ) )
166
+				esc_url(get_edit_post_link($invoice->get_id())),
167
+				esc_html(__('Edit', 'invoicing'))
168 168
 			);
169 169
 
170
-			if ( ! $invoice->is_draft() ) {
170
+			if (!$invoice->is_draft()) {
171 171
 
172 172
 				$actions['view'] = sprintf(
173 173
 					'<a href="%1$s">%2$s</a>',
174
-					esc_url( $invoice->get_view_url() ),
174
+					esc_url($invoice->get_view_url()),
175 175
 					sprintf(
176
-						esc_html( __( 'View %s', 'invoicing' ) ),
177
-						getpaid_get_post_type_label( $invoice->get_post_type(), false )
176
+						esc_html(__('View %s', 'invoicing')),
177
+						getpaid_get_post_type_label($invoice->get_post_type(), false)
178 178
 					)
179 179
 				);
180 180
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 							'getpaid-nonce'
193 193
 						)
194 194
 					),
195
-					esc_html( __( 'Send to Customer', 'invoicing' ) )
195
+					esc_html(__('Send to Customer', 'invoicing'))
196 196
 				);
197 197
 
198 198
 			}
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 						'getpaid-nonce'
212 212
 					)
213 213
 				),
214
-				esc_html( __( 'Duplicate', 'invoicing' ) )
214
+				esc_html(__('Duplicate', 'invoicing'))
215 215
 			);
216 216
 
217 217
         }
@@ -222,42 +222,42 @@  discard block
 block discarded – undo
222 222
 	/**
223 223
 	 * Returns an array of invoice table columns.
224 224
 	 */
225
-	public static function invoice_columns( $columns ) {
225
+	public static function invoice_columns($columns) {
226 226
 
227 227
 		$columns = array(
228 228
 			'cb'           => $columns['cb'],
229
-			'number'       => __( 'Invoice', 'invoicing' ),
230
-			'customer'     => __( 'Customer', 'invoicing' ),
231
-			'invoice_date' => __( 'Created', 'invoicing' ),
232
-			'payment_date' => __( 'Completed', 'invoicing' ),
233
-			'amount'       => __( 'Amount', 'invoicing' ),
234
-			'recurring'    => __( 'Recurring', 'invoicing' ),
235
-			'status'       => __( 'Status', 'invoicing' ),
229
+			'number'       => __('Invoice', 'invoicing'),
230
+			'customer'     => __('Customer', 'invoicing'),
231
+			'invoice_date' => __('Created', 'invoicing'),
232
+			'payment_date' => __('Completed', 'invoicing'),
233
+			'amount'       => __('Amount', 'invoicing'),
234
+			'recurring'    => __('Recurring', 'invoicing'),
235
+			'status'       => __('Status', 'invoicing'),
236 236
 		);
237 237
 
238
-		return apply_filters( 'wpi_invoice_table_columns', $columns );
238
+		return apply_filters('wpi_invoice_table_columns', $columns);
239 239
 	}
240 240
 
241 241
 	/**
242 242
 	 * Displays invoice table columns.
243 243
 	 */
244
-	public static function display_invoice_columns( $column_name, $post_id ) {
244
+	public static function display_invoice_columns($column_name, $post_id) {
245 245
 
246
-		$invoice = new WPInv_Invoice( $post_id );
246
+		$invoice = new WPInv_Invoice($post_id);
247 247
 
248
-		switch ( $column_name ) {
248
+		switch ($column_name) {
249 249
 
250 250
 			case 'invoice_date':
251
-				$date_time = esc_attr( $invoice->get_created_date() );
252
-				$date      = esc_html( getpaid_format_date_value( $date_time, '&mdash;', true ) );
253
-				echo wp_kses_post( "<span title='$date_time'>$date</span>" );
251
+				$date_time = esc_attr($invoice->get_created_date());
252
+				$date      = esc_html(getpaid_format_date_value($date_time, '&mdash;', true));
253
+				echo wp_kses_post("<span title='$date_time'>$date</span>");
254 254
 				break;
255 255
 
256 256
 			case 'payment_date':
257
-				if ( $invoice->is_paid() ) {
258
-					$date_time = esc_attr( $invoice->get_completed_date() );
259
-					$date      = esc_html( getpaid_format_date_value( $date_time, '&mdash;', true ) );
260
-					echo wp_kses_post( "<span title='$date_time'>$date</span>" );
257
+				if ($invoice->is_paid()) {
258
+					$date_time = esc_attr($invoice->get_completed_date());
259
+					$date      = esc_html(getpaid_format_date_value($date_time, '&mdash;', true));
260
+					echo wp_kses_post("<span title='$date_time'>$date</span>");
261 261
 				} else {
262 262
 					echo '&mdash;';
263 263
 				}
@@ -266,57 +266,57 @@  discard block
 block discarded – undo
266 266
 
267 267
 			case 'amount':
268 268
 				$amount = $invoice->get_total();
269
-				$formated_amount = wp_kses_post( wpinv_price( $amount, $invoice->get_currency() ) );
269
+				$formated_amount = wp_kses_post(wpinv_price($amount, $invoice->get_currency()));
270 270
 
271
-				if ( $invoice->is_refunded() ) {
272
-					$refunded_amount = wpinv_price( 0, $invoice->get_currency() );
273
-					echo wp_kses_post( "<del>$formated_amount</del>&nbsp;<ins>$refunded_amount</ins>" );
271
+				if ($invoice->is_refunded()) {
272
+					$refunded_amount = wpinv_price(0, $invoice->get_currency());
273
+					echo wp_kses_post("<del>$formated_amount</del>&nbsp;<ins>$refunded_amount</ins>");
274 274
 				} else {
275 275
 
276 276
 					$discount = $invoice->get_total_discount();
277 277
 
278
-					if ( ! empty( $discount ) ) {
279
-						$new_amount = wpinv_price( $amount + $discount, $invoice->get_currency() );
280
-						echo wp_kses_post( "<del>$new_amount</del>&nbsp;<ins>$formated_amount</ins>" );
278
+					if (!empty($discount)) {
279
+						$new_amount = wpinv_price($amount + $discount, $invoice->get_currency());
280
+						echo wp_kses_post("<del>$new_amount</del>&nbsp;<ins>$formated_amount</ins>");
281 281
 					} else {
282
-						echo wp_kses_post( $formated_amount );
282
+						echo wp_kses_post($formated_amount);
283 283
 					}
284 284
 }
285 285
 
286 286
 				break;
287 287
 
288 288
 			case 'status':
289
-				$status       = esc_html( $invoice->get_status() );
290
-				$status_label = esc_html( $invoice->get_status_nicename() );
289
+				$status       = esc_html($invoice->get_status());
290
+				$status_label = esc_html($invoice->get_status_nicename());
291 291
 
292 292
 				// If it is paid, show the gateway title.
293
-				if ( $invoice->is_paid() ) {
294
-					$gateway = esc_html( $invoice->get_gateway_title() );
295
-					$gateway = wp_sprintf( esc_attr__( 'Paid via %s', 'invoicing' ), esc_html( $gateway ) );
293
+				if ($invoice->is_paid()) {
294
+					$gateway = esc_html($invoice->get_gateway_title());
295
+					$gateway = wp_sprintf(esc_attr__('Paid via %s', 'invoicing'), esc_html($gateway));
296 296
 
297
-					echo wp_kses_post( "<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>" );
297
+					echo wp_kses_post("<mark class='wpi-help-tip getpaid-invoice-status $status' title='$gateway'><span>$status_label</span></mark>");
298 298
 				} else {
299
-					echo wp_kses_post( "<mark class='getpaid-invoice-status $status'><span>$status_label</span></mark>" );
299
+					echo wp_kses_post("<mark class='getpaid-invoice-status $status'><span>$status_label</span></mark>");
300 300
 				}
301 301
 
302 302
 				// If it is not paid, display the overdue and view status.
303
-				if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
303
+				if (!$invoice->is_paid() && !$invoice->is_refunded()) {
304 304
 
305 305
 					// Invoice view status.
306
-					if ( wpinv_is_invoice_viewed( $invoice->get_id() ) ) {
307
-						echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="' . esc_attr__( 'Viewed by Customer', 'invoicing' ) . '"></i>';
306
+					if (wpinv_is_invoice_viewed($invoice->get_id())) {
307
+						echo '&nbsp;&nbsp;<i class="fa fa-eye wpi-help-tip" title="' . esc_attr__('Viewed by Customer', 'invoicing') . '"></i>';
308 308
 					} else {
309
-						echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="' . esc_attr__( 'Not Viewed by Customer', 'invoicing' ) . '"></i>';
309
+						echo '&nbsp;&nbsp;<i class="fa fa-eye-slash wpi-help-tip" title="' . esc_attr__('Not Viewed by Customer', 'invoicing') . '"></i>';
310 310
 					}
311 311
 
312 312
 					// Display the overview status.
313
-					if ( wpinv_get_option( 'overdue_active' ) ) {
313
+					if (wpinv_get_option('overdue_active')) {
314 314
 						$due_date = $invoice->get_due_date();
315
-						$fomatted = getpaid_format_date( $due_date );
315
+						$fomatted = getpaid_format_date($due_date);
316 316
 
317
-						if ( ! empty( $fomatted ) ) {
318
-							$date = wp_sprintf( __( 'Due %s', 'invoicing' ), $fomatted );
319
-							echo wp_kses_post( "<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>" );
317
+						if (!empty($fomatted)) {
318
+							$date = wp_sprintf(__('Due %s', 'invoicing'), $fomatted);
319
+							echo wp_kses_post("<p class='description' style='color: #888;' title='$due_date'>$fomatted</p>");
320 320
 						}
321 321
 					}
322 322
 }
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 				break;
325 325
 
326 326
 			case 'recurring':
327
-				if ( $invoice->is_recurring() ) {
327
+				if ($invoice->is_recurring()) {
328 328
 					echo '<i class="fa fa-check" style="color:#43850a;"></i>';
329 329
 				} else {
330 330
 					echo '<i class="fa fa-times" style="color:#616161;"></i>';
@@ -332,25 +332,25 @@  discard block
 block discarded – undo
332 332
 				break;
333 333
 
334 334
 			case 'number':
335
-				$edit_link       = esc_url( get_edit_post_link( $invoice->get_id() ) );
336
-				$invoice_number  = esc_html( $invoice->get_number() );
337
-				$invoice_details = esc_attr__( 'View Invoice Details', 'invoicing' );
335
+				$edit_link       = esc_url(get_edit_post_link($invoice->get_id()));
336
+				$invoice_number  = esc_html($invoice->get_number());
337
+				$invoice_details = esc_attr__('View Invoice Details', 'invoicing');
338 338
 
339
-				echo wp_kses_post( "<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>" );
339
+				echo wp_kses_post("<a href='$edit_link' title='$invoice_details'><strong>$invoice_number</strong></a>");
340 340
 
341 341
 				break;
342 342
 
343 343
 			case 'customer':
344 344
 				$customer_name = $invoice->get_user_full_name();
345 345
 
346
-				if ( empty( $customer_name ) ) {
346
+				if (empty($customer_name)) {
347 347
 					$customer_name = $invoice->get_email();
348 348
 				}
349 349
 
350
-				if ( ! empty( $customer_name ) ) {
351
-					$customer_details = esc_attr__( 'View Customer Details', 'invoicing' );
352
-					$view_link        = esc_url( add_query_arg( 'user_id', $invoice->get_user_id(), admin_url( 'user-edit.php' ) ) );
353
-					echo wp_kses_post( "<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>" );
350
+				if (!empty($customer_name)) {
351
+					$customer_details = esc_attr__('View Customer Details', 'invoicing');
352
+					$view_link        = esc_url(add_query_arg('user_id', $invoice->get_user_id(), admin_url('user-edit.php')));
353
+					echo wp_kses_post("<a href='$view_link' title='$customer_details'><span>$customer_name</span></a>");
354 354
 				} else {
355 355
 					echo '<div>&mdash;</div>';
356 356
 				}
@@ -364,19 +364,19 @@  discard block
 block discarded – undo
364 364
 	/**
365 365
 	 * Displays invoice bulk actions.
366 366
 	 */
367
-	public static function invoice_bulk_actions( $actions ) {
368
-		$actions['resend-invoice'] = __( 'Send to Customer', 'invoicing' );
367
+	public static function invoice_bulk_actions($actions) {
368
+		$actions['resend-invoice'] = __('Send to Customer', 'invoicing');
369 369
 		return $actions;
370 370
 	}
371 371
 
372 372
 	/**
373 373
 	 * Processes invoice bulk actions.
374 374
 	 */
375
-	public static function handle_invoice_bulk_actions( $redirect_url, $action, $post_ids ) {
375
+	public static function handle_invoice_bulk_actions($redirect_url, $action, $post_ids) {
376 376
 
377
-		if ( $action == 'resend-invoice' ) {
378
-			foreach ( $post_ids as $post_id ) {
379
-				getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $post_id ), true );
377
+		if ($action == 'resend-invoice') {
378
+			foreach ($post_ids as $post_id) {
379
+				getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($post_id), true);
380 380
 			}
381 381
 		}
382 382
 
@@ -387,49 +387,49 @@  discard block
 block discarded – undo
387 387
 	/**
388 388
 	 * Returns an array of payment forms table columns.
389 389
 	 */
390
-	public static function payment_form_columns( $columns ) {
390
+	public static function payment_form_columns($columns) {
391 391
 
392 392
 		$columns = array(
393 393
 			'cb'        => $columns['cb'],
394
-			'title'     => __( 'Name', 'invoicing' ),
395
-			'shortcode' => __( 'Shortcode', 'invoicing' ),
396
-			'earnings'  => __( 'Revenue', 'invoicing' ),
397
-			'refunds'   => __( 'Refunded', 'invoicing' ),
398
-			'items'     => __( 'Items', 'invoicing' ),
399
-			'date'      => __( 'Date', 'invoicing' ),
394
+			'title'     => __('Name', 'invoicing'),
395
+			'shortcode' => __('Shortcode', 'invoicing'),
396
+			'earnings'  => __('Revenue', 'invoicing'),
397
+			'refunds'   => __('Refunded', 'invoicing'),
398
+			'items'     => __('Items', 'invoicing'),
399
+			'date'      => __('Date', 'invoicing'),
400 400
 		);
401 401
 
402
-		return apply_filters( 'wpi_payment_form_table_columns', $columns );
402
+		return apply_filters('wpi_payment_form_table_columns', $columns);
403 403
 
404 404
 	}
405 405
 
406 406
 	/**
407 407
 	 * Displays payment form table columns.
408 408
 	 */
409
-	public static function display_payment_form_columns( $column_name, $post_id ) {
409
+	public static function display_payment_form_columns($column_name, $post_id) {
410 410
 
411 411
 		// Retrieve the payment form.
412
-		$form = new GetPaid_Payment_Form( $post_id );
412
+		$form = new GetPaid_Payment_Form($post_id);
413 413
 
414
-		switch ( $column_name ) {
414
+		switch ($column_name) {
415 415
 
416 416
 			case 'earnings':
417
-				echo wp_kses_post( wpinv_price( $form->get_earned() ) );
417
+				echo wp_kses_post(wpinv_price($form->get_earned()));
418 418
 				break;
419 419
 
420 420
 			case 'refunds':
421
-				echo wp_kses_post( wpinv_price( $form->get_refunded() ) );
421
+				echo wp_kses_post(wpinv_price($form->get_refunded()));
422 422
 				break;
423 423
 
424 424
 			case 'refunds':
425
-				echo wp_kses_post( wpinv_price( $form->get_refunded() ) );
425
+				echo wp_kses_post(wpinv_price($form->get_refunded()));
426 426
 				break;
427 427
 
428 428
 			case 'shortcode':
429
-				if ( $form->is_default() ) {
429
+				if ($form->is_default()) {
430 430
 					echo '&mdash;';
431 431
 				} else {
432
-					echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr( $form->get_id() ) . ']" style="width: 100%;" readonly/>';
432
+					echo '<input onClick="this.select()" type="text" value="[getpaid form=' . esc_attr($form->get_id()) . ']" style="width: 100%;" readonly/>';
433 433
 				}
434 434
 
435 435
 				break;
@@ -437,28 +437,28 @@  discard block
 block discarded – undo
437 437
 			case 'items':
438 438
 				$items = $form->get_items();
439 439
 
440
-				if ( $form->is_default() || empty( $items ) ) {
440
+				if ($form->is_default() || empty($items)) {
441 441
 					echo '&mdash;';
442 442
 					return;
443 443
 				}
444 444
 
445 445
 				$_items = array();
446 446
 
447
-				foreach ( $items as $item ) {
447
+				foreach ($items as $item) {
448 448
 					$url = $item->get_edit_url();
449 449
 
450
-					if ( empty( $url ) ) {
451
-						$_items[] = esc_html( $item->get_name() );
450
+					if (empty($url)) {
451
+						$_items[] = esc_html($item->get_name());
452 452
 					} else {
453 453
 						$_items[] = sprintf(
454 454
 							'<a href="%s">%s</a>',
455
-							esc_url( $url ),
456
-							esc_html( $item->get_name() )
455
+							esc_url($url),
456
+							esc_html($item->get_name())
457 457
 						);
458 458
 					}
459 459
 }
460 460
 
461
-				echo wp_kses_post( implode( '<br>', $_items ) );
461
+				echo wp_kses_post(implode('<br>', $_items));
462 462
 
463 463
 				break;
464 464
 
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 	/**
470 470
 	 * Filters post states.
471 471
 	 */
472
-	public static function filter_payment_form_state( $post_states, $post ) {
472
+	public static function filter_payment_form_state($post_states, $post) {
473 473
 
474
-		if ( 'wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID ) {
475
-			$post_states['default_form'] = __( 'Default Payment Form', 'invoicing' );
474
+		if ('wpi_payment_form' == $post->post_type && wpinv_get_default_payment_form() == $post->ID) {
475
+			$post_states['default_form'] = __('Default Payment Form', 'invoicing');
476 476
 		}
477 477
 
478 478
 		return $post_states;
@@ -482,35 +482,35 @@  discard block
 block discarded – undo
482 482
 	/**
483 483
 	 * Returns an array of coupon table columns.
484 484
 	 */
485
-	public static function discount_columns( $columns ) {
485
+	public static function discount_columns($columns) {
486 486
 
487 487
 		$columns = array(
488 488
 			'cb'          => $columns['cb'],
489
-			'title'       => __( 'Name', 'invoicing' ),
490
-			'code'        => __( 'Code', 'invoicing' ),
491
-			'amount'      => __( 'Amount', 'invoicing' ),
492
-			'usage'       => __( 'Usage / Limit', 'invoicing' ),
493
-			'start_date'  => __( 'Start Date', 'invoicing' ),
494
-			'expiry_date' => __( 'Expiry Date', 'invoicing' ),
489
+			'title'       => __('Name', 'invoicing'),
490
+			'code'        => __('Code', 'invoicing'),
491
+			'amount'      => __('Amount', 'invoicing'),
492
+			'usage'       => __('Usage / Limit', 'invoicing'),
493
+			'start_date'  => __('Start Date', 'invoicing'),
494
+			'expiry_date' => __('Expiry Date', 'invoicing'),
495 495
 		);
496 496
 
497
-		return apply_filters( 'wpi_discount_table_columns', $columns );
497
+		return apply_filters('wpi_discount_table_columns', $columns);
498 498
 	}
499 499
 
500 500
 	/**
501 501
 	 * Filters post states.
502 502
 	 */
503
-	public static function filter_discount_state( $post_states, $post ) {
503
+	public static function filter_discount_state($post_states, $post) {
504 504
 
505
-		if ( 'wpi_discount' == $post->post_type ) {
505
+		if ('wpi_discount' == $post->post_type) {
506 506
 
507
-			$discount = new WPInv_Discount( $post );
507
+			$discount = new WPInv_Discount($post);
508 508
 
509 509
 			$status = $discount->is_expired() ? 'expired' : $discount->get_status();
510 510
 
511
-			if ( $status != 'publish' ) {
511
+			if ($status != 'publish') {
512 512
 				return array(
513
-					'discount_status' => wpinv_discount_status( $status ),
513
+					'discount_status' => wpinv_discount_status($status),
514 514
 				);
515 515
 			}
516 516
 
@@ -525,30 +525,30 @@  discard block
 block discarded – undo
525 525
 	/**
526 526
 	 * Returns an array of items table columns.
527 527
 	 */
528
-	public static function item_columns( $columns ) {
528
+	public static function item_columns($columns) {
529 529
 
530 530
 		$columns = array(
531 531
 			'cb'        => $columns['cb'],
532
-			'title'     => __( 'Name', 'invoicing' ),
533
-			'price'     => __( 'Price', 'invoicing' ),
534
-			'vat_rule'  => __( 'Tax Rule', 'invoicing' ),
535
-			'vat_class' => __( 'Tax Class', 'invoicing' ),
536
-			'type'      => __( 'Type', 'invoicing' ),
537
-			'shortcode' => __( 'Shortcode', 'invoicing' ),
532
+			'title'     => __('Name', 'invoicing'),
533
+			'price'     => __('Price', 'invoicing'),
534
+			'vat_rule'  => __('Tax Rule', 'invoicing'),
535
+			'vat_class' => __('Tax Class', 'invoicing'),
536
+			'type'      => __('Type', 'invoicing'),
537
+			'shortcode' => __('Shortcode', 'invoicing'),
538 538
 		);
539 539
 
540
-		if ( ! wpinv_use_taxes() ) {
541
-			unset( $columns['vat_rule'] );
542
-			unset( $columns['vat_class'] );
540
+		if (!wpinv_use_taxes()) {
541
+			unset($columns['vat_rule']);
542
+			unset($columns['vat_class']);
543 543
 		}
544 544
 
545
-		return apply_filters( 'wpi_item_table_columns', $columns );
545
+		return apply_filters('wpi_item_table_columns', $columns);
546 546
 	}
547 547
 
548 548
 	/**
549 549
 	 * Returns an array of sortable items table columns.
550 550
 	 */
551
-	public static function sortable_item_columns( $columns ) {
551
+	public static function sortable_item_columns($columns) {
552 552
 
553 553
 		return array_merge(
554 554
 			$columns,
@@ -565,45 +565,45 @@  discard block
 block discarded – undo
565 565
 	/**
566 566
 	 * Displays items table columns.
567 567
 	 */
568
-	public static function display_item_columns( $column_name, $post_id ) {
568
+	public static function display_item_columns($column_name, $post_id) {
569 569
 
570
-		$item = new WPInv_Item( $post_id );
570
+		$item = new WPInv_Item($post_id);
571 571
 
572
-		switch ( $column_name ) {
572
+		switch ($column_name) {
573 573
 
574 574
 			case 'price':
575
-				if ( ! $item->is_recurring() ) {
576
-					echo wp_kses_post( $item->get_the_price() );
575
+				if (!$item->is_recurring()) {
576
+					echo wp_kses_post($item->get_the_price());
577 577
 					break;
578 578
 				}
579 579
 
580 580
 				$price = wp_sprintf(
581
-					__( '%1$s / %2$s', 'invoicing' ),
581
+					__('%1$s / %2$s', 'invoicing'),
582 582
 					$item->get_the_price(),
583
-					getpaid_get_subscription_period_label( $item->get_recurring_period(), $item->get_recurring_interval(), '' )
583
+					getpaid_get_subscription_period_label($item->get_recurring_period(), $item->get_recurring_interval(), '')
584 584
 				);
585 585
 
586
-				if ( $item->get_the_price() == $item->get_the_initial_price() ) {
587
-					echo wp_kses_post( $price );
586
+				if ($item->get_the_price() == $item->get_the_initial_price()) {
587
+					echo wp_kses_post($price);
588 588
 					break;
589 589
 				}
590 590
 
591
-				echo wp_kses_post( $item->get_the_initial_price() );
591
+				echo wp_kses_post($item->get_the_initial_price());
592 592
 
593
-				echo '<span class="meta">' . wp_sprintf( esc_html__( 'then %s', 'invoicing' ), wp_kses_post( $price ) ) . '</span>';
593
+				echo '<span class="meta">' . wp_sprintf(esc_html__('then %s', 'invoicing'), wp_kses_post($price)) . '</span>';
594 594
 				break;
595 595
 
596 596
 			case 'vat_rule':
597
-				echo wp_kses_post( getpaid_get_tax_rule_label( $item->get_vat_rule() ) );
597
+				echo wp_kses_post(getpaid_get_tax_rule_label($item->get_vat_rule()));
598 598
 				break;
599 599
 
600 600
 			case 'vat_class':
601
-				echo wp_kses_post( getpaid_get_tax_class_label( $item->get_vat_class() ) );
601
+				echo wp_kses_post(getpaid_get_tax_class_label($item->get_vat_class()));
602 602
 				break;
603 603
 
604 604
 			case 'shortcode':
605
-				if ( $item->is_type( array( '', 'fee', 'custom' ) ) ) {
606
-					echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr( $item->get_id() ) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
605
+				if ($item->is_type(array('', 'fee', 'custom'))) {
606
+					echo '<input onClick="this.select()" type="text" value="[getpaid item=' . esc_attr($item->get_id()) . ' button=\'Buy Now\']" style="width: 100%;" readonly/>';
607 607
 				} else {
608 608
 					echo '&mdash;';
609 609
 				}
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 				break;
612 612
 
613 613
 			case 'type':
614
-				echo wp_kses_post( wpinv_item_type( $item->get_id() ) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>' );
614
+				echo wp_kses_post(wpinv_item_type($item->get_id()) . '<span class="meta">' . $item->get_custom_singular_name() . '</span>');
615 615
 				break;
616 616
 
617 617
 		}
@@ -621,21 +621,21 @@  discard block
 block discarded – undo
621 621
 	/**
622 622
 	 * Lets users filter items using taxes.
623 623
 	 */
624
-	public static function add_item_filters( $post_type ) {
624
+	public static function add_item_filters($post_type) {
625 625
 
626 626
 		// Abort if we're not dealing with items.
627
-		if ( $post_type != 'wpi_item' ) {
627
+		if ($post_type != 'wpi_item') {
628 628
 			return;
629 629
 		}
630 630
 
631 631
 		// Filter by vat rules.
632
-		if ( wpinv_use_taxes() ) {
632
+		if (wpinv_use_taxes()) {
633 633
 
634 634
 			// Sanitize selected vat rule.
635 635
 			$vat_rule   = '';
636 636
 			$vat_rules  = getpaid_get_tax_rules();
637
-			if ( isset( $_GET['vat_rule'] ) ) {
638
-				$vat_rule   = sanitize_text_field( $_GET['vat_rule'] );
637
+			if (isset($_GET['vat_rule'])) {
638
+				$vat_rule = sanitize_text_field($_GET['vat_rule']);
639 639
 			}
640 640
 
641 641
 			// Filter by VAT rule.
@@ -643,13 +643,13 @@  discard block
 block discarded – undo
643 643
 				array(
644 644
 					'options'          => array_merge(
645 645
 						array(
646
-							'' => __( 'All Tax Rules', 'invoicing' ),
646
+							'' => __('All Tax Rules', 'invoicing'),
647 647
 						),
648 648
 						$vat_rules
649 649
 					),
650 650
 					'name'             => 'vat_rule',
651 651
 					'id'               => 'vat_rule',
652
-					'selected'         => in_array( $vat_rule, array_keys( $vat_rules ) ) ? $vat_rule : '',
652
+					'selected'         => in_array($vat_rule, array_keys($vat_rules)) ? $vat_rule : '',
653 653
 					'show_option_all'  => false,
654 654
 					'show_option_none' => false,
655 655
 				)
@@ -660,21 +660,21 @@  discard block
 block discarded – undo
660 660
 			// Sanitize selected vat rule.
661 661
 			$vat_class   = '';
662 662
 			$vat_classes = getpaid_get_tax_classes();
663
-			if ( isset( $_GET['vat_class'] ) ) {
664
-				$vat_class   = sanitize_text_field( $_GET['vat_class'] );
663
+			if (isset($_GET['vat_class'])) {
664
+				$vat_class = sanitize_text_field($_GET['vat_class']);
665 665
 			}
666 666
 
667 667
 			wpinv_html_select(
668 668
 				array(
669 669
 					'options'          => array_merge(
670 670
 						array(
671
-							'' => __( 'All Tax Classes', 'invoicing' ),
671
+							'' => __('All Tax Classes', 'invoicing'),
672 672
 						),
673 673
 						$vat_classes
674 674
 					),
675 675
 					'name'             => 'vat_class',
676 676
 					'id'               => 'vat_class',
677
-					'selected'         => in_array( $vat_class, array_keys( $vat_classes ) ) ? $vat_class : '',
677
+					'selected'         => in_array($vat_class, array_keys($vat_classes)) ? $vat_class : '',
678 678
 					'show_option_all'  => false,
679 679
 					'show_option_none' => false,
680 680
 				)
@@ -683,22 +683,22 @@  discard block
 block discarded – undo
683 683
 		}
684 684
 
685 685
 		// Filter by item type.
686
-		$type   = '';
687
-		if ( isset( $_GET['type'] ) ) {
688
-			$type   = sanitize_text_field( $_GET['type'] );
686
+		$type = '';
687
+		if (isset($_GET['type'])) {
688
+			$type = sanitize_text_field($_GET['type']);
689 689
 		}
690 690
 
691 691
 		wpinv_html_select(
692 692
 			array(
693 693
 				'options'          => array_merge(
694 694
 					array(
695
-						'' => __( 'All item types', 'invoicing' ),
695
+						'' => __('All item types', 'invoicing'),
696 696
 					),
697 697
 					wpinv_get_item_types()
698 698
 				),
699 699
 				'name'             => 'type',
700 700
 				'id'               => 'type',
701
-				'selected'         => in_array( $type, wpinv_item_types() ) ? $type : '',
701
+				'selected'         => in_array($type, wpinv_item_types()) ? $type : '',
702 702
 				'show_option_all'  => false,
703 703
 				'show_option_none' => false,
704 704
 			)
@@ -709,45 +709,45 @@  discard block
 block discarded – undo
709 709
 	/**
710 710
 	 * Filters the item query.
711 711
 	 */
712
-	public static function filter_item_query( $query ) {
712
+	public static function filter_item_query($query) {
713 713
 
714 714
 		// modify the query only if it admin and main query.
715
-		if ( ! ( is_admin() && $query->is_main_query() ) ) {
715
+		if (!(is_admin() && $query->is_main_query())) {
716 716
 			return $query;
717 717
 		}
718 718
 
719 719
 		// we want to modify the query for our items.
720
-		if ( empty( $query->query['post_type'] ) || 'wpi_item' != $query->query['post_type'] ) {
720
+		if (empty($query->query['post_type']) || 'wpi_item' != $query->query['post_type']) {
721 721
 			return $query;
722 722
 		}
723 723
 
724
-		if ( empty( $query->query_vars['meta_query'] ) ) {
724
+		if (empty($query->query_vars['meta_query'])) {
725 725
 			$query->query_vars['meta_query'] = array();
726 726
 		}
727 727
 
728 728
 		// Filter vat rule type
729
-        if ( ! empty( $_GET['vat_rule'] ) ) {
729
+        if (!empty($_GET['vat_rule'])) {
730 730
             $query->query_vars['meta_query'][] = array(
731 731
                 'key'     => '_wpinv_vat_rule',
732
-                'value'   => sanitize_text_field( $_GET['vat_rule'] ),
732
+                'value'   => sanitize_text_field($_GET['vat_rule']),
733 733
                 'compare' => '=',
734 734
             );
735 735
         }
736 736
 
737 737
         // Filter vat class
738
-        if ( ! empty( $_GET['vat_class'] ) ) {
738
+        if (!empty($_GET['vat_class'])) {
739 739
             $query->query_vars['meta_query'][] = array(
740 740
                 'key'     => '_wpinv_vat_class',
741
-                'value'   => sanitize_text_field( $_GET['vat_class'] ),
741
+                'value'   => sanitize_text_field($_GET['vat_class']),
742 742
                 'compare' => '=',
743 743
             );
744 744
         }
745 745
 
746 746
         // Filter item type
747
-        if ( ! empty( $_GET['type'] ) ) {
747
+        if (!empty($_GET['type'])) {
748 748
             $query->query_vars['meta_query'][] = array(
749 749
                 'key'     => '_wpinv_type',
750
-                'value'   => sanitize_text_field( $_GET['type'] ),
750
+                'value'   => sanitize_text_field($_GET['type']),
751 751
                 'compare' => '=',
752 752
             );
753 753
 		}
@@ -757,15 +757,15 @@  discard block
 block discarded – undo
757 757
 	/**
758 758
 	 * Reorders items.
759 759
 	 */
760
-	public static function reorder_items( $vars ) {
760
+	public static function reorder_items($vars) {
761 761
 		global $typenow;
762 762
 
763
-		if ( 'wpi_item' !== $typenow || empty( $vars['orderby'] ) ) {
763
+		if ('wpi_item' !== $typenow || empty($vars['orderby'])) {
764 764
 			return $vars;
765 765
 		}
766 766
 
767 767
 		// By item type.
768
-		if ( 'type' == $vars['orderby'] ) {
768
+		if ('type' == $vars['orderby']) {
769 769
 			return array_merge(
770 770
 				$vars,
771 771
 				array(
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 		}
777 777
 
778 778
 		// By vat class.
779
-		if ( 'vat_class' == $vars['orderby'] ) {
779
+		if ('vat_class' == $vars['orderby']) {
780 780
 			return array_merge(
781 781
 				$vars,
782 782
 				array(
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 		}
788 788
 
789 789
 		// By vat rule.
790
-		if ( 'vat_rule' == $vars['orderby'] ) {
790
+		if ('vat_rule' == $vars['orderby']) {
791 791
 			return array_merge(
792 792
 				$vars,
793 793
 				array(
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 		}
799 799
 
800 800
 		// By price.
801
-		if ( 'price' == $vars['orderby'] ) {
801
+		if ('price' == $vars['orderby']) {
802 802
 			return array_merge(
803 803
 				$vars,
804 804
 				array(
@@ -815,27 +815,27 @@  discard block
 block discarded – undo
815 815
 	/**
816 816
 	 * Fired when deleting a post.
817 817
 	 */
818
-	public static function delete_post( $post_id ) {
818
+	public static function delete_post($post_id) {
819 819
 
820
-		switch ( get_post_type( $post_id ) ) {
820
+		switch (get_post_type($post_id)) {
821 821
 
822 822
 			case 'wpi_item':
823
-				do_action( 'getpaid_before_delete_item', new WPInv_Item( $post_id ) );
823
+				do_action('getpaid_before_delete_item', new WPInv_Item($post_id));
824 824
 				break;
825 825
 
826 826
 			case 'wpi_payment_form':
827
-				do_action( 'getpaid_before_delete_payment_form', new GetPaid_Payment_Form( $post_id ) );
827
+				do_action('getpaid_before_delete_payment_form', new GetPaid_Payment_Form($post_id));
828 828
 				break;
829 829
 
830 830
 			case 'wpi_discount':
831
-				do_action( 'getpaid_before_delete_discount', new WPInv_Discount( $post_id ) );
831
+				do_action('getpaid_before_delete_discount', new WPInv_Discount($post_id));
832 832
 				break;
833 833
 
834 834
 			case 'wpi_invoice':
835
-				$invoice = new WPInv_Invoice( $post_id );
836
-				do_action( 'getpaid_before_delete_invoice', $invoice );
837
-				$invoice->get_data_store()->delete_items( $invoice );
838
-				$invoice->get_data_store()->delete_special_fields( $invoice );
835
+				$invoice = new WPInv_Invoice($post_id);
836
+				do_action('getpaid_before_delete_invoice', $invoice);
837
+				$invoice->get_data_store()->delete_items($invoice);
838
+				$invoice->get_data_store()->delete_special_fields($invoice);
839 839
 				break;
840 840
 		}
841 841
 	}
@@ -848,28 +848,28 @@  discard block
 block discarded – undo
848 848
      *
849 849
      * @return mixed
850 850
      */
851
-    public static function add_display_post_states( $post_states, $post ) {
851
+    public static function add_display_post_states($post_states, $post) {
852 852
 
853
-        if ( wpinv_get_option( 'success_page', 0 ) == $post->ID ) {
854
-            $post_states['getpaid_success_page'] = __( 'GetPaid Receipt Page', 'invoicing' );
853
+        if (wpinv_get_option('success_page', 0) == $post->ID) {
854
+            $post_states['getpaid_success_page'] = __('GetPaid Receipt Page', 'invoicing');
855 855
         }
856 856
 
857
-		foreach ( getpaid_get_invoice_post_types() as $post_type => $label ) {
857
+		foreach (getpaid_get_invoice_post_types() as $post_type => $label) {
858 858
 
859
-			if ( wpinv_get_option( "{$post_type}_history_page", 0 ) == $post->ID ) {
860
-				$post_states[ "getpaid_{$post_type}_history_page" ] = sprintf(
861
-					__( 'GetPaid %s History Page', 'invoicing' ),
859
+			if (wpinv_get_option("{$post_type}_history_page", 0) == $post->ID) {
860
+				$post_states["getpaid_{$post_type}_history_page"] = sprintf(
861
+					__('GetPaid %s History Page', 'invoicing'),
862 862
 					$label
863 863
 				);
864 864
 			}
865 865
 }
866 866
 
867
-		if ( wpinv_get_option( 'invoice_subscription_page', 0 ) == $post->ID ) {
868
-            $post_states['getpaid_invoice_subscription_page'] = __( 'GetPaid Subscription Page', 'invoicing' );
867
+		if (wpinv_get_option('invoice_subscription_page', 0) == $post->ID) {
868
+            $post_states['getpaid_invoice_subscription_page'] = __('GetPaid Subscription Page', 'invoicing');
869 869
         }
870 870
 
871
-		if ( wpinv_get_option( 'checkout_page', 0 ) == $post->ID ) {
872
-            $post_states['getpaid_checkout_page'] = __( 'GetPaid Checkout Page', 'invoicing' );
871
+		if (wpinv_get_option('checkout_page', 0) == $post->ID) {
872
+            $post_states['getpaid_checkout_page'] = __('GetPaid Checkout Page', 'invoicing');
873 873
         }
874 874
 
875 875
         return $post_states;
Please login to merge, or discard this patch.
includes/class-getpaid-tax.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  *
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * Class GetPaid_Tax
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
 	 * @param  boolean $price_includes_tax Whether the passed price has taxes included.
22 22
 	 * @return array                       Array of tax name => tax amount.
23 23
 	 */
24
-	public static function calc_tax( $price, $rates, $price_includes_tax = false ) {
24
+	public static function calc_tax($price, $rates, $price_includes_tax = false) {
25 25
 
26
-		if ( $price_includes_tax ) {
27
-			$taxes = self::calc_inclusive_tax( $price, $rates );
26
+		if ($price_includes_tax) {
27
+			$taxes = self::calc_inclusive_tax($price, $rates);
28 28
 		} else {
29
-			$taxes = self::calc_exclusive_tax( $price, $rates );
29
+			$taxes = self::calc_exclusive_tax($price, $rates);
30 30
 		}
31 31
 
32
-		return apply_filters( 'getpaid_calc_tax', $taxes, $price, $rates, $price_includes_tax );
32
+		return apply_filters('getpaid_calc_tax', $taxes, $price, $rates, $price_includes_tax);
33 33
 
34 34
 	}
35 35
 
@@ -40,22 +40,22 @@  discard block
 block discarded – undo
40 40
 	 * @param  array $rates Array of tax rates.
41 41
 	 * @return array
42 42
 	 */
43
-	public static function calc_inclusive_tax( $price, $rates ) {
43
+	public static function calc_inclusive_tax($price, $rates) {
44 44
 		$taxes     = array();
45
-		$tax_rates = wp_list_pluck( $rates, 'rate', 'name' );
45
+		$tax_rates = wp_list_pluck($rates, 'rate', 'name');
46 46
 
47 47
 		// Add tax rates.
48
-		$tax_rate  = 1 + ( array_sum( $tax_rates ) / 100 );
48
+		$tax_rate  = 1 + (array_sum($tax_rates) / 100);
49 49
 
50
-		foreach ( $tax_rates as $name => $rate ) {
51
-			$the_rate       = ( $rate / 100 ) / $tax_rate;
52
-			$net_price      = $price - ( $the_rate * $price );
53
-			$tax_amount     = apply_filters( 'getpaid_price_inc_tax_amount', $price - $net_price, $name, $rate, $price );
54
-			$taxes[ $name ] = $tax_amount;
50
+		foreach ($tax_rates as $name => $rate) {
51
+			$the_rate       = ($rate / 100) / $tax_rate;
52
+			$net_price      = $price - ($the_rate * $price);
53
+			$tax_amount     = apply_filters('getpaid_price_inc_tax_amount', $price - $net_price, $name, $rate, $price);
54
+			$taxes[$name] = $tax_amount;
55 55
 		}
56 56
 
57 57
 		// Round all taxes to precision (4DP) before passing them back.
58
-		$taxes = array_map( array( __CLASS__, 'round' ), $taxes );
58
+		$taxes = array_map(array(__CLASS__, 'round'), $taxes);
59 59
 
60 60
 		return $taxes;
61 61
 	}
@@ -67,19 +67,19 @@  discard block
 block discarded – undo
67 67
 	 * @param  array $rates Array of tax rates.
68 68
 	 * @return array
69 69
 	 */
70
-	public static function calc_exclusive_tax( $price, $rates ) {
70
+	public static function calc_exclusive_tax($price, $rates) {
71 71
 		$taxes     = array();
72
-		$tax_rates = wp_list_pluck( $rates, 'rate', 'name' );
72
+		$tax_rates = wp_list_pluck($rates, 'rate', 'name');
73 73
 
74
-		foreach ( $tax_rates as $name => $rate ) {
74
+		foreach ($tax_rates as $name => $rate) {
75 75
 
76
-			$tax_amount     = $price * ( $rate / 100 );
77
-			$taxes[ $name ] = apply_filters( 'getpaid_price_ex_tax_amount', $tax_amount, $name, $rate, $price );
76
+			$tax_amount     = $price * ($rate / 100);
77
+			$taxes[$name] = apply_filters('getpaid_price_ex_tax_amount', $tax_amount, $name, $rate, $price);
78 78
 
79 79
 		}
80 80
 
81 81
 		// Round all taxes to precision (4DP) before passing them back.
82
-		$taxes = array_map( array( __CLASS__, 'round' ), $taxes );
82
+		$taxes = array_map(array(__CLASS__, 'round'), $taxes);
83 83
 
84 84
 		return $taxes;
85 85
 	}
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public static function get_all_tax_rates() {
93 93
 
94
-		$rates = get_option( 'wpinv_tax_rates', array() );
94
+		$rates = get_option('wpinv_tax_rates', array());
95 95
 
96 96
 		return apply_filters(
97 97
 			'getpaid_get_all_tax_rates',
98
-			array_filter( wpinv_parse_list( $rates ) )
98
+			array_filter(wpinv_parse_list($rates))
99 99
 		);
100 100
 
101 101
 	}
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 					'state'   => wpinv_get_default_state(),
116 116
 					'global'  => true,
117 117
 					'rate'    => wpinv_get_default_tax_rate(),
118
-					'name'    => __( 'Base Tax', 'invoicing' ),
118
+					'name'    => __('Base Tax', 'invoicing'),
119 119
 				),
120 120
 			)
121 121
 		);
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
 			array(
135 135
 				array(
136 136
 					'key'               => 'physical',
137
-					'label'             => __( 'Physical Item', 'invoicing' ),
138
-					'tax_base'          => wpinv_get_option( 'tax_base', 'billing' ),
139
-					'same_country_rule' => wpinv_get_option( 'vat_same_country_rule', 'vat_too' ),
137
+					'label'             => __('Physical Item', 'invoicing'),
138
+					'tax_base'          => wpinv_get_option('tax_base', 'billing'),
139
+					'same_country_rule' => wpinv_get_option('vat_same_country_rule', 'vat_too'),
140 140
 				),
141 141
 				array(
142 142
 					'key'               => 'digital',
143
-					'label'             => __( 'Digital Item', 'invoicing' ),
144
-					'tax_base'          => wpinv_get_option( 'tax_base', 'billing' ),
145
-					'same_country_rule' => wpinv_get_option( 'vat_same_country_rule', 'vat_too' ),
143
+					'label'             => __('Digital Item', 'invoicing'),
144
+					'tax_base'          => wpinv_get_option('tax_base', 'billing'),
145
+					'same_country_rule' => wpinv_get_option('vat_same_country_rule', 'vat_too'),
146 146
 				),
147 147
         	)
148 148
 		);
149 149
 
150 150
 		return apply_filters(
151 151
 			'getpaid_tax_rules',
152
-			array_filter( array_values( wpinv_parse_list( $rules ) ) )
152
+			array_filter(array_values(wpinv_parse_list($rules)))
153 153
 		);
154 154
 
155 155
 	}
@@ -161,23 +161,23 @@  discard block
 block discarded – undo
161 161
 	 * @param string $state
162 162
 	 * @return array
163 163
 	 */
164
-	public static function get_address_tax_rates( $country, $state ) {
164
+	public static function get_address_tax_rates($country, $state) {
165 165
 
166 166
 		$all_tax_rates  = self::get_all_tax_rates();
167 167
 		$matching_rates = array_merge(
168
-			wp_list_filter( $all_tax_rates, array( 'country' => $country ) ),
169
-			wp_list_filter( $all_tax_rates, array( 'country' => '' ) )
168
+			wp_list_filter($all_tax_rates, array('country' => $country)),
169
+			wp_list_filter($all_tax_rates, array('country' => ''))
170 170
 		);
171 171
 
172
-		foreach ( $matching_rates as $i => $rate ) {
172
+		foreach ($matching_rates as $i => $rate) {
173 173
 
174
-			$states = array_filter( wpinv_clean( explode( ',', strtolower( $rate['state'] ) ) ) );
175
-			if ( empty( $rate['global'] ) && ! in_array( strtolower( $state ), $states ) ) {
176
-				unset( $matching_rates[ $i ] );
174
+			$states = array_filter(wpinv_clean(explode(',', strtolower($rate['state']))));
175
+			if (empty($rate['global']) && !in_array(strtolower($state), $states)) {
176
+				unset($matching_rates[$i]);
177 177
 			}
178 178
 }
179 179
 
180
-		return apply_filters( 'getpaid_get_address_tax_rates', $matching_rates, $country, $state );
180
+		return apply_filters('getpaid_get_address_tax_rates', $matching_rates, $country, $state);
181 181
 
182 182
 	}
183 183
 
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 	 * @param  array $taxes Array of taxes.
188 188
 	 * @return float
189 189
 	 */
190
-	public static function get_tax_total( $taxes ) {
191
-		return self::round( array_sum( $taxes ) );
190
+	public static function get_tax_total($taxes) {
191
+		return self::round(array_sum($taxes));
192 192
 	}
193 193
 
194 194
 	/**
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 	 * @param float|int $in Value to round.
205 205
 	 * @return float
206 206
 	 */
207
-	public static function round( $in ) {
208
-		return apply_filters( 'getpaid_tax_round', round( $in, 4 ), $in );
207
+	public static function round($in) {
208
+		return apply_filters('getpaid_tax_round', round($in, 4), $in);
209 209
 	}
210 210
 
211 211
 }
Please login to merge, or discard this patch.
includes/wpinv-tax-functions.php 1 patch
Spacing   +130 added lines, -130 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
  * Returns an array of eu states.
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @return array
13 13
  */
14 14
 function getpaid_get_eu_states() {
15
-    return wpinv_get_data( 'eu-states' );
15
+    return wpinv_get_data('eu-states');
16 16
 }
17 17
 
18 18
 /**
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * @return bool
22 22
  */
23
-function getpaid_is_eu_state( $country ) {
24
-    return ! empty( $country ) && in_array( strtoupper( $country ), getpaid_get_eu_states() ) ? true : false;
23
+function getpaid_is_eu_state($country) {
24
+    return !empty($country) && in_array(strtoupper($country), getpaid_get_eu_states()) ? true : false;
25 25
 }
26 26
 
27 27
 /**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * @return array
31 31
  */
32 32
 function getpaid_get_gst_states() {
33
-    return array( 'AU', 'NZ', 'CA', 'CN' );
33
+    return array('AU', 'NZ', 'CA', 'CN');
34 34
 }
35 35
 
36 36
 /**
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
  *
39 39
  * @return bool
40 40
  */
41
-function getpaid_is_gst_country( $country ) {
42
-    return ! empty( $country ) && in_array( strtoupper( $country ), getpaid_get_gst_states() ) ? true : false;
41
+function getpaid_is_gst_country($country) {
42
+    return !empty($country) && in_array(strtoupper($country), getpaid_get_gst_states()) ? true : false;
43 43
 }
44 44
 
45 45
 /**
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
  */
50 50
 function wpinv_use_taxes() {
51 51
 
52
-    $ret = wpinv_get_option( 'enable_taxes', false );
53
-    return (bool) apply_filters( 'wpinv_use_taxes', ! empty( $ret ) );
52
+    $ret = wpinv_get_option('enable_taxes', false);
53
+    return (bool) apply_filters('wpinv_use_taxes', !empty($ret));
54 54
 
55 55
 }
56 56
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
  * @param WPInv_Invoice $invoice
61 61
  * @return bool
62 62
  */
63
-function wpinv_is_invoice_taxable( $invoice ) {
63
+function wpinv_is_invoice_taxable($invoice) {
64 64
     return $invoice->is_taxable();
65 65
 }
66 66
 
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
  * @param string $country
71 71
  * @return bool
72 72
  */
73
-function wpinv_is_country_taxable( $country ) {
74
-    $is_eu     = getpaid_is_eu_state( $country );
75
-    $is_exempt = ! $is_eu && wpinv_is_base_country( $country ) && wpinv_same_country_exempt_vat();
73
+function wpinv_is_country_taxable($country) {
74
+    $is_eu     = getpaid_is_eu_state($country);
75
+    $is_exempt = !$is_eu && wpinv_is_base_country($country) && wpinv_same_country_exempt_vat();
76 76
 
77
-    return (bool) apply_filters( 'wpinv_is_country_taxable', ! $is_exempt, $country );
77
+    return (bool) apply_filters('wpinv_is_country_taxable', !$is_exempt, $country);
78 78
 
79 79
 }
80 80
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
  * @param WPInv_Item|GetPaid_Form_Item $item
85 85
  * @return bool
86 86
  */
87
-function wpinv_is_item_taxable( $item ) {
87
+function wpinv_is_item_taxable($item) {
88 88
     return '_exempt' != $item->get_vat_rule();
89 89
 }
90 90
 
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
  *
94 94
  * @return bool
95 95
  */
96
-function wpinv_use_store_address_as_tax_base( $tax_rule = false ) {
97
-    $use_base = wpinv_get_option( 'tax_base', 'billing' ) === 'base';
96
+function wpinv_use_store_address_as_tax_base($tax_rule = false) {
97
+    $use_base = wpinv_get_option('tax_base', 'billing') === 'base';
98 98
 
99
-    if ( $tax_rule ) {
100
-        $rules    = getpaid_get_tax_rules( 'tax_base' );
101
-        $use_base = isset( $rules[ $tax_rule ] ) ? 'base' === $rules[ $tax_rule ] : $use_base;
99
+    if ($tax_rule) {
100
+        $rules    = getpaid_get_tax_rules('tax_base');
101
+        $use_base = isset($rules[$tax_rule]) ? 'base' === $rules[$tax_rule] : $use_base;
102 102
     }
103 103
 
104
-    return (bool) apply_filters( 'wpinv_use_store_address_as_tax_base', $use_base, $tax_rule );
104
+    return (bool) apply_filters('wpinv_use_store_address_as_tax_base', $use_base, $tax_rule);
105 105
 }
106 106
 
107 107
 /**
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
  *
110 110
  * @return bool
111 111
  */
112
-function wpinv_get_vat_same_country_rule( $tax_rule = false ) {
113
-    $rule = wpinv_get_option( 'vat_same_country_rule', 'vat_too' );
112
+function wpinv_get_vat_same_country_rule($tax_rule = false) {
113
+    $rule = wpinv_get_option('vat_same_country_rule', 'vat_too');
114 114
 
115
-    if ( $tax_rule ) {
116
-        $rules = getpaid_get_tax_rules( 'same_country_rule' );
117
-        $rule  = isset( $rules[ $tax_rule ] ) ? $rules[ $tax_rule ] : $rule;
115
+    if ($tax_rule) {
116
+        $rules = getpaid_get_tax_rules('same_country_rule');
117
+        $rule  = isset($rules[$tax_rule]) ? $rules[$tax_rule] : $rule;
118 118
     }
119 119
 
120
-    return (bool) apply_filters( 'wpinv_get_vat_same_country_rule', $rule, $tax_rule );
120
+    return (bool) apply_filters('wpinv_get_vat_same_country_rule', $rule, $tax_rule);
121 121
 }
122 122
 
123 123
 /**
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
  * @return bool
127 127
  */
128 128
 function wpinv_prices_include_tax() {
129
-    $is_inclusive = wpinv_get_option( 'prices_include_tax', 'no' ) == 'yes';
130
-    return (bool) apply_filters( 'wpinv_prices_include_tax', $is_inclusive );
129
+    $is_inclusive = wpinv_get_option('prices_include_tax', 'no') == 'yes';
130
+    return (bool) apply_filters('wpinv_prices_include_tax', $is_inclusive);
131 131
 }
132 132
 
133 133
 /**
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
  * @return bool
137 137
  */
138 138
 function wpinv_round_tax_per_tax_rate() {
139
-    $subtotal_rounding = wpinv_get_option( 'tax_subtotal_rounding', 1 );
140
-    return (bool) apply_filters( 'wpinv_round_tax_per_tax_rate', empty( $subtotal_rounding ) );
139
+    $subtotal_rounding = wpinv_get_option('tax_subtotal_rounding', 1);
140
+    return (bool) apply_filters('wpinv_round_tax_per_tax_rate', empty($subtotal_rounding));
141 141
 }
142 142
 
143 143
 /**
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
  * @return bool
147 147
  */
148 148
 function wpinv_display_individual_tax_rates() {
149
-    $individual = wpinv_get_option( 'tax_display_totals', 'single' ) == 'individual';
150
-    return (bool) apply_filters( 'wpinv_display_individual_tax_rates', $individual );
149
+    $individual = wpinv_get_option('tax_display_totals', 'single') == 'individual';
150
+    return (bool) apply_filters('wpinv_display_individual_tax_rates', $individual);
151 151
 }
152 152
 
153 153
 /**
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
  * @return float
157 157
  */
158 158
 function wpinv_get_default_tax_rate() {
159
-    $rate = wpinv_get_option( 'tax_rate', 0 );
160
-    return (float) apply_filters( 'wpinv_get_default_tax_rate', floatval( $rate ) );
159
+    $rate = wpinv_get_option('tax_rate', 0);
160
+    return (float) apply_filters('wpinv_get_default_tax_rate', floatval($rate));
161 161
 }
162 162
 
163 163
 /**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
  * @return bool
167 167
  */
168 168
 function wpinv_same_country_exempt_vat() {
169
-    return 'no' == wpinv_get_option( 'vat_same_country_rule', 'vat_too' );
169
+    return 'no' == wpinv_get_option('vat_same_country_rule', 'vat_too');
170 170
 }
171 171
 
172 172
 /**
@@ -186,28 +186,28 @@  discard block
 block discarded – undo
186 186
  * @param string $state
187 187
  * @return array
188 188
  */
189
-function getpaid_get_item_tax_rates( $item, $country = '', $state = '' ) {
189
+function getpaid_get_item_tax_rates($item, $country = '', $state = '') {
190 190
 
191 191
     // Abort if the item is not taxable.
192
-    if ( ! wpinv_is_item_taxable( $item ) ) {
192
+    if (!wpinv_is_item_taxable($item)) {
193 193
         return array();
194 194
     }
195 195
 
196 196
     // Maybe use the store address.
197
-    if ( wpinv_use_store_address_as_tax_base( $item->get_vat_rule() ) ) {
197
+    if (wpinv_use_store_address_as_tax_base($item->get_vat_rule())) {
198 198
         $country = wpinv_get_default_country();
199 199
         $state   = wpinv_get_default_state();
200 200
     }
201 201
 
202 202
     // Retrieve tax rates.
203
-    $tax_rates = GetPaid_Tax::get_address_tax_rates( $country, $state );
203
+    $tax_rates = GetPaid_Tax::get_address_tax_rates($country, $state);
204 204
 
205 205
     // Fallback to the default tax rates if non were found.
206
-    if ( empty( $tax_rates ) ) {
206
+    if (empty($tax_rates)) {
207 207
         $tax_rates = GetPaid_Tax::get_default_tax_rates();
208 208
     }
209 209
 
210
-    return apply_filters( 'getpaid_get_item_tax_rates', $tax_rates, $item, $country, $state );
210
+    return apply_filters('getpaid_get_item_tax_rates', $tax_rates, $item, $country, $state);
211 211
 }
212 212
 
213 213
 /**
@@ -217,22 +217,22 @@  discard block
 block discarded – undo
217 217
  * @param array $rates
218 218
  * @return array
219 219
  */
220
-function getpaid_filter_item_tax_rates( $item, $rates ) {
220
+function getpaid_filter_item_tax_rates($item, $rates) {
221 221
 
222 222
     $tax_class = $item->get_vat_class();
223 223
 
224
-    foreach ( $rates as $i => $rate ) {
224
+    foreach ($rates as $i => $rate) {
225 225
 
226
-        if ( $tax_class == '_reduced' ) {
227
-            $rates[ $i ]['rate'] = empty( $rate['reduced_rate'] ) ? 0 : $rate['reduced_rate'];
226
+        if ($tax_class == '_reduced') {
227
+            $rates[$i]['rate'] = empty($rate['reduced_rate']) ? 0 : $rate['reduced_rate'];
228 228
         }
229 229
 
230
-        if ( $tax_class == '_exempt' ) {
231
-            $rates[ $i ]['rate'] = 0;
230
+        if ($tax_class == '_exempt') {
231
+            $rates[$i]['rate'] = 0;
232 232
         }
233 233
 }
234 234
 
235
-    return apply_filters( 'getpaid_filter_item_tax_rates', $rates, $item );
235
+    return apply_filters('getpaid_filter_item_tax_rates', $rates, $item);
236 236
 }
237 237
 
238 238
 /**
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
  * @param array $rates
243 243
  * @return array
244 244
  */
245
-function getpaid_calculate_item_taxes( $amount, $rates ) {
245
+function getpaid_calculate_item_taxes($amount, $rates) {
246 246
 
247 247
     $is_inclusive = wpinv_prices_include_tax();
248
-    $taxes        = GetPaid_Tax::calc_tax( $amount, $rates, $is_inclusive );
248
+    $taxes        = GetPaid_Tax::calc_tax($amount, $rates, $is_inclusive);
249 249
 
250
-    return apply_filters( 'getpaid_calculate_taxes', $taxes, $amount, $rates );
250
+    return apply_filters('getpaid_calculate_taxes', $taxes, $amount, $rates);
251 251
 }
252 252
 
253 253
 /**
@@ -259,17 +259,17 @@  discard block
 block discarded – undo
259 259
  * @param float $recurring_tax_amount
260 260
  * @return array
261 261
  */
262
-function getpaid_prepare_item_tax( $item, $tax_name, $tax_amount, $recurring_tax_amount ) {
262
+function getpaid_prepare_item_tax($item, $tax_name, $tax_amount, $recurring_tax_amount) {
263 263
 
264
-    $initial_tax   = $tax_amount;
264
+    $initial_tax = $tax_amount;
265 265
 	$recurring_tax = 0;
266 266
 
267
-    if ( $item->is_recurring() ) {
267
+    if ($item->is_recurring()) {
268 268
 		$recurring_tax = $recurring_tax_amount;
269 269
 	}
270 270
 
271 271
 	return array(
272
-		'name'          => sanitize_text_field( $tax_name ),
272
+		'name'          => sanitize_text_field($tax_name),
273 273
 		'initial_tax'   => $initial_tax,
274 274
 		'recurring_tax' => $recurring_tax,
275 275
     );
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
  * @param string $vat_number
283 283
  * @return string
284 284
  */
285
-function wpinv_sanitize_vat_number( $vat_number ) {
286
-    return str_replace( array( ' ', '.', '-', '_', ',' ), '', strtoupper( trim( $vat_number ) ) );
285
+function wpinv_sanitize_vat_number($vat_number) {
286
+    return str_replace(array(' ', '.', '-', '_', ','), '', strtoupper(trim($vat_number)));
287 287
 }
288 288
 
289 289
 /**
@@ -292,22 +292,22 @@  discard block
 block discarded – undo
292 292
  * @param string $vat_number
293 293
  * @return bool
294 294
  */
295
-function wpinv_regex_validate_vat_number( $vat_number ) {
295
+function wpinv_regex_validate_vat_number($vat_number) {
296 296
 
297
-    $country    = substr( $vat_number, 0, 2 );
298
-    $vatin      = substr( $vat_number, 2 );
299
-    $regexes    = wpinv_get_data( 'vat-number-regexes' );
297
+    $country    = substr($vat_number, 0, 2);
298
+    $vatin      = substr($vat_number, 2);
299
+    $regexes    = wpinv_get_data('vat-number-regexes');
300 300
 
301
-    if ( isset( $regexes[ $country ] ) ) {
301
+    if (isset($regexes[$country])) {
302 302
 
303
-        $regex = $regexes[ $country ];
303
+        $regex = $regexes[$country];
304 304
         $regex = '/^(?:' . $regex . ')$/';
305
-        return 1 === preg_match( $regex, $vatin );
305
+        return 1 === preg_match($regex, $vatin);
306 306
 
307 307
     }
308 308
 
309 309
     // Not an EU state, use filters to validate the number.
310
-    return apply_filters( 'wpinv_regex_validate_vat_number', true, $vat_number );
310
+    return apply_filters('wpinv_regex_validate_vat_number', true, $vat_number);
311 311
 }
312 312
 
313 313
 /**
@@ -316,29 +316,29 @@  discard block
 block discarded – undo
316 316
  * @param string $vat_number
317 317
  * @return bool
318 318
  */
319
-function wpinv_vies_validate_vat_number( $vat_number ) {
319
+function wpinv_vies_validate_vat_number($vat_number) {
320 320
 
321
-    $country    = substr( $vat_number, 0, 2 );
322
-    $vatin      = substr( $vat_number, 2 );
321
+    $country    = substr($vat_number, 0, 2);
322
+    $vatin      = substr($vat_number, 2);
323 323
 
324 324
     $url        = add_query_arg(
325 325
         array(
326
-            'ms'  => urlencode( $country ),
327
-            'iso' => urlencode( $country ),
328
-            'vat' => urlencode( $vatin ),
326
+            'ms'  => urlencode($country),
327
+            'iso' => urlencode($country),
328
+            'vat' => urlencode($vatin),
329 329
         ),
330 330
         'http://ec.europa.eu/taxation_customs/vies/viesquer.do'
331 331
     );
332 332
 
333
-    $response   = wp_remote_get( $url );
334
-    $response   = wp_remote_retrieve_body( $response );
333
+    $response   = wp_remote_get($url);
334
+    $response   = wp_remote_retrieve_body($response);
335 335
 
336 336
     // Fallback gracefully if the VIES website is down.
337
-    if ( empty( $response ) ) {
337
+    if (empty($response)) {
338 338
         return true;
339 339
     }
340 340
 
341
-    return 1 !== preg_match( '/invalid VAT number/i', $response );
341
+    return 1 !== preg_match('/invalid VAT number/i', $response);
342 342
 
343 343
 }
344 344
 
@@ -349,18 +349,18 @@  discard block
 block discarded – undo
349 349
  * @param string $country
350 350
  * @return bool
351 351
  */
352
-function wpinv_validate_vat_number( $vat_number, $country ) {
352
+function wpinv_validate_vat_number($vat_number, $country) {
353 353
 
354 354
     // In case the vat number does not have a country code...
355
-    $vat_number = wpinv_sanitize_vat_number( $vat_number );
356
-    $_country   = substr( $vat_number, 0, 2 );
357
-    $_country   = $_country == wpinv_country_name( $_country );
355
+    $vat_number = wpinv_sanitize_vat_number($vat_number);
356
+    $_country   = substr($vat_number, 0, 2);
357
+    $_country   = $_country == wpinv_country_name($_country);
358 358
 
359
-    if ( $_country ) {
360
-        $vat_number = strtoupper( $country ) . $vat_number;
359
+    if ($_country) {
360
+        $vat_number = strtoupper($country) . $vat_number;
361 361
     }
362 362
 
363
-    return wpinv_regex_validate_vat_number( $vat_number ) && wpinv_vies_validate_vat_number( $vat_number );
363
+    return wpinv_regex_validate_vat_number($vat_number) && wpinv_vies_validate_vat_number($vat_number);
364 364
 }
365 365
 
366 366
 /**
@@ -369,39 +369,39 @@  discard block
 block discarded – undo
369 369
  * @return bool
370 370
  */
371 371
 function wpinv_should_validate_vat_number() {
372
-    $validate = wpinv_get_option( 'validate_vat_number' );
373
-	return ! empty( $validate );
372
+    $validate = wpinv_get_option('validate_vat_number');
373
+	return !empty($validate);
374 374
 }
375 375
 
376
-function wpinv_sales_tax_for_year( $year = null ) {
377
-    return wpinv_price( wpinv_get_sales_tax_for_year( $year ) );
376
+function wpinv_sales_tax_for_year($year = null) {
377
+    return wpinv_price(wpinv_get_sales_tax_for_year($year));
378 378
 }
379 379
 
380
-function wpinv_get_sales_tax_for_year( $year = null ) {
380
+function wpinv_get_sales_tax_for_year($year = null) {
381 381
     global $wpdb;
382 382
 
383 383
     // Start at zero
384 384
     $tax = 0;
385 385
 
386
-    if ( ! empty( $year ) ) {
386
+    if (!empty($year)) {
387 387
         $args = array(
388 388
             'post_type'      => 'wpi_invoice',
389
-            'post_status'    => array( 'publish' ),
389
+            'post_status'    => array('publish'),
390 390
             'posts_per_page' => -1,
391 391
             'year'           => $year,
392 392
             'fields'         => 'ids',
393 393
         );
394 394
 
395
-        $payments    = get_posts( $args );
396
-        $payment_ids = implode( ',', $payments );
395
+        $payments    = get_posts($args);
396
+        $payment_ids = implode(',', $payments);
397 397
 
398
-        if ( count( $payments ) > 0 ) {
398
+        if (count($payments) > 0) {
399 399
             $sql = "SELECT SUM( meta_value ) FROM $wpdb->postmeta WHERE meta_key = '_wpinv_tax' AND post_id IN( $payment_ids )";
400
-            $tax = $wpdb->get_var( $sql );
400
+            $tax = $wpdb->get_var($sql);
401 401
         }
402 402
 }
403 403
 
404
-    return apply_filters( 'wpinv_get_sales_tax_for_year', $tax, $year );
404
+    return apply_filters('wpinv_get_sales_tax_for_year', $tax, $year);
405 405
 }
406 406
 
407 407
 function wpinv_is_cart_taxed() {
@@ -410,34 +410,34 @@  discard block
 block discarded – undo
410 410
 
411 411
 function wpinv_prices_show_tax_on_checkout() {
412 412
     return false; // TODO
413
-    $ret = ( wpinv_get_option( 'checkout_include_tax', false ) == 'yes' && wpinv_use_taxes() );
413
+    $ret = (wpinv_get_option('checkout_include_tax', false) == 'yes' && wpinv_use_taxes());
414 414
 
415
-    return apply_filters( 'wpinv_taxes_on_prices_on_checkout', $ret );
415
+    return apply_filters('wpinv_taxes_on_prices_on_checkout', $ret);
416 416
 }
417 417
 
418 418
 function wpinv_display_tax_rate() {
419
-    $ret = wpinv_use_taxes() && wpinv_get_option( 'display_tax_rate', false );
419
+    $ret = wpinv_use_taxes() && wpinv_get_option('display_tax_rate', false);
420 420
 
421
-    return apply_filters( 'wpinv_display_tax_rate', $ret );
421
+    return apply_filters('wpinv_display_tax_rate', $ret);
422 422
 }
423 423
 
424 424
 function wpinv_cart_needs_tax_address_fields() {
425
-    if ( ! wpinv_is_cart_taxed() ) {
425
+    if (!wpinv_is_cart_taxed()) {
426 426
         return false;
427 427
     }
428 428
 
429
-    return ! did_action( 'wpinv_after_cc_fields', 'wpinv_default_cc_address_fields' );
429
+    return !did_action('wpinv_after_cc_fields', 'wpinv_default_cc_address_fields');
430 430
 }
431 431
 
432
-function wpinv_item_is_tax_exclusive( $item_id = 0 ) {
433
-    $ret = (bool)get_post_meta( $item_id, '_wpinv_tax_exclusive', false );
434
-    return apply_filters( 'wpinv_is_tax_exclusive', $ret, $item_id );
432
+function wpinv_item_is_tax_exclusive($item_id = 0) {
433
+    $ret = (bool) get_post_meta($item_id, '_wpinv_tax_exclusive', false);
434
+    return apply_filters('wpinv_is_tax_exclusive', $ret, $item_id);
435 435
 }
436 436
 
437
-function wpinv_currency_decimal_filter( $decimals = 2 ) {
437
+function wpinv_currency_decimal_filter($decimals = 2) {
438 438
     $currency = wpinv_get_currency();
439 439
 
440
-    switch ( $currency ) {
440
+    switch ($currency) {
441 441
         case 'RIAL':
442 442
         case 'JPY':
443 443
         case 'TWD':
@@ -446,13 +446,13 @@  discard block
 block discarded – undo
446 446
             break;
447 447
     }
448 448
 
449
-    return apply_filters( 'wpinv_currency_decimal_count', $decimals, $currency );
449
+    return apply_filters('wpinv_currency_decimal_count', $decimals, $currency);
450 450
 }
451 451
 
452 452
 function wpinv_tax_amount() {
453 453
     $output = 0.00;
454 454
 
455
-    return apply_filters( 'wpinv_tax_amount', $output );
455
+    return apply_filters('wpinv_tax_amount', $output);
456 456
 }
457 457
 
458 458
 /**
@@ -460,25 +460,25 @@  discard block
 block discarded – undo
460 460
  *
461 461
  * @param string|bool|null $vat_rule
462 462
  */
463
-function getpaid_filter_vat_rule( $vat_rule ) {
463
+function getpaid_filter_vat_rule($vat_rule) {
464 464
 
465
-    if ( empty( $vat_rule ) ) {
465
+    if (empty($vat_rule)) {
466 466
         return 'digital';
467 467
     }
468 468
 
469 469
     return $vat_rule;
470 470
 }
471
-add_filter( 'wpinv_get_item_vat_rule', 'getpaid_filter_vat_rule' );
471
+add_filter('wpinv_get_item_vat_rule', 'getpaid_filter_vat_rule');
472 472
 
473 473
 /**
474 474
  * Filters the VAT class to ensure that each item has a VAT class.
475 475
  *
476 476
  * @param string|bool|null $vat_rule
477 477
  */
478
-function getpaid_filter_vat_class( $vat_class ) {
479
-    return empty( $vat_class ) ? '_standard' : $vat_class;
478
+function getpaid_filter_vat_class($vat_class) {
479
+    return empty($vat_class) ? '_standard' : $vat_class;
480 480
 }
481
-add_filter( 'wpinv_get_item_vat_class', 'getpaid_filter_vat_class' );
481
+add_filter('wpinv_get_item_vat_class', 'getpaid_filter_vat_class');
482 482
 
483 483
 /**
484 484
  * Returns a list of all tax classes.
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
     return apply_filters(
491 491
         'getpaid_tax_classes',
492 492
         array(
493
-            '_standard' => __( 'Standard Tax Rate', 'invoicing' ),
494
-            '_reduced'  => __( 'Reduced Tax Rate', 'invoicing' ),
495
-            '_exempt'   => __( 'Tax Exempt', 'invoicing' ),
493
+            '_standard' => __('Standard Tax Rate', 'invoicing'),
494
+            '_reduced'  => __('Reduced Tax Rate', 'invoicing'),
495
+            '_exempt'   => __('Tax Exempt', 'invoicing'),
496 496
         )
497 497
     );
498 498
 
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
  *
504 504
  * @return array
505 505
  */
506
-function getpaid_get_tax_rules( $return = 'label' ) {
507
-    return wp_list_pluck( GetPaid_Tax::get_all_tax_rules(), $return, 'key' );
506
+function getpaid_get_tax_rules($return = 'label') {
507
+    return wp_list_pluck(GetPaid_Tax::get_all_tax_rules(), $return, 'key');
508 508
 }
509 509
 
510 510
 /**
@@ -513,15 +513,15 @@  discard block
 block discarded – undo
513 513
  * @param string $tax_class
514 514
  * @return string
515 515
  */
516
-function getpaid_get_tax_class_label( $tax_class ) {
516
+function getpaid_get_tax_class_label($tax_class) {
517 517
 
518 518
     $classes = getpaid_get_tax_classes();
519 519
 
520
-    if ( isset( $classes[ $tax_class ] ) ) {
521
-        return sanitize_text_field( $classes[ $tax_class ] );
520
+    if (isset($classes[$tax_class])) {
521
+        return sanitize_text_field($classes[$tax_class]);
522 522
     }
523 523
 
524
-    return sanitize_text_field( $tax_class );
524
+    return sanitize_text_field($tax_class);
525 525
 
526 526
 }
527 527
 
@@ -531,15 +531,15 @@  discard block
 block discarded – undo
531 531
  * @param string $tax_rule
532 532
  * @return string
533 533
  */
534
-function getpaid_get_tax_rule_label( $tax_rule ) {
534
+function getpaid_get_tax_rule_label($tax_rule) {
535 535
 
536 536
     $rules = getpaid_get_tax_rules();
537 537
 
538
-    if ( isset( $rules[ $tax_rule ] ) ) {
539
-        return sanitize_text_field( $rules[ $tax_rule ] );
538
+    if (isset($rules[$tax_rule])) {
539
+        return sanitize_text_field($rules[$tax_rule]);
540 540
     }
541 541
 
542
-    return sanitize_text_field( $tax_rule );
542
+    return sanitize_text_field($tax_rule);
543 543
 
544 544
 }
545 545
 
@@ -550,11 +550,11 @@  discard block
 block discarded – undo
550 550
  * @param string $recurring
551 551
  * @return string
552 552
  */
553
-function getpaid_get_taxable_amount( $item, $recurring = false ) {
553
+function getpaid_get_taxable_amount($item, $recurring = false) {
554 554
 
555 555
     $taxable_amount  = $recurring ? $item->get_recurring_sub_total() : $item->get_sub_total();
556 556
     $taxable_amount -= $recurring ? $item->recurring_item_discount : $item->item_discount;
557
-    $taxable_amount  = max( 0, $taxable_amount );
558
-    return apply_filters( 'getpaid_taxable_amount', $taxable_amount, $item, $recurring );
557
+    $taxable_amount  = max(0, $taxable_amount);
558
+    return apply_filters('getpaid_taxable_amount', $taxable_amount, $item, $recurring);
559 559
 
560 560
 }
Please login to merge, or discard this patch.
includes/data/admin-settings.php 1 patch
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -8,40 +8,40 @@  discard block
 block discarded – undo
8 8
  * @version 1.0.19
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 $getpaid_pages = GetPaid_Installer::get_pages();
14
-$pages         = wpinv_get_pages( true );
14
+$pages         = wpinv_get_pages(true);
15 15
 
16 16
 $currencies = wpinv_get_currencies();
17 17
 
18 18
 $currency_code_options = array();
19
-foreach ( $currencies as $code => $name ) {
20
-    $currency_code_options[ $code ] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol( $code ) . ')';
19
+foreach ($currencies as $code => $name) {
20
+    $currency_code_options[$code] = $code . ' - ' . $name . ' (' . wpinv_currency_symbol($code) . ')';
21 21
 }
22 22
 
23 23
 $invoice_number_padd_options = array();
24
-for ( $i = 0; $i <= 20; $i++ ) {
25
-    $invoice_number_padd_options[ $i ] = $i;
24
+for ($i = 0; $i <= 20; $i++) {
25
+    $invoice_number_padd_options[$i] = $i;
26 26
 }
27 27
 
28 28
 $currency_symbol = wpinv_currency_symbol();
29 29
 
30 30
 $last_number = $reset_number = '';
31
-if ( $last_invoice_number = get_option( 'wpinv_last_invoice_number' ) ) {
32
-    $last_invoice_number = preg_replace( '/[^0-9]/', '', $last_invoice_number );
31
+if ($last_invoice_number = get_option('wpinv_last_invoice_number')) {
32
+    $last_invoice_number = preg_replace('/[^0-9]/', '', $last_invoice_number);
33 33
 
34
-    if ( ! empty( $last_invoice_number ) ) {
35
-        $last_number = ' ' . wp_sprintf( __( "( Last Invoice's sequential number: <b>%s</b> )", 'invoicing' ), $last_invoice_number );
34
+    if (!empty($last_invoice_number)) {
35
+        $last_number = ' ' . wp_sprintf(__("( Last Invoice's sequential number: <b>%s</b> )", 'invoicing'), $last_invoice_number);
36 36
     }
37 37
 
38
-    $nonce = wp_create_nonce( 'reset_invoice_count' );
38
+    $nonce = wp_create_nonce('reset_invoice_count');
39 39
     $reset_number = '<a href="' . add_query_arg(
40 40
         array(
41 41
 			'reset_invoice_count' => 1,
42 42
 			'_nonce'              => $nonce,
43 43
         )
44
-    ) . '" class="btn button">' . __( 'Force Reset Sequence', 'invoicing' ) . '</a>';
44
+    ) . '" class="btn button">' . __('Force Reset Sequence', 'invoicing') . '</a>';
45 45
 }
46 46
 
47 47
 $alert_wrapper_start = '<p style="color: #F00">';
@@ -54,59 +54,59 @@  discard block
 block discarded – undo
54 54
             'main'             => array(
55 55
                 'location_settings' => array(
56 56
                     'id'   => 'location_settings',
57
-                    'name' => '<h3>' . __( 'Default Location', 'invoicing' ) . '</h3>',
57
+                    'name' => '<h3>' . __('Default Location', 'invoicing') . '</h3>',
58 58
                     'desc' => '',
59 59
                     'type' => 'header',
60 60
                 ),
61 61
                 'default_country'   => array(
62 62
                     'id'          => 'default_country',
63
-                    'name'        => __( 'Default Country', 'invoicing' ),
64
-                    'desc'        => __( 'Where does your store operate from?', 'invoicing' ),
63
+                    'name'        => __('Default Country', 'invoicing'),
64
+                    'desc'        => __('Where does your store operate from?', 'invoicing'),
65 65
                     'type'        => 'select',
66 66
                     'options'     => wpinv_get_country_list(),
67 67
                     'std'         => 'GB',
68 68
                     'class'       => 'wpi_select2',
69
-                    'placeholder' => __( 'Select a country', 'invoicing' ),
69
+                    'placeholder' => __('Select a country', 'invoicing'),
70 70
                 ),
71 71
                 'default_state'     => array(
72 72
                     'id'          => 'default_state',
73
-                    'name'        => __( 'Default State / Province', 'invoicing' ),
74
-                    'desc'        => __( 'What state / province does your store operate from?', 'invoicing' ),
73
+                    'name'        => __('Default State / Province', 'invoicing'),
74
+                    'desc'        => __('What state / province does your store operate from?', 'invoicing'),
75 75
                     'type'        => 'country_states',
76 76
                     'class'       => 'wpi_select2',
77
-                    'placeholder' => __( 'Select a state', 'invoicing' ),
77
+                    'placeholder' => __('Select a state', 'invoicing'),
78 78
                 ),
79 79
                 'store_name'        => array(
80 80
                     'id'   => 'store_name',
81
-                    'name' => __( 'Store Name', 'invoicing' ),
82
-                    'desc' => __( 'Store name to print on invoices.', 'invoicing' ),
83
-                    'std'  => get_option( 'blogname' ),
81
+                    'name' => __('Store Name', 'invoicing'),
82
+                    'desc' => __('Store name to print on invoices.', 'invoicing'),
83
+                    'std'  => get_option('blogname'),
84 84
                     'type' => 'text',
85 85
                 ),
86 86
                 'logo'              => array(
87 87
                     'id'   => 'logo',
88
-                    'name' => __( 'Logo URL', 'invoicing' ),
89
-                    'desc' => __( 'Store logo to print on invoices.', 'invoicing' ),
88
+                    'name' => __('Logo URL', 'invoicing'),
89
+                    'desc' => __('Store logo to print on invoices.', 'invoicing'),
90 90
                     'type' => 'text',
91 91
                 ),
92 92
                 'logo_width'        => array(
93 93
                     'id'          => 'logo_width',
94
-                    'name'        => __( 'Logo width', 'invoicing' ),
95
-                    'desc'        => __( 'Logo width to use in invoice image.', 'invoicing' ),
94
+                    'name'        => __('Logo width', 'invoicing'),
95
+                    'desc'        => __('Logo width to use in invoice image.', 'invoicing'),
96 96
                     'type'        => 'number',
97
-                    'placeholder' => __( 'Auto', 'invoicing' ),
97
+                    'placeholder' => __('Auto', 'invoicing'),
98 98
                 ),
99 99
                 'logo_height'       => array(
100 100
                     'id'          => 'logo_height',
101
-                    'name'        => __( 'Logo height', 'invoicing' ),
102
-                    'desc'        => __( 'Logo height to use in invoice image.', 'invoicing' ),
101
+                    'name'        => __('Logo height', 'invoicing'),
102
+                    'desc'        => __('Logo height to use in invoice image.', 'invoicing'),
103 103
                     'type'        => 'number',
104
-                    'placeholder' => __( 'Auto', 'invoicing' ),
104
+                    'placeholder' => __('Auto', 'invoicing'),
105 105
                 ),
106 106
                 'store_address'     => array(
107 107
                     'id'   => 'store_address',
108
-                    'name' => __( 'Store Address', 'invoicing' ),
109
-                    'desc' => __( 'Enter the store address to display on invoice', 'invoicing' ),
108
+                    'name' => __('Store Address', 'invoicing'),
109
+                    'desc' => __('Enter the store address to display on invoice', 'invoicing'),
110 110
                     'type' => 'textarea',
111 111
                 ),
112 112
 
@@ -114,114 +114,114 @@  discard block
 block discarded – undo
114 114
             'page_section'     => array(
115 115
                 'page_settings'             => array(
116 116
                     'id'   => 'page_settings',
117
-                    'name' => '<h3>' . __( 'Page Settings', 'invoicing' ) . '</h3>',
117
+                    'name' => '<h3>' . __('Page Settings', 'invoicing') . '</h3>',
118 118
                     'desc' => '',
119 119
                     'type' => 'header',
120 120
                 ),
121 121
                 'checkout_page'             => array(
122 122
                     'id'              => 'checkout_page',
123
-                    'name'            => __( 'Checkout Page', 'invoicing' ),
124
-                    'desc'            => __( 'This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing' ),
123
+                    'name'            => __('Checkout Page', 'invoicing'),
124
+                    'desc'            => __('This is the checkout page where buyers will complete their payments. The <b>[wpinv_checkout]</b> short code must be on this page.', 'invoicing'),
125 125
                     'type'            => 'select',
126 126
                     'options'         => $pages,
127 127
                     'class'           => 'wpi_select2',
128
-                    'placeholder'     => __( 'Select a page', 'invoicing' ),
129
-                    'default_content' => empty( $getpaid_pages['checkout_page'] ) ? '' : $getpaid_pages['checkout_page']['content'],
128
+                    'placeholder'     => __('Select a page', 'invoicing'),
129
+                    'default_content' => empty($getpaid_pages['checkout_page']) ? '' : $getpaid_pages['checkout_page']['content'],
130 130
                     'help-tip'        => true,
131 131
                 ),
132 132
                 'success_page'              => array(
133 133
                     'id'              => 'success_page',
134
-                    'name'            => __( 'Success Page', 'invoicing' ),
135
-                    'desc'            => __( 'This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing' ),
134
+                    'name'            => __('Success Page', 'invoicing'),
135
+                    'desc'            => __('This is the page buyers are sent to after completing their payments. The <b>[wpinv_receipt]</b> short code should be on this page.', 'invoicing'),
136 136
                     'type'            => 'select',
137 137
                     'options'         => $pages,
138 138
                     'class'           => 'wpi_select2',
139
-                    'placeholder'     => __( 'Select a page', 'invoicing' ),
140
-                    'default_content' => empty( $getpaid_pages['success_page'] ) ? '' : $getpaid_pages['success_page']['content'],
139
+                    'placeholder'     => __('Select a page', 'invoicing'),
140
+                    'default_content' => empty($getpaid_pages['success_page']) ? '' : $getpaid_pages['success_page']['content'],
141 141
                     'help-tip'        => true,
142 142
                 ),
143 143
                 'failure_page'              => array(
144 144
                     'id'              => 'failure_page',
145
-                    'name'            => __( 'Failed Transaction Page', 'invoicing' ),
146
-                    'desc'            => __( 'This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing' ),
145
+                    'name'            => __('Failed Transaction Page', 'invoicing'),
146
+                    'desc'            => __('This is the page buyers are sent to if their transaction is cancelled or fails.', 'invoicing'),
147 147
                     'type'            => 'select',
148 148
                     'options'         => $pages,
149 149
                     'class'           => 'wpi_select2',
150
-                    'placeholder'     => __( 'Select a page', 'invoicing' ),
151
-                    'default_content' => empty( $getpaid_pages['failure_page'] ) ? '' : $getpaid_pages['failure_page']['content'],
150
+                    'placeholder'     => __('Select a page', 'invoicing'),
151
+                    'default_content' => empty($getpaid_pages['failure_page']) ? '' : $getpaid_pages['failure_page']['content'],
152 152
                     'help-tip'        => true,
153 153
                 ),
154 154
                 'invoice_history_page'      => array(
155 155
                     'id'              => 'invoice_history_page',
156
-                    'name'            => __( 'Invoice History Page', 'invoicing' ),
157
-                    'desc'            => __( 'This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing' ),
156
+                    'name'            => __('Invoice History Page', 'invoicing'),
157
+                    'desc'            => __('This page shows an invoice history for the current user. The <b>[wpinv_history]</b> short code should be on this page.', 'invoicing'),
158 158
                     'type'            => 'select',
159 159
                     'options'         => $pages,
160 160
                     'class'           => 'wpi_select2',
161
-                    'placeholder'     => __( 'Select a page', 'invoicing' ),
162
-                    'default_content' => empty( $getpaid_pages['invoice_history_page'] ) ? '' : $getpaid_pages['invoice_history_page']['content'],
161
+                    'placeholder'     => __('Select a page', 'invoicing'),
162
+                    'default_content' => empty($getpaid_pages['invoice_history_page']) ? '' : $getpaid_pages['invoice_history_page']['content'],
163 163
                     'help-tip'        => true,
164 164
                 ),
165 165
                 'invoice_subscription_page' => array(
166 166
                     'id'              => 'invoice_subscription_page',
167
-                    'name'            => __( 'Invoice Subscriptions Page', 'invoicing' ),
168
-                    'desc'            => __( 'This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing' ),
167
+                    'name'            => __('Invoice Subscriptions Page', 'invoicing'),
168
+                    'desc'            => __('This page shows subscriptions history for the current user. The <b>[wpinv_subscriptions]</b> short code should be on this page.', 'invoicing'),
169 169
                     'type'            => 'select',
170 170
                     'options'         => $pages,
171 171
                     'class'           => 'wpi_select2',
172
-                    'placeholder'     => __( 'Select a page', 'invoicing' ),
173
-                    'default_content' => empty( $getpaid_pages['invoice_subscription_page'] ) ? '' : $getpaid_pages['invoice_subscription_page']['content'],
172
+                    'placeholder'     => __('Select a page', 'invoicing'),
173
+                    'default_content' => empty($getpaid_pages['invoice_subscription_page']) ? '' : $getpaid_pages['invoice_subscription_page']['content'],
174 174
                     'help-tip'        => true,
175 175
                 ),
176 176
             ),
177 177
             'currency_section' => array(
178 178
                 'currency_settings'   => array(
179 179
                     'id'   => 'currency_settings',
180
-                    'name' => '<h3>' . __( 'Currency Settings', 'invoicing' ) . '</h3>',
180
+                    'name' => '<h3>' . __('Currency Settings', 'invoicing') . '</h3>',
181 181
                     'desc' => '',
182 182
                     'type' => 'header',
183 183
                 ),
184 184
                 'currency'            => array(
185 185
                     'id'      => 'currency',
186
-                    'name'    => __( 'Currency', 'invoicing' ),
187
-                    'desc'    => __( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing' ),
186
+                    'name'    => __('Currency', 'invoicing'),
187
+                    'desc'    => __('Choose your currency. Note that some payment gateways have currency restrictions.', 'invoicing'),
188 188
                     'type'    => 'select',
189 189
                     'class'   => 'wpi_select2',
190 190
                     'options' => $currency_code_options,
191 191
                 ),
192 192
                 'currency_position'   => array(
193 193
                     'id'      => 'currency_position',
194
-                    'name'    => __( 'Currency Position', 'invoicing' ),
195
-                    'desc'    => __( 'Choose the location of the currency sign.', 'invoicing' ),
194
+                    'name'    => __('Currency Position', 'invoicing'),
195
+                    'desc'    => __('Choose the location of the currency sign.', 'invoicing'),
196 196
                     'type'    => 'select',
197 197
                     'class'   => 'wpi_select2',
198 198
                     'options' => array(
199
-                        'left'        => __( 'Left', 'invoicing' ) . ' (' . $currency_symbol . wpinv_format_amount( '99.99' ) . ')',
200
-                        'right'       => __( 'Right', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . $currency_symbol . ')',
201
-                        'left_space'  => __( 'Left with space', 'invoicing' ) . ' (' . $currency_symbol . ' ' . wpinv_format_amount( '99.99' ) . ')',
202
-                        'right_space' => __( 'Right with space', 'invoicing' ) . ' (' . wpinv_format_amount( '99.99' ) . ' ' . $currency_symbol . ')',
199
+                        'left'        => __('Left', 'invoicing') . ' (' . $currency_symbol . wpinv_format_amount('99.99') . ')',
200
+                        'right'       => __('Right', 'invoicing') . ' (' . wpinv_format_amount('99.99') . $currency_symbol . ')',
201
+                        'left_space'  => __('Left with space', 'invoicing') . ' (' . $currency_symbol . ' ' . wpinv_format_amount('99.99') . ')',
202
+                        'right_space' => __('Right with space', 'invoicing') . ' (' . wpinv_format_amount('99.99') . ' ' . $currency_symbol . ')',
203 203
                     ),
204 204
                 ),
205 205
                 'thousands_separator' => array(
206 206
                     'id'   => 'thousands_separator',
207
-                    'name' => __( 'Thousands Separator', 'invoicing' ),
208
-                    'desc' => __( 'The symbol (usually , or .) to separate thousands', 'invoicing' ),
207
+                    'name' => __('Thousands Separator', 'invoicing'),
208
+                    'desc' => __('The symbol (usually , or .) to separate thousands', 'invoicing'),
209 209
                     'type' => 'text',
210 210
                     'size' => 'small',
211 211
                     'std'  => ',',
212 212
                 ),
213 213
                 'decimal_separator'   => array(
214 214
                     'id'   => 'decimal_separator',
215
-                    'name' => __( 'Decimal Separator', 'invoicing' ),
216
-                    'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'invoicing' ),
215
+                    'name' => __('Decimal Separator', 'invoicing'),
216
+                    'desc' => __('The symbol (usually , or .) to separate decimal points', 'invoicing'),
217 217
                     'type' => 'text',
218 218
                     'size' => 'small',
219 219
                     'std'  => '.',
220 220
                 ),
221 221
                 'decimals'            => array(
222 222
                     'id'   => 'decimals',
223
-                    'name' => __( 'Number of Decimals', 'invoicing' ),
224
-                    'desc' => __( 'This sets the number of decimal points shown in displayed prices.', 'invoicing' ),
223
+                    'name' => __('Number of Decimals', 'invoicing'),
224
+                    'desc' => __('This sets the number of decimal points shown in displayed prices.', 'invoicing'),
225 225
                     'type' => 'number',
226 226
                     'size' => 'small',
227 227
                     'std'  => '2',
@@ -233,21 +233,21 @@  discard block
 block discarded – undo
233 233
             'labels'           => array(
234 234
                 'labels'                   => array(
235 235
                     'id'   => 'labels_settings',
236
-                    'name' => '<h3>' . __( 'Invoice Labels', 'invoicing' ) . '</h3>',
236
+                    'name' => '<h3>' . __('Invoice Labels', 'invoicing') . '</h3>',
237 237
                     'desc' => '',
238 238
                     'type' => 'header',
239 239
                 ),
240 240
                 'vat_invoice_notice_label' => array(
241 241
                     'id'   => 'vat_invoice_notice_label',
242
-                    'name' => __( 'Invoice Notice Label', 'invoicing' ),
243
-                    'desc' => __( 'Use this to add an invoice notice section (label) to your invoices', 'invoicing' ),
242
+                    'name' => __('Invoice Notice Label', 'invoicing'),
243
+                    'desc' => __('Use this to add an invoice notice section (label) to your invoices', 'invoicing'),
244 244
                     'type' => 'text',
245 245
                     'size' => 'regular',
246 246
                 ),
247 247
                 'vat_invoice_notice'       => array(
248 248
                     'id'   => 'vat_invoice_notice',
249
-                    'name' => __( 'Invoice notice', 'invoicing' ),
250
-                    'desc' => __( 'Use this to add an invoice notice section (description) to your invoices', 'invoicing' ),
249
+                    'name' => __('Invoice notice', 'invoicing'),
250
+                    'desc' => __('Use this to add an invoice notice section (description) to your invoices', 'invoicing'),
251 251
                     'type' => 'text',
252 252
                     'size' => 'regular',
253 253
                 ),
@@ -260,22 +260,22 @@  discard block
 block discarded – undo
260 260
             'main' => array(
261 261
                 'gateway_settings' => array(
262 262
                     'id'   => 'api_header',
263
-                    'name' => '<h3>' . __( 'Gateway Settings', 'invoicing' ) . '</h3>',
263
+                    'name' => '<h3>' . __('Gateway Settings', 'invoicing') . '</h3>',
264 264
                     'desc' => '',
265 265
                     'type' => 'header',
266 266
                 ),
267 267
                 'gateways'         => array(
268 268
                     'id'      => 'gateways',
269
-                    'name'    => __( 'Payment Gateways', 'invoicing' ),
270
-                    'desc'    => __( 'Choose the payment gateways you want to enable.', 'invoicing' ),
269
+                    'name'    => __('Payment Gateways', 'invoicing'),
270
+                    'desc'    => __('Choose the payment gateways you want to enable.', 'invoicing'),
271 271
                     'type'    => 'gateways',
272
-                    'std'     => array( 'manual' => 1 ),
272
+                    'std'     => array('manual' => 1),
273 273
                     'options' => wpinv_get_payment_gateways(),
274 274
                 ),
275 275
                 'default_gateway'  => array(
276 276
                     'id'      => 'default_gateway',
277
-                    'name'    => __( 'Default Gateway', 'invoicing' ),
278
-                    'desc'    => __( 'This gateway will be loaded automatically with the checkout page.', 'invoicing' ),
277
+                    'name'    => __('Default Gateway', 'invoicing'),
278
+                    'desc'    => __('This gateway will be loaded automatically with the checkout page.', 'invoicing'),
279 279
                     'type'    => 'gateway_select',
280 280
                     'std'     => 'manual',
281 281
                     'class'   => 'wpi_select2',
@@ -291,32 +291,32 @@  discard block
 block discarded – undo
291 291
             'main'  => array(
292 292
                 'tax_settings'          => array(
293 293
                     'id'   => 'tax_settings',
294
-                    'name' => '<h3>' . __( 'Tax Settings', 'invoicing' ) . '</h3>',
294
+                    'name' => '<h3>' . __('Tax Settings', 'invoicing') . '</h3>',
295 295
                     'type' => 'header',
296 296
                 ),
297 297
 
298 298
                 'enable_taxes'          => array(
299 299
                     'id'   => 'enable_taxes',
300
-                    'name' => __( 'Enable Taxes', 'invoicing' ),
301
-                    'desc' => __( 'Enable tax rates and calculations.', 'invoicing' ),
300
+                    'name' => __('Enable Taxes', 'invoicing'),
301
+                    'desc' => __('Enable tax rates and calculations.', 'invoicing'),
302 302
                     'type' => 'checkbox',
303 303
                     'std'  => 0,
304 304
                 ),
305 305
 
306 306
                 'tax_subtotal_rounding' => array(
307 307
                     'id'   => 'tax_subtotal_rounding',
308
-                    'name' => __( 'Rounding', 'invoicing' ),
309
-                    'desc' => __( 'Round tax at subtotal level, instead of rounding per tax rate', 'invoicing' ),
308
+                    'name' => __('Rounding', 'invoicing'),
309
+                    'desc' => __('Round tax at subtotal level, instead of rounding per tax rate', 'invoicing'),
310 310
                     'type' => 'checkbox',
311 311
                     'std'  => 1,
312 312
                 ),
313 313
 
314 314
                 'prices_include_tax'    => array(
315 315
                     'id'      => 'prices_include_tax',
316
-                    'name'    => __( 'Prices entered with tax', 'invoicing' ),
316
+                    'name'    => __('Prices entered with tax', 'invoicing'),
317 317
                     'options' => array(
318
-                        'yes' => __( 'Yes, I will enter prices inclusive of tax', 'invoicing' ),
319
-                        'no'  => __( 'No, I will enter prices exclusive of tax', 'invoicing' ),
318
+                        'yes' => __('Yes, I will enter prices inclusive of tax', 'invoicing'),
319
+                        'no'  => __('No, I will enter prices exclusive of tax', 'invoicing'),
320 320
                     ),
321 321
                     'type'    => 'select',
322 322
                     'std'     => 'no',
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 
325 325
                 'tax_base'              => array(
326 326
                     'id'      => 'tax_base',
327
-                    'name'    => __( 'Calculate tax based on', 'invoicing' ),
327
+                    'name'    => __('Calculate tax based on', 'invoicing'),
328 328
                     'options' => array(
329
-                        'billing' => __( 'Customer billing address', 'invoicing' ),
330
-                        'base'    => __( 'Shop base address', 'invoicing' ),
329
+                        'billing' => __('Customer billing address', 'invoicing'),
330
+                        'base'    => __('Shop base address', 'invoicing'),
331 331
                     ),
332 332
                     'type'    => 'select',
333 333
                     'std'     => 'billing',
@@ -335,24 +335,24 @@  discard block
 block discarded – undo
335 335
 
336 336
                 'vat_same_country_rule'    => array(
337 337
                     'id'          => 'vat_same_country_rule',
338
-                    'name'        => __( 'Same country rule', 'invoicing' ),
339
-                    'desc'        => __( 'What should happen if a customer is from the same country as your business?', 'invoicing' ),
338
+                    'name'        => __('Same country rule', 'invoicing'),
339
+                    'desc'        => __('What should happen if a customer is from the same country as your business?', 'invoicing'),
340 340
                     'type'        => 'select',
341 341
                     'options'     => array(
342
-                        'no'      => __( 'Do not charge tax', 'invoicing' ),
343
-                        'always'  => __( 'Charge tax unless vat number is validated', 'invoicing' ),
344
-                        'vat_too' => __( 'Charge tax even if vat number is validated', 'invoicing' ),
342
+                        'no'      => __('Do not charge tax', 'invoicing'),
343
+                        'always'  => __('Charge tax unless vat number is validated', 'invoicing'),
344
+                        'vat_too' => __('Charge tax even if vat number is validated', 'invoicing'),
345 345
                     ),
346
-                    'placeholder' => __( 'Select an option', 'invoicing' ),
346
+                    'placeholder' => __('Select an option', 'invoicing'),
347 347
                     'std'         => 'vat_too',
348 348
                 ),
349 349
 
350 350
                 'tax_display_totals'    => array(
351 351
                     'id'      => 'tax_display_totals',
352
-                    'name'    => __( 'Display tax totals', 'invoicing' ),
352
+                    'name'    => __('Display tax totals', 'invoicing'),
353 353
                     'options' => array(
354
-                        'single'     => __( 'As a single total', 'invoicing' ),
355
-                        'individual' => __( 'As individual tax rates', 'invoicing' ),
354
+                        'single'     => __('As a single total', 'invoicing'),
355
+                        'individual' => __('As individual tax rates', 'invoicing'),
356 356
                     ),
357 357
                     'type'    => 'select',
358 358
                     'std'     => 'individual',
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 
361 361
                 'tax_rate'              => array(
362 362
                     'id'   => 'tax_rate',
363
-                    'name' => __( 'Fallback Tax Rate', 'invoicing' ),
364
-                    'desc' => __( 'Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing' ),
363
+                    'name' => __('Fallback Tax Rate', 'invoicing'),
364
+                    'desc' => __('Enter a percentage, such as 6.5. Customers not in a specific rate will be charged this rate.', 'invoicing'),
365 365
                     'type' => 'number',
366 366
                     'size' => 'small',
367 367
                     'min'  => '0',
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
             'rules' => array(
374 374
                 'tax_rules' => array(
375 375
                     'id'   => 'tax_rules',
376
-                    'name' => '<h3>' . __( 'Tax Rules', 'invoicing' ) . '</h3>',
377
-                    'desc' => __( 'Create/Update tax rules', 'invoicing' ),
376
+                    'name' => '<h3>' . __('Tax Rules', 'invoicing') . '</h3>',
377
+                    'desc' => __('Create/Update tax rules', 'invoicing'),
378 378
                     'type' => 'tax_rules',
379 379
                 ),
380 380
             ),
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
             'rates' => array(
383 383
                 'tax_rates' => array(
384 384
                     'id'   => 'tax_rates',
385
-                    'name' => '<h3>' . __( 'Tax Rates', 'invoicing' ) . '</h3>',
386
-                    'desc' => __( 'Enter tax rates for specific regions.', 'invoicing' ),
385
+                    'name' => '<h3>' . __('Tax Rates', 'invoicing') . '</h3>',
386
+                    'desc' => __('Enter tax rates for specific regions.', 'invoicing'),
387 387
                     'type' => 'tax_rates',
388 388
                 ),
389 389
             ),
@@ -392,31 +392,31 @@  discard block
 block discarded – undo
392 392
 
393 393
                 'vat_company_name'         => array(
394 394
                     'id'   => 'vat_company_name',
395
-                    'name' => __( 'Company Name', 'invoicing' ),
396
-                    'desc' => wp_sprintf( __( 'Verify your company name and  VAT number on the %1$sEU VIES System.%2$s', 'invoicing' ), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>' ),
395
+                    'name' => __('Company Name', 'invoicing'),
396
+                    'desc' => wp_sprintf(__('Verify your company name and  VAT number on the %1$sEU VIES System.%2$s', 'invoicing'), '<a href="http://ec.europa.eu/taxation_customs/vies/" target="_blank">', '</a>'),
397 397
                     'type' => 'text',
398 398
                     'size' => 'regular',
399 399
                 ),
400 400
 
401 401
                 'vat_number'               => array(
402 402
                     'id'   => 'vat_number',
403
-                    'name' => __( 'VAT Number', 'invoicing' ),
404
-                    'desc' => __( 'Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing' ),
403
+                    'name' => __('VAT Number', 'invoicing'),
404
+                    'desc' => __('Enter your VAT number including the country identifier, eg: GB123456789', 'invoicing'),
405 405
                     'type' => 'text',
406 406
                     'size' => 'regular',
407 407
                 ),
408 408
 
409 409
                 'vat_prevent_b2c_purchase' => array(
410 410
                     'id'   => 'vat_prevent_b2c_purchase',
411
-                    'name' => __( 'Prevent B2C Sales', 'invoicing' ),
412
-                    'desc' => __( 'Require everyone in the EU to provide a VAT number.', 'invoicing' ),
411
+                    'name' => __('Prevent B2C Sales', 'invoicing'),
412
+                    'desc' => __('Require everyone in the EU to provide a VAT number.', 'invoicing'),
413 413
                     'type' => 'checkbox',
414 414
                 ),
415 415
 
416 416
                 'validate_vat_number'      => array(
417 417
                     'id'   => 'validate_vat_number',
418
-                    'name' => __( 'Validate VAT Number', 'invoicing' ),
419
-                    'desc' => __( 'Validate VAT numbers with VIES.', 'invoicing' ),
418
+                    'name' => __('Validate VAT Number', 'invoicing'),
419
+                    'desc' => __('Validate VAT numbers with VIES.', 'invoicing'),
420 420
                     'type' => 'checkbox',
421 421
                 ),
422 422
 
@@ -431,66 +431,66 @@  discard block
 block discarded – undo
431 431
             'main' => array(
432 432
                 'email_settings_header'       => array(
433 433
                     'id'   => 'email_settings_header',
434
-                    'name' => '<h3>' . __( 'Email Sender Options', 'invoicing' ) . '</h3>',
434
+                    'name' => '<h3>' . __('Email Sender Options', 'invoicing') . '</h3>',
435 435
                     'type' => 'header',
436 436
                 ),
437 437
                 'email_from_name'             => array(
438 438
                     'id'   => 'email_from_name',
439
-                    'name' => __( 'From Name', 'invoicing' ),
440
-                    'desc' => __( 'Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing' ),
441
-                    'std'  => esc_attr( get_bloginfo( 'name', 'display' ) ),
439
+                    'name' => __('From Name', 'invoicing'),
440
+                    'desc' => __('Enter the sender\'s name appears in outgoing invoice emails. This should be your site name.', 'invoicing'),
441
+                    'std'  => esc_attr(get_bloginfo('name', 'display')),
442 442
                     'type' => 'text',
443 443
                 ),
444 444
                 'email_from'                  => array(
445 445
                     'id'   => 'email_from',
446
-                    'name' => __( 'From Email', 'invoicing' ),
447
-                    'desc' => sprintf( __( 'Email address to send invoice emails from. This will act as the "from" address. %1$s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%2$s', 'invoicing' ), $alert_wrapper_start, $alert_wrapper_close ),
448
-                    'std'  => get_option( 'admin_email' ),
446
+                    'name' => __('From Email', 'invoicing'),
447
+                    'desc' => sprintf(__('Email address to send invoice emails from. This will act as the "from" address. %1$s If emails are not being sent it may be that your hosting prevents emails being sent if the email domains do not match.%2$s', 'invoicing'), $alert_wrapper_start, $alert_wrapper_close),
448
+                    'std'  => get_option('admin_email'),
449 449
                     'type' => 'text',
450 450
                 ),
451 451
                 'admin_email'                 => array(
452 452
                     'id'   => 'admin_email',
453
-                    'name' => __( 'Admin Email', 'invoicing' ),
454
-                    'desc' => __( 'Where should we send admin notifications? This will is also act as the "reply-to" address for invoice emails', 'invoicing' ),
455
-                    'std'  => get_option( 'admin_email' ),
453
+                    'name' => __('Admin Email', 'invoicing'),
454
+                    'desc' => __('Where should we send admin notifications? This will is also act as the "reply-to" address for invoice emails', 'invoicing'),
455
+                    'std'  => get_option('admin_email'),
456 456
                     'type' => 'text',
457 457
                 ),
458 458
                 'skip_email_free_invoice'     => array(
459 459
                     'id'   => 'skip_email_free_invoice',
460
-                    'name' => __( 'Skip Free Invoices', 'invoicing' ),
461
-                    'desc' => __( 'Check this to disable sending emails for free invoices.', 'invoicing' ),
460
+                    'name' => __('Skip Free Invoices', 'invoicing'),
461
+                    'desc' => __('Check this to disable sending emails for free invoices.', 'invoicing'),
462 462
                     'type' => 'checkbox',
463 463
                     'std'  => false,
464 464
                 ),
465 465
                 'overdue_settings_header'     => array(
466 466
                     'id'   => 'overdue_settings_header',
467
-                    'name' => '<h3>' . __( 'Due Date Settings', 'invoicing' ) . '</h3>',
467
+                    'name' => '<h3>' . __('Due Date Settings', 'invoicing') . '</h3>',
468 468
                     'type' => 'header',
469 469
                 ),
470 470
                 'overdue_active'              => array(
471 471
                     'id'   => 'overdue_active',
472
-                    'name' => __( 'Enable Due Date', 'invoicing' ),
473
-                    'desc' => __( 'Check this to enable due date option for invoices.', 'invoicing' ),
472
+                    'name' => __('Enable Due Date', 'invoicing'),
473
+                    'desc' => __('Check this to enable due date option for invoices.', 'invoicing'),
474 474
                     'type' => 'checkbox',
475 475
                     'std'  => false,
476 476
                 ),
477 477
                 'email_template_header'       => array(
478 478
                     'id'   => 'email_template_header',
479
-                    'name' => '<h3>' . __( 'Email Template', 'invoicing' ) . '</h3>',
479
+                    'name' => '<h3>' . __('Email Template', 'invoicing') . '</h3>',
480 480
                     'type' => 'header',
481 481
                 ),
482 482
                 'email_header_image'          => array(
483 483
                     'id'   => 'email_header_image',
484
-                    'name' => __( 'Header Image', 'invoicing' ),
485
-                    'desc' => __( 'URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing' ),
484
+                    'name' => __('Header Image', 'invoicing'),
485
+                    'desc' => __('URL to an image you want to show in the email header. Upload images using the media uploader (Admin > Media).', 'invoicing'),
486 486
                     'std'  => '',
487 487
                     'type' => 'text',
488 488
                 ),
489 489
                 'email_footer_text'           => array(
490 490
                     'id'    => 'email_footer_text',
491
-                    'name'  => __( 'Footer Text', 'invoicing' ),
492
-                    'desc'  => __( 'The text to appear in the footer of all invoice emails.', 'invoicing' ),
493
-                    'std'   => get_bloginfo( 'name', 'display' ) . ' - ' . __( 'Powered by GetPaid', 'invoicing' ),
491
+                    'name'  => __('Footer Text', 'invoicing'),
492
+                    'desc'  => __('The text to appear in the footer of all invoice emails.', 'invoicing'),
493
+                    'std'   => get_bloginfo('name', 'display') . ' - ' . __('Powered by GetPaid', 'invoicing'),
494 494
                     'type'  => 'textarea',
495 495
                     'class' => 'regular-text',
496 496
                     'rows'  => 2,
@@ -498,29 +498,29 @@  discard block
 block discarded – undo
498 498
                 ),
499 499
                 'email_base_color'            => array(
500 500
                     'id'   => 'email_base_color',
501
-                    'name' => __( 'Base Color', 'invoicing' ),
502
-                    'desc' => __( 'The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing' ),
501
+                    'name' => __('Base Color', 'invoicing'),
502
+                    'desc' => __('The base color for invoice email template. Default <code>#557da2</code>.', 'invoicing'),
503 503
                     'std'  => '#557da2',
504 504
                     'type' => 'color',
505 505
                 ),
506 506
                 'email_background_color'      => array(
507 507
                     'id'   => 'email_background_color',
508
-                    'name' => __( 'Background Color', 'invoicing' ),
509
-                    'desc' => __( 'The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing' ),
508
+                    'name' => __('Background Color', 'invoicing'),
509
+                    'desc' => __('The background color of email template. Default <code>#f5f5f5</code>.', 'invoicing'),
510 510
                     'std'  => '#f5f5f5',
511 511
                     'type' => 'color',
512 512
                 ),
513 513
                 'email_body_background_color' => array(
514 514
                     'id'   => 'email_body_background_color',
515
-                    'name' => __( 'Body Background Color', 'invoicing' ),
516
-                    'desc' => __( 'The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing' ),
515
+                    'name' => __('Body Background Color', 'invoicing'),
516
+                    'desc' => __('The main body background color of email template. Default <code>#fdfdfd</code>.', 'invoicing'),
517 517
                     'std'  => '#fdfdfd',
518 518
                     'type' => 'color',
519 519
                 ),
520 520
                 'email_text_color'            => array(
521 521
                     'id'   => 'email_text_color',
522
-                    'name' => __( 'Body Text Color', 'invoicing' ),
523
-                    'desc' => __( 'The main body text color. Default <code>#505050</code>.', 'invoicing' ),
522
+                    'name' => __('Body Text Color', 'invoicing'),
523
+                    'desc' => __('The main body text color. Default <code>#505050</code>.', 'invoicing'),
524 524
                     'std'  => '#505050',
525 525
                     'type' => 'color',
526 526
                 ),
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
     ),
536 536
 
537 537
     // Integrations.
538
-    'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'settings', 'id' ),
538
+    'integrations' => wp_list_pluck(getpaid_get_integration_settings(), 'settings', 'id'),
539 539
 
540 540
     /** Privacy Settings */
541 541
     'privacy'      => apply_filters(
@@ -544,17 +544,17 @@  discard block
 block discarded – undo
544 544
             'main' => array(
545 545
                 'invoicing_privacy_policy_settings' => array(
546 546
                     'id'   => 'invoicing_privacy_policy_settings',
547
-                    'name' => '<h3>' . __( 'Privacy Policy', 'invoicing' ) . '</h3>',
547
+                    'name' => '<h3>' . __('Privacy Policy', 'invoicing') . '</h3>',
548 548
                     'type' => 'header',
549 549
                 ),
550 550
                 'privacy_page'                      => array(
551 551
                     'id'          => 'privacy_page',
552
-                    'name'        => __( 'Privacy Page', 'invoicing' ),
553
-                    'desc'        => __( 'If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing' ),
552
+                    'name'        => __('Privacy Page', 'invoicing'),
553
+                    'desc'        => __('If no privacy policy page set in Settings->Privacy default settings, this page will be used on checkout page.', 'invoicing'),
554 554
                     'type'        => 'select',
555
-                    'options'     => wpinv_get_pages( true, __( 'Select a page', 'invoicing' ) ),
555
+                    'options'     => wpinv_get_pages(true, __('Select a page', 'invoicing')),
556 556
                     'class'       => 'wpi_select2',
557
-                    'placeholder' => __( 'Select a page', 'invoicing' ),
557
+                    'placeholder' => __('Select a page', 'invoicing'),
558 558
                 ),
559 559
             ),
560 560
         )
@@ -566,19 +566,19 @@  discard block
 block discarded – undo
566 566
             'main'       => array(
567 567
                 'invoice_number_format_settings' => array(
568 568
                     'id'   => 'invoice_number_format_settings',
569
-                    'name' => '<h3>' . __( 'Invoice Number', 'invoicing' ) . '</h3>',
569
+                    'name' => '<h3>' . __('Invoice Number', 'invoicing') . '</h3>',
570 570
                     'type' => 'header',
571 571
                 ),
572 572
                 'sequential_invoice_number'      => array(
573 573
                     'id'   => 'sequential_invoice_number',
574
-                    'name' => __( 'Sequential Invoice Numbers', 'invoicing' ),
575
-                    'desc' => __( 'Check this box to enable sequential invoice numbers.', 'invoicing' ) . $reset_number,
574
+                    'name' => __('Sequential Invoice Numbers', 'invoicing'),
575
+                    'desc' => __('Check this box to enable sequential invoice numbers.', 'invoicing') . $reset_number,
576 576
                     'type' => 'checkbox',
577 577
                 ),
578 578
                 'invoice_sequence_start'         => array(
579 579
                     'id'    => 'invoice_sequence_start',
580
-                    'name'  => __( 'Sequential Starting Number', 'invoicing' ),
581
-                    'desc'  => __( 'The number at which the invoice number sequence should begin.', 'invoicing' ) . $last_number,
580
+                    'name'  => __('Sequential Starting Number', 'invoicing'),
581
+                    'desc'  => __('The number at which the invoice number sequence should begin.', 'invoicing') . $last_number,
582 582
                     'type'  => 'number',
583 583
                     'size'  => 'small',
584 584
                     'std'   => '1',
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
                 ),
587 587
                 'invoice_number_padd'            => array(
588 588
                     'id'      => 'invoice_number_padd',
589
-                    'name'    => __( 'Minimum Digits', 'invoicing' ),
590
-                    'desc'    => __( 'If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing' ),
589
+                    'name'    => __('Minimum Digits', 'invoicing'),
590
+                    'desc'    => __('If the invoice number has less digits than this number, it is left padded with 0s. Ex: invoice number 108 will padded to 00108 if digits set to 5. The default 0 means no padding.', 'invoicing'),
591 591
                     'type'    => 'select',
592 592
                     'options' => $invoice_number_padd_options,
593 593
                     'std'     => 5,
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
                 ),
596 596
                 'invoice_number_prefix'          => array(
597 597
                     'id'          => 'invoice_number_prefix',
598
-                    'name'        => __( 'Invoice Number Prefix', 'invoicing' ),
599
-                    'desc'        => __( 'Prefix for all invoice numbers. Ex: INV-', 'invoicing' ),
598
+                    'name'        => __('Invoice Number Prefix', 'invoicing'),
599
+                    'desc'        => __('Prefix for all invoice numbers. Ex: INV-', 'invoicing'),
600 600
                     'type'        => 'text',
601 601
                     'size'        => 'regular',
602 602
                     'std'         => 'INV-',
@@ -604,46 +604,46 @@  discard block
 block discarded – undo
604 604
                 ),
605 605
                 'invoice_number_postfix'         => array(
606 606
                     'id'   => 'invoice_number_postfix',
607
-                    'name' => __( 'Invoice Number Postfix', 'invoicing' ),
608
-                    'desc' => __( 'Postfix for all invoice numbers.', 'invoicing' ),
607
+                    'name' => __('Invoice Number Postfix', 'invoicing'),
608
+                    'desc' => __('Postfix for all invoice numbers.', 'invoicing'),
609 609
                     'type' => 'text',
610 610
                     'size' => 'regular',
611 611
                     'std'  => '',
612 612
                 ),
613 613
                 'checkout_settings'              => array(
614 614
                     'id'   => 'checkout_settings',
615
-                    'name' => '<h3>' . __( 'Checkout Settings', 'invoicing' ) . '</h3>',
615
+                    'name' => '<h3>' . __('Checkout Settings', 'invoicing') . '</h3>',
616 616
                     'type' => 'header',
617 617
                 ),
618 618
                 'disable_new_user_emails'        => array(
619 619
                     'id'   => 'disable_new_user_emails',
620
-                    'name' => __( 'Disable new user emails', 'invoicing' ),
621
-                    'desc' => __( 'Do not send an email to customers when a new user account is created for them.', 'invoicing' ),
620
+                    'name' => __('Disable new user emails', 'invoicing'),
621
+                    'desc' => __('Do not send an email to customers when a new user account is created for them.', 'invoicing'),
622 622
                     'type' => 'checkbox',
623 623
                 ),
624 624
                 'login_to_checkout'              => array(
625 625
                     'id'   => 'login_to_checkout',
626
-                    'name' => __( 'Require Login To Checkout', 'invoicing' ),
627
-                    'desc' => __( 'If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing' ),
626
+                    'name' => __('Require Login To Checkout', 'invoicing'),
627
+                    'desc' => __('If ticked then user needs to be logged in to view or pay invoice, can only view or pay their own invoice. If unticked then anyone can view or pay the invoice.', 'invoicing'),
628 628
                     'type' => 'checkbox',
629 629
                 ),
630 630
                 'maxmind_license_key'            => array(
631 631
                     'id'   => 'maxmind_license_key',
632
-                    'name' => __( 'MaxMind License Key', 'invoicing' ),
632
+                    'name' => __('MaxMind License Key', 'invoicing'),
633 633
                     'type' => 'text',
634 634
                     'size' => 'regular',
635
-                    'desc' => __( "Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing' ) . ' <a href="https://support.maxmind.com/hc/en-us/articles/4407111582235-Generate-a-License-Key">' . __( 'How to generate a free license key.', 'invoicing' ) . '</a>',
635
+                    'desc' => __("Enter you license key if you would like to use MaxMind to automatically detect a customer's country.", 'invoicing') . ' <a href="https://support.maxmind.com/hc/en-us/articles/4407111582235-Generate-a-License-Key">' . __('How to generate a free license key.', 'invoicing') . '</a>',
636 636
                 ),
637 637
 
638 638
                 'uninstall_settings'             => array(
639 639
                     'id'   => 'uninstall_settings',
640
-                    'name' => '<h3>' . __( 'Uninstall Settings', 'invoicing' ) . '</h3>',
640
+                    'name' => '<h3>' . __('Uninstall Settings', 'invoicing') . '</h3>',
641 641
                     'type' => 'header',
642 642
                 ),
643 643
                 'remove_data_on_unistall'        => array(
644 644
                     'id'   => 'remove_data_on_unistall',
645
-                    'name' => __( 'Remove Data on Uninstall?', 'invoicing' ),
646
-                    'desc' => __( 'Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing' ),
645
+                    'name' => __('Remove Data on Uninstall?', 'invoicing'),
646
+                    'desc' => __('Check this box if you would like Invoicing plugin to completely remove all of its data when the plugin is deleted/uninstalled.', 'invoicing'),
647 647
                     'type' => 'checkbox',
648 648
                     'std'  => '',
649 649
                 ),
@@ -652,13 +652,13 @@  discard block
 block discarded – undo
652 652
             'custom-css' => array(
653 653
                 'css_settings'        => array(
654 654
                     'id'   => 'css_settings',
655
-                    'name' => '<h3>' . __( 'Custom CSS', 'invoicing' ) . '</h3>',
655
+                    'name' => '<h3>' . __('Custom CSS', 'invoicing') . '</h3>',
656 656
                     'type' => 'header',
657 657
                 ),
658 658
                 'template_custom_css' => array(
659 659
                     'id'    => 'template_custom_css',
660
-                    'name'  => __( 'Invoice Template CSS', 'invoicing' ),
661
-                    'desc'  => __( 'Add CSS to modify appearance of the print invoice page.', 'invoicing' ),
660
+                    'name'  => __('Invoice Template CSS', 'invoicing'),
661
+                    'desc'  => __('Add CSS to modify appearance of the print invoice page.', 'invoicing'),
662 662
                     'type'  => 'textarea',
663 663
                     'class' => 'regular-text',
664 664
                     'rows'  => 10,
@@ -673,8 +673,8 @@  discard block
 block discarded – undo
673 673
             'main' => array(
674 674
                 'tool_settings' => array(
675 675
                     'id'   => 'tool_settings',
676
-                    'name' => '<h3>' . __( 'Diagnostic Tools', 'invoicing' ) . '</h3>',
677
-                    'desc' => __( 'Invoicing diagnostic tools', 'invoicing' ),
676
+                    'name' => '<h3>' . __('Diagnostic Tools', 'invoicing') . '</h3>',
677
+                    'desc' => __('Invoicing diagnostic tools', 'invoicing'),
678 678
                     'type' => 'tools',
679 679
                 ),
680 680
             ),
Please login to merge, or discard this patch.
includes/admin/views/wizard-gateways.php 1 patch
Spacing   +18 added lines, -18 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
 
@@ -12,24 +12,24 @@  discard block
 block discarded – undo
12 12
 
13 13
     <form method="post" class="text-center card-body">
14 14
         <div class="gp-wizard-payments">
15
-            <h2 class="gd-settings-title h3 "><?php esc_html_e( 'Gateway Setup', 'invoicing' ); ?></h2>
16
-            <p><?php esc_html_e( 'Below are a few gateways that can be setup in a few seconds.', 'invoicing' ); ?>
15
+            <h2 class="gd-settings-title h3 "><?php esc_html_e('Gateway Setup', 'invoicing'); ?></h2>
16
+            <p><?php esc_html_e('Below are a few gateways that can be setup in a few seconds.', 'invoicing'); ?>
17 17
                 <br>
18
-                <?php esc_html_e( 'We have 20+ Gateways that can be setup later.', 'invoicing' ); ?>
18
+                <?php esc_html_e('We have 20+ Gateways that can be setup later.', 'invoicing'); ?>
19 19
             </p>
20 20
 
21 21
             <ul class="list-group">
22 22
 
23 23
 				<li class="list-group-item d-flex justify-content-between align-items-center">
24
-				    <span class="mr-auto"><img src="<?php echo esc_url( WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg' ); ?>" class="ml-n2" alt="Stripe"></span>
25
-				    <?php if ( false === wpinv_get_option( 'stripe_live_connect_account_id' ) ) : ?>
24
+				    <span class="mr-auto"><img src="<?php echo esc_url(WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg'); ?>" class="ml-n2" alt="Stripe"></span>
25
+				    <?php if (false === wpinv_get_option('stripe_live_connect_account_id')) : ?>
26 26
                         <a href="<?php
27
-                        echo esc_url( wp_nonce_url(
27
+                        echo esc_url(wp_nonce_url(
28 28
                             add_query_arg(
29 29
                                 array(
30 30
                                     'getpaid-admin-action' => 'connect_gateway',
31 31
                                     'plugin'               => 'stripe',
32
-                                    'redirect'             => urlencode( add_query_arg( 'step', 'payments' ) ),
32
+                                    'redirect'             => urlencode(add_query_arg('step', 'payments')),
33 33
                                 ),
34 34
                                 admin_url()
35 35
                             ),
@@ -37,31 +37,31 @@  discard block
 block discarded – undo
37 37
                             'getpaid-nonce'
38 38
                         ));
39 39
                         ?>"
40
-                        class="btn btn-sm btn-outline-primary"><?php esc_html_e( 'Connect', 'invoicing' ); ?></a>
40
+                        class="btn btn-sm btn-outline-primary"><?php esc_html_e('Connect', 'invoicing'); ?></a>
41 41
                     <?php else : ?>
42
-                        <span class="btn btn-sm btn-success"><?php esc_html_e( 'Connected', 'invoicing' ); ?></span>
42
+                        <span class="btn btn-sm btn-success"><?php esc_html_e('Connected', 'invoicing'); ?></span>
43 43
                     <?php endif; ?>
44 44
 				</li>
45 45
 
46 46
 				<li class="list-group-item">
47 47
                     <div class="d-flex justify-content-between align-items-center">
48 48
                         <span class="mr-auto">
49
-                            <img src="<?php echo esc_url( WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp' ); ?>" class="" alt="PayPal" height="25">
49
+                            <img src="<?php echo esc_url(WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp'); ?>" class="" alt="PayPal" height="25">
50 50
                         </span>
51 51
                         <a
52 52
                             href="#"
53 53
                             onclick="jQuery('.getpaid-setup-paypal-input').toggleClass('d-none'); return false;"
54
-                            class="getpaid-setup-paypal btn btn-sm btn-outline-primary"><?php esc_html_e( 'Set-up', 'invoicing' ); ?></a>
54
+                            class="getpaid-setup-paypal btn btn-sm btn-outline-primary"><?php esc_html_e('Set-up', 'invoicing'); ?></a>
55 55
                     </div>
56 56
                     <div class="mt-4 getpaid-setup-paypal-input d-none">
57
-                        <input type="text" placeholder="<?php esc_attr_e( 'PayPal Email', 'invoicing' ); ?>" name="paypal-email" class="form-control" value="<?php echo esc_attr( wpinv_get_option( 'paypal_email' ) ); ?>">
57
+                        <input type="text" placeholder="<?php esc_attr_e('PayPal Email', 'invoicing'); ?>" name="paypal-email" class="form-control" value="<?php echo esc_attr(wpinv_get_option('paypal_email')); ?>">
58 58
                     </div>
59 59
                 </li>
60 60
 
61 61
 				<li class="list-group-item d-flex justify-content-between align-items-center">
62
-				    <span class="mr-auto"><?php esc_html_e( 'Test Gateway', 'invoicing' ); ?></span>
62
+				    <span class="mr-auto"><?php esc_html_e('Test Gateway', 'invoicing'); ?></span>
63 63
 					<div class="custom-control custom-switch">
64
-						<input type="checkbox" name="enable-manual-gateway" class="custom-control-input" id="enable-manual-gateway" <?php checked( wpinv_is_gateway_active( 'manual' ) ); ?>>
64
+						<input type="checkbox" name="enable-manual-gateway" class="custom-control-input" id="enable-manual-gateway" <?php checked(wpinv_is_gateway_active('manual')); ?>>
65 65
 						<label class="custom-control-label" for="enable-manual-gateway"></label>
66 66
 					</div>
67 67
 				</li>
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
         </div>
71 71
 
72 72
         <p class="gp-setup-actions step text-center mt-4">
73
-			<input type="submit" class="btn btn-primary" value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" />
73
+			<input type="submit" class="btn btn-primary" value="<?php esc_attr_e('Continue', 'invoicing'); ?>" />
74 74
 		</p>
75 75
         
76
-        <?php getpaid_hidden_field( 'save_step', 1 ); ?>
77
-        <?php wp_nonce_field( 'getpaid-setup-wizard', 'getpaid-setup-wizard' ); ?>
76
+        <?php getpaid_hidden_field('save_step', 1); ?>
77
+        <?php wp_nonce_field('getpaid-setup-wizard', 'getpaid-setup-wizard'); ?>
78 78
     </form>
79 79
 </div>
Please login to merge, or discard this patch.