Passed
Pull Request — master (#861)
by Kiran
06:26 queued 01:06
created
vendor/ayecode/wp-ayecode-ui/includes/inc/bs5-js.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     function aui_init_flatpickr(){
261 261
         if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) {
262 262
             $aui_doing_init_flatpickr = true;
263
-			<?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);}catch(err){console.log(err.message);}<?php } ?>
263
+			<?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);}catch(err){console.log(err.message);}<?php } ?>
264 264
             jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr();
265 265
         }
266 266
         $aui_doing_init_flatpickr = false;
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 
1077 1077
 	<?php
1078 1078
 	// FSE tweaks.
1079
-	if(!empty($_REQUEST['postType']) || !empty($_REQUEST['canvas']) ){ ?>
1079
+	if (!empty($_REQUEST['postType']) || !empty($_REQUEST['canvas'])) { ?>
1080 1080
     function aui_fse_set_data_scroll() {
1081 1081
         console.log('init scroll');
1082 1082
         let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas");
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/inc/bs4-js.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     function aui_init_flatpickr(){
243 243
         if ( typeof jQuery.fn.flatpickr === "function" && !$aui_doing_init_flatpickr) {
244 244
             $aui_doing_init_flatpickr = true;
245
-			<?php if ( ! empty( $flatpickr_locale ) ) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);}catch(err){console.log(err.message);}<?php } ?>
245
+			<?php if (!empty($flatpickr_locale)) { ?>try{flatpickr.localize(<?php echo $flatpickr_locale; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>);}catch(err){console.log(err.message);}<?php } ?>
246 246
             jQuery('input[data-aui-init="flatpickr"]:not(.flatpickr-input)').flatpickr();
247 247
         }
248 248
         $aui_doing_init_flatpickr = false;
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 
964 964
 	<?php
965 965
 	// FSE tweaks.
966
-	if(!empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template' || !empty($_REQUEST['canvas']) ){ ?>
966
+	if (!empty($_REQUEST['postType']) && $_REQUEST['postType'] == 'wp_template' || !empty($_REQUEST['canvas'])) { ?>
967 967
     function aui_fse_set_data_scroll() {
968 968
         console.log('init scroll');
969 969
         let Iframe = document.getElementsByClassName("edit-site-visual-editor__editor-canvas");
Please login to merge, or discard this patch.
templates/subscriptions/subscriptions-table-row.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,50 +9,50 @@
 block discarded – undo
9 9
  * @var WPInv_Subscriptions_Widget $widget
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14
-foreach ( array_keys( $widget->get_subscriptions_table_columns() ) as $column ) :
14
+foreach (array_keys($widget->get_subscriptions_table_columns()) as $column) :
15 15
 
16
-	$class = sanitize_html_class( $column );
17
-	echo "<td class='getpaid-subscriptions-table-column-" . esc_attr( $class ) . "'>";
16
+	$class = sanitize_html_class($column);
17
+	echo "<td class='getpaid-subscriptions-table-column-" . esc_attr($class) . "'>";
18 18
 
19
-		do_action( "getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription );
19
+		do_action("getpaid_subscriptions_before_frontend_subscription_table_$column", $subscription);
20 20
 
21
-		switch ( $column ) :
21
+		switch ($column) :
22 22
 
23 23
 		case 'subscription':
24 24
 			$subscription_id = (int) $subscription->get_id();
25
-			$url             = esc_url( $subscription->get_view_url() );
25
+			$url             = esc_url($subscription->get_view_url());
26 26
 			$id_label        = sprintf(
27
-				esc_attr_x( '#%s', 'subscription id', 'invoicing' ),
27
+				esc_attr_x('#%s', 'subscription id', 'invoicing'),
28 28
 				(int) $subscription->get_id()
29 29
 			);
30 30
 
31
-			echo wp_kses_post( "<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>" );
31
+			echo wp_kses_post("<a href='$url' class='font-weight-bold text-decoration-none'>$id_label</a>");
32 32
 			break;
33 33
 
34 34
 		case 'status':
35
-			echo wp_kses_post( $subscription->get_status_label_html() );
35
+			echo wp_kses_post($subscription->get_status_label_html());
36 36
 			break;
37 37
 
38 38
 		case 'renewal-date':
39
-			$renewal = getpaid_format_date_value( $subscription->get_next_renewal_date() );
40
-			echo $subscription->is_active() ? esc_html( $renewal ) : '&mdash;';
39
+			$renewal = getpaid_format_date_value($subscription->get_next_renewal_date());
40
+			echo $subscription->is_active() ? esc_html($renewal) : '&mdash;';
41 41
 			break;
42 42
 
43 43
 		case 'amount':
44
-			$frequency = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency(), '' );
45
-			$amount    = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() );
46
-			echo wp_kses_post( "<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>" );
44
+			$frequency = getpaid_get_subscription_period_label($subscription->get_period(), $subscription->get_frequency(), '');
45
+			$amount    = wpinv_price($subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency());
46
+			echo wp_kses_post("<span>$amount</span> / <span class='getpaid-item-recurring-period'>$frequency</span>");
47 47
 			break;
48 48
 
49 49
 		case 'actions':
50
-			echo wp_kses_post( $widget->add_row_actions( '', $subscription ) );
50
+			echo wp_kses_post($widget->add_row_actions('', $subscription));
51 51
 			break;
52 52
 
53 53
 		endswitch;
54 54
 
55
-		do_action( "getpaid_subscriptions_frontend_subscription_table_$column", $subscription );
55
+		do_action("getpaid_subscriptions_frontend_subscription_table_$column", $subscription);
56 56
 
57 57
 	echo '</td>';
58 58
 
Please login to merge, or discard this patch.
includes/wpinv-subscription.php 1 patch
Spacing   +239 added lines, -239 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
  * The Subscription Class
@@ -68,27 +68,27 @@  discard block
 block discarded – undo
68 68
 	 * @param  int|string|object|WPInv_Subscription $subscription Subscription id, profile_id, or object to read.
69 69
 	 * @param  bool $deprecated
70 70
 	 */
71
-	function __construct( $subscription = 0, $deprecated = false ) {
71
+	function __construct($subscription = 0, $deprecated = false) {
72 72
 
73
-		parent::__construct( $subscription );
73
+		parent::__construct($subscription);
74 74
 
75
-		if ( ! $deprecated && ! empty( $subscription ) && is_numeric( $subscription ) ) {
76
-			$this->set_id( $subscription );
77
-		} elseif ( $subscription instanceof self ) {
78
-			$this->set_id( $subscription->get_id() );
79
-		} elseif ( $deprecated && $subscription_id = self::get_subscription_id_by_field( $subscription, 'profile_id' ) ) {
80
-			$this->set_id( $subscription_id );
81
-		} elseif ( ! empty( $subscription->id ) ) {
82
-			$this->set_id( $subscription->id );
75
+		if (!$deprecated && !empty($subscription) && is_numeric($subscription)) {
76
+			$this->set_id($subscription);
77
+		} elseif ($subscription instanceof self) {
78
+			$this->set_id($subscription->get_id());
79
+		} elseif ($deprecated && $subscription_id = self::get_subscription_id_by_field($subscription, 'profile_id')) {
80
+			$this->set_id($subscription_id);
81
+		} elseif (!empty($subscription->id)) {
82
+			$this->set_id($subscription->id);
83 83
 		} else {
84
-			$this->set_object_read( true );
84
+			$this->set_object_read(true);
85 85
 		}
86 86
 
87 87
 		// Load the datastore.
88
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
88
+		$this->data_store = GetPaid_Data_Store::load($this->data_store_name);
89 89
 
90
-		if ( $this->get_id() > 0 ) {
91
-			$this->data_store->read( $this );
90
+		if ($this->get_id() > 0) {
91
+			$this->data_store->read($this);
92 92
 		}
93 93
 
94 94
 	}
@@ -103,17 +103,17 @@  discard block
 block discarded – undo
103 103
 	 * @since 1.0.19
104 104
 	 * @return int
105 105
 	 */
106
-	public static function get_subscription_id_by_field( $value, $field = 'profile_id' ) {
106
+	public static function get_subscription_id_by_field($value, $field = 'profile_id') {
107 107
         global $wpdb;
108 108
 
109 109
 		// Trim the value.
110
-		$value = trim( $value );
110
+		$value = trim($value);
111 111
 
112
-		if ( empty( $value ) ) {
112
+		if (empty($value)) {
113 113
 			return 0;
114 114
 		}
115 115
 
116
-		if ( 'invoice_id' == $field ) {
116
+		if ('invoice_id' == $field) {
117 117
 			$field = 'parent_payment_id';
118 118
 		}
119 119
 
@@ -125,28 +125,28 @@  discard block
 block discarded – undo
125 125
 		);
126 126
 
127 127
 		// Ensure a field has been passed.
128
-		if ( empty( $field ) || ! in_array( $field, $fields ) ) {
128
+		if (empty($field) || !in_array($field, $fields)) {
129 129
 			return 0;
130 130
 		}
131 131
 
132 132
 		// Maybe retrieve from the cache.
133
-		$subscription_id   = wp_cache_get( $value, "getpaid_subscription_{$field}s_to_subscription_ids" );
134
-		if ( ! empty( $subscription_id ) ) {
133
+		$subscription_id = wp_cache_get($value, "getpaid_subscription_{$field}s_to_subscription_ids");
134
+		if (!empty($subscription_id)) {
135 135
 			return $subscription_id;
136 136
 		}
137 137
 
138 138
         // Fetch from the db.
139 139
         $table            = $wpdb->prefix . 'wpinv_subscriptions';
140 140
         $subscription_id  = (int) $wpdb->get_var(
141
-            $wpdb->prepare( "SELECT `id` FROM $table WHERE `$field`=%s LIMIT 1", $value )
141
+            $wpdb->prepare("SELECT `id` FROM $table WHERE `$field`=%s LIMIT 1", $value)
142 142
         );
143 143
 
144
-		if ( empty( $subscription_id ) ) {
144
+		if (empty($subscription_id)) {
145 145
 			return 0;
146 146
 		}
147 147
 
148 148
 		// Update the cache with our data.
149
-		wp_cache_set( $value, $subscription_id, "getpaid_subscription_{$field}s_to_subscription_ids" );
149
+		wp_cache_set($value, $subscription_id, "getpaid_subscription_{$field}s_to_subscription_ids");
150 150
 
151 151
 		return $subscription_id;
152 152
 	}
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 			'getpaid_subscriptions'                                       => $this->get_id(),
163 163
 		);
164 164
 
165
-		foreach ( $caches as $cache => $value ) {
166
-			if ( '' !== $value && false !== $value ) {
167
-				wp_cache_delete( $value, $cache );
165
+		foreach ($caches as $cache => $value) {
166
+			if ('' !== $value && false !== $value) {
167
+				wp_cache_delete($value, $cache);
168 168
 			}
169 169
 		}
170 170
 	}
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	/**
173 173
      * Checks if a subscription key is set.
174 174
      */
175
-    public function _isset( $key ) {
176
-        return isset( $this->data[ $key ] ) || method_exists( $this, "get_$key" );
175
+    public function _isset($key) {
176
+        return isset($this->data[$key]) || method_exists($this, "get_$key");
177 177
 	}
178 178
 
179 179
 	/*
@@ -198,8 +198,8 @@  discard block
 block discarded – undo
198 198
 	 * @param  string $context View or edit context.
199 199
 	 * @return int
200 200
 	 */
201
-	public function get_customer_id( $context = 'view' ) {
202
-		return (int) $this->get_prop( 'customer_id', $context );
201
+	public function get_customer_id($context = 'view') {
202
+		return (int) $this->get_prop('customer_id', $context);
203 203
 	}
204 204
 
205 205
 	/**
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 	 * @param  string $context View or edit context.
210 210
 	 * @return WP_User|false WP_User object on success, false on failure.
211 211
 	 */
212
-	public function get_customer( $context = 'view' ) {
213
-		return get_userdata( $this->get_customer_id( $context ) );
212
+	public function get_customer($context = 'view') {
213
+		return get_userdata($this->get_customer_id($context));
214 214
 	}
215 215
 
216 216
 	/**
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 	 * @param  string $context View or edit context.
221 221
 	 * @return int
222 222
 	 */
223
-	public function get_parent_invoice_id( $context = 'view' ) {
224
-		return (int) $this->get_prop( 'parent_payment_id', $context );
223
+	public function get_parent_invoice_id($context = 'view') {
224
+		return (int) $this->get_prop('parent_payment_id', $context);
225 225
 	}
226 226
 
227 227
 	/**
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
 	 * @param  string $context View or edit context.
232 232
 	 * @return int
233 233
 	 */
234
-    public function get_parent_payment_id( $context = 'view' ) {
235
-        return $this->get_parent_invoice_id( $context );
234
+    public function get_parent_payment_id($context = 'view') {
235
+        return $this->get_parent_invoice_id($context);
236 236
 	}
237 237
 
238 238
 	/**
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
      * @since  1.0.0
242 242
      * @return int
243 243
      */
244
-    public function get_original_payment_id( $context = 'view' ) {
245
-        return $this->get_parent_invoice_id( $context );
244
+    public function get_original_payment_id($context = 'view') {
245
+        return $this->get_parent_invoice_id($context);
246 246
     }
247 247
 
248 248
 	/**
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
 	 * @param  string $context View or edit context.
253 253
 	 * @return WPInv_Invoice
254 254
 	 */
255
-	public function get_parent_invoice( $context = 'view' ) {
256
-		return new WPInv_Invoice( $this->get_parent_invoice_id( $context ) );
255
+	public function get_parent_invoice($context = 'view') {
256
+		return new WPInv_Invoice($this->get_parent_invoice_id($context));
257 257
 	}
258 258
 
259 259
 	/**
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
 	 * @param  string $context View or edit context.
264 264
 	 * @return WPInv_Invoice
265 265
 	 */
266
-    public function get_parent_payment( $context = 'view' ) {
267
-        return $this->get_parent_invoice( $context );
266
+    public function get_parent_payment($context = 'view') {
267
+        return $this->get_parent_invoice($context);
268 268
 	}
269 269
 
270 270
 	/**
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 	 * @param  string $context View or edit context.
275 275
 	 * @return int
276 276
 	 */
277
-	public function get_product_id( $context = 'view' ) {
278
-		return (int) $this->get_prop( 'product_id', $context );
277
+	public function get_product_id($context = 'view') {
278
+		return (int) $this->get_prop('product_id', $context);
279 279
 	}
280 280
 
281 281
 	/**
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 	 * @param  string $context View or edit context.
286 286
 	 * @return WPInv_Item
287 287
 	 */
288
-	public function get_product( $context = 'view' ) {
289
-		return new WPInv_Item( $this->get_product_id( $context ) );
288
+	public function get_product($context = 'view') {
289
+		return new WPInv_Item($this->get_product_id($context));
290 290
 	}
291 291
 
292 292
 	/**
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
 	 * @param  string $context View or edit context.
299 299
 	 * @return string
300 300
 	 */
301
-	public function get_gateway( $context = 'view' ) {
302
-		return $this->get_parent_invoice( $context )->get_gateway();
301
+	public function get_gateway($context = 'view') {
302
+		return $this->get_parent_invoice($context)->get_gateway();
303 303
 	}
304 304
 
305 305
 	/**
@@ -309,8 +309,8 @@  discard block
 block discarded – undo
309 309
 	 * @param  string $context View or edit context.
310 310
 	 * @return string
311 311
 	 */
312
-	public function get_period( $context = 'view' ) {
313
-		return $this->get_prop( 'period', $context );
312
+	public function get_period($context = 'view') {
313
+		return $this->get_prop('period', $context);
314 314
 	}
315 315
 
316 316
 	/**
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 	 * @param  string $context View or edit context.
321 321
 	 * @return int
322 322
 	 */
323
-	public function get_frequency( $context = 'view' ) {
324
-		return (int) $this->get_prop( 'frequency', $context );
323
+	public function get_frequency($context = 'view') {
324
+		return (int) $this->get_prop('frequency', $context);
325 325
 	}
326 326
 
327 327
 	/**
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 	 * @param  string $context View or edit context.
332 332
 	 * @return float
333 333
 	 */
334
-	public function get_initial_amount( $context = 'view' ) {
335
-		return (float) wpinv_sanitize_amount( $this->get_prop( 'initial_amount', $context ) );
334
+	public function get_initial_amount($context = 'view') {
335
+		return (float) wpinv_sanitize_amount($this->get_prop('initial_amount', $context));
336 336
 	}
337 337
 
338 338
 	/**
@@ -342,8 +342,8 @@  discard block
 block discarded – undo
342 342
 	 * @param  string $context View or edit context.
343 343
 	 * @return float
344 344
 	 */
345
-	public function get_recurring_amount( $context = 'view' ) {
346
-		return (float) wpinv_sanitize_amount( $this->get_prop( 'recurring_amount', $context ) );
345
+	public function get_recurring_amount($context = 'view') {
346
+		return (float) wpinv_sanitize_amount($this->get_prop('recurring_amount', $context));
347 347
 	}
348 348
 
349 349
 	/**
@@ -353,8 +353,8 @@  discard block
 block discarded – undo
353 353
 	 * @param  string $context View or edit context.
354 354
 	 * @return int
355 355
 	 */
356
-	public function get_bill_times( $context = 'view' ) {
357
-		return (int) $this->get_prop( 'bill_times', $context );
356
+	public function get_bill_times($context = 'view') {
357
+		return (int) $this->get_prop('bill_times', $context);
358 358
 	}
359 359
 
360 360
 	/**
@@ -364,8 +364,8 @@  discard block
 block discarded – undo
364 364
 	 * @param  string $context View or edit context.
365 365
 	 * @return string
366 366
 	 */
367
-	public function get_transaction_id( $context = 'view' ) {
368
-		return $this->get_prop( 'transaction_id', $context );
367
+	public function get_transaction_id($context = 'view') {
368
+		return $this->get_prop('transaction_id', $context);
369 369
 	}
370 370
 
371 371
 	/**
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
 	 * @param  string $context View or edit context.
376 376
 	 * @return string
377 377
 	 */
378
-	public function get_created( $context = 'view' ) {
379
-		return $this->get_prop( 'created', $context );
378
+	public function get_created($context = 'view') {
379
+		return $this->get_prop('created', $context);
380 380
 	}
381 381
 
382 382
 	/**
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
 	 * @param  string $context View or edit context.
387 387
 	 * @return string
388 388
 	 */
389
-	public function get_date_created( $context = 'view' ) {
390
-		return $this->get_created( $context );
389
+	public function get_date_created($context = 'view') {
390
+		return $this->get_created($context);
391 391
 	}
392 392
 
393 393
 	/**
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	public function get_time_created() {
400 400
 		$created = $this->get_date_created();
401
-		return empty( $created ) ? current_time( 'timestamp' ) : strtotime( $created, current_time( 'timestamp' ) );
401
+		return empty($created) ? current_time('timestamp') : strtotime($created, current_time('timestamp'));
402 402
 	}
403 403
 
404 404
 	/**
@@ -408,11 +408,11 @@  discard block
 block discarded – undo
408 408
 	 * @param  string $context View or edit context.
409 409
 	 * @return string
410 410
 	 */
411
-	public function get_date_created_gmt( $context = 'view' ) {
412
-        $date = $this->get_date_created( $context );
411
+	public function get_date_created_gmt($context = 'view') {
412
+        $date = $this->get_date_created($context);
413 413
 
414
-        if ( $date ) {
415
-            $date = get_gmt_from_date( $date );
414
+        if ($date) {
415
+            $date = get_gmt_from_date($date);
416 416
         }
417 417
 		return $date;
418 418
 	}
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
 	 * @param  string $context View or edit context.
425 425
 	 * @return string
426 426
 	 */
427
-	public function get_next_renewal_date( $context = 'view' ) {
428
-		return $this->get_prop( 'expiration', $context );
427
+	public function get_next_renewal_date($context = 'view') {
428
+		return $this->get_prop('expiration', $context);
429 429
 	}
430 430
 
431 431
 	/**
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 	 * @param  string $context View or edit context.
436 436
 	 * @return string
437 437
 	 */
438
-	public function get_expiration( $context = 'view' ) {
439
-		return $this->get_next_renewal_date( $context );
438
+	public function get_expiration($context = 'view') {
439
+		return $this->get_next_renewal_date($context);
440 440
 	}
441 441
 
442 442
 	/**
@@ -448,12 +448,12 @@  discard block
 block discarded – undo
448 448
 	public function get_expiration_time() {
449 449
 		$expiration = $this->get_expiration();
450 450
 
451
-		if ( empty( $expiration ) || '0000-00-00 00:00:00' == $expiration ) {
452
-			return current_time( 'timestamp' );
451
+		if (empty($expiration) || '0000-00-00 00:00:00' == $expiration) {
452
+			return current_time('timestamp');
453 453
 		}
454 454
 
455
-		$expiration = strtotime( $expiration, current_time( 'timestamp' ) );
456
-		return $expiration < current_time( 'timestamp' ) ? current_time( 'timestamp' ) : $expiration;
455
+		$expiration = strtotime($expiration, current_time('timestamp'));
456
+		return $expiration < current_time('timestamp') ? current_time('timestamp') : $expiration;
457 457
 	}
458 458
 
459 459
 	/**
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
 	 * @param  string $context View or edit context.
464 464
 	 * @return string
465 465
 	 */
466
-	public function get_next_renewal_date_gmt( $context = 'view' ) {
467
-        $date = $this->get_next_renewal_date( $context );
466
+	public function get_next_renewal_date_gmt($context = 'view') {
467
+        $date = $this->get_next_renewal_date($context);
468 468
 
469
-        if ( $date ) {
470
-            $date = get_gmt_from_date( $date );
469
+        if ($date) {
470
+            $date = get_gmt_from_date($date);
471 471
         }
472 472
 		return $date;
473 473
 	}
@@ -479,8 +479,8 @@  discard block
 block discarded – undo
479 479
 	 * @param  string $context View or edit context.
480 480
 	 * @return string
481 481
 	 */
482
-	public function get_trial_period( $context = 'view' ) {
483
-		return $this->get_prop( 'trial_period', $context );
482
+	public function get_trial_period($context = 'view') {
483
+		return $this->get_prop('trial_period', $context);
484 484
 	}
485 485
 
486 486
 	/**
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
 	 * @param  string $context View or edit context.
491 491
 	 * @return string
492 492
 	 */
493
-	public function get_status( $context = 'view' ) {
494
-		return $this->get_prop( 'status', $context );
493
+	public function get_status($context = 'view') {
494
+		return $this->get_prop('status', $context);
495 495
 	}
496 496
 
497 497
 	/**
@@ -501,8 +501,8 @@  discard block
 block discarded – undo
501 501
 	 * @param  string $context View or edit context.
502 502
 	 * @return string
503 503
 	 */
504
-	public function get_profile_id( $context = 'view' ) {
505
-		return $this->get_prop( 'profile_id', $context );
504
+	public function get_profile_id($context = 'view') {
505
+		return $this->get_prop('profile_id', $context);
506 506
 	}
507 507
 
508 508
 	/*
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 	 * @since 1.0.19
518 518
 	 * @param  int $value The customer's id.
519 519
 	 */
520
-	public function set_customer_id( $value ) {
521
-		$this->set_prop( 'customer_id', (int) $value );
520
+	public function set_customer_id($value) {
521
+		$this->set_prop('customer_id', (int) $value);
522 522
 	}
523 523
 
524 524
 	/**
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 	 * @since 1.0.19
528 528
 	 * @param  int $value The parent invoice id.
529 529
 	 */
530
-	public function set_parent_invoice_id( $value ) {
531
-		$this->set_prop( 'parent_payment_id', (int) $value );
530
+	public function set_parent_invoice_id($value) {
531
+		$this->set_prop('parent_payment_id', (int) $value);
532 532
 	}
533 533
 
534 534
 	/**
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
 	 * @since 1.0.19
538 538
 	 * @param  int $value The parent invoice id.
539 539
 	 */
540
-    public function set_parent_payment_id( $value ) {
541
-        $this->set_parent_invoice_id( $value );
540
+    public function set_parent_payment_id($value) {
541
+        $this->set_parent_invoice_id($value);
542 542
 	}
543 543
 
544 544
 	/**
@@ -547,8 +547,8 @@  discard block
 block discarded – undo
547 547
      * @since 1.0.19
548 548
 	 * @param  int $value The parent invoice id.
549 549
      */
550
-    public function set_original_payment_id( $value ) {
551
-        $this->set_parent_invoice_id( $value );
550
+    public function set_original_payment_id($value) {
551
+        $this->set_parent_invoice_id($value);
552 552
 	}
553 553
 
554 554
 	/**
@@ -557,8 +557,8 @@  discard block
 block discarded – undo
557 557
 	 * @since 1.0.19
558 558
 	 * @param  int $value The subscription product id.
559 559
 	 */
560
-	public function set_product_id( $value ) {
561
-		$this->set_prop( 'product_id', (int) $value );
560
+	public function set_product_id($value) {
561
+		$this->set_prop('product_id', (int) $value);
562 562
 	}
563 563
 
564 564
 	/**
@@ -567,8 +567,8 @@  discard block
 block discarded – undo
567 567
 	 * @since 1.0.19
568 568
 	 * @param  string $value The renewal period.
569 569
 	 */
570
-	public function set_period( $value ) {
571
-		$this->set_prop( 'period', $value );
570
+	public function set_period($value) {
571
+		$this->set_prop('period', $value);
572 572
 	}
573 573
 
574 574
 	/**
@@ -577,9 +577,9 @@  discard block
 block discarded – undo
577 577
 	 * @since 1.0.19
578 578
 	 * @param  int $value The subscription frequency.
579 579
 	 */
580
-	public function set_frequency( $value ) {
581
-		$value = empty( $value ) ? 1 : (int) $value;
582
-		$this->set_prop( 'frequency', absint( $value ) );
580
+	public function set_frequency($value) {
581
+		$value = empty($value) ? 1 : (int) $value;
582
+		$this->set_prop('frequency', absint($value));
583 583
 	}
584 584
 
585 585
 	/**
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
 	 * @since 1.0.19
589 589
 	 * @param  float $value The initial subcription amount.
590 590
 	 */
591
-	public function set_initial_amount( $value ) {
592
-		$this->set_prop( 'initial_amount', wpinv_sanitize_amount( $value ) );
591
+	public function set_initial_amount($value) {
592
+		$this->set_prop('initial_amount', wpinv_sanitize_amount($value));
593 593
 	}
594 594
 
595 595
 	/**
@@ -598,8 +598,8 @@  discard block
 block discarded – undo
598 598
 	 * @since 1.0.19
599 599
 	 * @param  float $value The recurring subcription amount.
600 600
 	 */
601
-	public function set_recurring_amount( $value ) {
602
-		$this->set_prop( 'recurring_amount', wpinv_sanitize_amount( $value ) );
601
+	public function set_recurring_amount($value) {
602
+		$this->set_prop('recurring_amount', wpinv_sanitize_amount($value));
603 603
 	}
604 604
 
605 605
 	/**
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
 	 * @since 1.0.19
609 609
 	 * @param  int $value Bill times.
610 610
 	 */
611
-	public function set_bill_times( $value ) {
612
-		$this->set_prop( 'bill_times', (int) $value );
611
+	public function set_bill_times($value) {
612
+		$this->set_prop('bill_times', (int) $value);
613 613
 	}
614 614
 
615 615
 	/**
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
 	 * @since 1.0.19
619 619
 	 * @param string $value Bill times.
620 620
 	 */
621
-	public function set_transaction_id( $value ) {
622
-		$this->set_prop( 'transaction_id', sanitize_text_field( $value ) );
621
+	public function set_transaction_id($value) {
622
+		$this->set_prop('transaction_id', sanitize_text_field($value));
623 623
 	}
624 624
 
625 625
 	/**
@@ -628,15 +628,15 @@  discard block
 block discarded – undo
628 628
 	 * @since 1.0.19
629 629
 	 * @param string $value strtotime compliant date.
630 630
 	 */
631
-	public function set_created( $value ) {
632
-        $date = strtotime( $value );
631
+	public function set_created($value) {
632
+        $date = strtotime($value);
633 633
 
634
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
635
-            $this->set_prop( 'created', gmdate( 'Y-m-d H:i:s', $date ) );
634
+        if ($date && $value !== '0000-00-00 00:00:00') {
635
+            $this->set_prop('created', gmdate('Y-m-d H:i:s', $date));
636 636
             return;
637 637
         }
638 638
 
639
-		$this->set_prop( 'created', '' );
639
+		$this->set_prop('created', '');
640 640
 
641 641
 	}
642 642
 
@@ -646,8 +646,8 @@  discard block
 block discarded – undo
646 646
 	 * @since 1.0.19
647 647
 	 * @param string $value strtotime compliant date.
648 648
 	 */
649
-	public function set_date_created( $value ) {
650
-		$this->set_created( $value );
649
+	public function set_date_created($value) {
650
+		$this->set_created($value);
651 651
     }
652 652
 
653 653
 	/**
@@ -656,15 +656,15 @@  discard block
 block discarded – undo
656 656
 	 * @since 1.0.19
657 657
 	 * @param string $value strtotime compliant date.
658 658
 	 */
659
-	public function set_next_renewal_date( $value ) {
660
-		$date = strtotime( $value );
659
+	public function set_next_renewal_date($value) {
660
+		$date = strtotime($value);
661 661
 
662
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
663
-            $this->set_prop( 'expiration', gmdate( 'Y-m-d H:i:s', $date ) );
662
+        if ($date && $value !== '0000-00-00 00:00:00') {
663
+            $this->set_prop('expiration', gmdate('Y-m-d H:i:s', $date));
664 664
             return;
665 665
 		}
666 666
 
667
-		$this->set_prop( 'expiration', '' );
667
+		$this->set_prop('expiration', '');
668 668
 
669 669
 	}
670 670
 
@@ -674,8 +674,8 @@  discard block
 block discarded – undo
674 674
 	 * @since 1.0.19
675 675
 	 * @param string $value strtotime compliant date.
676 676
 	 */
677
-	public function set_expiration( $value ) {
678
-		$this->set_next_renewal_date( $value );
677
+	public function set_expiration($value) {
678
+		$this->set_next_renewal_date($value);
679 679
     }
680 680
 
681 681
 	/**
@@ -684,8 +684,8 @@  discard block
 block discarded – undo
684 684
 	 * @since 1.0.19
685 685
 	 * @param string $value trial period e.g 1 year.
686 686
 	 */
687
-	public function set_trial_period( $value ) {
688
-		$this->set_prop( 'trial_period', $value );
687
+	public function set_trial_period($value) {
688
+		$this->set_prop('trial_period', $value);
689 689
 	}
690 690
 
691 691
 	/**
@@ -694,22 +694,22 @@  discard block
 block discarded – undo
694 694
 	 * @since 1.0.19
695 695
 	 * @param string $new_status    New subscription status.
696 696
 	 */
697
-	public function set_status( $new_status ) {
697
+	public function set_status($new_status) {
698 698
 
699 699
 		// Abort if this is not a valid status;
700
-		if ( ! array_key_exists( $new_status, getpaid_get_subscription_statuses() ) ) {
700
+		if (!array_key_exists($new_status, getpaid_get_subscription_statuses())) {
701 701
 			return;
702 702
 		}
703 703
 
704
-		$old_status = ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $this->get_status();
705
-		if ( true === $this->object_read && $old_status !== $new_status ) {
704
+		$old_status = !empty($this->status_transition['from']) ? $this->status_transition['from'] : $this->get_status();
705
+		if (true === $this->object_read && $old_status !== $new_status) {
706 706
 			$this->status_transition = array(
707 707
 				'from' => $old_status,
708 708
 				'to'   => $new_status,
709 709
 			);
710 710
 		}
711 711
 
712
-		$this->set_prop( 'status', $new_status );
712
+		$this->set_prop('status', $new_status);
713 713
 	}
714 714
 
715 715
 	/**
@@ -718,8 +718,8 @@  discard block
 block discarded – undo
718 718
 	 * @since 1.0.19
719 719
 	 * @param  string $value the remote profile id.
720 720
 	 */
721
-	public function set_profile_id( $value ) {
722
-		$this->set_prop( 'profile_id', sanitize_text_field( $value ) );
721
+	public function set_profile_id($value) {
722
+		$this->set_prop('profile_id', sanitize_text_field($value));
723 723
 	}
724 724
 
725 725
 	/*
@@ -737,8 +737,8 @@  discard block
 block discarded – undo
737 737
 	 * @param string|array String or array of strings to check for.
738 738
 	 * @return bool
739 739
      */
740
-    public function has_status( $status ) {
741
-        return in_array( $this->get_status(), wpinv_clean( wpinv_parse_list( $status ) ) );
740
+    public function has_status($status) {
741
+        return in_array($this->get_status(), wpinv_clean(wpinv_parse_list($status)));
742 742
 	}
743 743
 
744 744
 	/**
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
      */
749 749
     public function has_trial_period() {
750 750
 		$period = $this->get_trial_period();
751
-        return ! empty( $period );
751
+        return !empty($period);
752 752
 	}
753 753
 
754 754
 	/**
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 	 * @return bool
758 758
 	 */
759 759
 	public function is_active() {
760
-		return $this->has_status( 'active trialling' ) && ! $this->is_expired();
760
+		return $this->has_status('active trialling') && !$this->is_expired();
761 761
 	}
762 762
 
763 763
 	/**
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 	 * @return bool
767 767
 	 */
768 768
 	public function is_expired() {
769
-		return $this->has_status( 'expired' ) || ( $this->has_status( 'active cancelled trialling' ) && $this->get_expiration_time() < current_time( 'timestamp' ) );
769
+		return $this->has_status('expired') || ($this->has_status('active cancelled trialling') && $this->get_expiration_time() < current_time('timestamp'));
770 770
 	}
771 771
 
772 772
 	/**
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 	 */
777 777
 	public function is_last_renewal() {
778 778
 		$max_bills = $this->get_bill_times();
779
-		return ! empty( $max_bills ) && $max_bills <= $this->get_times_billed();
779
+		return !empty($max_bills) && $max_bills <= $this->get_times_billed();
780 780
 	}
781 781
 
782 782
 	/*
@@ -791,11 +791,11 @@  discard block
 block discarded – undo
791 791
 	/**
792 792
 	 * Backwards compatibilty.
793 793
 	 */
794
-	public function create( $data = array() ) {
794
+	public function create($data = array()) {
795 795
 
796 796
 		// Set the properties.
797
-		if ( is_array( $data ) ) {
798
-			$this->set_props( $data );
797
+		if (is_array($data)) {
798
+			$this->set_props($data);
799 799
 		}
800 800
 
801 801
 		// Save the item.
@@ -806,8 +806,8 @@  discard block
 block discarded – undo
806 806
 	/**
807 807
 	 * Backwards compatibilty.
808 808
 	 */
809
-	public function update( $args = array() ) {
810
-		return $this->create( $args );
809
+	public function update($args = array()) {
810
+		return $this->create($args);
811 811
 	}
812 812
 
813 813
     /**
@@ -816,12 +816,12 @@  discard block
 block discarded – undo
816 816
      * @since  1.0.0
817 817
      * @return WP_Post[]
818 818
      */
819
-    public function get_child_payments( $hide_pending = true ) {
819
+    public function get_child_payments($hide_pending = true) {
820 820
 
821
-		$statuses = array( 'publish', 'wpi-processing', 'wpi-renewal' );
821
+		$statuses = array('publish', 'wpi-processing', 'wpi-renewal');
822 822
 
823
-		if ( ! $hide_pending ) {
824
-			$statuses = array_keys( wpinv_get_invoice_statuses() );
823
+		if (!$hide_pending) {
824
+			$statuses = array_keys(wpinv_get_invoice_statuses());
825 825
 		}
826 826
 
827 827
         return get_posts(
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
      * @return int
844 844
      */
845 845
     public function get_total_payments() {
846
-		return getpaid_count_subscription_invoices( $this->get_parent_invoice_id(), $this->get_id() );
846
+		return getpaid_count_subscription_invoices($this->get_parent_invoice_id(), $this->get_id());
847 847
     }
848 848
 
849 849
     /**
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
     public function get_times_billed() {
856 856
         $times_billed = $this->get_total_payments();
857 857
 
858
-        if ( (float) $this->get_initial_amount() == 0 && $times_billed > 0 ) {
858
+        if ((float) $this->get_initial_amount() == 0 && $times_billed > 0) {
859 859
             $times_billed--;
860 860
         }
861 861
 
@@ -870,52 +870,52 @@  discard block
 block discarded – undo
870 870
 	 * @param  WPInv_Invoice $invoice If adding an existing invoice.
871 871
      * @return bool
872 872
      */
873
-    public function add_payment( $args = array(), $invoice = false ) {
873
+    public function add_payment($args = array(), $invoice = false) {
874 874
 
875 875
 		// Process each payment once.
876
-        if ( ! empty( $args['transaction_id'] ) && $this->payment_exists( $args['transaction_id'] ) ) {
876
+        if (!empty($args['transaction_id']) && $this->payment_exists($args['transaction_id'])) {
877 877
             return false;
878 878
         }
879 879
 
880 880
 		// Are we creating a new invoice?
881
-		if ( empty( $invoice ) ) {
882
-			$invoice = $this->create_payment( false );
881
+		if (empty($invoice)) {
882
+			$invoice = $this->create_payment(false);
883 883
 
884
-			if ( empty( $invoice ) ) {
884
+			if (empty($invoice)) {
885 885
 				return false;
886 886
 			}
887 887
 		}
888 888
 
889 889
 		// Maybe set a transaction id.
890
-		if ( ! empty( $args['transaction_id'] ) ) {
891
-			$invoice->set_transaction_id( $args['transaction_id'] );
890
+		if (!empty($args['transaction_id'])) {
891
+			$invoice->set_transaction_id($args['transaction_id']);
892 892
 		}
893 893
 
894 894
 		// Set the completed date.
895
-		$invoice->set_completed_date( current_time( 'mysql' ) );
895
+		$invoice->set_completed_date(current_time('mysql'));
896 896
 
897 897
 		// And the gateway.
898
-		if ( ! empty( $args['gateway'] ) ) {
899
-			$invoice->set_gateway( $args['gateway'] );
898
+		if (!empty($args['gateway'])) {
899
+			$invoice->set_gateway($args['gateway']);
900 900
 		}
901 901
 
902
-		$invoice->set_status( 'wpi-renewal' );
902
+		$invoice->set_status('wpi-renewal');
903 903
 		$invoice->save();
904 904
 
905
-		if ( ! $invoice->exists() ) {
905
+		if (!$invoice->exists()) {
906 906
 			return false;
907 907
 		}
908 908
 
909
-		return $this->after_add_payment( $invoice );
909
+		return $this->after_add_payment($invoice);
910 910
 	}
911 911
 
912
-    public function after_add_payment( $invoice ) {
912
+    public function after_add_payment($invoice) {
913 913
 
914
-		do_action( 'getpaid_after_create_subscription_renewal_invoice', $invoice, $this );
915
-		do_action( 'wpinv_recurring_add_subscription_payment', $invoice, $this );
916
-        do_action( 'wpinv_recurring_record_payment', $invoice->get_id(), $this->get_parent_invoice_id(), $invoice->get_recurring_total(), $invoice->get_transaction_id() );
914
+		do_action('getpaid_after_create_subscription_renewal_invoice', $invoice, $this);
915
+		do_action('wpinv_recurring_add_subscription_payment', $invoice, $this);
916
+        do_action('wpinv_recurring_record_payment', $invoice->get_id(), $this->get_parent_invoice_id(), $invoice->get_recurring_total(), $invoice->get_transaction_id());
917 917
 
918
-        update_post_meta( $invoice->get_id(), '_wpinv_subscription_id', $this->id );
918
+        update_post_meta($invoice->get_id(), '_wpinv_subscription_id', $this->id);
919 919
 
920 920
         return $invoice->get_id();
921 921
 	}
@@ -927,53 +927,53 @@  discard block
 block discarded – undo
927 927
 	 * @param bool $save Whether we should save the invoice.
928 928
      * @return WPInv_Invoice|bool
929 929
      */
930
-    public function create_payment( $save = true ) {
930
+    public function create_payment($save = true) {
931 931
 
932 932
 		$parent_invoice = $this->get_parent_payment();
933 933
 
934
-		if ( ! $parent_invoice->exists() ) {
934
+		if (!$parent_invoice->exists()) {
935 935
 			return false;
936 936
 		}
937 937
 
938 938
 		// Duplicate the parent invoice.
939
-		$invoice = getpaid_duplicate_invoice( $parent_invoice );
940
-		$invoice->set_parent_id( $parent_invoice->get_id() );
941
-		$invoice->set_subscription_id( $this->get_id() );
942
-		$invoice->set_remote_subscription_id( $this->get_profile_id() );
939
+		$invoice = getpaid_duplicate_invoice($parent_invoice);
940
+		$invoice->set_parent_id($parent_invoice->get_id());
941
+		$invoice->set_subscription_id($this->get_id());
942
+		$invoice->set_remote_subscription_id($this->get_profile_id());
943 943
 
944 944
 		// Set invoice items.
945
-		$subscription_group = getpaid_get_invoice_subscription_group( $parent_invoice->get_id(), $this->get_id() );
946
-		$allowed_items      = empty( $subscription_group ) ? array( $this->get_product_id() ) : array_keys( $subscription_group['items'] );
945
+		$subscription_group = getpaid_get_invoice_subscription_group($parent_invoice->get_id(), $this->get_id());
946
+		$allowed_items      = empty($subscription_group) ? array($this->get_product_id()) : array_keys($subscription_group['items']);
947 947
 		$invoice_items      = array();
948 948
 
949
-		foreach ( $invoice->get_items() as $item ) {
950
-			if ( in_array( $item->get_id(), $allowed_items ) ) {
949
+		foreach ($invoice->get_items() as $item) {
950
+			if (in_array($item->get_id(), $allowed_items)) {
951 951
 				$invoice_items[] = $item;
952 952
 			}
953 953
 		}
954 954
 
955
-		$invoice->set_items( $invoice_items );
955
+		$invoice->set_items($invoice_items);
956 956
 
957
-		if ( ! empty( $subscription_group['fees'] ) ) {
958
-			$invoice->set_fees( $subscription_group['fees'] );
957
+		if (!empty($subscription_group['fees'])) {
958
+			$invoice->set_fees($subscription_group['fees']);
959 959
 		}
960 960
 
961 961
 		// Maybe recalculate discount (Pre-GetPaid Fix).
962
-		$discount = new WPInv_Discount( $invoice->get_discount_code() );
962
+		$discount = new WPInv_Discount($invoice->get_discount_code());
963 963
 
964
-		if ( $discount->exists() && $discount->is_recurring() ) {
965
-			$invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) );
966
-		}  else {
964
+		if ($discount->exists() && $discount->is_recurring()) {
965
+			$invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount));
966
+		} else {
967 967
 			// Unset discount code.
968
-			$invoice->set_discount_code( '' );
968
+			$invoice->set_discount_code('');
969 969
 
970
-			$invoice->remove_discount( 'discount_code' );
970
+			$invoice->remove_discount('discount_code');
971 971
 		}
972 972
 
973 973
 		$invoice->recalculate_total();
974
-		$invoice->set_status( 'wpi-pending' );
974
+		$invoice->set_status('wpi-pending');
975 975
 
976
-		if ( ! $save ) {
976
+		if (!$save) {
977 977
 			return $invoice;
978 978
 		}
979 979
 
@@ -988,28 +988,28 @@  discard block
 block discarded – undo
988 988
 	 * @since  1.0.0
989 989
 	 * @return int The subscription's id
990 990
 	 */
991
-	public function renew( $calculate_from = null, $_new_expiration = null ) {
991
+	public function renew($calculate_from = null, $_new_expiration = null) {
992 992
 		// Complete subscription if applicable
993
-		if ( $this->is_last_renewal() ) {
993
+		if ($this->is_last_renewal()) {
994 994
 			return $this->complete();
995 995
 		}
996 996
 
997
-		if ( ! empty( $_new_expiration ) ) {
997
+		if (!empty($_new_expiration)) {
998 998
 			$new_expiration = $_new_expiration;
999 999
 		} else {
1000 1000
 			// Calculate new expiration
1001 1001
 			$frequency      = $this->get_frequency();
1002 1002
 			$period         = $this->get_period();
1003
-			$calculate_from = empty( $calculate_from ) ? $this->get_expiration_time() : $calculate_from;
1004
-			$new_expiration = strtotime( "+ $frequency $period", $calculate_from );
1005
-			$new_expiration = date( 'Y-m-d H:i:s', $new_expiration );
1003
+			$calculate_from = empty($calculate_from) ? $this->get_expiration_time() : $calculate_from;
1004
+			$new_expiration = strtotime("+ $frequency $period", $calculate_from);
1005
+			$new_expiration = date('Y-m-d H:i:s', $new_expiration);
1006 1006
 		}
1007 1007
 
1008
-		$this->set_expiration( $new_expiration );
1009
-		$this->set_status( 'active' );
1008
+		$this->set_expiration($new_expiration);
1009
+		$this->set_status('active');
1010 1010
 		$this->save();
1011 1011
 
1012
-		do_action( 'getpaid_subscription_renewed', $this );
1012
+		do_action('getpaid_subscription_renewed', $this);
1013 1013
 
1014 1014
 		return $this->get_id();
1015 1015
 	}
@@ -1025,11 +1025,11 @@  discard block
 block discarded – undo
1025 1025
 	public function complete() {
1026 1026
 
1027 1027
 		// Only mark a subscription as complete if it's not already cancelled.
1028
-		if ( $this->has_status( 'cancelled' ) ) {
1028
+		if ($this->has_status('cancelled')) {
1029 1029
 			return false;
1030 1030
 		}
1031 1031
 
1032
-		$this->set_status( 'completed' );
1032
+		$this->set_status('completed');
1033 1033
 		return $this->save();
1034 1034
 
1035 1035
 	}
@@ -1041,14 +1041,14 @@  discard block
 block discarded – undo
1041 1041
 	 * @param  bool $check_expiration
1042 1042
 	 * @return int|bool Subscription id or false if $check_expiration is true and expiration date is in the future.
1043 1043
 	 */
1044
-	public function expire( $check_expiration = false ) {
1044
+	public function expire($check_expiration = false) {
1045 1045
 
1046
-		if ( $check_expiration && $this->get_expiration_time() > current_time( 'timestamp' ) ) {
1046
+		if ($check_expiration && $this->get_expiration_time() > current_time('timestamp')) {
1047 1047
 			// Do not mark as expired since real expiration date is in the future
1048 1048
 			return false;
1049 1049
 		}
1050 1050
 
1051
-		$this->set_status( 'expired' );
1051
+		$this->set_status('expired');
1052 1052
 		return $this->save();
1053 1053
 
1054 1054
 	}
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 	 * @return int Subscription id.
1061 1061
 	 */
1062 1062
 	public function failing() {
1063
-		$this->set_status( 'failing' );
1063
+		$this->set_status('failing');
1064 1064
 		return $this->save();
1065 1065
 	}
1066 1066
 
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
      * @return int Subscription id.
1072 1072
      */
1073 1073
     public function cancel() {
1074
-		$this->set_status( 'cancelled' );
1074
+		$this->set_status('cancelled');
1075 1075
 		return $this->save();
1076 1076
     }
1077 1077
 
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 	 * @return bool
1083 1083
 	 */
1084 1084
 	public function can_cancel() {
1085
-		return apply_filters( 'wpinv_subscription_can_cancel', $this->has_status( $this->get_cancellable_statuses() ), $this );
1085
+		return apply_filters('wpinv_subscription_can_cancel', $this->has_status($this->get_cancellable_statuses()), $this);
1086 1086
 	}
1087 1087
 
1088 1088
     /**
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
      * @return      array
1094 1094
      */
1095 1095
     public function get_cancellable_statuses() {
1096
-        return apply_filters( 'wpinv_recurring_cancellable_statuses', array( 'active', 'trialling', 'failing' ) );
1096
+        return apply_filters('wpinv_recurring_cancellable_statuses', array('active', 'trialling', 'failing'));
1097 1097
     }
1098 1098
 
1099 1099
 	/**
@@ -1103,8 +1103,8 @@  discard block
 block discarded – undo
1103 1103
 	 * @return string
1104 1104
 	 */
1105 1105
 	public function get_cancel_url() {
1106
-		$url = getpaid_get_authenticated_action_url( 'subscription_cancel', $this->get_view_url() );
1107
-		return apply_filters( 'wpinv_subscription_cancel_url', $url, $this );
1106
+		$url = getpaid_get_authenticated_action_url('subscription_cancel', $this->get_view_url());
1107
+		return apply_filters('wpinv_subscription_cancel_url', $url, $this);
1108 1108
 	}
1109 1109
 
1110 1110
 	/**
@@ -1115,10 +1115,10 @@  discard block
 block discarded – undo
1115 1115
 	 */
1116 1116
 	public function get_view_url() {
1117 1117
 
1118
-		$url = getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) );
1119
-		$url = add_query_arg( 'subscription', $this->get_id(), $url );
1118
+		$url = getpaid_get_tab_url('gp-subscriptions', get_permalink((int) wpinv_get_option('invoice_subscription_page')));
1119
+		$url = add_query_arg('subscription', $this->get_id(), $url);
1120 1120
 
1121
-		return apply_filters( 'getpaid_get_subscription_view_url', $url, $this );
1121
+		return apply_filters('getpaid_get_subscription_view_url', $url, $this);
1122 1122
 	}
1123 1123
 
1124 1124
 	/**
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
 	 * @return bool
1132 1132
 	 */
1133 1133
 	public function can_renew() {
1134
-		return apply_filters( 'wpinv_subscription_can_renew', true, $this );
1134
+		return apply_filters('wpinv_subscription_can_renew', true, $this);
1135 1135
 	}
1136 1136
 
1137 1137
 	/**
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
             ),
1151 1151
             'getpaid-nonce'
1152 1152
         );
1153
-		return apply_filters( 'wpinv_subscription_renew_url', $url, $this );
1153
+		return apply_filters('wpinv_subscription_renew_url', $url, $this);
1154 1154
 	}
1155 1155
 
1156 1156
 	/**
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 	 * @return bool
1161 1161
 	 */
1162 1162
 	public function can_update() {
1163
-		return apply_filters( 'wpinv_subscription_can_update', false, $this );
1163
+		return apply_filters('wpinv_subscription_can_update', false, $this);
1164 1164
 	}
1165 1165
 
1166 1166
 	/**
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 				'subscription_id' => $this->get_id(),
1177 1177
             )
1178 1178
         );
1179
-		return apply_filters( 'wpinv_subscription_update_url', $url, $this );
1179
+		return apply_filters('wpinv_subscription_update_url', $url, $this);
1180 1180
 	}
1181 1181
 
1182 1182
 	/**
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 	 * @return string
1187 1187
 	 */
1188 1188
 	public function get_status_label() {
1189
-		return getpaid_get_subscription_status_label( $this->get_status() );
1189
+		return getpaid_get_subscription_status_label($this->get_status());
1190 1190
 	}
1191 1191
 
1192 1192
 	/**
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 	 */
1198 1198
 	public function get_status_class() {
1199 1199
 		$statuses = getpaid_get_subscription_status_classes();
1200
-		return isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : 'bg-dark';
1200
+		return isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : 'bg-dark';
1201 1201
 	}
1202 1202
 
1203 1203
     /**
@@ -1208,9 +1208,9 @@  discard block
 block discarded – undo
1208 1208
      */
1209 1209
     public function get_status_label_html() {
1210 1210
 
1211
-		$status_label = sanitize_text_field( $this->get_status_label() );
1212
-		$class        = esc_attr( $this->get_status_class() );
1213
-		$status       = sanitize_html_class( $this->get_status() );
1211
+		$status_label = sanitize_text_field($this->get_status_label());
1212
+		$class        = esc_attr($this->get_status_class());
1213
+		$status       = sanitize_html_class($this->get_status());
1214 1214
 
1215 1215
 		return "<span class='bsui'><span class='badge $class $status text-white'>$status_label</span></span>";
1216 1216
     }
@@ -1222,9 +1222,9 @@  discard block
 block discarded – undo
1222 1222
      * @param  string $txn_id The transaction ID from the merchant processor
1223 1223
      * @return bool
1224 1224
      */
1225
-    public function payment_exists( $txn_id = '' ) {
1226
-		$invoice_id = WPInv_Invoice::get_invoice_id_by_field( $txn_id, 'transaction_id' );
1227
-        return ! empty( $invoice_id );
1225
+    public function payment_exists($txn_id = '') {
1226
+		$invoice_id = WPInv_Invoice::get_invoice_id_by_field($txn_id, 'transaction_id');
1227
+        return !empty($invoice_id);
1228 1228
 	}
1229 1229
 
1230 1230
 	/**
@@ -1236,35 +1236,35 @@  discard block
 block discarded – undo
1236 1236
 		// Reset status transition variable.
1237 1237
 		$this->status_transition = false;
1238 1238
 
1239
-		if ( $status_transition ) {
1239
+		if ($status_transition) {
1240 1240
 			try {
1241 1241
 
1242 1242
 				// Fire a hook for the status change.
1243
-				do_action( 'wpinv_subscription_' . $status_transition['to'], $this->get_id(), $this, $status_transition );
1244
-				do_action( 'getpaid_subscription_' . $status_transition['to'], $this, $status_transition );
1243
+				do_action('wpinv_subscription_' . $status_transition['to'], $this->get_id(), $this, $status_transition);
1244
+				do_action('getpaid_subscription_' . $status_transition['to'], $this, $status_transition);
1245 1245
 
1246
-				if ( ! empty( $status_transition['from'] ) ) {
1246
+				if (!empty($status_transition['from'])) {
1247 1247
 
1248 1248
 					/* translators: 1: old subscription status 2: new subscription status */
1249
-					$transition_note = sprintf( __( 'Subscription status changed from %1$s to %2$s.', 'invoicing' ), getpaid_get_subscription_status_label( $status_transition['from'] ), getpaid_get_subscription_status_label( $status_transition['to'] ) );
1249
+					$transition_note = sprintf(__('Subscription status changed from %1$s to %2$s.', 'invoicing'), getpaid_get_subscription_status_label($status_transition['from']), getpaid_get_subscription_status_label($status_transition['to']));
1250 1250
 
1251 1251
 					// Note the transition occurred.
1252
-					$this->get_parent_payment()->add_note( $transition_note, false, false, true );
1252
+					$this->get_parent_payment()->add_note($transition_note, false, false, true);
1253 1253
 
1254 1254
 					// Fire another hook.
1255
-					do_action( 'getpaid_subscription_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $this );
1256
-					do_action( 'getpaid_subscription_status_changed', $this, $status_transition['from'], $status_transition['to'] );
1255
+					do_action('getpaid_subscription_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $this);
1256
+					do_action('getpaid_subscription_status_changed', $this, $status_transition['from'], $status_transition['to']);
1257 1257
 
1258 1258
 				} else {
1259 1259
 					/* translators: %s: new invoice status */
1260
-					$transition_note = sprintf( __( 'Subscription status set to %s.', 'invoicing' ), getpaid_get_subscription_status_label( $status_transition['to'] ) );
1260
+					$transition_note = sprintf(__('Subscription status set to %s.', 'invoicing'), getpaid_get_subscription_status_label($status_transition['to']));
1261 1261
 
1262 1262
 					// Note the transition occurred.
1263
-					$this->get_parent_payment()->add_note( $transition_note, false, false, true );
1263
+					$this->get_parent_payment()->add_note($transition_note, false, false, true);
1264 1264
 
1265 1265
 				}
1266
-			} catch ( Exception $e ) {
1267
-				$this->get_parent_payment()->add_note( __( 'Error during subscription status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
1266
+			} catch (Exception $e) {
1267
+				$this->get_parent_payment()->add_note(__('Error during subscription status transition.', 'invoicing') . ' ' . $e->getMessage());
1268 1268
 			}
1269 1269
 		}
1270 1270
 
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
 	 */
1291 1291
 	public function activate() {
1292 1292
 		$status = $this->has_trial_period() && 'trialling' === $this->get_status() ? 'trialling' : 'active';
1293
-		$this->set_status( $status );
1293
+		$this->set_status($status);
1294 1294
 		return $this->save();
1295 1295
 	}
1296 1296
 
Please login to merge, or discard this patch.
includes/class-wpinv-invoice.php 1 patch
Spacing   +856 added lines, -856 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
  * Invoice class.
@@ -147,39 +147,39 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @param  int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object to read.
149 149
 	 */
150
-    public function __construct( $invoice = 0 ) {
150
+    public function __construct($invoice = 0) {
151 151
 
152
-        parent::__construct( $invoice );
152
+        parent::__construct($invoice);
153 153
 
154
-		if ( ! empty( $invoice ) && is_numeric( $invoice ) && getpaid_is_invoice_post_type( get_post_type( (int) $invoice ) ) ) {
155
-			$this->set_id( (int) $invoice );
156
-		} elseif ( $invoice instanceof self ) {
157
-			$this->set_id( $invoice->get_id() );
158
-		} elseif ( ! empty( $invoice->ID ) ) {
159
-			$this->set_id( $invoice->ID );
160
-		} elseif ( is_array( $invoice ) ) {
161
-			$this->set_props( $invoice );
154
+		if (!empty($invoice) && is_numeric($invoice) && getpaid_is_invoice_post_type(get_post_type((int) $invoice))) {
155
+			$this->set_id((int) $invoice);
156
+		} elseif ($invoice instanceof self) {
157
+			$this->set_id($invoice->get_id());
158
+		} elseif (!empty($invoice->ID)) {
159
+			$this->set_id($invoice->ID);
160
+		} elseif (is_array($invoice)) {
161
+			$this->set_props($invoice);
162 162
 
163
-			if ( isset( $invoice['ID'] ) ) {
164
-				$this->set_id( $invoice['ID'] );
163
+			if (isset($invoice['ID'])) {
164
+				$this->set_id($invoice['ID']);
165 165
 			}
166
-} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'key' ) ) {
167
-			$this->set_id( $invoice_id );
168
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'number' ) ) {
169
-			$this->set_id( $invoice_id );
170
-		} elseif ( is_string( $invoice ) && $invoice_id = self::get_invoice_id_by_field( $invoice, 'transaction_id' ) ) {
171
-			$this->set_id( $invoice_id );
166
+} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'key')) {
167
+			$this->set_id($invoice_id);
168
+		} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'number')) {
169
+			$this->set_id($invoice_id);
170
+		} elseif (is_string($invoice) && $invoice_id = self::get_invoice_id_by_field($invoice, 'transaction_id')) {
171
+			$this->set_id($invoice_id);
172 172
 		} else {
173
-			$this->set_object_read( true );
173
+			$this->set_object_read(true);
174 174
 		}
175 175
 
176 176
         // Load the datastore.
177
-		$this->data_store = GetPaid_Data_Store::load( $this->data_store_name );
177
+		$this->data_store = GetPaid_Data_Store::load($this->data_store_name);
178 178
 
179
-		if ( $this->get_id() > 0 ) {
180
-            $this->post = get_post( $this->get_id() );
179
+		if ($this->get_id() > 0) {
180
+            $this->post = get_post($this->get_id());
181 181
             $this->ID   = $this->get_id();
182
-			$this->data_store->read( $this );
182
+			$this->data_store->read($this);
183 183
         }
184 184
 
185 185
     }
@@ -194,39 +194,39 @@  discard block
 block discarded – undo
194 194
 	 * @since 1.0.15
195 195
 	 * @return int
196 196
 	 */
197
-	public static function get_invoice_id_by_field( $value, $field = 'key' ) {
197
+	public static function get_invoice_id_by_field($value, $field = 'key') {
198 198
         global $wpdb;
199 199
 
200 200
 		// Trim the value.
201
-		$value = trim( $value );
201
+		$value = trim($value);
202 202
 
203
-		if ( empty( $value ) ) {
203
+		if (empty($value)) {
204 204
 			return 0;
205 205
 		}
206 206
 
207 207
         // Valid fields.
208
-        $fields = array( 'key', 'number', 'transaction_id' );
208
+        $fields = array('key', 'number', 'transaction_id');
209 209
 
210 210
 		// Ensure a field has been passed.
211
-		if ( empty( $field ) || ! in_array( $field, $fields ) ) {
211
+		if (empty($field) || !in_array($field, $fields)) {
212 212
 			return 0;
213 213
 		}
214 214
 
215 215
 		// Maybe retrieve from the cache.
216
-		$invoice_id   = wp_cache_get( $value, "getpaid_invoice_{$field}s_to_invoice_ids" );
217
-		if ( false !== $invoice_id ) {
216
+		$invoice_id = wp_cache_get($value, "getpaid_invoice_{$field}s_to_invoice_ids");
217
+		if (false !== $invoice_id) {
218 218
 			return $invoice_id;
219 219
 		}
220 220
 
221 221
         // Fetch from the db.
222 222
         $table       = $wpdb->prefix . 'getpaid_invoices';
223
-		$db_field    = 'key' === $field ? 'invoice_key' : $field;
223
+		$db_field = 'key' === $field ? 'invoice_key' : $field;
224 224
         $invoice_id  = (int) $wpdb->get_var(
225
-            $wpdb->prepare( "SELECT `post_id` FROM $table WHERE `$db_field`=%s LIMIT 1", $value )
225
+            $wpdb->prepare("SELECT `post_id` FROM $table WHERE `$db_field`=%s LIMIT 1", $value)
226 226
         );
227 227
 
228 228
 		// Update the cache with our data
229
-		wp_cache_set( $value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids" );
229
+		wp_cache_set($value, $invoice_id, "getpaid_invoice_{$field}s_to_invoice_ids");
230 230
 
231 231
 		return $invoice_id;
232 232
     }
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
     /**
235 235
      * Checks if an invoice key is set.
236 236
      */
237
-    public function _isset( $key ) {
238
-        return isset( $this->data[ $key ] ) || method_exists( $this, "get_$key" );
237
+    public function _isset($key) {
238
+        return isset($this->data[$key]) || method_exists($this, "get_$key");
239 239
     }
240 240
 
241 241
     /*
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 	 * @param  string $context View or edit context.
261 261
 	 * @return int
262 262
 	 */
263
-	public function get_parent_id( $context = 'view' ) {
264
-		return (int) $this->get_prop( 'parent_id', $context );
263
+	public function get_parent_id($context = 'view') {
264
+		return (int) $this->get_prop('parent_id', $context);
265 265
     }
266 266
 
267 267
     /**
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @return WPInv_Invoice
272 272
 	 */
273 273
     public function get_parent_payment() {
274
-        return new WPInv_Invoice( $this->get_parent_id() );
274
+        return new WPInv_Invoice($this->get_parent_id());
275 275
     }
276 276
 
277 277
     /**
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
 	 * @param  string $context View or edit context.
292 292
 	 * @return string
293 293
 	 */
294
-	public function get_status( $context = 'view' ) {
295
-		return $this->get_prop( 'status', $context );
294
+	public function get_status($context = 'view') {
295
+		return $this->get_prop('status', $context);
296 296
 	}
297 297
 
298 298
 	/**
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 * @return array
303 303
 	 */
304 304
 	public function get_all_statuses() {
305
-		return wpinv_get_invoice_statuses( true, true, $this );
305
+		return wpinv_get_invoice_statuses(true, true, $this);
306 306
     }
307 307
 
308 308
     /**
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
     public function get_status_nicename() {
315 315
 		$statuses = $this->get_all_statuses();
316 316
 
317
-        $status = isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : $this->get_status();
317
+        $status = isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : $this->get_status();
318 318
 
319
-        return apply_filters( 'wpinv_get_invoice_status_nicename', $status, $this );
319
+        return apply_filters('wpinv_get_invoice_status_nicename', $status, $this);
320 320
     }
321 321
 
322 322
 	/**
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 */
328 328
 	public function get_status_class() {
329 329
 		$statuses = getpaid_get_invoice_status_classes();
330
-		return isset( $statuses[ $this->get_status() ] ) ? $statuses[ $this->get_status() ] : 'bg-dark text-white';
330
+		return isset($statuses[$this->get_status()]) ? $statuses[$this->get_status()] : 'bg-dark text-white';
331 331
 	}
332 332
 
333 333
 	/**
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
      */
339 339
     public function get_status_label_html() {
340 340
 
341
-		$status_label = sanitize_text_field( $this->get_status_nicename() );
342
-		$status       = sanitize_html_class( $this->get_status() );
343
-		$class        = esc_attr( $this->get_status_class() );
341
+		$status_label = sanitize_text_field($this->get_status_nicename());
342
+		$status       = sanitize_html_class($this->get_status());
343
+		$class        = esc_attr($this->get_status_class());
344 344
 
345 345
 		return "<span class='bsui'><span class='badge $class $status'>$status_label</span></span>";
346 346
 	}
@@ -352,23 +352,23 @@  discard block
 block discarded – undo
352 352
 	 * @param  string $context View or edit context.
353 353
 	 * @return string
354 354
 	 */
355
-	public function get_version( $context = 'view' ) {
356
-		return $this->get_prop( 'version', $context );
355
+	public function get_version($context = 'view') {
356
+		return $this->get_prop('version', $context);
357 357
 	}
358 358
 
359 359
 	/**
360 360
 	 * @deprecated
361 361
 	 */
362
-	public function get_invoice_date( $format = true ) {
363
-		$date      = getpaid_format_date( $this->get_date_completed() );
364
-		$date      = empty( $date ) ? $this->get_date_created() : $this->get_date_completed();
365
-		$formatted = getpaid_format_date( $date );
362
+	public function get_invoice_date($format = true) {
363
+		$date      = getpaid_format_date($this->get_date_completed());
364
+		$date      = empty($date) ? $this->get_date_created() : $this->get_date_completed();
365
+		$formatted = getpaid_format_date($date);
366 366
 
367
-		if ( $format ) {
367
+		if ($format) {
368 368
 			return $formatted;
369 369
 		}
370 370
 
371
-		return empty( $formatted ) ? '' : $date;
371
+		return empty($formatted) ? '' : $date;
372 372
 
373 373
     }
374 374
 
@@ -379,8 +379,8 @@  discard block
 block discarded – undo
379 379
 	 * @param  string $context View or edit context.
380 380
 	 * @return string
381 381
 	 */
382
-	public function get_date_created( $context = 'view' ) {
383
-		return $this->get_prop( 'date_created', $context );
382
+	public function get_date_created($context = 'view') {
383
+		return $this->get_prop('date_created', $context);
384 384
 	}
385 385
 
386 386
 	/**
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 	 * @param  string $context View or edit context.
391 391
 	 * @return string
392 392
 	 */
393
-	public function get_created_date( $context = 'view' ) {
394
-		return $this->get_date_created( $context );
393
+	public function get_created_date($context = 'view') {
394
+		return $this->get_date_created($context);
395 395
     }
396 396
 
397 397
     /**
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 	 * @param  string $context View or edit context.
402 402
 	 * @return string
403 403
 	 */
404
-	public function get_date_created_gmt( $context = 'view' ) {
405
-        $date = $this->get_date_created( $context );
404
+	public function get_date_created_gmt($context = 'view') {
405
+        $date = $this->get_date_created($context);
406 406
 
407
-        if ( $date ) {
408
-            $date = get_gmt_from_date( $date );
407
+        if ($date) {
408
+            $date = get_gmt_from_date($date);
409 409
         }
410 410
 		return $date;
411 411
     }
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 * @param  string $context View or edit context.
418 418
 	 * @return string
419 419
 	 */
420
-	public function get_date_modified( $context = 'view' ) {
421
-		return $this->get_prop( 'date_modified', $context );
420
+	public function get_date_modified($context = 'view') {
421
+		return $this->get_prop('date_modified', $context);
422 422
 	}
423 423
 
424 424
 	/**
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 	 * @param  string $context View or edit context.
429 429
 	 * @return string
430 430
 	 */
431
-	public function get_modified_date( $context = 'view' ) {
432
-		return $this->get_date_modified( $context );
431
+	public function get_modified_date($context = 'view') {
432
+		return $this->get_date_modified($context);
433 433
     }
434 434
 
435 435
     /**
@@ -439,11 +439,11 @@  discard block
 block discarded – undo
439 439
 	 * @param  string $context View or edit context.
440 440
 	 * @return string
441 441
 	 */
442
-	public function get_date_modified_gmt( $context = 'view' ) {
443
-        $date = $this->get_date_modified( $context );
442
+	public function get_date_modified_gmt($context = 'view') {
443
+        $date = $this->get_date_modified($context);
444 444
 
445
-        if ( $date ) {
446
-            $date = get_gmt_from_date( $date );
445
+        if ($date) {
446
+            $date = get_gmt_from_date($date);
447 447
         }
448 448
 		return $date;
449 449
     }
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
 	 * @param  string $context View or edit context.
456 456
 	 * @return string
457 457
 	 */
458
-	public function get_due_date( $context = 'view' ) {
459
-		return $this->get_prop( 'due_date', $context );
458
+	public function get_due_date($context = 'view') {
459
+		return $this->get_prop('due_date', $context);
460 460
     }
461 461
 
462 462
     /**
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 	 * @param  string $context View or edit context.
467 467
 	 * @return string
468 468
 	 */
469
-	public function get_date_due( $context = 'view' ) {
470
-		return $this->get_due_date( $context );
469
+	public function get_date_due($context = 'view') {
470
+		return $this->get_due_date($context);
471 471
     }
472 472
 
473 473
     /**
@@ -477,11 +477,11 @@  discard block
 block discarded – undo
477 477
 	 * @param  string $context View or edit context.
478 478
 	 * @return string
479 479
 	 */
480
-	public function get_due_date_gmt( $context = 'view' ) {
481
-        $date = $this->get_due_date( $context );
480
+	public function get_due_date_gmt($context = 'view') {
481
+        $date = $this->get_due_date($context);
482 482
 
483
-        if ( $date ) {
484
-            $date = get_gmt_from_date( $date );
483
+        if ($date) {
484
+            $date = get_gmt_from_date($date);
485 485
         }
486 486
 		return $date;
487 487
     }
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 	 * @param  string $context View or edit context.
494 494
 	 * @return string
495 495
 	 */
496
-	public function get_gmt_date_due( $context = 'view' ) {
497
-		return $this->get_due_date_gmt( $context );
496
+	public function get_gmt_date_due($context = 'view') {
497
+		return $this->get_due_date_gmt($context);
498 498
     }
499 499
 
500 500
     /**
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
 	 * @param  string $context View or edit context.
505 505
 	 * @return string
506 506
 	 */
507
-	public function get_completed_date( $context = 'view' ) {
508
-		return $this->get_prop( 'completed_date', $context );
507
+	public function get_completed_date($context = 'view') {
508
+		return $this->get_prop('completed_date', $context);
509 509
     }
510 510
 
511 511
     /**
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
 	 * @param  string $context View or edit context.
516 516
 	 * @return string
517 517
 	 */
518
-	public function get_date_completed( $context = 'view' ) {
519
-		return $this->get_completed_date( $context );
518
+	public function get_date_completed($context = 'view') {
519
+		return $this->get_completed_date($context);
520 520
     }
521 521
 
522 522
     /**
@@ -526,11 +526,11 @@  discard block
 block discarded – undo
526 526
 	 * @param  string $context View or edit context.
527 527
 	 * @return string
528 528
 	 */
529
-	public function get_completed_date_gmt( $context = 'view' ) {
530
-        $date = $this->get_completed_date( $context );
529
+	public function get_completed_date_gmt($context = 'view') {
530
+        $date = $this->get_completed_date($context);
531 531
 
532
-        if ( $date ) {
533
-            $date = get_gmt_from_date( $date );
532
+        if ($date) {
533
+            $date = get_gmt_from_date($date);
534 534
         }
535 535
 		return $date;
536 536
     }
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
 	 * @param  string $context View or edit context.
543 543
 	 * @return string
544 544
 	 */
545
-	public function get_gmt_completed_date( $context = 'view' ) {
546
-		return $this->get_completed_date_gmt( $context );
545
+	public function get_gmt_completed_date($context = 'view') {
546
+		return $this->get_completed_date_gmt($context);
547 547
     }
548 548
 
549 549
     /**
@@ -553,12 +553,12 @@  discard block
 block discarded – undo
553 553
 	 * @param  string $context View or edit context.
554 554
 	 * @return string
555 555
 	 */
556
-	public function get_number( $context = 'view' ) {
557
-		$number = $this->get_prop( 'number', $context );
556
+	public function get_number($context = 'view') {
557
+		$number = $this->get_prop('number', $context);
558 558
 
559
-		if ( empty( $number ) ) {
559
+		if (empty($number)) {
560 560
 			$number = $this->generate_number();
561
-			$this->set_number( $this->generate_number() );
561
+			$this->set_number($this->generate_number());
562 562
 		}
563 563
 
564 564
 		return $number;
@@ -572,8 +572,8 @@  discard block
 block discarded – undo
572 572
 	public function maybe_set_number() {
573 573
         $number = $this->get_number();
574 574
 
575
-        if ( empty( $number ) || $this->get_id() == $number ) {
576
-			$this->set_number( $this->generate_number() );
575
+        if (empty($number) || $this->get_id() == $number) {
576
+			$this->set_number($this->generate_number());
577 577
         }
578 578
 
579 579
 	}
@@ -585,8 +585,8 @@  discard block
 block discarded – undo
585 585
 	 * @param  string $context View or edit context.
586 586
 	 * @return string
587 587
 	 */
588
-	public function get_key( $context = 'view' ) {
589
-        return $this->get_prop( 'key', $context );
588
+	public function get_key($context = 'view') {
589
+        return $this->get_prop('key', $context);
590 590
 	}
591 591
 
592 592
 	/**
@@ -597,9 +597,9 @@  discard block
 block discarded – undo
597 597
 	public function maybe_set_key() {
598 598
         $key = $this->get_key();
599 599
 
600
-        if ( empty( $key ) ) {
601
-            $key = $this->generate_key( $this->get_type() . '_' );
602
-            $this->set_key( $key );
600
+        if (empty($key)) {
601
+            $key = $this->generate_key($this->get_type() . '_');
602
+            $this->set_key($key);
603 603
         }
604 604
 
605 605
     }
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
 	 * @param  string $context View or edit context.
612 612
 	 * @return string
613 613
 	 */
614
-	public function get_type( $context = 'view' ) {
615
-        return $this->get_prop( 'type', $context );
614
+	public function get_type($context = 'view') {
615
+        return $this->get_prop('type', $context);
616 616
 	}
617 617
 
618 618
 	/**
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	 * @return string
623 623
 	 */
624 624
 	public function get_invoice_quote_type() {
625
-        return getpaid_get_post_type_label( $this->get_post_type(), false );
625
+        return getpaid_get_post_type_label($this->get_post_type(), false);
626 626
     }
627 627
 
628 628
     /**
@@ -632,8 +632,8 @@  discard block
 block discarded – undo
632 632
 	 * @param  string $context View or edit context.
633 633
 	 * @return string
634 634
 	 */
635
-	public function get_label( $context = 'view' ) {
636
-        return getpaid_get_post_type_label( $this->get_post_type( $context ), false );
635
+	public function get_label($context = 'view') {
636
+        return getpaid_get_post_type_label($this->get_post_type($context), false);
637 637
 	}
638 638
 
639 639
 	/**
@@ -643,8 +643,8 @@  discard block
 block discarded – undo
643 643
 	 * @param  string $context View or edit context.
644 644
 	 * @return string
645 645
 	 */
646
-	public function get_post_type( $context = 'view' ) {
647
-        return $this->get_prop( 'post_type', $context );
646
+	public function get_post_type($context = 'view') {
647
+        return $this->get_prop('post_type', $context);
648 648
     }
649 649
 
650 650
     /**
@@ -654,8 +654,8 @@  discard block
 block discarded – undo
654 654
 	 * @param  string $context View or edit context.
655 655
 	 * @return string
656 656
 	 */
657
-	public function get_mode( $context = 'view' ) {
658
-        return $this->get_prop( 'mode', $context );
657
+	public function get_mode($context = 'view') {
658
+        return $this->get_prop('mode', $context);
659 659
     }
660 660
 
661 661
     /**
@@ -665,13 +665,13 @@  discard block
 block discarded – undo
665 665
 	 * @param  string $context View or edit context.
666 666
 	 * @return string
667 667
 	 */
668
-	public function get_path( $context = 'view' ) {
669
-        $path   = $this->get_prop( 'path', $context );
668
+	public function get_path($context = 'view') {
669
+        $path = $this->get_prop('path', $context);
670 670
 		$prefix = $this->get_type();
671 671
 
672
-		if ( 0 !== strpos( $path, $prefix ) ) {
673
-			$path = sanitize_title( $prefix . '-' . $this->get_id() );
674
-			$this->set_path( $path );
672
+		if (0 !== strpos($path, $prefix)) {
673
+			$path = sanitize_title($prefix . '-' . $this->get_id());
674
+			$this->set_path($path);
675 675
 		}
676 676
 
677 677
 		return $path;
@@ -684,8 +684,8 @@  discard block
 block discarded – undo
684 684
 	 * @param  string $context View or edit context.
685 685
 	 * @return string
686 686
 	 */
687
-	public function get_name( $context = 'view' ) {
688
-        return $this->get_prop( 'title', $context );
687
+	public function get_name($context = 'view') {
688
+        return $this->get_prop('title', $context);
689 689
     }
690 690
 
691 691
     /**
@@ -695,8 +695,8 @@  discard block
 block discarded – undo
695 695
 	 * @param  string $context View or edit context.
696 696
 	 * @return string
697 697
 	 */
698
-	public function get_title( $context = 'view' ) {
699
-		return $this->get_name( $context );
698
+	public function get_title($context = 'view') {
699
+		return $this->get_name($context);
700 700
     }
701 701
 
702 702
     /**
@@ -706,8 +706,8 @@  discard block
 block discarded – undo
706 706
 	 * @param  string $context View or edit context.
707 707
 	 * @return string
708 708
 	 */
709
-	public function get_description( $context = 'view' ) {
710
-		return $this->get_prop( 'description', $context );
709
+	public function get_description($context = 'view') {
710
+		return $this->get_prop('description', $context);
711 711
     }
712 712
 
713 713
     /**
@@ -717,8 +717,8 @@  discard block
 block discarded – undo
717 717
 	 * @param  string $context View or edit context.
718 718
 	 * @return string
719 719
 	 */
720
-	public function get_excerpt( $context = 'view' ) {
721
-		return $this->get_description( $context );
720
+	public function get_excerpt($context = 'view') {
721
+		return $this->get_description($context);
722 722
     }
723 723
 
724 724
     /**
@@ -728,8 +728,8 @@  discard block
 block discarded – undo
728 728
 	 * @param  string $context View or edit context.
729 729
 	 * @return string
730 730
 	 */
731
-	public function get_summary( $context = 'view' ) {
732
-		return $this->get_description( $context );
731
+	public function get_summary($context = 'view') {
732
+		return $this->get_description($context);
733 733
     }
734 734
 
735 735
     /**
@@ -739,26 +739,26 @@  discard block
 block discarded – undo
739 739
      * @param  string $context View or edit context.
740 740
 	 * @return array
741 741
 	 */
742
-    public function get_user_info( $context = 'view' ) {
742
+    public function get_user_info($context = 'view') {
743 743
 
744 744
         $user_info = array(
745
-            'user_id'    => $this->get_user_id( $context ),
746
-            'email'      => $this->get_email( $context ),
747
-            'first_name' => $this->get_first_name( $context ),
748
-            'last_name'  => $this->get_last_name( $context ),
749
-            'address'    => $this->get_address( $context ),
750
-            'phone'      => $this->get_phone( $context ),
751
-            'city'       => $this->get_city( $context ),
752
-            'country'    => $this->get_country( $context ),
753
-            'state'      => $this->get_state( $context ),
754
-            'zip'        => $this->get_zip( $context ),
755
-            'company'    => $this->get_company( $context ),
756
-			'company_id' => $this->get_company_id( $context ),
757
-            'vat_number' => $this->get_vat_number( $context ),
758
-            'discount'   => $this->get_discount_code( $context ),
745
+            'user_id'    => $this->get_user_id($context),
746
+            'email'      => $this->get_email($context),
747
+            'first_name' => $this->get_first_name($context),
748
+            'last_name'  => $this->get_last_name($context),
749
+            'address'    => $this->get_address($context),
750
+            'phone'      => $this->get_phone($context),
751
+            'city'       => $this->get_city($context),
752
+            'country'    => $this->get_country($context),
753
+            'state'      => $this->get_state($context),
754
+            'zip'        => $this->get_zip($context),
755
+            'company'    => $this->get_company($context),
756
+			'company_id' => $this->get_company_id($context),
757
+            'vat_number' => $this->get_vat_number($context),
758
+            'discount'   => $this->get_discount_code($context),
759 759
 		);
760 760
 
761
-		return apply_filters( 'wpinv_user_info', $user_info, $this->get_id(), $this );
761
+		return apply_filters('wpinv_user_info', $user_info, $this->get_id(), $this);
762 762
 
763 763
     }
764 764
 
@@ -769,8 +769,8 @@  discard block
 block discarded – undo
769 769
 	 * @param  string $context View or edit context.
770 770
 	 * @return int
771 771
 	 */
772
-	public function get_author( $context = 'view' ) {
773
-		return (int) $this->get_prop( 'author', $context );
772
+	public function get_author($context = 'view') {
773
+		return (int) $this->get_prop('author', $context);
774 774
     }
775 775
 
776 776
     /**
@@ -780,8 +780,8 @@  discard block
 block discarded – undo
780 780
 	 * @param  string $context View or edit context.
781 781
 	 * @return int
782 782
 	 */
783
-	public function get_user_id( $context = 'view' ) {
784
-		return $this->get_author( $context );
783
+	public function get_user_id($context = 'view') {
784
+		return $this->get_author($context);
785 785
     }
786 786
 
787 787
      /**
@@ -791,8 +791,8 @@  discard block
 block discarded – undo
791 791
 	 * @param  string $context View or edit context.
792 792
 	 * @return int
793 793
 	 */
794
-	public function get_customer_id( $context = 'view' ) {
795
-		return (int) $this->get_prop( 'customer_id', $context );
794
+	public function get_customer_id($context = 'view') {
795
+		return (int) $this->get_prop('customer_id', $context);
796 796
     }
797 797
 
798 798
     /**
@@ -802,8 +802,8 @@  discard block
 block discarded – undo
802 802
 	 * @param  string $context View or edit context.
803 803
 	 * @return string
804 804
 	 */
805
-	public function get_ip( $context = 'view' ) {
806
-		return $this->get_prop( 'user_ip', $context );
805
+	public function get_ip($context = 'view') {
806
+		return $this->get_prop('user_ip', $context);
807 807
     }
808 808
 
809 809
     /**
@@ -813,8 +813,8 @@  discard block
 block discarded – undo
813 813
 	 * @param  string $context View or edit context.
814 814
 	 * @return string
815 815
 	 */
816
-	public function get_user_ip( $context = 'view' ) {
817
-		return $this->get_ip( $context );
816
+	public function get_user_ip($context = 'view') {
817
+		return $this->get_ip($context);
818 818
     }
819 819
 
820 820
      /**
@@ -824,8 +824,8 @@  discard block
 block discarded – undo
824 824
 	 * @param  string $context View or edit context.
825 825
 	 * @return string
826 826
 	 */
827
-	public function get_customer_ip( $context = 'view' ) {
828
-		return $this->get_ip( $context );
827
+	public function get_customer_ip($context = 'view') {
828
+		return $this->get_ip($context);
829 829
     }
830 830
 
831 831
     /**
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
 	 * @param  string $context View or edit context.
836 836
 	 * @return string
837 837
 	 */
838
-	public function get_first_name( $context = 'view' ) {
839
-		return $this->get_prop( 'first_name', $context );
838
+	public function get_first_name($context = 'view') {
839
+		return $this->get_prop('first_name', $context);
840 840
     }
841 841
 
842 842
     /**
@@ -846,8 +846,8 @@  discard block
 block discarded – undo
846 846
 	 * @param  string $context View or edit context.
847 847
 	 * @return string
848 848
 	 */
849
-	public function get_user_first_name( $context = 'view' ) {
850
-		return $this->get_first_name( $context );
849
+	public function get_user_first_name($context = 'view') {
850
+		return $this->get_first_name($context);
851 851
     }
852 852
 
853 853
      /**
@@ -857,8 +857,8 @@  discard block
 block discarded – undo
857 857
 	 * @param  string $context View or edit context.
858 858
 	 * @return string
859 859
 	 */
860
-	public function get_customer_first_name( $context = 'view' ) {
861
-		return $this->get_first_name( $context );
860
+	public function get_customer_first_name($context = 'view') {
861
+		return $this->get_first_name($context);
862 862
     }
863 863
 
864 864
     /**
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
 	 * @param  string $context View or edit context.
869 869
 	 * @return string
870 870
 	 */
871
-	public function get_last_name( $context = 'view' ) {
872
-		return $this->get_prop( 'last_name', $context );
871
+	public function get_last_name($context = 'view') {
872
+		return $this->get_prop('last_name', $context);
873 873
     }
874 874
 
875 875
     /**
@@ -879,8 +879,8 @@  discard block
 block discarded – undo
879 879
 	 * @param  string $context View or edit context.
880 880
 	 * @return string
881 881
 	 */
882
-	public function get_user_last_name( $context = 'view' ) {
883
-		return $this->get_last_name( $context );
882
+	public function get_user_last_name($context = 'view') {
883
+		return $this->get_last_name($context);
884 884
     }
885 885
 
886 886
     /**
@@ -890,8 +890,8 @@  discard block
 block discarded – undo
890 890
 	 * @param  string $context View or edit context.
891 891
 	 * @return string
892 892
 	 */
893
-	public function get_customer_last_name( $context = 'view' ) {
894
-		return $this->get_last_name( $context );
893
+	public function get_customer_last_name($context = 'view') {
894
+		return $this->get_last_name($context);
895 895
     }
896 896
 
897 897
     /**
@@ -901,22 +901,22 @@  discard block
 block discarded – undo
901 901
 	 * @param  string $context View or edit context.
902 902
 	 * @return string
903 903
 	 */
904
-	public function get_full_name( $context = 'view' ) {
905
-		$name = trim( $this->get_first_name( $context ) . ' ' . $this->get_last_name( $context ) );
904
+	public function get_full_name($context = 'view') {
905
+		$name = trim($this->get_first_name($context) . ' ' . $this->get_last_name($context));
906 906
 
907
-		if ( ! $name ) {
908
-			$user = get_userdata( $this->get_author( $context ) );
907
+		if (!$name) {
908
+			$user = get_userdata($this->get_author($context));
909 909
 
910
-			if ( $user ) {
910
+			if ($user) {
911 911
 				$name = $user->display_name;
912 912
 			}
913 913
 		}
914 914
 
915
-		if ( ! $name ) {
916
-			$name = $this->get_email( $context );
915
+		if (!$name) {
916
+			$name = $this->get_email($context);
917 917
 		}
918 918
 
919
-		return apply_filters( 'wpinv_invoice_user_full_name', $name, $this );
919
+		return apply_filters('wpinv_invoice_user_full_name', $name, $this);
920 920
     }
921 921
 
922 922
     /**
@@ -926,8 +926,8 @@  discard block
 block discarded – undo
926 926
 	 * @param  string $context View or edit context.
927 927
 	 * @return string
928 928
 	 */
929
-	public function get_user_full_name( $context = 'view' ) {
930
-		return $this->get_full_name( $context );
929
+	public function get_user_full_name($context = 'view') {
930
+		return $this->get_full_name($context);
931 931
     }
932 932
 
933 933
     /**
@@ -937,8 +937,8 @@  discard block
 block discarded – undo
937 937
 	 * @param  string $context View or edit context.
938 938
 	 * @return string
939 939
 	 */
940
-	public function get_customer_full_name( $context = 'view' ) {
941
-		return $this->get_full_name( $context );
940
+	public function get_customer_full_name($context = 'view') {
941
+		return $this->get_full_name($context);
942 942
     }
943 943
 
944 944
     /**
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
 	 * @param  string $context View or edit context.
949 949
 	 * @return string
950 950
 	 */
951
-	public function get_phone( $context = 'view' ) {
952
-		return $this->get_prop( 'phone', $context );
951
+	public function get_phone($context = 'view') {
952
+		return $this->get_prop('phone', $context);
953 953
     }
954 954
 
955 955
     /**
@@ -959,8 +959,8 @@  discard block
 block discarded – undo
959 959
 	 * @param  string $context View or edit context.
960 960
 	 * @return string
961 961
 	 */
962
-	public function get_phone_number( $context = 'view' ) {
963
-		return $this->get_phone( $context );
962
+	public function get_phone_number($context = 'view') {
963
+		return $this->get_phone($context);
964 964
     }
965 965
 
966 966
     /**
@@ -970,8 +970,8 @@  discard block
 block discarded – undo
970 970
 	 * @param  string $context View or edit context.
971 971
 	 * @return string
972 972
 	 */
973
-	public function get_user_phone( $context = 'view' ) {
974
-		return $this->get_phone( $context );
973
+	public function get_user_phone($context = 'view') {
974
+		return $this->get_phone($context);
975 975
     }
976 976
 
977 977
     /**
@@ -981,8 +981,8 @@  discard block
 block discarded – undo
981 981
 	 * @param  string $context View or edit context.
982 982
 	 * @return string
983 983
 	 */
984
-	public function get_customer_phone( $context = 'view' ) {
985
-		return $this->get_phone( $context );
984
+	public function get_customer_phone($context = 'view') {
985
+		return $this->get_phone($context);
986 986
     }
987 987
 
988 988
     /**
@@ -992,8 +992,8 @@  discard block
 block discarded – undo
992 992
 	 * @param  string $context View or edit context.
993 993
 	 * @return string
994 994
 	 */
995
-	public function get_email( $context = 'view' ) {
996
-		return $this->get_prop( 'email', $context );
995
+	public function get_email($context = 'view') {
996
+		return $this->get_prop('email', $context);
997 997
     }
998 998
 
999 999
     /**
@@ -1003,8 +1003,8 @@  discard block
 block discarded – undo
1003 1003
 	 * @param  string $context View or edit context.
1004 1004
 	 * @return string
1005 1005
 	 */
1006
-	public function get_email_address( $context = 'view' ) {
1007
-		return $this->get_email( $context );
1006
+	public function get_email_address($context = 'view') {
1007
+		return $this->get_email($context);
1008 1008
     }
1009 1009
 
1010 1010
     /**
@@ -1014,8 +1014,8 @@  discard block
 block discarded – undo
1014 1014
 	 * @param  string $context View or edit context.
1015 1015
 	 * @return string
1016 1016
 	 */
1017
-	public function get_user_email( $context = 'view' ) {
1018
-		return $this->get_email( $context );
1017
+	public function get_user_email($context = 'view') {
1018
+		return $this->get_email($context);
1019 1019
     }
1020 1020
 
1021 1021
     /**
@@ -1025,8 +1025,8 @@  discard block
 block discarded – undo
1025 1025
 	 * @param  string $context View or edit context.
1026 1026
 	 * @return string
1027 1027
 	 */
1028
-	public function get_customer_email( $context = 'view' ) {
1029
-		return $this->get_email( $context );
1028
+	public function get_customer_email($context = 'view') {
1029
+		return $this->get_email($context);
1030 1030
     }
1031 1031
 
1032 1032
     /**
@@ -1036,9 +1036,9 @@  discard block
 block discarded – undo
1036 1036
 	 * @param  string $context View or edit context.
1037 1037
 	 * @return string
1038 1038
 	 */
1039
-	public function get_country( $context = 'view' ) {
1040
-		$country = $this->get_prop( 'country', $context );
1041
-		return empty( $country ) ? wpinv_get_default_country() : $country;
1039
+	public function get_country($context = 'view') {
1040
+		$country = $this->get_prop('country', $context);
1041
+		return empty($country) ? wpinv_get_default_country() : $country;
1042 1042
     }
1043 1043
 
1044 1044
     /**
@@ -1048,8 +1048,8 @@  discard block
 block discarded – undo
1048 1048
 	 * @param  string $context View or edit context.
1049 1049
 	 * @return string
1050 1050
 	 */
1051
-	public function get_user_country( $context = 'view' ) {
1052
-		return $this->get_country( $context );
1051
+	public function get_user_country($context = 'view') {
1052
+		return $this->get_country($context);
1053 1053
     }
1054 1054
 
1055 1055
     /**
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
 	 * @param  string $context View or edit context.
1060 1060
 	 * @return string
1061 1061
 	 */
1062
-	public function get_customer_country( $context = 'view' ) {
1063
-		return $this->get_country( $context );
1062
+	public function get_customer_country($context = 'view') {
1063
+		return $this->get_country($context);
1064 1064
     }
1065 1065
 
1066 1066
     /**
@@ -1070,9 +1070,9 @@  discard block
 block discarded – undo
1070 1070
 	 * @param  string $context View or edit context.
1071 1071
 	 * @return string
1072 1072
 	 */
1073
-	public function get_state( $context = 'view' ) {
1074
-		$state = $this->get_prop( 'state', $context );
1075
-		return empty( $state ) ? wpinv_get_default_state() : $state;
1073
+	public function get_state($context = 'view') {
1074
+		$state = $this->get_prop('state', $context);
1075
+		return empty($state) ? wpinv_get_default_state() : $state;
1076 1076
     }
1077 1077
 
1078 1078
     /**
@@ -1082,8 +1082,8 @@  discard block
 block discarded – undo
1082 1082
 	 * @param  string $context View or edit context.
1083 1083
 	 * @return string
1084 1084
 	 */
1085
-	public function get_user_state( $context = 'view' ) {
1086
-		return $this->get_state( $context );
1085
+	public function get_user_state($context = 'view') {
1086
+		return $this->get_state($context);
1087 1087
     }
1088 1088
 
1089 1089
     /**
@@ -1093,8 +1093,8 @@  discard block
 block discarded – undo
1093 1093
 	 * @param  string $context View or edit context.
1094 1094
 	 * @return string
1095 1095
 	 */
1096
-	public function get_customer_state( $context = 'view' ) {
1097
-		return $this->get_state( $context );
1096
+	public function get_customer_state($context = 'view') {
1097
+		return $this->get_state($context);
1098 1098
     }
1099 1099
 
1100 1100
     /**
@@ -1104,8 +1104,8 @@  discard block
 block discarded – undo
1104 1104
 	 * @param  string $context View or edit context.
1105 1105
 	 * @return string
1106 1106
 	 */
1107
-	public function get_city( $context = 'view' ) {
1108
-		return $this->get_prop( 'city', $context );
1107
+	public function get_city($context = 'view') {
1108
+		return $this->get_prop('city', $context);
1109 1109
     }
1110 1110
 
1111 1111
     /**
@@ -1115,8 +1115,8 @@  discard block
 block discarded – undo
1115 1115
 	 * @param  string $context View or edit context.
1116 1116
 	 * @return string
1117 1117
 	 */
1118
-	public function get_user_city( $context = 'view' ) {
1119
-		return $this->get_city( $context );
1118
+	public function get_user_city($context = 'view') {
1119
+		return $this->get_city($context);
1120 1120
     }
1121 1121
 
1122 1122
     /**
@@ -1126,8 +1126,8 @@  discard block
 block discarded – undo
1126 1126
 	 * @param  string $context View or edit context.
1127 1127
 	 * @return string
1128 1128
 	 */
1129
-	public function get_customer_city( $context = 'view' ) {
1130
-		return $this->get_city( $context );
1129
+	public function get_customer_city($context = 'view') {
1130
+		return $this->get_city($context);
1131 1131
     }
1132 1132
 
1133 1133
     /**
@@ -1137,8 +1137,8 @@  discard block
 block discarded – undo
1137 1137
 	 * @param  string $context View or edit context.
1138 1138
 	 * @return string
1139 1139
 	 */
1140
-	public function get_zip( $context = 'view' ) {
1141
-		return $this->get_prop( 'zip', $context );
1140
+	public function get_zip($context = 'view') {
1141
+		return $this->get_prop('zip', $context);
1142 1142
     }
1143 1143
 
1144 1144
     /**
@@ -1148,8 +1148,8 @@  discard block
 block discarded – undo
1148 1148
 	 * @param  string $context View or edit context.
1149 1149
 	 * @return string
1150 1150
 	 */
1151
-	public function get_user_zip( $context = 'view' ) {
1152
-		return $this->get_zip( $context );
1151
+	public function get_user_zip($context = 'view') {
1152
+		return $this->get_zip($context);
1153 1153
     }
1154 1154
 
1155 1155
     /**
@@ -1159,8 +1159,8 @@  discard block
 block discarded – undo
1159 1159
 	 * @param  string $context View or edit context.
1160 1160
 	 * @return string
1161 1161
 	 */
1162
-	public function get_customer_zip( $context = 'view' ) {
1163
-		return $this->get_zip( $context );
1162
+	public function get_customer_zip($context = 'view') {
1163
+		return $this->get_zip($context);
1164 1164
     }
1165 1165
 
1166 1166
     /**
@@ -1170,8 +1170,8 @@  discard block
 block discarded – undo
1170 1170
 	 * @param  string $context View or edit context.
1171 1171
 	 * @return string
1172 1172
 	 */
1173
-	public function get_company( $context = 'view' ) {
1174
-		return $this->get_prop( 'company', $context );
1173
+	public function get_company($context = 'view') {
1174
+		return $this->get_prop('company', $context);
1175 1175
     }
1176 1176
 
1177 1177
     /**
@@ -1181,8 +1181,8 @@  discard block
 block discarded – undo
1181 1181
 	 * @param  string $context View or edit context.
1182 1182
 	 * @return string
1183 1183
 	 */
1184
-	public function get_user_company( $context = 'view' ) {
1185
-		return $this->get_company( $context );
1184
+	public function get_user_company($context = 'view') {
1185
+		return $this->get_company($context);
1186 1186
     }
1187 1187
 
1188 1188
     /**
@@ -1192,8 +1192,8 @@  discard block
 block discarded – undo
1192 1192
 	 * @param  string $context View or edit context.
1193 1193
 	 * @return string
1194 1194
 	 */
1195
-	public function get_customer_company( $context = 'view' ) {
1196
-		return $this->get_company( $context );
1195
+	public function get_customer_company($context = 'view') {
1196
+		return $this->get_company($context);
1197 1197
     }
1198 1198
 
1199 1199
 	/**
@@ -1203,8 +1203,8 @@  discard block
 block discarded – undo
1203 1203
 	 * @param  string $context View or edit context.
1204 1204
 	 * @return string
1205 1205
 	 */
1206
-	public function get_company_id( $context = 'view' ) {
1207
-		return $this->get_prop( 'company_id', $context );
1206
+	public function get_company_id($context = 'view') {
1207
+		return $this->get_prop('company_id', $context);
1208 1208
     }
1209 1209
 
1210 1210
     /**
@@ -1214,8 +1214,8 @@  discard block
 block discarded – undo
1214 1214
 	 * @param  string $context View or edit context.
1215 1215
 	 * @return string
1216 1216
 	 */
1217
-	public function get_vat_number( $context = 'view' ) {
1218
-		return $this->get_prop( 'vat_number', $context );
1217
+	public function get_vat_number($context = 'view') {
1218
+		return $this->get_prop('vat_number', $context);
1219 1219
     }
1220 1220
 
1221 1221
     /**
@@ -1225,8 +1225,8 @@  discard block
 block discarded – undo
1225 1225
 	 * @param  string $context View or edit context.
1226 1226
 	 * @return string
1227 1227
 	 */
1228
-	public function get_user_vat_number( $context = 'view' ) {
1229
-		return $this->get_vat_number( $context );
1228
+	public function get_user_vat_number($context = 'view') {
1229
+		return $this->get_vat_number($context);
1230 1230
     }
1231 1231
 
1232 1232
     /**
@@ -1236,8 +1236,8 @@  discard block
 block discarded – undo
1236 1236
 	 * @param  string $context View or edit context.
1237 1237
 	 * @return string
1238 1238
 	 */
1239
-	public function get_customer_vat_number( $context = 'view' ) {
1240
-		return $this->get_vat_number( $context );
1239
+	public function get_customer_vat_number($context = 'view') {
1240
+		return $this->get_vat_number($context);
1241 1241
     }
1242 1242
 
1243 1243
     /**
@@ -1247,8 +1247,8 @@  discard block
 block discarded – undo
1247 1247
 	 * @param  string $context View or edit context.
1248 1248
 	 * @return string
1249 1249
 	 */
1250
-	public function get_vat_rate( $context = 'view' ) {
1251
-		return $this->get_prop( 'vat_rate', $context );
1250
+	public function get_vat_rate($context = 'view') {
1251
+		return $this->get_prop('vat_rate', $context);
1252 1252
     }
1253 1253
 
1254 1254
     /**
@@ -1258,8 +1258,8 @@  discard block
 block discarded – undo
1258 1258
 	 * @param  string $context View or edit context.
1259 1259
 	 * @return string
1260 1260
 	 */
1261
-	public function get_user_vat_rate( $context = 'view' ) {
1262
-		return $this->get_vat_rate( $context );
1261
+	public function get_user_vat_rate($context = 'view') {
1262
+		return $this->get_vat_rate($context);
1263 1263
     }
1264 1264
 
1265 1265
     /**
@@ -1269,8 +1269,8 @@  discard block
 block discarded – undo
1269 1269
 	 * @param  string $context View or edit context.
1270 1270
 	 * @return string
1271 1271
 	 */
1272
-	public function get_customer_vat_rate( $context = 'view' ) {
1273
-		return $this->get_vat_rate( $context );
1272
+	public function get_customer_vat_rate($context = 'view') {
1273
+		return $this->get_vat_rate($context);
1274 1274
     }
1275 1275
 
1276 1276
     /**
@@ -1280,8 +1280,8 @@  discard block
 block discarded – undo
1280 1280
 	 * @param  string $context View or edit context.
1281 1281
 	 * @return string
1282 1282
 	 */
1283
-	public function get_address( $context = 'view' ) {
1284
-		return $this->get_prop( 'address', $context );
1283
+	public function get_address($context = 'view') {
1284
+		return $this->get_prop('address', $context);
1285 1285
     }
1286 1286
 
1287 1287
     /**
@@ -1291,8 +1291,8 @@  discard block
 block discarded – undo
1291 1291
 	 * @param  string $context View or edit context.
1292 1292
 	 * @return string
1293 1293
 	 */
1294
-	public function get_user_address( $context = 'view' ) {
1295
-		return $this->get_address( $context );
1294
+	public function get_user_address($context = 'view') {
1295
+		return $this->get_address($context);
1296 1296
     }
1297 1297
 
1298 1298
     /**
@@ -1302,8 +1302,8 @@  discard block
 block discarded – undo
1302 1302
 	 * @param  string $context View or edit context.
1303 1303
 	 * @return string
1304 1304
 	 */
1305
-	public function get_customer_address( $context = 'view' ) {
1306
-		return $this->get_address( $context );
1305
+	public function get_customer_address($context = 'view') {
1306
+		return $this->get_address($context);
1307 1307
     }
1308 1308
 
1309 1309
     /**
@@ -1313,8 +1313,8 @@  discard block
 block discarded – undo
1313 1313
 	 * @param  string $context View or edit context.
1314 1314
 	 * @return bool
1315 1315
 	 */
1316
-	public function get_is_viewed( $context = 'view' ) {
1317
-		return (bool) $this->get_prop( 'is_viewed', $context );
1316
+	public function get_is_viewed($context = 'view') {
1317
+		return (bool) $this->get_prop('is_viewed', $context);
1318 1318
 	}
1319 1319
 
1320 1320
 	/**
@@ -1324,8 +1324,8 @@  discard block
 block discarded – undo
1324 1324
 	 * @param  string $context View or edit context.
1325 1325
 	 * @return bool
1326 1326
 	 */
1327
-	public function get_email_cc( $context = 'view' ) {
1328
-		return $this->get_prop( 'email_cc', $context );
1327
+	public function get_email_cc($context = 'view') {
1328
+		return $this->get_prop('email_cc', $context);
1329 1329
 	}
1330 1330
 
1331 1331
 	/**
@@ -1335,8 +1335,8 @@  discard block
 block discarded – undo
1335 1335
 	 * @param  string $context View or edit context.
1336 1336
 	 * @return bool
1337 1337
 	 */
1338
-	public function get_template( $context = 'view' ) {
1339
-		return $this->get_prop( 'template', $context );
1338
+	public function get_template($context = 'view') {
1339
+		return $this->get_prop('template', $context);
1340 1340
 	}
1341 1341
 
1342 1342
 	/**
@@ -1346,8 +1346,8 @@  discard block
 block discarded – undo
1346 1346
 	 * @param  string $context View or edit context.
1347 1347
 	 * @return bool
1348 1348
 	 */
1349
-	public function get_created_via( $context = 'view' ) {
1350
-		return $this->get_prop( 'created_via', $context );
1349
+	public function get_created_via($context = 'view') {
1350
+		return $this->get_prop('created_via', $context);
1351 1351
 	}
1352 1352
 
1353 1353
 	/**
@@ -1357,8 +1357,8 @@  discard block
 block discarded – undo
1357 1357
 	 * @param  string $context View or edit context.
1358 1358
 	 * @return bool
1359 1359
 	 */
1360
-	public function get_address_confirmed( $context = 'view' ) {
1361
-		return (bool) $this->get_prop( 'address_confirmed', $context );
1360
+	public function get_address_confirmed($context = 'view') {
1361
+		return (bool) $this->get_prop('address_confirmed', $context);
1362 1362
     }
1363 1363
 
1364 1364
     /**
@@ -1368,8 +1368,8 @@  discard block
 block discarded – undo
1368 1368
 	 * @param  string $context View or edit context.
1369 1369
 	 * @return bool
1370 1370
 	 */
1371
-	public function get_user_address_confirmed( $context = 'view' ) {
1372
-		return $this->get_address_confirmed( $context );
1371
+	public function get_user_address_confirmed($context = 'view') {
1372
+		return $this->get_address_confirmed($context);
1373 1373
     }
1374 1374
 
1375 1375
     /**
@@ -1379,8 +1379,8 @@  discard block
 block discarded – undo
1379 1379
 	 * @param  string $context View or edit context.
1380 1380
 	 * @return bool
1381 1381
 	 */
1382
-	public function get_customer_address_confirmed( $context = 'view' ) {
1383
-		return $this->get_address_confirmed( $context );
1382
+	public function get_customer_address_confirmed($context = 'view') {
1383
+		return $this->get_address_confirmed($context);
1384 1384
     }
1385 1385
 
1386 1386
 	/**
@@ -1391,8 +1391,8 @@  discard block
 block discarded – undo
1391 1391
 	 */
1392 1392
 	public function get_shipping_address() {
1393 1393
 
1394
-		$shipping_address = get_post_meta( $this->get_id(), 'shipping_address', true );
1395
-		return is_array( $shipping_address ) ? $shipping_address : false;
1394
+		$shipping_address = get_post_meta($this->get_id(), 'shipping_address', true);
1395
+		return is_array($shipping_address) ? $shipping_address : false;
1396 1396
     }
1397 1397
 
1398 1398
 	/**
@@ -1409,17 +1409,17 @@  discard block
 block discarded – undo
1409 1409
 	 * @param  string $context View or edit context.
1410 1410
 	 * @return float
1411 1411
 	 */
1412
-	public function get_shipping( $context = 'view' ) {
1412
+	public function get_shipping($context = 'view') {
1413 1413
 
1414
-		if ( $context = 'view' ) {
1415
-			return floatval( $this->get_prop( 'shipping', $context ) );
1414
+		if ($context = 'view') {
1415
+			return floatval($this->get_prop('shipping', $context));
1416 1416
 		}
1417 1417
 
1418
-		return $this->get_prop( 'shipping', $context );
1418
+		return $this->get_prop('shipping', $context);
1419 1419
     }
1420 1420
 
1421 1421
 	public function has_shipping() {
1422
-		return defined( 'GETPAID_SHIPPING_CALCULATOR_VERSION' ) && $this->get_prop( 'shipping', 'edit' );
1422
+		return defined('GETPAID_SHIPPING_CALCULATOR_VERSION') && $this->get_prop('shipping', 'edit');
1423 1423
     }
1424 1424
 
1425 1425
     /**
@@ -1429,12 +1429,12 @@  discard block
 block discarded – undo
1429 1429
 	 * @param  string $context View or edit context.
1430 1430
 	 * @return float
1431 1431
 	 */
1432
-	public function get_subtotal( $context = 'view' ) {
1433
-        $subtotal = (float) $this->get_prop( 'subtotal', $context );
1432
+	public function get_subtotal($context = 'view') {
1433
+        $subtotal = (float) $this->get_prop('subtotal', $context);
1434 1434
 
1435 1435
         // Backwards compatibility.
1436
-        if ( is_bool( $context ) && $context ) {
1437
-            return wpinv_price( $subtotal, $this->get_currency() );
1436
+        if (is_bool($context) && $context) {
1437
+            return wpinv_price($subtotal, $this->get_currency());
1438 1438
         }
1439 1439
 
1440 1440
         return $subtotal;
@@ -1447,8 +1447,8 @@  discard block
 block discarded – undo
1447 1447
 	 * @param  string $context View or edit context.
1448 1448
 	 * @return float
1449 1449
 	 */
1450
-	public function get_total_discount( $context = 'view' ) {
1451
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_discount', $context ) ) );
1450
+	public function get_total_discount($context = 'view') {
1451
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_discount', $context)));
1452 1452
     }
1453 1453
 
1454 1454
     /**
@@ -1458,18 +1458,18 @@  discard block
 block discarded – undo
1458 1458
 	 * @param  string $context View or edit context.
1459 1459
 	 * @return float
1460 1460
 	 */
1461
-	public function get_total_tax( $context = 'view' ) {
1462
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_tax', $context ) ) );
1461
+	public function get_total_tax($context = 'view') {
1462
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_tax', $context)));
1463 1463
 	}
1464 1464
 
1465 1465
 	/**
1466 1466
 	 * @deprecated
1467 1467
 	 */
1468
-	public function get_final_tax( $currency = false ) {
1468
+	public function get_final_tax($currency = false) {
1469 1469
 		$tax = $this->get_total_tax();
1470 1470
 
1471
-        if ( $currency ) {
1472
-			return wpinv_price( $tax, $this->get_currency() );
1471
+        if ($currency) {
1472
+			return wpinv_price($tax, $this->get_currency());
1473 1473
         }
1474 1474
 
1475 1475
         return $tax;
@@ -1482,8 +1482,8 @@  discard block
 block discarded – undo
1482 1482
 	 * @param  string $context View or edit context.
1483 1483
 	 * @return float
1484 1484
 	 */
1485
-	public function get_total_fees( $context = 'view' ) {
1486
-		return wpinv_round_amount( wpinv_sanitize_amount( $this->get_prop( 'total_fees', $context ) ) );
1485
+	public function get_total_fees($context = 'view') {
1486
+		return wpinv_round_amount(wpinv_sanitize_amount($this->get_prop('total_fees', $context)));
1487 1487
     }
1488 1488
 
1489 1489
     /**
@@ -1493,8 +1493,8 @@  discard block
 block discarded – undo
1493 1493
 	 * @param  string $context View or edit context.
1494 1494
 	 * @return float
1495 1495
 	 */
1496
-	public function get_fees_total( $context = 'view' ) {
1497
-		return $this->get_total_fees( $context );
1496
+	public function get_fees_total($context = 'view') {
1497
+		return $this->get_total_fees($context);
1498 1498
     }
1499 1499
 
1500 1500
     /**
@@ -1503,14 +1503,14 @@  discard block
 block discarded – undo
1503 1503
 	 * @since 1.0.19
1504 1504
      * @return float
1505 1505
 	 */
1506
-	public function get_total( $context = 'view' ) {
1507
-		$total = $this->get_prop( 'total', $context );
1506
+	public function get_total($context = 'view') {
1507
+		$total = $this->get_prop('total', $context);
1508 1508
 
1509
-		if ( $this->has_shipping() && $context == 'view' ) {
1510
-			$total = $this->get_prop( 'total', $context ) + $this->get_shipping( $context );
1509
+		if ($this->has_shipping() && $context == 'view') {
1510
+			$total = $this->get_prop('total', $context) + $this->get_shipping($context);
1511 1511
 		}
1512 1512
 
1513
-		return wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1513
+		return wpinv_round_amount(wpinv_sanitize_amount($total));
1514 1514
 	}
1515 1515
 
1516 1516
 	/**
@@ -1522,20 +1522,20 @@  discard block
 block discarded – undo
1522 1522
 	public function get_non_recurring_total() {
1523 1523
 
1524 1524
 		$subtotal = 0;
1525
-		foreach ( $this->get_items() as $item ) {
1526
-			if ( ! $item->is_recurring() ) {
1525
+		foreach ($this->get_items() as $item) {
1526
+			if (!$item->is_recurring()) {
1527 1527
 				$subtotal += $item->get_sub_total();
1528 1528
 			}
1529 1529
 		}
1530 1530
 
1531
-		foreach ( $this->get_fees() as $fee ) {
1532
-			if ( empty( $fee['recurring_fee'] ) ) {
1533
-				$subtotal += wpinv_sanitize_amount( $fee['initial_fee'] );
1531
+		foreach ($this->get_fees() as $fee) {
1532
+			if (empty($fee['recurring_fee'])) {
1533
+				$subtotal += wpinv_sanitize_amount($fee['initial_fee']);
1534 1534
 			}
1535 1535
 		}
1536 1536
 
1537
-		$subtotal = wpinv_round_amount( wpinv_sanitize_amount( $subtotal ) );
1538
-        return apply_filters( 'wpinv_get_non_recurring_invoice_total', $subtotal, $this );
1537
+		$subtotal = wpinv_round_amount(wpinv_sanitize_amount($subtotal));
1538
+        return apply_filters('wpinv_get_non_recurring_invoice_total', $subtotal, $this);
1539 1539
 
1540 1540
     }
1541 1541
 
@@ -1558,7 +1558,7 @@  discard block
 block discarded – undo
1558 1558
 	 */
1559 1559
     public function get_initial_total() {
1560 1560
 
1561
-		if ( empty( $this->totals ) ) {
1561
+		if (empty($this->totals)) {
1562 1562
 			$this->recalculate_total();
1563 1563
 		}
1564 1564
 
@@ -1568,12 +1568,12 @@  discard block
 block discarded – undo
1568 1568
 		$subtotal = $this->totals['subtotal']['initial'];
1569 1569
 		$total    = $tax + $fee - $discount + $subtotal;
1570 1570
 
1571
-		if ( 0 > $total ) {
1571
+		if (0 > $total) {
1572 1572
 			$total = 0;
1573 1573
 		}
1574 1574
 
1575
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1576
-        return apply_filters( 'wpinv_get_initial_invoice_total', $total, $this );
1575
+		$total = wpinv_round_amount(wpinv_sanitize_amount($total));
1576
+        return apply_filters('wpinv_get_initial_invoice_total', $total, $this);
1577 1577
 	}
1578 1578
 
1579 1579
 	/**
@@ -1585,7 +1585,7 @@  discard block
 block discarded – undo
1585 1585
 	 */
1586 1586
     public function get_recurring_total() {
1587 1587
 
1588
-		if ( empty( $this->totals ) ) {
1588
+		if (empty($this->totals)) {
1589 1589
 			$this->recalculate_total();
1590 1590
 		}
1591 1591
 
@@ -1595,12 +1595,12 @@  discard block
 block discarded – undo
1595 1595
 		$subtotal = $this->totals['subtotal']['recurring'];
1596 1596
 		$total    = $tax + $fee - $discount + $subtotal;
1597 1597
 
1598
-		if ( 0 > $total ) {
1598
+		if (0 > $total) {
1599 1599
 			$total = 0;
1600 1600
 		}
1601 1601
 
1602
-		$total = wpinv_round_amount( wpinv_sanitize_amount( $total ) );
1603
-        return apply_filters( 'wpinv_get_recurring_invoice_total', $total, $this );
1602
+		$total = wpinv_round_amount(wpinv_sanitize_amount($total));
1603
+        return apply_filters('wpinv_get_recurring_invoice_total', $total, $this);
1604 1604
 	}
1605 1605
 
1606 1606
 	/**
@@ -1611,10 +1611,10 @@  discard block
 block discarded – undo
1611 1611
 	 * @param string $currency Whether to include the currency.
1612 1612
      * @return float|string
1613 1613
 	 */
1614
-    public function get_recurring_details( $field = '', $currency = false ) {
1614
+    public function get_recurring_details($field = '', $currency = false) {
1615 1615
 
1616 1616
 		// Maybe recalculate totals.
1617
-		if ( empty( $this->totals ) ) {
1617
+		if (empty($this->totals)) {
1618 1618
 			$this->recalculate_total();
1619 1619
 		}
1620 1620
 
@@ -1634,8 +1634,8 @@  discard block
 block discarded – undo
1634 1634
 			$currency
1635 1635
 		);
1636 1636
 
1637
-        if ( isset( $data[ $field ] ) ) {
1638
-            return ( $currency ? wpinv_price( $data[ $field ], $this->get_currency() ) : $data[ $field ] );
1637
+        if (isset($data[$field])) {
1638
+            return ($currency ? wpinv_price($data[$field], $this->get_currency()) : $data[$field]);
1639 1639
         }
1640 1640
 
1641 1641
         return $data;
@@ -1648,8 +1648,8 @@  discard block
 block discarded – undo
1648 1648
 	 * @param  string $context View or edit context.
1649 1649
 	 * @return array
1650 1650
 	 */
1651
-	public function get_fees( $context = 'view' ) {
1652
-		return wpinv_parse_list( $this->get_prop( 'fees', $context ) );
1651
+	public function get_fees($context = 'view') {
1652
+		return wpinv_parse_list($this->get_prop('fees', $context));
1653 1653
     }
1654 1654
 
1655 1655
     /**
@@ -1659,8 +1659,8 @@  discard block
 block discarded – undo
1659 1659
 	 * @param  string $context View or edit context.
1660 1660
 	 * @return array
1661 1661
 	 */
1662
-	public function get_discounts( $context = 'view' ) {
1663
-		return wpinv_parse_list( $this->get_prop( 'discounts', $context ) );
1662
+	public function get_discounts($context = 'view') {
1663
+		return wpinv_parse_list($this->get_prop('discounts', $context));
1664 1664
     }
1665 1665
 
1666 1666
     /**
@@ -1670,8 +1670,8 @@  discard block
 block discarded – undo
1670 1670
 	 * @param  string $context View or edit context.
1671 1671
 	 * @return array
1672 1672
 	 */
1673
-	public function get_taxes( $context = 'view' ) {
1674
-		return wpinv_parse_list( $this->get_prop( 'taxes', $context ) );
1673
+	public function get_taxes($context = 'view') {
1674
+		return wpinv_parse_list($this->get_prop('taxes', $context));
1675 1675
     }
1676 1676
 
1677 1677
     /**
@@ -1681,8 +1681,8 @@  discard block
 block discarded – undo
1681 1681
 	 * @param  string $context View or edit context.
1682 1682
 	 * @return GetPaid_Form_Item[]
1683 1683
 	 */
1684
-	public function get_items( $context = 'view' ) {
1685
-        return $this->get_prop( 'items', $context );
1684
+	public function get_items($context = 'view') {
1685
+        return $this->get_prop('items', $context);
1686 1686
 	}
1687 1687
 
1688 1688
 	/**
@@ -1692,7 +1692,7 @@  discard block
 block discarded – undo
1692 1692
 	 * @return string
1693 1693
 	 */
1694 1694
 	public function get_item_ids() {
1695
-		return implode( ', ', wp_list_pluck( $this->get_cart_details(), 'item_id' ) );
1695
+		return implode(', ', wp_list_pluck($this->get_cart_details(), 'item_id'));
1696 1696
     }
1697 1697
 
1698 1698
     /**
@@ -1702,8 +1702,8 @@  discard block
 block discarded – undo
1702 1702
 	 * @param  string $context View or edit context.
1703 1703
 	 * @return int
1704 1704
 	 */
1705
-	public function get_payment_form( $context = 'view' ) {
1706
-		return intval( $this->get_prop( 'payment_form', $context ) );
1705
+	public function get_payment_form($context = 'view') {
1706
+		return intval($this->get_prop('payment_form', $context));
1707 1707
     }
1708 1708
 
1709 1709
     /**
@@ -1713,8 +1713,8 @@  discard block
 block discarded – undo
1713 1713
 	 * @param  string $context View or edit context.
1714 1714
 	 * @return string
1715 1715
 	 */
1716
-	public function get_submission_id( $context = 'view' ) {
1717
-		return $this->get_prop( 'submission_id', $context );
1716
+	public function get_submission_id($context = 'view') {
1717
+		return $this->get_prop('submission_id', $context);
1718 1718
     }
1719 1719
 
1720 1720
     /**
@@ -1724,8 +1724,8 @@  discard block
 block discarded – undo
1724 1724
 	 * @param  string $context View or edit context.
1725 1725
 	 * @return string
1726 1726
 	 */
1727
-	public function get_discount_code( $context = 'view' ) {
1728
-		return $this->get_prop( 'discount_code', $context );
1727
+	public function get_discount_code($context = 'view') {
1728
+		return $this->get_prop('discount_code', $context);
1729 1729
     }
1730 1730
 
1731 1731
     /**
@@ -1735,8 +1735,8 @@  discard block
 block discarded – undo
1735 1735
 	 * @param  string $context View or edit context.
1736 1736
 	 * @return string
1737 1737
 	 */
1738
-	public function get_gateway( $context = 'view' ) {
1739
-		return $this->get_prop( 'gateway', $context );
1738
+	public function get_gateway($context = 'view') {
1739
+		return $this->get_prop('gateway', $context);
1740 1740
     }
1741 1741
 
1742 1742
     /**
@@ -1746,8 +1746,8 @@  discard block
 block discarded – undo
1746 1746
 	 * @return string
1747 1747
 	 */
1748 1748
     public function get_gateway_title() {
1749
-        $title = wpinv_get_gateway_checkout_label( $this->get_gateway() );
1750
-        return apply_filters( 'wpinv_gateway_title', $title, $this->get_id(), $this );
1749
+        $title = wpinv_get_gateway_checkout_label($this->get_gateway());
1750
+        return apply_filters('wpinv_gateway_title', $title, $this->get_id(), $this);
1751 1751
     }
1752 1752
 
1753 1753
     /**
@@ -1757,8 +1757,8 @@  discard block
 block discarded – undo
1757 1757
 	 * @param  string $context View or edit context.
1758 1758
 	 * @return string
1759 1759
 	 */
1760
-	public function get_transaction_id( $context = 'view' ) {
1761
-		return $this->get_prop( 'transaction_id', $context );
1760
+	public function get_transaction_id($context = 'view') {
1761
+		return $this->get_prop('transaction_id', $context);
1762 1762
     }
1763 1763
 
1764 1764
     /**
@@ -1768,9 +1768,9 @@  discard block
 block discarded – undo
1768 1768
 	 * @param  string $context View or edit context.
1769 1769
 	 * @return string
1770 1770
 	 */
1771
-	public function get_currency( $context = 'view' ) {
1772
-        $currency = $this->get_prop( 'currency', $context );
1773
-        return empty( $currency ) ? wpinv_get_currency() : $currency;
1771
+	public function get_currency($context = 'view') {
1772
+        $currency = $this->get_prop('currency', $context);
1773
+        return empty($currency) ? wpinv_get_currency() : $currency;
1774 1774
     }
1775 1775
 
1776 1776
     /**
@@ -1780,8 +1780,8 @@  discard block
 block discarded – undo
1780 1780
 	 * @param  string $context View or edit context.
1781 1781
 	 * @return bool
1782 1782
 	 */
1783
-	public function get_disable_taxes( $context = 'view' ) {
1784
-        return (bool) $this->get_prop( 'disable_taxes', $context );
1783
+	public function get_disable_taxes($context = 'view') {
1784
+        return (bool) $this->get_prop('disable_taxes', $context);
1785 1785
     }
1786 1786
 
1787 1787
     /**
@@ -1791,8 +1791,8 @@  discard block
 block discarded – undo
1791 1791
 	 * @param  string $context View or edit context.
1792 1792
 	 * @return int
1793 1793
 	 */
1794
-    public function get_subscription_id( $context = 'view' ) {
1795
-		return $this->is_renewal() ? $this->get_parent()->get_subscription_id( $context ) : $this->get_prop( 'subscription_id', $context );
1794
+    public function get_subscription_id($context = 'view') {
1795
+		return $this->is_renewal() ? $this->get_parent()->get_subscription_id($context) : $this->get_prop('subscription_id', $context);
1796 1796
 	}
1797 1797
 
1798 1798
 	/**
@@ -1802,12 +1802,12 @@  discard block
 block discarded – undo
1802 1802
 	 * @param  string $context View or edit context.
1803 1803
 	 * @return int
1804 1804
 	 */
1805
-    public function get_remote_subscription_id( $context = 'view' ) {
1806
-        $subscription_id = $this->get_prop( 'remote_subscription_id', $context );
1805
+    public function get_remote_subscription_id($context = 'view') {
1806
+        $subscription_id = $this->get_prop('remote_subscription_id', $context);
1807 1807
 
1808
-        if ( empty( $subscription_id ) && $this->is_renewal() ) {
1808
+        if (empty($subscription_id) && $this->is_renewal()) {
1809 1809
             $parent = $this->get_parent();
1810
-            return $parent->get_remote_subscription_id( $context );
1810
+            return $parent->get_remote_subscription_id($context);
1811 1811
         }
1812 1812
 
1813 1813
         return $subscription_id;
@@ -1820,8 +1820,8 @@  discard block
 block discarded – undo
1820 1820
 	 * @param  string $context View or edit context.
1821 1821
 	 * @return string
1822 1822
 	 */
1823
-	public function get_is_anonymized( $context = 'view' ) {
1824
-		return (bool) $this->get_prop( 'is_anonymized', $context );
1823
+	public function get_is_anonymized($context = 'view') {
1824
+		return (bool) $this->get_prop('is_anonymized', $context);
1825 1825
     }
1826 1826
 
1827 1827
     /**
@@ -1831,20 +1831,20 @@  discard block
 block discarded – undo
1831 1831
 	 * @param  string $context View or edit context.
1832 1832
 	 * @return array
1833 1833
 	 */
1834
-    public function get_payment_meta( $context = 'view' ) {
1834
+    public function get_payment_meta($context = 'view') {
1835 1835
 
1836 1836
         return array(
1837
-            'price'        => $this->get_total( $context ),
1838
-            'date'         => $this->get_date_created( $context ),
1839
-            'user_email'   => $this->get_email( $context ),
1840
-            'invoice_key'  => $this->get_key( $context ),
1841
-            'currency'     => $this->get_currency( $context ),
1842
-            'items'        => $this->get_items( $context ),
1843
-            'user_info'    => $this->get_user_info( $context ),
1837
+            'price'        => $this->get_total($context),
1838
+            'date'         => $this->get_date_created($context),
1839
+            'user_email'   => $this->get_email($context),
1840
+            'invoice_key'  => $this->get_key($context),
1841
+            'currency'     => $this->get_currency($context),
1842
+            'items'        => $this->get_items($context),
1843
+            'user_info'    => $this->get_user_info($context),
1844 1844
             'cart_details' => $this->get_cart_details(),
1845
-            'status'       => $this->get_status( $context ),
1846
-            'fees'         => $this->get_fees( $context ),
1847
-            'taxes'        => $this->get_taxes( $context ),
1845
+            'status'       => $this->get_status($context),
1846
+            'fees'         => $this->get_fees($context),
1847
+            'taxes'        => $this->get_taxes($context),
1848 1848
         );
1849 1849
 
1850 1850
     }
@@ -1859,9 +1859,9 @@  discard block
 block discarded – undo
1859 1859
         $items        = $this->get_items();
1860 1860
         $cart_details = array();
1861 1861
 
1862
-        foreach ( $items as $item ) {
1862
+        foreach ($items as $item) {
1863 1863
 			$item->invoice_id = $this->get_id();
1864
-            $cart_details[]   = $item->prepare_data_for_saving();
1864
+            $cart_details[] = $item->prepare_data_for_saving();
1865 1865
         }
1866 1866
 
1867 1867
         return $cart_details;
@@ -1872,11 +1872,11 @@  discard block
 block discarded – undo
1872 1872
 	 *
1873 1873
 	 * @return null|GetPaid_Form_Item|int
1874 1874
 	 */
1875
-	public function get_recurring( $object = false ) {
1875
+	public function get_recurring($object = false) {
1876 1876
 
1877 1877
 		// Are we returning an object?
1878
-        if ( $object ) {
1879
-            return $this->get_item( $this->recurring_item );
1878
+        if ($object) {
1879
+            return $this->get_item($this->recurring_item);
1880 1880
         }
1881 1881
 
1882 1882
         return $this->recurring_item;
@@ -1891,15 +1891,15 @@  discard block
 block discarded – undo
1891 1891
 	public function get_subscription_name() {
1892 1892
 
1893 1893
 		// Retrieve the recurring name
1894
-        $item = $this->get_recurring( true );
1894
+        $item = $this->get_recurring(true);
1895 1895
 
1896 1896
 		// Abort if it does not exist.
1897
-        if ( empty( $item ) ) {
1897
+        if (empty($item)) {
1898 1898
             return '';
1899 1899
         }
1900 1900
 
1901 1901
 		// Return the item name.
1902
-        return apply_filters( 'wpinv_invoice_get_subscription_name', $item->get_name(), $this );
1902
+        return apply_filters('wpinv_invoice_get_subscription_name', $item->get_name(), $this);
1903 1903
 	}
1904 1904
 
1905 1905
 	/**
@@ -1909,9 +1909,9 @@  discard block
 block discarded – undo
1909 1909
 	 * @return string
1910 1910
 	 */
1911 1911
 	public function get_view_url() {
1912
-        $invoice_url = get_permalink( $this->get_id() );
1913
-		$invoice_url = add_query_arg( 'invoice_key', $this->get_key(), $invoice_url );
1914
-        return apply_filters( 'wpinv_get_view_url', $invoice_url, $this );
1912
+        $invoice_url = get_permalink($this->get_id());
1913
+		$invoice_url = add_query_arg('invoice_key', $this->get_key(), $invoice_url);
1914
+        return apply_filters('wpinv_get_view_url', $invoice_url, $this);
1915 1915
 	}
1916 1916
 
1917 1917
 	/**
@@ -1920,25 +1920,25 @@  discard block
 block discarded – undo
1920 1920
 	 * @since 1.0.19
1921 1921
 	 * @return string
1922 1922
 	 */
1923
-	public function get_checkout_payment_url( $deprecated = false, $secret = false ) {
1923
+	public function get_checkout_payment_url($deprecated = false, $secret = false) {
1924 1924
 
1925 1925
 		// Retrieve the checkout url.
1926 1926
         $pay_url = wpinv_get_checkout_uri();
1927 1927
 
1928 1928
 		// Maybe force ssl.
1929
-        if ( is_ssl() ) {
1930
-            $pay_url = str_replace( 'http:', 'https:', $pay_url );
1929
+        if (is_ssl()) {
1930
+            $pay_url = str_replace('http:', 'https:', $pay_url);
1931 1931
         }
1932 1932
 
1933 1933
 		// Add the invoice key.
1934
-		$pay_url = add_query_arg( 'invoice_key', $this->get_key(), $pay_url );
1934
+		$pay_url = add_query_arg('invoice_key', $this->get_key(), $pay_url);
1935 1935
 
1936 1936
 		// (Maybe?) add a secret
1937
-        if ( $secret ) {
1938
-            $pay_url = add_query_arg( array( '_wpipay' => md5( $this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key() ) ), $pay_url );
1937
+        if ($secret) {
1938
+            $pay_url = add_query_arg(array('_wpipay' => md5($this->get_user_id() . '::' . $this->get_email() . '::' . $this->get_key())), $pay_url);
1939 1939
         }
1940 1940
 
1941
-        return apply_filters( 'wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret );
1941
+        return apply_filters('wpinv_get_checkout_payment_url', $pay_url, $this, $deprecated, $secret);
1942 1942
 	}
1943 1943
 
1944 1944
 	/**
@@ -1953,14 +1953,14 @@  discard block
 block discarded – undo
1953 1953
         $receipt_url = wpinv_get_success_page_uri();
1954 1954
 
1955 1955
 		// Maybe force ssl.
1956
-        if ( is_ssl() ) {
1957
-            $receipt_url = str_replace( 'http:', 'https:', $receipt_url );
1956
+        if (is_ssl()) {
1957
+            $receipt_url = str_replace('http:', 'https:', $receipt_url);
1958 1958
         }
1959 1959
 
1960 1960
 		// Add the invoice key.
1961
-		$receipt_url = add_query_arg( 'invoice_key', $this->get_key(), $receipt_url );
1961
+		$receipt_url = add_query_arg('invoice_key', $this->get_key(), $receipt_url);
1962 1962
 
1963
-        return apply_filters( 'getpaid_get_invoice_receipt_url', $receipt_url, $this );
1963
+        return apply_filters('getpaid_get_invoice_receipt_url', $receipt_url, $this);
1964 1964
 	}
1965 1965
 
1966 1966
 	/**
@@ -1970,7 +1970,7 @@  discard block
 block discarded – undo
1970 1970
 	 * @return string
1971 1971
 	 */
1972 1972
 	public function get_transaction_url() {
1973
-		return apply_filters( 'getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this );
1973
+		return apply_filters('getpaid_gateway_' . $this->get_gateway() . '_transaction_url', '', $this);
1974 1974
 	}
1975 1975
 
1976 1976
 	/**
@@ -1983,7 +1983,7 @@  discard block
 block discarded – undo
1983 1983
 
1984 1984
 		$type   = $this->get_type();
1985 1985
 		$status = "wpi-$type-pending";
1986
-		return str_replace( '-invoice', '', $status );
1986
+		return str_replace('-invoice', '', $status);
1987 1987
 
1988 1988
 	}
1989 1989
 
@@ -1997,14 +1997,14 @@  discard block
 block discarded – undo
1997 1997
 	 * @param  string $context View or edit context.
1998 1998
 	 * @return mixed Value of the given invoice property (if set).
1999 1999
 	 */
2000
-	public function get( $key, $context = 'view' ) {
2000
+	public function get($key, $context = 'view') {
2001 2001
 		$method = "get_$key";
2002 2002
 
2003
-		if ( is_callable( array( $this, $method ) ) ) {
2004
-			return $this->$method( $context );
2003
+		if (is_callable(array($this, $method))) {
2004
+			return $this->$method($context);
2005 2005
 		}
2006 2006
 
2007
-        return $this->get_prop( $key, $context );
2007
+        return $this->get_prop($key, $context);
2008 2008
 	}
2009 2009
 
2010 2010
     /*
@@ -2027,11 +2027,11 @@  discard block
 block discarded – undo
2027 2027
 	 * @param  mixed $value new value.
2028 2028
 	 * @return mixed Value of the given invoice property (if set).
2029 2029
 	 */
2030
-	public function set( $key, $value ) {
2030
+	public function set($key, $value) {
2031 2031
 
2032 2032
         $setter = "set_$key";
2033
-        if ( is_callable( array( $this, $setter ) ) ) {
2034
-            $this->{$setter}( $value );
2033
+        if (is_callable(array($this, $setter))) {
2034
+            $this->{$setter}($value);
2035 2035
         }
2036 2036
 
2037 2037
 	}
@@ -2045,45 +2045,45 @@  discard block
 block discarded – undo
2045 2045
 	 * @param bool   $manual_update Is this a manual status change?.
2046 2046
 	 * @return array details of change.
2047 2047
 	 */
2048
-	public function set_status( $new_status, $note = '', $manual_update = false ) {
2048
+	public function set_status($new_status, $note = '', $manual_update = false) {
2049 2049
 		$old_status = $this->get_status();
2050 2050
 
2051 2051
 		$statuses = $this->get_all_statuses();
2052 2052
 
2053
-		if ( isset( $statuses['draft'] ) ) {
2054
-			unset( $statuses['draft'] );
2053
+		if (isset($statuses['draft'])) {
2054
+			unset($statuses['draft']);
2055 2055
 		}
2056 2056
 
2057
-		$this->set_prop( 'status', $new_status );
2057
+		$this->set_prop('status', $new_status);
2058 2058
 
2059 2059
 		// If setting the status, ensure it's set to a valid status.
2060
-		if ( true === $this->object_read ) {
2060
+		if (true === $this->object_read) {
2061 2061
 
2062 2062
 			// Only allow valid new status.
2063
-			if ( ! array_key_exists( $new_status, $statuses ) ) {
2063
+			if (!array_key_exists($new_status, $statuses)) {
2064 2064
 				$new_status = $this->get_default_status();
2065 2065
 			}
2066 2066
 
2067 2067
 			// If the old status is set but unknown (e.g. draft) assume its pending for action usage.
2068
-			if ( $old_status && ! array_key_exists( $new_status, $statuses ) ) {
2068
+			if ($old_status && !array_key_exists($new_status, $statuses)) {
2069 2069
 				$old_status = $this->get_default_status();
2070 2070
 			}
2071 2071
 
2072 2072
 			// Paid - Renewal (i.e when duplicating a parent invoice )
2073
-			if ( $new_status == 'wpi-pending' && $old_status == 'publish' && ! $this->get_id() ) {
2073
+			if ($new_status == 'wpi-pending' && $old_status == 'publish' && !$this->get_id()) {
2074 2074
 				$old_status = 'wpi-pending';
2075 2075
 			}
2076 2076
 
2077
-			if ( $old_status !== $new_status ) {
2077
+			if ($old_status !== $new_status) {
2078 2078
 				$this->status_transition = array(
2079
-					'from'   => ! empty( $this->status_transition['from'] ) ? $this->status_transition['from'] : $old_status,
2079
+					'from'   => !empty($this->status_transition['from']) ? $this->status_transition['from'] : $old_status,
2080 2080
 					'to'     => $new_status,
2081 2081
 					'note'   => $note,
2082 2082
 					'manual' => (bool) $manual_update,
2083 2083
 				);
2084 2084
 
2085
-				if ( $manual_update ) {
2086
-					do_action( 'getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status );
2085
+				if ($manual_update) {
2086
+					do_action('getpaid_' . $this->object_type . '_edit_status', $this->get_id(), $new_status);
2087 2087
 				}
2088 2088
 
2089 2089
 				$this->maybe_set_date_paid();
@@ -2107,8 +2107,8 @@  discard block
 block discarded – undo
2107 2107
 	 */
2108 2108
 	public function maybe_set_date_paid() {
2109 2109
 
2110
-		if ( ! $this->get_date_completed( 'edit' ) && $this->is_paid() ) {
2111
-			$this->set_date_completed( current_time( 'mysql' ) );
2110
+		if (!$this->get_date_completed('edit') && $this->is_paid()) {
2111
+			$this->set_date_completed(current_time('mysql'));
2112 2112
 		}
2113 2113
 	}
2114 2114
 
@@ -2117,11 +2117,11 @@  discard block
 block discarded – undo
2117 2117
 	 *
2118 2118
 	 * @since 1.0.19
2119 2119
 	 */
2120
-	public function set_parent_id( $value ) {
2121
-		if ( $value && ( $value === $this->get_id() ) ) {
2120
+	public function set_parent_id($value) {
2121
+		if ($value && ($value === $this->get_id())) {
2122 2122
 			return;
2123 2123
 		}
2124
-		$this->set_prop( 'parent_id', absint( $value ) );
2124
+		$this->set_prop('parent_id', absint($value));
2125 2125
     }
2126 2126
 
2127 2127
     /**
@@ -2129,8 +2129,8 @@  discard block
 block discarded – undo
2129 2129
 	 *
2130 2130
 	 * @since 1.0.19
2131 2131
 	 */
2132
-	public function set_version( $value ) {
2133
-		$this->set_prop( 'version', $value );
2132
+	public function set_version($value) {
2133
+		$this->set_prop('version', $value);
2134 2134
     }
2135 2135
 
2136 2136
     /**
@@ -2140,15 +2140,15 @@  discard block
 block discarded – undo
2140 2140
 	 * @param string $value Value to set.
2141 2141
      * @return bool Whether or not the date was set.
2142 2142
 	 */
2143
-	public function set_date_created( $value ) {
2144
-        $date = strtotime( $value );
2143
+	public function set_date_created($value) {
2144
+        $date = strtotime($value);
2145 2145
 
2146
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2147
-            $this->set_prop( 'date_created', date( 'Y-m-d H:i:s', $date ) );
2146
+        if ($date && $value !== '0000-00-00 00:00:00') {
2147
+            $this->set_prop('date_created', date('Y-m-d H:i:s', $date));
2148 2148
             return true;
2149 2149
         }
2150 2150
 
2151
-		$this->set_prop( 'date_created', '' );
2151
+		$this->set_prop('date_created', '');
2152 2152
 		return false;
2153 2153
 
2154 2154
     }
@@ -2160,15 +2160,15 @@  discard block
 block discarded – undo
2160 2160
 	 * @param string $value Value to set.
2161 2161
      * @return bool Whether or not the date was set.
2162 2162
 	 */
2163
-	public function set_due_date( $value ) {
2164
-        $date = strtotime( $value );
2163
+	public function set_due_date($value) {
2164
+        $date = strtotime($value);
2165 2165
 
2166
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2167
-            $this->set_prop( 'due_date', date( 'Y-m-d H:i:s', $date ) );
2166
+        if ($date && $value !== '0000-00-00 00:00:00') {
2167
+            $this->set_prop('due_date', date('Y-m-d H:i:s', $date));
2168 2168
             return true;
2169 2169
         }
2170 2170
 
2171
-		$this->set_prop( 'due_date', '' );
2171
+		$this->set_prop('due_date', '');
2172 2172
         return false;
2173 2173
 
2174 2174
     }
@@ -2179,8 +2179,8 @@  discard block
 block discarded – undo
2179 2179
 	 * @since 1.0.19
2180 2180
 	 * @param  string $value New name.
2181 2181
 	 */
2182
-	public function set_date_due( $value ) {
2183
-		$this->set_due_date( $value );
2182
+	public function set_date_due($value) {
2183
+		$this->set_due_date($value);
2184 2184
     }
2185 2185
 
2186 2186
     /**
@@ -2190,15 +2190,15 @@  discard block
 block discarded – undo
2190 2190
 	 * @param string $value Value to set.
2191 2191
      * @return bool Whether or not the date was set.
2192 2192
 	 */
2193
-	public function set_completed_date( $value ) {
2194
-        $date = strtotime( $value );
2193
+	public function set_completed_date($value) {
2194
+        $date = strtotime($value);
2195 2195
 
2196
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2197
-            $this->set_prop( 'completed_date', date( 'Y-m-d H:i:s', $date ) );
2196
+        if ($date && $value !== '0000-00-00 00:00:00') {
2197
+            $this->set_prop('completed_date', date('Y-m-d H:i:s', $date));
2198 2198
             return true;
2199 2199
         }
2200 2200
 
2201
-		$this->set_prop( 'completed_date', '' );
2201
+		$this->set_prop('completed_date', '');
2202 2202
         return false;
2203 2203
 
2204 2204
     }
@@ -2209,8 +2209,8 @@  discard block
 block discarded – undo
2209 2209
 	 * @since 1.0.19
2210 2210
 	 * @param  string $value New name.
2211 2211
 	 */
2212
-	public function set_date_completed( $value ) {
2213
-		$this->set_completed_date( $value );
2212
+	public function set_date_completed($value) {
2213
+		$this->set_completed_date($value);
2214 2214
     }
2215 2215
 
2216 2216
     /**
@@ -2220,15 +2220,15 @@  discard block
 block discarded – undo
2220 2220
 	 * @param string $value Value to set.
2221 2221
      * @return bool Whether or not the date was set.
2222 2222
 	 */
2223
-	public function set_date_modified( $value ) {
2224
-        $date = strtotime( $value );
2223
+	public function set_date_modified($value) {
2224
+        $date = strtotime($value);
2225 2225
 
2226
-        if ( $date && $value !== '0000-00-00 00:00:00' ) {
2227
-            $this->set_prop( 'date_modified', date( 'Y-m-d H:i:s', $date ) );
2226
+        if ($date && $value !== '0000-00-00 00:00:00') {
2227
+            $this->set_prop('date_modified', date('Y-m-d H:i:s', $date));
2228 2228
             return true;
2229 2229
         }
2230 2230
 
2231
-		$this->set_prop( 'date_modified', '' );
2231
+		$this->set_prop('date_modified', '');
2232 2232
         return false;
2233 2233
 
2234 2234
     }
@@ -2239,9 +2239,9 @@  discard block
 block discarded – undo
2239 2239
 	 * @since 1.0.19
2240 2240
 	 * @param  string $value New number.
2241 2241
 	 */
2242
-	public function set_number( $value ) {
2243
-        $number = sanitize_text_field( $value );
2244
-		$this->set_prop( 'number', $number );
2242
+	public function set_number($value) {
2243
+        $number = sanitize_text_field($value);
2244
+		$this->set_prop('number', $number);
2245 2245
     }
2246 2246
 
2247 2247
     /**
@@ -2250,9 +2250,9 @@  discard block
 block discarded – undo
2250 2250
 	 * @since 1.0.19
2251 2251
 	 * @param  string $value Type.
2252 2252
 	 */
2253
-	public function set_type( $value ) {
2254
-        $type = sanitize_text_field( str_replace( 'wpi_', '', $value ) );
2255
-		$this->set_prop( 'type', $type );
2253
+	public function set_type($value) {
2254
+        $type = sanitize_text_field(str_replace('wpi_', '', $value));
2255
+		$this->set_prop('type', $type);
2256 2256
 	}
2257 2257
 
2258 2258
     /**
@@ -2261,10 +2261,10 @@  discard block
 block discarded – undo
2261 2261
 	 * @since 1.0.19
2262 2262
 	 * @param  string $value Post type.
2263 2263
 	 */
2264
-	public function set_post_type( $value ) {
2265
-        if ( getpaid_is_invoice_post_type( $value ) ) {
2266
-			$this->set_type( $value );
2267
-            $this->set_prop( 'post_type', $value );
2264
+	public function set_post_type($value) {
2265
+        if (getpaid_is_invoice_post_type($value)) {
2266
+			$this->set_type($value);
2267
+            $this->set_prop('post_type', $value);
2268 2268
         }
2269 2269
     }
2270 2270
 
@@ -2274,9 +2274,9 @@  discard block
 block discarded – undo
2274 2274
 	 * @since 1.0.19
2275 2275
 	 * @param  string $value New key.
2276 2276
 	 */
2277
-	public function set_key( $value ) {
2278
-        $key = sanitize_text_field( $value );
2279
-		$this->set_prop( 'key', $key );
2277
+	public function set_key($value) {
2278
+        $key = sanitize_text_field($value);
2279
+		$this->set_prop('key', $key);
2280 2280
     }
2281 2281
 
2282 2282
     /**
@@ -2285,9 +2285,9 @@  discard block
 block discarded – undo
2285 2285
 	 * @since 1.0.19
2286 2286
 	 * @param  string $value mode.
2287 2287
 	 */
2288
-	public function set_mode( $value ) {
2289
-        if ( in_array( $value, array( 'live', 'test' ) ) ) {
2290
-            $this->set_prop( 'mode', $value );
2288
+	public function set_mode($value) {
2289
+        if (in_array($value, array('live', 'test'))) {
2290
+            $this->set_prop('mode', $value);
2291 2291
         }
2292 2292
     }
2293 2293
 
@@ -2297,8 +2297,8 @@  discard block
 block discarded – undo
2297 2297
 	 * @since 1.0.19
2298 2298
 	 * @param  string $value path.
2299 2299
 	 */
2300
-	public function set_path( $value ) {
2301
-        $this->set_prop( 'path', $value );
2300
+	public function set_path($value) {
2301
+        $this->set_prop('path', $value);
2302 2302
     }
2303 2303
 
2304 2304
     /**
@@ -2307,9 +2307,9 @@  discard block
 block discarded – undo
2307 2307
 	 * @since 1.0.19
2308 2308
 	 * @param  string $value New name.
2309 2309
 	 */
2310
-	public function set_name( $value ) {
2311
-        $name = sanitize_text_field( $value );
2312
-		$this->set_prop( 'name', $name );
2310
+	public function set_name($value) {
2311
+        $name = sanitize_text_field($value);
2312
+		$this->set_prop('name', $name);
2313 2313
     }
2314 2314
 
2315 2315
     /**
@@ -2318,8 +2318,8 @@  discard block
 block discarded – undo
2318 2318
 	 * @since 1.0.19
2319 2319
 	 * @param  string $value New name.
2320 2320
 	 */
2321
-	public function set_title( $value ) {
2322
-		$this->set_name( $value );
2321
+	public function set_title($value) {
2322
+		$this->set_name($value);
2323 2323
     }
2324 2324
 
2325 2325
     /**
@@ -2328,9 +2328,9 @@  discard block
 block discarded – undo
2328 2328
 	 * @since 1.0.19
2329 2329
 	 * @param  string $value New description.
2330 2330
 	 */
2331
-	public function set_description( $value ) {
2332
-        $description = wp_kses_post( $value );
2333
-		$this->set_prop( 'description', $description );
2331
+	public function set_description($value) {
2332
+        $description = wp_kses_post($value);
2333
+		$this->set_prop('description', $description);
2334 2334
     }
2335 2335
 
2336 2336
     /**
@@ -2339,8 +2339,8 @@  discard block
 block discarded – undo
2339 2339
 	 * @since 1.0.19
2340 2340
 	 * @param  string $value New description.
2341 2341
 	 */
2342
-	public function set_excerpt( $value ) {
2343
-		$this->set_description( $value );
2342
+	public function set_excerpt($value) {
2343
+		$this->set_description($value);
2344 2344
     }
2345 2345
 
2346 2346
     /**
@@ -2349,8 +2349,8 @@  discard block
 block discarded – undo
2349 2349
 	 * @since 1.0.19
2350 2350
 	 * @param  string $value New description.
2351 2351
 	 */
2352
-	public function set_summary( $value ) {
2353
-		$this->set_description( $value );
2352
+	public function set_summary($value) {
2353
+		$this->set_description($value);
2354 2354
     }
2355 2355
 
2356 2356
     /**
@@ -2359,12 +2359,12 @@  discard block
 block discarded – undo
2359 2359
 	 * @since 1.0.19
2360 2360
 	 * @param  int $value New author.
2361 2361
 	 */
2362
-	public function set_author( $value ) {
2363
-		$user = get_user_by( 'id', (int) $value );
2362
+	public function set_author($value) {
2363
+		$user = get_user_by('id', (int) $value);
2364 2364
 
2365
-		if ( $user && $user->ID ) {
2366
-			$this->set_prop( 'author', $user->ID );
2367
-			$this->set_prop( 'email', $user->user_email );
2365
+		if ($user && $user->ID) {
2366
+			$this->set_prop('author', $user->ID);
2367
+			$this->set_prop('email', $user->user_email);
2368 2368
 		}
2369 2369
 
2370 2370
     }
@@ -2375,8 +2375,8 @@  discard block
 block discarded – undo
2375 2375
 	 * @since 1.0.19
2376 2376
 	 * @param  int $value New user id.
2377 2377
 	 */
2378
-	public function set_user_id( $value ) {
2379
-		$this->set_author( $value );
2378
+	public function set_user_id($value) {
2379
+		$this->set_author($value);
2380 2380
     }
2381 2381
 
2382 2382
     /**
@@ -2385,8 +2385,8 @@  discard block
 block discarded – undo
2385 2385
 	 * @since 1.0.19
2386 2386
 	 * @param  int $value New user id.
2387 2387
 	 */
2388
-	public function set_customer_id( $value ) {
2389
-		$this->set_prop( 'customer_id', (int) $value );
2388
+	public function set_customer_id($value) {
2389
+		$this->set_prop('customer_id', (int) $value);
2390 2390
     }
2391 2391
 
2392 2392
     /**
@@ -2395,8 +2395,8 @@  discard block
 block discarded – undo
2395 2395
 	 * @since 1.0.19
2396 2396
 	 * @param  string $value ip address.
2397 2397
 	 */
2398
-	public function set_ip( $value ) {
2399
-		$this->set_prop( 'ip', $value );
2398
+	public function set_ip($value) {
2399
+		$this->set_prop('ip', $value);
2400 2400
     }
2401 2401
 
2402 2402
     /**
@@ -2405,8 +2405,8 @@  discard block
 block discarded – undo
2405 2405
 	 * @since 1.0.19
2406 2406
 	 * @param  string $value ip address.
2407 2407
 	 */
2408
-	public function set_user_ip( $value ) {
2409
-		$this->set_ip( $value );
2408
+	public function set_user_ip($value) {
2409
+		$this->set_ip($value);
2410 2410
     }
2411 2411
 
2412 2412
     /**
@@ -2415,8 +2415,8 @@  discard block
 block discarded – undo
2415 2415
 	 * @since 1.0.19
2416 2416
 	 * @param  string $value first name.
2417 2417
 	 */
2418
-	public function set_first_name( $value ) {
2419
-		$this->set_prop( 'first_name', $value );
2418
+	public function set_first_name($value) {
2419
+		$this->set_prop('first_name', $value);
2420 2420
     }
2421 2421
 
2422 2422
     /**
@@ -2425,8 +2425,8 @@  discard block
 block discarded – undo
2425 2425
 	 * @since 1.0.19
2426 2426
 	 * @param  string $value first name.
2427 2427
 	 */
2428
-	public function set_user_first_name( $value ) {
2429
-		$this->set_first_name( $value );
2428
+	public function set_user_first_name($value) {
2429
+		$this->set_first_name($value);
2430 2430
     }
2431 2431
 
2432 2432
     /**
@@ -2435,8 +2435,8 @@  discard block
 block discarded – undo
2435 2435
 	 * @since 1.0.19
2436 2436
 	 * @param  string $value first name.
2437 2437
 	 */
2438
-	public function set_customer_first_name( $value ) {
2439
-		$this->set_first_name( $value );
2438
+	public function set_customer_first_name($value) {
2439
+		$this->set_first_name($value);
2440 2440
     }
2441 2441
 
2442 2442
     /**
@@ -2445,8 +2445,8 @@  discard block
 block discarded – undo
2445 2445
 	 * @since 1.0.19
2446 2446
 	 * @param  string $value last name.
2447 2447
 	 */
2448
-	public function set_last_name( $value ) {
2449
-		$this->set_prop( 'last_name', $value );
2448
+	public function set_last_name($value) {
2449
+		$this->set_prop('last_name', $value);
2450 2450
     }
2451 2451
 
2452 2452
     /**
@@ -2455,8 +2455,8 @@  discard block
 block discarded – undo
2455 2455
 	 * @since 1.0.19
2456 2456
 	 * @param  string $value last name.
2457 2457
 	 */
2458
-	public function set_user_last_name( $value ) {
2459
-		$this->set_last_name( $value );
2458
+	public function set_user_last_name($value) {
2459
+		$this->set_last_name($value);
2460 2460
     }
2461 2461
 
2462 2462
     /**
@@ -2465,8 +2465,8 @@  discard block
 block discarded – undo
2465 2465
 	 * @since 1.0.19
2466 2466
 	 * @param  string $value last name.
2467 2467
 	 */
2468
-	public function set_customer_last_name( $value ) {
2469
-		$this->set_last_name( $value );
2468
+	public function set_customer_last_name($value) {
2469
+		$this->set_last_name($value);
2470 2470
     }
2471 2471
 
2472 2472
     /**
@@ -2475,8 +2475,8 @@  discard block
 block discarded – undo
2475 2475
 	 * @since 1.0.19
2476 2476
 	 * @param  string $value phone.
2477 2477
 	 */
2478
-	public function set_phone( $value ) {
2479
-		$this->set_prop( 'phone', $value );
2478
+	public function set_phone($value) {
2479
+		$this->set_prop('phone', $value);
2480 2480
     }
2481 2481
 
2482 2482
     /**
@@ -2485,8 +2485,8 @@  discard block
 block discarded – undo
2485 2485
 	 * @since 1.0.19
2486 2486
 	 * @param  string $value phone.
2487 2487
 	 */
2488
-	public function set_user_phone( $value ) {
2489
-		$this->set_phone( $value );
2488
+	public function set_user_phone($value) {
2489
+		$this->set_phone($value);
2490 2490
     }
2491 2491
 
2492 2492
     /**
@@ -2495,8 +2495,8 @@  discard block
 block discarded – undo
2495 2495
 	 * @since 1.0.19
2496 2496
 	 * @param  string $value phone.
2497 2497
 	 */
2498
-	public function set_customer_phone( $value ) {
2499
-		$this->set_phone( $value );
2498
+	public function set_customer_phone($value) {
2499
+		$this->set_phone($value);
2500 2500
     }
2501 2501
 
2502 2502
     /**
@@ -2505,8 +2505,8 @@  discard block
 block discarded – undo
2505 2505
 	 * @since 1.0.19
2506 2506
 	 * @param  string $value phone.
2507 2507
 	 */
2508
-	public function set_phone_number( $value ) {
2509
-		$this->set_phone( $value );
2508
+	public function set_phone_number($value) {
2509
+		$this->set_phone($value);
2510 2510
     }
2511 2511
 
2512 2512
     /**
@@ -2515,8 +2515,8 @@  discard block
 block discarded – undo
2515 2515
 	 * @since 1.0.19
2516 2516
 	 * @param  string $value email address.
2517 2517
 	 */
2518
-	public function set_email( $value ) {
2519
-		$this->set_prop( 'email', $value );
2518
+	public function set_email($value) {
2519
+		$this->set_prop('email', $value);
2520 2520
     }
2521 2521
 
2522 2522
     /**
@@ -2525,8 +2525,8 @@  discard block
 block discarded – undo
2525 2525
 	 * @since 1.0.19
2526 2526
 	 * @param  string $value email address.
2527 2527
 	 */
2528
-	public function set_user_email( $value ) {
2529
-		$this->set_email( $value );
2528
+	public function set_user_email($value) {
2529
+		$this->set_email($value);
2530 2530
     }
2531 2531
 
2532 2532
     /**
@@ -2535,8 +2535,8 @@  discard block
 block discarded – undo
2535 2535
 	 * @since 1.0.19
2536 2536
 	 * @param  string $value email address.
2537 2537
 	 */
2538
-	public function set_email_address( $value ) {
2539
-		$this->set_email( $value );
2538
+	public function set_email_address($value) {
2539
+		$this->set_email($value);
2540 2540
     }
2541 2541
 
2542 2542
     /**
@@ -2545,8 +2545,8 @@  discard block
 block discarded – undo
2545 2545
 	 * @since 1.0.19
2546 2546
 	 * @param  string $value email address.
2547 2547
 	 */
2548
-	public function set_customer_email( $value ) {
2549
-		$this->set_email( $value );
2548
+	public function set_customer_email($value) {
2549
+		$this->set_email($value);
2550 2550
     }
2551 2551
 
2552 2552
     /**
@@ -2555,8 +2555,8 @@  discard block
 block discarded – undo
2555 2555
 	 * @since 1.0.19
2556 2556
 	 * @param  string $value country.
2557 2557
 	 */
2558
-	public function set_country( $value ) {
2559
-		$this->set_prop( 'country', $value );
2558
+	public function set_country($value) {
2559
+		$this->set_prop('country', $value);
2560 2560
     }
2561 2561
 
2562 2562
     /**
@@ -2565,8 +2565,8 @@  discard block
 block discarded – undo
2565 2565
 	 * @since 1.0.19
2566 2566
 	 * @param  string $value country.
2567 2567
 	 */
2568
-	public function set_user_country( $value ) {
2569
-		$this->set_country( $value );
2568
+	public function set_user_country($value) {
2569
+		$this->set_country($value);
2570 2570
     }
2571 2571
 
2572 2572
     /**
@@ -2575,8 +2575,8 @@  discard block
 block discarded – undo
2575 2575
 	 * @since 1.0.19
2576 2576
 	 * @param  string $value country.
2577 2577
 	 */
2578
-	public function set_customer_country( $value ) {
2579
-		$this->set_country( $value );
2578
+	public function set_customer_country($value) {
2579
+		$this->set_country($value);
2580 2580
     }
2581 2581
 
2582 2582
     /**
@@ -2585,8 +2585,8 @@  discard block
 block discarded – undo
2585 2585
 	 * @since 1.0.19
2586 2586
 	 * @param  string $value state.
2587 2587
 	 */
2588
-	public function set_state( $value ) {
2589
-		$this->set_prop( 'state', $value );
2588
+	public function set_state($value) {
2589
+		$this->set_prop('state', $value);
2590 2590
     }
2591 2591
 
2592 2592
     /**
@@ -2595,8 +2595,8 @@  discard block
 block discarded – undo
2595 2595
 	 * @since 1.0.19
2596 2596
 	 * @param  string $value state.
2597 2597
 	 */
2598
-	public function set_user_state( $value ) {
2599
-		$this->set_state( $value );
2598
+	public function set_user_state($value) {
2599
+		$this->set_state($value);
2600 2600
     }
2601 2601
 
2602 2602
     /**
@@ -2605,8 +2605,8 @@  discard block
 block discarded – undo
2605 2605
 	 * @since 1.0.19
2606 2606
 	 * @param  string $value state.
2607 2607
 	 */
2608
-	public function set_customer_state( $value ) {
2609
-		$this->set_state( $value );
2608
+	public function set_customer_state($value) {
2609
+		$this->set_state($value);
2610 2610
     }
2611 2611
 
2612 2612
     /**
@@ -2615,8 +2615,8 @@  discard block
 block discarded – undo
2615 2615
 	 * @since 1.0.19
2616 2616
 	 * @param  string $value city.
2617 2617
 	 */
2618
-	public function set_city( $value ) {
2619
-		$this->set_prop( 'city', $value );
2618
+	public function set_city($value) {
2619
+		$this->set_prop('city', $value);
2620 2620
     }
2621 2621
 
2622 2622
     /**
@@ -2625,8 +2625,8 @@  discard block
 block discarded – undo
2625 2625
 	 * @since 1.0.19
2626 2626
 	 * @param  string $value city.
2627 2627
 	 */
2628
-	public function set_user_city( $value ) {
2629
-		$this->set_city( $value );
2628
+	public function set_user_city($value) {
2629
+		$this->set_city($value);
2630 2630
     }
2631 2631
 
2632 2632
     /**
@@ -2635,8 +2635,8 @@  discard block
 block discarded – undo
2635 2635
 	 * @since 1.0.19
2636 2636
 	 * @param  string $value city.
2637 2637
 	 */
2638
-	public function set_customer_city( $value ) {
2639
-		$this->set_city( $value );
2638
+	public function set_customer_city($value) {
2639
+		$this->set_city($value);
2640 2640
     }
2641 2641
 
2642 2642
     /**
@@ -2645,8 +2645,8 @@  discard block
 block discarded – undo
2645 2645
 	 * @since 1.0.19
2646 2646
 	 * @param  string $value zip.
2647 2647
 	 */
2648
-	public function set_zip( $value ) {
2649
-		$this->set_prop( 'zip', $value );
2648
+	public function set_zip($value) {
2649
+		$this->set_prop('zip', $value);
2650 2650
     }
2651 2651
 
2652 2652
     /**
@@ -2655,8 +2655,8 @@  discard block
 block discarded – undo
2655 2655
 	 * @since 1.0.19
2656 2656
 	 * @param  string $value zip.
2657 2657
 	 */
2658
-	public function set_user_zip( $value ) {
2659
-		$this->set_zip( $value );
2658
+	public function set_user_zip($value) {
2659
+		$this->set_zip($value);
2660 2660
     }
2661 2661
 
2662 2662
     /**
@@ -2665,8 +2665,8 @@  discard block
 block discarded – undo
2665 2665
 	 * @since 1.0.19
2666 2666
 	 * @param  string $value zip.
2667 2667
 	 */
2668
-	public function set_customer_zip( $value ) {
2669
-		$this->set_zip( $value );
2668
+	public function set_customer_zip($value) {
2669
+		$this->set_zip($value);
2670 2670
     }
2671 2671
 
2672 2672
     /**
@@ -2675,8 +2675,8 @@  discard block
 block discarded – undo
2675 2675
 	 * @since 1.0.19
2676 2676
 	 * @param  string $value company.
2677 2677
 	 */
2678
-	public function set_company( $value ) {
2679
-		$this->set_prop( 'company', $value );
2678
+	public function set_company($value) {
2679
+		$this->set_prop('company', $value);
2680 2680
     }
2681 2681
 
2682 2682
     /**
@@ -2685,8 +2685,8 @@  discard block
 block discarded – undo
2685 2685
 	 * @since 1.0.19
2686 2686
 	 * @param  string $value company.
2687 2687
 	 */
2688
-	public function set_user_company( $value ) {
2689
-		$this->set_company( $value );
2688
+	public function set_user_company($value) {
2689
+		$this->set_company($value);
2690 2690
     }
2691 2691
 
2692 2692
     /**
@@ -2695,8 +2695,8 @@  discard block
 block discarded – undo
2695 2695
 	 * @since 1.0.19
2696 2696
 	 * @param  string $value company.
2697 2697
 	 */
2698
-	public function set_customer_company( $value ) {
2699
-		$this->set_company( $value );
2698
+	public function set_customer_company($value) {
2699
+		$this->set_company($value);
2700 2700
     }
2701 2701
 
2702 2702
 	/**
@@ -2705,8 +2705,8 @@  discard block
 block discarded – undo
2705 2705
 	 * @since 1.0.19
2706 2706
 	 * @param  string $value company id.
2707 2707
 	 */
2708
-	public function set_company_id( $value ) {
2709
-		$this->set_prop( 'company_id', $value );
2708
+	public function set_company_id($value) {
2709
+		$this->set_prop('company_id', $value);
2710 2710
     }
2711 2711
 
2712 2712
     /**
@@ -2715,8 +2715,8 @@  discard block
 block discarded – undo
2715 2715
 	 * @since 1.0.19
2716 2716
 	 * @param  string $value var number.
2717 2717
 	 */
2718
-	public function set_vat_number( $value ) {
2719
-		$this->set_prop( 'vat_number', $value );
2718
+	public function set_vat_number($value) {
2719
+		$this->set_prop('vat_number', $value);
2720 2720
     }
2721 2721
 
2722 2722
     /**
@@ -2725,8 +2725,8 @@  discard block
 block discarded – undo
2725 2725
 	 * @since 1.0.19
2726 2726
 	 * @param  string $value var number.
2727 2727
 	 */
2728
-	public function set_user_vat_number( $value ) {
2729
-		$this->set_vat_number( $value );
2728
+	public function set_user_vat_number($value) {
2729
+		$this->set_vat_number($value);
2730 2730
     }
2731 2731
 
2732 2732
     /**
@@ -2735,8 +2735,8 @@  discard block
 block discarded – undo
2735 2735
 	 * @since 1.0.19
2736 2736
 	 * @param  string $value var number.
2737 2737
 	 */
2738
-	public function set_customer_vat_number( $value ) {
2739
-		$this->set_vat_number( $value );
2738
+	public function set_customer_vat_number($value) {
2739
+		$this->set_vat_number($value);
2740 2740
     }
2741 2741
 
2742 2742
     /**
@@ -2745,8 +2745,8 @@  discard block
 block discarded – undo
2745 2745
 	 * @since 1.0.19
2746 2746
 	 * @param  string $value var rate.
2747 2747
 	 */
2748
-	public function set_vat_rate( $value ) {
2749
-		$this->set_prop( 'vat_rate', $value );
2748
+	public function set_vat_rate($value) {
2749
+		$this->set_prop('vat_rate', $value);
2750 2750
     }
2751 2751
 
2752 2752
     /**
@@ -2755,8 +2755,8 @@  discard block
 block discarded – undo
2755 2755
 	 * @since 1.0.19
2756 2756
 	 * @param  string $value var number.
2757 2757
 	 */
2758
-	public function set_user_vat_rate( $value ) {
2759
-		$this->set_vat_rate( $value );
2758
+	public function set_user_vat_rate($value) {
2759
+		$this->set_vat_rate($value);
2760 2760
     }
2761 2761
 
2762 2762
     /**
@@ -2765,8 +2765,8 @@  discard block
 block discarded – undo
2765 2765
 	 * @since 1.0.19
2766 2766
 	 * @param  string $value var number.
2767 2767
 	 */
2768
-	public function set_customer_vat_rate( $value ) {
2769
-		$this->set_vat_rate( $value );
2768
+	public function set_customer_vat_rate($value) {
2769
+		$this->set_vat_rate($value);
2770 2770
     }
2771 2771
 
2772 2772
     /**
@@ -2775,8 +2775,8 @@  discard block
 block discarded – undo
2775 2775
 	 * @since 1.0.19
2776 2776
 	 * @param  string $value address.
2777 2777
 	 */
2778
-	public function set_address( $value ) {
2779
-		$this->set_prop( 'address', $value );
2778
+	public function set_address($value) {
2779
+		$this->set_prop('address', $value);
2780 2780
     }
2781 2781
 
2782 2782
     /**
@@ -2785,8 +2785,8 @@  discard block
 block discarded – undo
2785 2785
 	 * @since 1.0.19
2786 2786
 	 * @param  string $value address.
2787 2787
 	 */
2788
-	public function set_user_address( $value ) {
2789
-		$this->set_address( $value );
2788
+	public function set_user_address($value) {
2789
+		$this->set_address($value);
2790 2790
     }
2791 2791
 
2792 2792
     /**
@@ -2795,8 +2795,8 @@  discard block
 block discarded – undo
2795 2795
 	 * @since 1.0.19
2796 2796
 	 * @param  string $value address.
2797 2797
 	 */
2798
-	public function set_customer_address( $value ) {
2799
-		$this->set_address( $value );
2798
+	public function set_customer_address($value) {
2799
+		$this->set_address($value);
2800 2800
     }
2801 2801
 
2802 2802
     /**
@@ -2805,8 +2805,8 @@  discard block
 block discarded – undo
2805 2805
 	 * @since 1.0.19
2806 2806
 	 * @param  int|bool $value confirmed.
2807 2807
 	 */
2808
-	public function set_is_viewed( $value ) {
2809
-		$this->set_prop( 'is_viewed', $value );
2808
+	public function set_is_viewed($value) {
2809
+		$this->set_prop('is_viewed', $value);
2810 2810
 	}
2811 2811
 
2812 2812
 	/**
@@ -2815,8 +2815,8 @@  discard block
 block discarded – undo
2815 2815
 	 * @since 1.0.19
2816 2816
 	 * @param  string $value email recipients.
2817 2817
 	 */
2818
-	public function set_email_cc( $value ) {
2819
-		$this->set_prop( 'email_cc', $value );
2818
+	public function set_email_cc($value) {
2819
+		$this->set_prop('email_cc', $value);
2820 2820
 	}
2821 2821
 
2822 2822
 	/**
@@ -2825,9 +2825,9 @@  discard block
 block discarded – undo
2825 2825
 	 * @since 1.0.19
2826 2826
 	 * @param  string $value template.
2827 2827
 	 */
2828
-	public function set_template( $value ) {
2829
-		if ( in_array( $value, array( 'quantity', 'hours', 'amount' ) ) ) {
2830
-			$this->set_prop( 'template', $value );
2828
+	public function set_template($value) {
2829
+		if (in_array($value, array('quantity', 'hours', 'amount'))) {
2830
+			$this->set_prop('template', $value);
2831 2831
 		}
2832 2832
 	}
2833 2833
 
@@ -2838,8 +2838,8 @@  discard block
 block discarded – undo
2838 2838
 	 * @param  string $value source.
2839 2839
 	 * @deprecated
2840 2840
 	 */
2841
-	public function created_via( $value ) {
2842
-		$this->set_created_via( sanitize_text_field( $value ) );
2841
+	public function created_via($value) {
2842
+		$this->set_created_via(sanitize_text_field($value));
2843 2843
 	}
2844 2844
 
2845 2845
 	/**
@@ -2848,8 +2848,8 @@  discard block
 block discarded – undo
2848 2848
 	 * @since 1.0.19
2849 2849
 	 * @param  string $value source.
2850 2850
 	 */
2851
-	public function set_created_via( $value ) {
2852
-		$this->set_prop( 'created_via', sanitize_text_field( $value ) );
2851
+	public function set_created_via($value) {
2852
+		$this->set_prop('created_via', sanitize_text_field($value));
2853 2853
 	}
2854 2854
 
2855 2855
 	/**
@@ -2858,8 +2858,8 @@  discard block
 block discarded – undo
2858 2858
 	 * @since 1.0.19
2859 2859
 	 * @param  int|bool $value confirmed.
2860 2860
 	 */
2861
-	public function set_address_confirmed( $value ) {
2862
-		$this->set_prop( 'address_confirmed', $value );
2861
+	public function set_address_confirmed($value) {
2862
+		$this->set_prop('address_confirmed', $value);
2863 2863
     }
2864 2864
 
2865 2865
     /**
@@ -2868,8 +2868,8 @@  discard block
 block discarded – undo
2868 2868
 	 * @since 1.0.19
2869 2869
 	 * @param  int|bool $value confirmed.
2870 2870
 	 */
2871
-	public function set_user_address_confirmed( $value ) {
2872
-		$this->set_address_confirmed( $value );
2871
+	public function set_user_address_confirmed($value) {
2872
+		$this->set_address_confirmed($value);
2873 2873
     }
2874 2874
 
2875 2875
     /**
@@ -2878,8 +2878,8 @@  discard block
 block discarded – undo
2878 2878
 	 * @since 1.0.19
2879 2879
 	 * @param  int|bool $value confirmed.
2880 2880
 	 */
2881
-	public function set_customer_address_confirmed( $value ) {
2882
-		$this->set_address_confirmed( $value );
2881
+	public function set_customer_address_confirmed($value) {
2882
+		$this->set_address_confirmed($value);
2883 2883
     }
2884 2884
 
2885 2885
     /**
@@ -2888,13 +2888,13 @@  discard block
 block discarded – undo
2888 2888
 	 * @since 1.0.19
2889 2889
 	 * @param  float $value shipping amount.
2890 2890
 	 */
2891
-	public function set_shipping( $value ) {
2891
+	public function set_shipping($value) {
2892 2892
 
2893
-		if ( ! is_numeric( $value ) ) {
2894
-			return $this->set_prop( 'shipping', null );
2893
+		if (!is_numeric($value)) {
2894
+			return $this->set_prop('shipping', null);
2895 2895
 		}
2896 2896
 
2897
-		$this->set_prop( 'shipping', max( 0, floatval( $value ) ) );
2897
+		$this->set_prop('shipping', max(0, floatval($value)));
2898 2898
 	}
2899 2899
 
2900 2900
 	/**
@@ -2903,8 +2903,8 @@  discard block
 block discarded – undo
2903 2903
 	 * @since 1.0.19
2904 2904
 	 * @param  float $value sub total.
2905 2905
 	 */
2906
-	public function set_subtotal( $value ) {
2907
-		$this->set_prop( 'subtotal', max( 0, $value ) );
2906
+	public function set_subtotal($value) {
2907
+		$this->set_prop('subtotal', max(0, $value));
2908 2908
 	}
2909 2909
 
2910 2910
 	/**
@@ -2913,8 +2913,8 @@  discard block
 block discarded – undo
2913 2913
 	 * @since 1.0.19
2914 2914
 	 * @param  float $value sub total.
2915 2915
 	 */
2916
-	public function set_total( $value ) {
2917
-		$this->set_prop( 'total', max( 0, $value ) );
2916
+	public function set_total($value) {
2917
+		$this->set_prop('total', max(0, $value));
2918 2918
     }
2919 2919
 
2920 2920
     /**
@@ -2923,8 +2923,8 @@  discard block
 block discarded – undo
2923 2923
 	 * @since 1.0.19
2924 2924
 	 * @param  float $value discount total.
2925 2925
 	 */
2926
-	public function set_total_discount( $value ) {
2927
-		$this->set_prop( 'total_discount', max( 0, $value ) );
2926
+	public function set_total_discount($value) {
2927
+		$this->set_prop('total_discount', max(0, $value));
2928 2928
     }
2929 2929
 
2930 2930
     /**
@@ -2933,8 +2933,8 @@  discard block
 block discarded – undo
2933 2933
 	 * @since 1.0.19
2934 2934
 	 * @param  float $value discount total.
2935 2935
 	 */
2936
-	public function set_discount( $value ) {
2937
-		$this->set_total_discount( $value );
2936
+	public function set_discount($value) {
2937
+		$this->set_total_discount($value);
2938 2938
     }
2939 2939
 
2940 2940
     /**
@@ -2943,8 +2943,8 @@  discard block
 block discarded – undo
2943 2943
 	 * @since 1.0.19
2944 2944
 	 * @param  float $value tax total.
2945 2945
 	 */
2946
-	public function set_total_tax( $value ) {
2947
-		$this->set_prop( 'total_tax', max( 0, $value ) );
2946
+	public function set_total_tax($value) {
2947
+		$this->set_prop('total_tax', max(0, $value));
2948 2948
     }
2949 2949
 
2950 2950
     /**
@@ -2953,8 +2953,8 @@  discard block
 block discarded – undo
2953 2953
 	 * @since 1.0.19
2954 2954
 	 * @param  float $value tax total.
2955 2955
 	 */
2956
-	public function set_tax_total( $value ) {
2957
-		$this->set_total_tax( $value );
2956
+	public function set_tax_total($value) {
2957
+		$this->set_total_tax($value);
2958 2958
     }
2959 2959
 
2960 2960
     /**
@@ -2963,8 +2963,8 @@  discard block
 block discarded – undo
2963 2963
 	 * @since 1.0.19
2964 2964
 	 * @param  float $value fees total.
2965 2965
 	 */
2966
-	public function set_total_fees( $value ) {
2967
-		$this->set_prop( 'total_fees', max( 0, $value ) );
2966
+	public function set_total_fees($value) {
2967
+		$this->set_prop('total_fees', max(0, $value));
2968 2968
     }
2969 2969
 
2970 2970
     /**
@@ -2973,8 +2973,8 @@  discard block
 block discarded – undo
2973 2973
 	 * @since 1.0.19
2974 2974
 	 * @param  float $value fees total.
2975 2975
 	 */
2976
-	public function set_fees_total( $value ) {
2977
-		$this->set_total_fees( $value );
2976
+	public function set_fees_total($value) {
2977
+		$this->set_total_fees($value);
2978 2978
     }
2979 2979
 
2980 2980
     /**
@@ -2983,13 +2983,13 @@  discard block
 block discarded – undo
2983 2983
 	 * @since 1.0.19
2984 2984
 	 * @param  array $value fees.
2985 2985
 	 */
2986
-	public function set_fees( $value ) {
2986
+	public function set_fees($value) {
2987 2987
 
2988
-		if ( ! is_array( $value ) ) {
2988
+		if (!is_array($value)) {
2989 2989
 			$value = array();
2990 2990
 		}
2991 2991
 
2992
-		$this->set_prop( 'fees', $value );
2992
+		$this->set_prop('fees', $value);
2993 2993
 
2994 2994
     }
2995 2995
 
@@ -2999,13 +2999,13 @@  discard block
 block discarded – undo
2999 2999
 	 * @since 1.0.19
3000 3000
 	 * @param  array $value taxes.
3001 3001
 	 */
3002
-	public function set_taxes( $value ) {
3002
+	public function set_taxes($value) {
3003 3003
 
3004
-		if ( ! is_array( $value ) ) {
3004
+		if (!is_array($value)) {
3005 3005
 			$value = array();
3006 3006
 		}
3007 3007
 
3008
-		$this->set_prop( 'taxes', $value );
3008
+		$this->set_prop('taxes', $value);
3009 3009
 
3010 3010
     }
3011 3011
 
@@ -3015,13 +3015,13 @@  discard block
 block discarded – undo
3015 3015
 	 * @since 1.0.19
3016 3016
 	 * @param  array $value discounts.
3017 3017
 	 */
3018
-	public function set_discounts( $value ) {
3018
+	public function set_discounts($value) {
3019 3019
 
3020
-		if ( ! is_array( $value ) ) {
3020
+		if (!is_array($value)) {
3021 3021
 			$value = array();
3022 3022
 		}
3023 3023
 
3024
-		$this->set_prop( 'discounts', $value );
3024
+		$this->set_prop('discounts', $value);
3025 3025
     }
3026 3026
 
3027 3027
     /**
@@ -3030,19 +3030,19 @@  discard block
 block discarded – undo
3030 3030
 	 * @since 1.0.19
3031 3031
 	 * @param  GetPaid_Form_Item[] $value items.
3032 3032
 	 */
3033
-	public function set_items( $value ) {
3033
+	public function set_items($value) {
3034 3034
 
3035 3035
         // Remove existing items.
3036
-        $this->set_prop( 'items', array() );
3036
+        $this->set_prop('items', array());
3037 3037
 		$this->recurring_item = null;
3038 3038
 
3039 3039
         // Ensure that we have an array.
3040
-        if ( ! is_array( $value ) ) {
3040
+        if (!is_array($value)) {
3041 3041
             return;
3042 3042
         }
3043 3043
 
3044
-        foreach ( $value as $item ) {
3045
-            $this->add_item( $item );
3044
+        foreach ($value as $item) {
3045
+            $this->add_item($item);
3046 3046
         }
3047 3047
 
3048 3048
     }
@@ -3053,8 +3053,8 @@  discard block
 block discarded – undo
3053 3053
 	 * @since 1.0.19
3054 3054
 	 * @param  int $value payment form.
3055 3055
 	 */
3056
-	public function set_payment_form( $value ) {
3057
-		$this->set_prop( 'payment_form', $value );
3056
+	public function set_payment_form($value) {
3057
+		$this->set_prop('payment_form', $value);
3058 3058
     }
3059 3059
 
3060 3060
     /**
@@ -3063,8 +3063,8 @@  discard block
 block discarded – undo
3063 3063
 	 * @since 1.0.19
3064 3064
 	 * @param  string $value submission id.
3065 3065
 	 */
3066
-	public function set_submission_id( $value ) {
3067
-		$this->set_prop( 'submission_id', $value );
3066
+	public function set_submission_id($value) {
3067
+		$this->set_prop('submission_id', $value);
3068 3068
     }
3069 3069
 
3070 3070
     /**
@@ -3073,8 +3073,8 @@  discard block
 block discarded – undo
3073 3073
 	 * @since 1.0.19
3074 3074
 	 * @param  string $value discount code.
3075 3075
 	 */
3076
-	public function set_discount_code( $value ) {
3077
-		$this->set_prop( 'discount_code', sanitize_text_field( $value ) );
3076
+	public function set_discount_code($value) {
3077
+		$this->set_prop('discount_code', sanitize_text_field($value));
3078 3078
     }
3079 3079
 
3080 3080
     /**
@@ -3083,8 +3083,8 @@  discard block
 block discarded – undo
3083 3083
 	 * @since 1.0.19
3084 3084
 	 * @param  string $value gateway.
3085 3085
 	 */
3086
-	public function set_gateway( $value ) {
3087
-		$this->set_prop( 'gateway', $value );
3086
+	public function set_gateway($value) {
3087
+		$this->set_prop('gateway', $value);
3088 3088
     }
3089 3089
 
3090 3090
     /**
@@ -3093,9 +3093,9 @@  discard block
 block discarded – undo
3093 3093
 	 * @since 1.0.19
3094 3094
 	 * @param  string $value transaction id.
3095 3095
 	 */
3096
-	public function set_transaction_id( $value ) {
3097
-		if ( ! empty( $value ) ) {
3098
-			$this->set_prop( 'transaction_id', $value );
3096
+	public function set_transaction_id($value) {
3097
+		if (!empty($value)) {
3098
+			$this->set_prop('transaction_id', $value);
3099 3099
 		}
3100 3100
     }
3101 3101
 
@@ -3105,8 +3105,8 @@  discard block
 block discarded – undo
3105 3105
 	 * @since 1.0.19
3106 3106
 	 * @param  string $value currency id.
3107 3107
 	 */
3108
-	public function set_currency( $value ) {
3109
-		$this->set_prop( 'currency', $value );
3108
+	public function set_currency($value) {
3109
+		$this->set_prop('currency', $value);
3110 3110
     }
3111 3111
 
3112 3112
 	/**
@@ -3115,8 +3115,8 @@  discard block
 block discarded – undo
3115 3115
 	 * @since 1.0.19
3116 3116
 	 * @param  bool $value value.
3117 3117
 	 */
3118
-	public function set_disable_taxes( $value ) {
3119
-		$this->set_prop( 'disable_taxes', (bool) $value );
3118
+	public function set_disable_taxes($value) {
3119
+		$this->set_prop('disable_taxes', (bool) $value);
3120 3120
 	}
3121 3121
 
3122 3122
     /**
@@ -3125,8 +3125,8 @@  discard block
 block discarded – undo
3125 3125
 	 * @since 1.0.19
3126 3126
 	 * @param  string $value subscription id.
3127 3127
 	 */
3128
-	public function set_subscription_id( $value ) {
3129
-		$this->set_prop( 'subscription_id', $value );
3128
+	public function set_subscription_id($value) {
3129
+		$this->set_prop('subscription_id', $value);
3130 3130
 	}
3131 3131
 
3132 3132
 	/**
@@ -3135,8 +3135,8 @@  discard block
 block discarded – undo
3135 3135
 	 * @since 1.0.19
3136 3136
 	 * @param  string $value subscription id.
3137 3137
 	 */
3138
-	public function set_remote_subscription_id( $value ) {
3139
-		$this->set_prop( 'remote_subscription_id', $value );
3138
+	public function set_remote_subscription_id($value) {
3139
+		$this->set_prop('remote_subscription_id', $value);
3140 3140
     }
3141 3141
 
3142 3142
 	/**
@@ -3145,8 +3145,8 @@  discard block
 block discarded – undo
3145 3145
 	 * @since 2.8.22
3146 3146
 	 * @param  bool $is_anonymized is anonymized.
3147 3147
 	 */
3148
-	public function set_is_anonymized( $is_anonymized ) {
3149
-		$this->set_prop( 'is_anonymized', (bool) $is_anonymized );
3148
+	public function set_is_anonymized($is_anonymized) {
3149
+		$this->set_prop('is_anonymized', (bool) $is_anonymized);
3150 3150
     }
3151 3151
 
3152 3152
     /*
@@ -3163,28 +3163,28 @@  discard block
 block discarded – undo
3163 3163
      */
3164 3164
     public function is_parent() {
3165 3165
         $parent = $this->get_parent_id();
3166
-        return apply_filters( 'wpinv_invoice_is_parent', empty( $parent ), $this );
3166
+        return apply_filters('wpinv_invoice_is_parent', empty($parent), $this);
3167 3167
     }
3168 3168
 
3169 3169
     /**
3170 3170
      * Checks if this is a renewal invoice.
3171 3171
      */
3172 3172
     public function is_renewal() {
3173
-        return $this->is_recurring() && ! $this->is_parent();
3173
+        return $this->is_recurring() && !$this->is_parent();
3174 3174
     }
3175 3175
 
3176 3176
     /**
3177 3177
      * Checks if this is a recurring invoice.
3178 3178
      */
3179 3179
     public function is_recurring() {
3180
-        return ! empty( $this->recurring_item );
3180
+        return !empty($this->recurring_item);
3181 3181
     }
3182 3182
 
3183 3183
     /**
3184 3184
      * Checks if this is a taxable invoice.
3185 3185
      */
3186 3186
     public function is_taxable() {
3187
-        return ! $this->get_disable_taxes();
3187
+        return !$this->get_disable_taxes();
3188 3188
 	}
3189 3189
 
3190 3190
 	/**
@@ -3198,45 +3198,45 @@  discard block
 block discarded – undo
3198 3198
 	 * Checks to see if the invoice requires payment.
3199 3199
 	 */
3200 3200
 	public function is_free() {
3201
-        $is_free = ( (float) wpinv_round_amount( $this->get_initial_total() ) == 0 );
3201
+        $is_free = ((float) wpinv_round_amount($this->get_initial_total()) == 0);
3202 3202
 
3203
-		if ( $this->is_recurring() && $this->get_recurring_total() > 0 ) {
3203
+		if ($this->is_recurring() && $this->get_recurring_total() > 0) {
3204 3204
 			$is_free = false;
3205 3205
 		}
3206 3206
 
3207
-        return apply_filters( 'wpinv_invoice_is_free', $is_free, $this );
3207
+        return apply_filters('wpinv_invoice_is_free', $is_free, $this);
3208 3208
     }
3209 3209
 
3210 3210
     /**
3211 3211
      * Checks if the invoice is paid.
3212 3212
      */
3213 3213
     public function is_paid() {
3214
-        $is_paid = $this->has_status( array( 'publish', 'wpi-processing', 'wpi-renewal' ) );
3215
-        return apply_filters( 'wpinv_invoice_is_paid', $is_paid, $this );
3214
+        $is_paid = $this->has_status(array('publish', 'wpi-processing', 'wpi-renewal'));
3215
+        return apply_filters('wpinv_invoice_is_paid', $is_paid, $this);
3216 3216
 	}
3217 3217
 
3218 3218
 	/**
3219 3219
      * Checks if the invoice needs payment.
3220 3220
      */
3221 3221
 	public function needs_payment() {
3222
-		$needs_payment = ! $this->is_paid() && ! $this->is_refunded() && ! $this->is_free();
3223
-        return apply_filters( 'wpinv_needs_payment', $needs_payment, $this );
3222
+		$needs_payment = !$this->is_paid() && !$this->is_refunded() && !$this->is_free();
3223
+        return apply_filters('wpinv_needs_payment', $needs_payment, $this);
3224 3224
     }
3225 3225
 
3226 3226
 	/**
3227 3227
      * Checks if the invoice is refunded.
3228 3228
      */
3229 3229
 	public function is_refunded() {
3230
-        $is_refunded = $this->has_status( 'wpi-refunded' );
3231
-        return apply_filters( 'wpinv_invoice_is_refunded', $is_refunded, $this );
3230
+        $is_refunded = $this->has_status('wpi-refunded');
3231
+        return apply_filters('wpinv_invoice_is_refunded', $is_refunded, $this);
3232 3232
 	}
3233 3233
 
3234 3234
 	/**
3235 3235
      * Checks if the invoice is held.
3236 3236
      */
3237 3237
 	public function is_held() {
3238
-        $is_held = $this->has_status( 'wpi-onhold' );
3239
-        return apply_filters( 'wpinv_invoice_is_held', $is_held, $this );
3238
+        $is_held = $this->has_status('wpi-onhold');
3239
+        return apply_filters('wpinv_invoice_is_held', $is_held, $this);
3240 3240
 	}
3241 3241
 
3242 3242
 	/**
@@ -3244,30 +3244,30 @@  discard block
 block discarded – undo
3244 3244
      */
3245 3245
 	public function is_due() {
3246 3246
 		$due_date = $this->get_due_date();
3247
-		return empty( $due_date ) ? false : current_time( 'timestamp' ) > strtotime( $due_date );
3247
+		return empty($due_date) ? false : current_time('timestamp') > strtotime($due_date);
3248 3248
 	}
3249 3249
 
3250 3250
 	/**
3251 3251
      * Checks if the invoice is draft.
3252 3252
      */
3253 3253
 	public function is_draft() {
3254
-        return $this->has_status( 'draft, auto-draft' );
3254
+        return $this->has_status('draft, auto-draft');
3255 3255
 	}
3256 3256
 
3257 3257
     /**
3258 3258
      * Checks if the invoice has a given status.
3259 3259
      */
3260
-    public function has_status( $status ) {
3261
-        $status = wpinv_parse_list( $status );
3262
-        return apply_filters( 'wpinv_has_status', in_array( $this->get_status(), $status ), $status );
3260
+    public function has_status($status) {
3261
+        $status = wpinv_parse_list($status);
3262
+        return apply_filters('wpinv_has_status', in_array($this->get_status(), $status), $status);
3263 3263
 	}
3264 3264
 
3265 3265
 	/**
3266 3266
      * Checks if the invoice is of a given type.
3267 3267
      */
3268
-    public function is_type( $type ) {
3269
-        $type = wpinv_parse_list( $type );
3270
-        return in_array( $this->get_type(), $type );
3268
+    public function is_type($type) {
3269
+        $type = wpinv_parse_list($type);
3270
+        return in_array($this->get_type(), $type);
3271 3271
     }
3272 3272
 
3273 3273
     /**
@@ -3299,8 +3299,8 @@  discard block
 block discarded – undo
3299 3299
      *
3300 3300
      */
3301 3301
 	public function is_initial_free() {
3302
-        $is_initial_free = ! ( (float) wpinv_round_amount( $this->get_initial_total() ) > 0 );
3303
-        return apply_filters( 'wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this );
3302
+        $is_initial_free = !((float) wpinv_round_amount($this->get_initial_total()) > 0);
3303
+        return apply_filters('wpinv_invoice_is_initial_free', $is_initial_free, $this->get_cart_details(), $this);
3304 3304
     }
3305 3305
 
3306 3306
 	/**
@@ -3310,11 +3310,11 @@  discard block
 block discarded – undo
3310 3310
     public function item_has_free_trial() {
3311 3311
 
3312 3312
         // Ensure we have a recurring item.
3313
-        if ( ! $this->is_recurring() ) {
3313
+        if (!$this->is_recurring()) {
3314 3314
             return false;
3315 3315
         }
3316 3316
 
3317
-        $item = $this->get_recurring( true );
3317
+        $item = $this->get_recurring(true);
3318 3318
         return $item->has_free_trial();
3319 3319
 	}
3320 3320
 
@@ -3322,7 +3322,7 @@  discard block
 block discarded – undo
3322 3322
      * Check if the free trial is a result of a discount.
3323 3323
      */
3324 3324
     public function is_free_trial_from_discount() {
3325
-		return $this->has_free_trial() && ! $this->item_has_free_trial();
3325
+		return $this->has_free_trial() && !$this->item_has_free_trial();
3326 3326
 	}
3327 3327
 
3328 3328
 	/**
@@ -3339,12 +3339,12 @@  discard block
 block discarded – undo
3339 3339
      */
3340 3340
     public function discount_first_payment_only() {
3341 3341
 
3342
-		$discount = wpinv_get_discount_obj( $this->get_discount_code() );
3343
-        if ( ! $discount->exists() || ! $this->is_recurring() ) {
3342
+		$discount = wpinv_get_discount_obj($this->get_discount_code());
3343
+        if (!$discount->exists() || !$this->is_recurring()) {
3344 3344
             return true;
3345 3345
         }
3346 3346
 
3347
-        return ! $discount->get_is_recurring();
3347
+        return !$discount->get_is_recurring();
3348 3348
     }
3349 3349
 
3350 3350
     /*
@@ -3362,23 +3362,23 @@  discard block
 block discarded – undo
3362 3362
      * @param GetPaid_Form_Item|array $item
3363 3363
      * @return WP_Error|Bool
3364 3364
      */
3365
-    public function add_item( $item ) {
3365
+    public function add_item($item) {
3366 3366
 
3367
-		if ( is_array( $item ) ) {
3368
-			$item = $this->process_array_item( $item );
3367
+		if (is_array($item)) {
3368
+			$item = $this->process_array_item($item);
3369 3369
 		}
3370 3370
 
3371
-		if ( is_numeric( $item ) ) {
3372
-			$item = new GetPaid_Form_Item( $item );
3371
+		if (is_numeric($item)) {
3372
+			$item = new GetPaid_Form_Item($item);
3373 3373
 		}
3374 3374
 
3375 3375
         // Make sure that it is available for purchase.
3376
-		if ( $item->get_id() > 0 && ! $item->can_purchase() ) {
3377
-			return new WP_Error( 'invalid_item', __( 'This item is not available for purchase', 'invoicing' ) );
3376
+		if ($item->get_id() > 0 && !$item->can_purchase()) {
3377
+			return new WP_Error('invalid_item', __('This item is not available for purchase', 'invoicing'));
3378 3378
         }
3379 3379
 
3380 3380
         // Do we have a recurring item?
3381
-		if ( $item->is_recurring() ) {
3381
+		if ($item->is_recurring()) {
3382 3382
 			$this->recurring_item = $item->get_id();
3383 3383
         }
3384 3384
 
@@ -3386,9 +3386,9 @@  discard block
 block discarded – undo
3386 3386
         $item->invoice_id = (int) $this->get_id();
3387 3387
 
3388 3388
 		// Remove duplicates.
3389
-		$this->remove_item( $item->get_id() );
3389
+		$this->remove_item($item->get_id());
3390 3390
 
3391
-		if ( 0 == $item->get_quantity() ) {
3391
+		if (0 == $item->get_quantity()) {
3392 3392
 			return;
3393 3393
 		}
3394 3394
 
@@ -3398,7 +3398,7 @@  discard block
 block discarded – undo
3398 3398
 		// Add new item.
3399 3399
         $items[] = $item;
3400 3400
 
3401
-        $this->set_prop( 'items', $items );
3401
+        $this->set_prop('items', $items);
3402 3402
 
3403 3403
 		return true;
3404 3404
 	}
@@ -3409,26 +3409,26 @@  discard block
 block discarded – undo
3409 3409
 	 * @since 1.0.19
3410 3410
 	 * @return GetPaid_Form_Item
3411 3411
 	 */
3412
-	protected function process_array_item( $array ) {
3412
+	protected function process_array_item($array) {
3413 3413
 
3414
-		$item_id = isset( $array['item_id'] ) ? $array['item_id'] : 0;
3415
-		$item    = new GetPaid_Form_Item( $item_id );
3414
+		$item_id = isset($array['item_id']) ? $array['item_id'] : 0;
3415
+		$item    = new GetPaid_Form_Item($item_id);
3416 3416
 
3417 3417
 		// Set item data.
3418
-		foreach ( array( 'name', 'price', 'description' ) as $key ) {
3419
-			if ( isset( $array[ "item_$key" ] ) ) {
3418
+		foreach (array('name', 'price', 'description') as $key) {
3419
+			if (isset($array["item_$key"])) {
3420 3420
 				$method = "set_$key";
3421
-				$item->$method( $array[ "item_$key" ] );
3421
+				$item->$method($array["item_$key"]);
3422 3422
 			}
3423 3423
 		}
3424 3424
 
3425
-		if ( isset( $array['quantity'] ) ) {
3426
-			$item->set_quantity( $array['quantity'] );
3425
+		if (isset($array['quantity'])) {
3426
+			$item->set_quantity($array['quantity']);
3427 3427
 		}
3428 3428
 
3429 3429
 		// Set item meta.
3430
-		if ( isset( $array['meta'] ) && is_array( $array['meta'] ) ) {
3431
-			$item->set_item_meta( $array['meta'] );
3430
+		if (isset($array['meta']) && is_array($array['meta'])) {
3431
+			$item->set_item_meta($array['meta']);
3432 3432
 		}
3433 3433
 
3434 3434
 		return $item;
@@ -3441,10 +3441,10 @@  discard block
 block discarded – undo
3441 3441
 	 * @since 1.0.19
3442 3442
 	 * @return GetPaid_Form_Item|null
3443 3443
 	 */
3444
-	public function get_item( $item_id ) {
3444
+	public function get_item($item_id) {
3445 3445
 
3446
-		foreach ( $this->get_items() as $item ) {
3447
-			if ( (int) $item_id == $item->get_id() ) {
3446
+		foreach ($this->get_items() as $item) {
3447
+			if ((int) $item_id == $item->get_id()) {
3448 3448
 				return $item;
3449 3449
 			}
3450 3450
 		}
@@ -3457,16 +3457,16 @@  discard block
 block discarded – undo
3457 3457
 	 *
3458 3458
 	 * @since 1.0.19
3459 3459
 	 */
3460
-	public function remove_item( $item_id ) {
3460
+	public function remove_item($item_id) {
3461 3461
 		$items   = $this->get_items();
3462 3462
 		$item_id = (int) $item_id;
3463 3463
 
3464
-		foreach ( $items as $index => $item ) {
3465
-			if ( (int) $item_id == $item->get_id() ) {
3466
-				unset( $items[ $index ] );
3467
-				$this->set_prop( 'items', $items );
3464
+		foreach ($items as $index => $item) {
3465
+			if ((int) $item_id == $item->get_id()) {
3466
+				unset($items[$index]);
3467
+				$this->set_prop('items', $items);
3468 3468
 
3469
-				if ( $item_id == $this->recurring_item ) {
3469
+				if ($item_id == $this->recurring_item) {
3470 3470
 					$this->recurring_item = null;
3471 3471
 				}
3472 3472
 }
@@ -3480,11 +3480,11 @@  discard block
 block discarded – undo
3480 3480
 	 * @param array $fee An array of fee details. name, initial_fee, and recurring_fee are required.
3481 3481
 	 * @since 1.0.19
3482 3482
 	 */
3483
-    public function add_fee( $fee ) {
3483
+    public function add_fee($fee) {
3484 3484
 
3485 3485
 		$fees                 = $this->get_fees();
3486
-		$fees[ $fee['name'] ] = $fee;
3487
-		$this->set_prop( 'fees', $fees );
3486
+		$fees[$fee['name']] = $fee;
3487
+		$this->set_prop('fees', $fees);
3488 3488
 
3489 3489
     }
3490 3490
 
@@ -3493,9 +3493,9 @@  discard block
 block discarded – undo
3493 3493
 	 *
3494 3494
 	 * @since 1.0.19
3495 3495
 	 */
3496
-	public function get_fee( $fee ) {
3496
+	public function get_fee($fee) {
3497 3497
         $fees = $this->get_fees();
3498
-		return isset( $fees[ $fee ] ) ? $fees[ $fee ] : null;
3498
+		return isset($fees[$fee]) ? $fees[$fee] : null;
3499 3499
     }
3500 3500
 
3501 3501
     /**
@@ -3503,11 +3503,11 @@  discard block
 block discarded – undo
3503 3503
 	 *
3504 3504
 	 * @since 1.0.19
3505 3505
 	 */
3506
-	public function remove_fee( $fee ) {
3506
+	public function remove_fee($fee) {
3507 3507
         $fees = $this->get_fees();
3508
-        if ( isset( $fees[ $fee ] ) ) {
3509
-            unset( $fees[ $fee ] );
3510
-            $this->set_prop( 'fees', $fees );
3508
+        if (isset($fees[$fee])) {
3509
+            unset($fees[$fee]);
3510
+            $this->set_prop('fees', $fees);
3511 3511
         }
3512 3512
     }
3513 3513
 
@@ -3517,11 +3517,11 @@  discard block
 block discarded – undo
3517 3517
 	 * @param array $discount An array of discount details. name, initial_discount, and recurring_discount are required. Include discount_code if the discount is from a discount code.
3518 3518
 	 * @since 1.0.19
3519 3519
 	 */
3520
-	public function add_discount( $discount ) {
3520
+	public function add_discount($discount) {
3521 3521
 
3522 3522
 		$discounts = $this->get_discounts();
3523
-		$discounts[ $discount['name'] ] = $discount;
3524
-		$this->set_prop( 'discounts', $discounts );
3523
+		$discounts[$discount['name']] = $discount;
3524
+		$this->set_prop('discounts', $discounts);
3525 3525
 
3526 3526
 	}
3527 3527
 
@@ -3531,15 +3531,15 @@  discard block
 block discarded – undo
3531 3531
 	 * @since 1.0.19
3532 3532
 	 * @return float
3533 3533
 	 */
3534
-	public function get_discount( $discount = false ) {
3534
+	public function get_discount($discount = false) {
3535 3535
 
3536 3536
 		// Backwards compatibility.
3537
-		if ( empty( $discount ) ) {
3537
+		if (empty($discount)) {
3538 3538
 			return $this->get_total_discount();
3539 3539
 		}
3540 3540
 
3541 3541
         $discounts = $this->get_discounts();
3542
-		return isset( $discounts[ $discount ] ) ? $discounts[ $discount ] : null;
3542
+		return isset($discounts[$discount]) ? $discounts[$discount] : null;
3543 3543
     }
3544 3544
 
3545 3545
     /**
@@ -3547,15 +3547,15 @@  discard block
 block discarded – undo
3547 3547
 	 *
3548 3548
 	 * @since 1.0.19
3549 3549
 	 */
3550
-	public function remove_discount( $discount ) {
3550
+	public function remove_discount($discount) {
3551 3551
         $discounts = $this->get_discounts();
3552
-        if ( isset( $discounts[ $discount ] ) ) {
3553
-            unset( $discounts[ $discount ] );
3554
-            $this->set_prop( 'discounts', $discounts );
3552
+        if (isset($discounts[$discount])) {
3553
+            unset($discounts[$discount]);
3554
+            $this->set_prop('discounts', $discounts);
3555 3555
         }
3556 3556
 
3557
-		if ( 'discount_code' == $discount ) {
3558
-			foreach ( $this->get_items() as $item ) {
3557
+		if ('discount_code' == $discount) {
3558
+			foreach ($this->get_items() as $item) {
3559 3559
 				$item->item_discount           = 0;
3560 3560
 				$item->recurring_item_discount = 0;
3561 3561
 			}
@@ -3568,12 +3568,12 @@  discard block
 block discarded – undo
3568 3568
      *
3569 3569
      * @param array $tax An array of tax details. name, initial_tax, and recurring_tax are required.
3570 3570
      */
3571
-    public function add_tax( $tax ) {
3572
-        if ( $this->is_taxable() ) {
3571
+    public function add_tax($tax) {
3572
+        if ($this->is_taxable()) {
3573 3573
 
3574
-            $taxes                 = $this->get_taxes();
3575
-			$taxes[ $tax['name'] ] = $tax;
3576
-			$this->set_prop( 'taxes', $tax );
3574
+            $taxes = $this->get_taxes();
3575
+			$taxes[$tax['name']] = $tax;
3576
+			$this->set_prop('taxes', $tax);
3577 3577
 
3578 3578
         }
3579 3579
     }
@@ -3583,29 +3583,29 @@  discard block
 block discarded – undo
3583 3583
 	 *
3584 3584
 	 * @since 1.0.19
3585 3585
 	 */
3586
-	public function get_tax( $tax = null ) {
3586
+	public function get_tax($tax = null) {
3587 3587
 
3588 3588
 		// Backwards compatibility.
3589
-		if ( empty( $tax ) ) {
3589
+		if (empty($tax)) {
3590 3590
 			return $this->get_total_tax();
3591 3591
 		}
3592 3592
 
3593 3593
         $taxes = $this->get_taxes();
3594
-		return isset( $taxes[ $tax ] ) ? $taxes[ $tax ] : null;
3594
+		return isset($taxes[$tax]) ? $taxes[$tax] : null;
3595 3595
     }
3596 3596
 
3597
-	public function get_tax_total_by_name( $name ) {
3598
-		if ( $name && 0 === strpos( $name, 'tax__' ) ) {
3599
-			$name = str_replace( 'tax__', '', $name );
3597
+	public function get_tax_total_by_name($name) {
3598
+		if ($name && 0 === strpos($name, 'tax__')) {
3599
+			$name = str_replace('tax__', '', $name);
3600 3600
 		}
3601 3601
 
3602
-		if ( empty( $name ) ) {
3602
+		if (empty($name)) {
3603 3603
 			return 0;
3604 3604
 		}
3605 3605
 
3606
-		$tax = $this->get_tax( $name );
3606
+		$tax = $this->get_tax($name);
3607 3607
 
3608
-		if ( empty( $tax ) ) {
3608
+		if (empty($tax)) {
3609 3609
 			return 0;
3610 3610
 		}
3611 3611
 
@@ -3617,18 +3617,18 @@  discard block
 block discarded – undo
3617 3617
 	 *
3618 3618
 	 * @since 2.8.8
3619 3619
 	 */
3620
-	public function get_tax_item_name( $tax_key, $tax_item, $suffix = '' ) {
3621
-		$tax_name = _x( 'Tax', 'Tax name', 'invoicing' );
3620
+	public function get_tax_item_name($tax_key, $tax_item, $suffix = '') {
3621
+		$tax_name = _x('Tax', 'Tax name', 'invoicing');
3622 3622
 
3623
-		if ( ! empty( $tax_item ) && is_array( $tax_item ) && ! empty( $tax_item['name'] ) ) {
3624
-			$tax_name = __( $tax_item['name'], 'invoicing' );
3623
+		if (!empty($tax_item) && is_array($tax_item) && !empty($tax_item['name'])) {
3624
+			$tax_name = __($tax_item['name'], 'invoicing');
3625 3625
 		}
3626 3626
 
3627
-		if ( $suffix ) {
3627
+		if ($suffix) {
3628 3628
 			$tax_name .= $suffix;
3629 3629
 		}
3630 3630
 
3631
-		return apply_filters( 'wpinv_invoice_get_tax_name', $tax_name, $this, $tax_key, $tax_item, $suffix );
3631
+		return apply_filters('wpinv_invoice_get_tax_name', $tax_name, $this, $tax_key, $tax_item, $suffix);
3632 3632
 	}
3633 3633
 
3634 3634
 	/**
@@ -3636,44 +3636,44 @@  discard block
 block discarded – undo
3636 3636
 	 *
3637 3637
 	 * @since 2.8.8
3638 3638
 	 */
3639
-	public function get_tax_item_amount( $tax_key, $tax_item, $with_currency = false ) {
3640
-		$tax_amount = $this->get_tax_total_by_name( $tax_key );
3639
+	public function get_tax_item_amount($tax_key, $tax_item, $with_currency = false) {
3640
+		$tax_amount = $this->get_tax_total_by_name($tax_key);
3641 3641
 
3642
-		if ( $with_currency ) {
3643
-			$tax_amount = wpinv_price( $tax_amount, $this->get_currency() );
3642
+		if ($with_currency) {
3643
+			$tax_amount = wpinv_price($tax_amount, $this->get_currency());
3644 3644
 		}
3645 3645
 
3646
-		return apply_filters( 'wpinv_invoice_get_tax_amount', $tax_amount, $this, $tax_item, $with_currency );
3646
+		return apply_filters('wpinv_invoice_get_tax_amount', $tax_amount, $this, $tax_item, $with_currency);
3647 3647
 	}
3648 3648
 
3649
-	public function get_item_tax_name( $percentage = true, $sep = ' + ' ) {
3649
+	public function get_item_tax_name($percentage = true, $sep = ' + ') {
3650 3650
 		$taxes = $this->get_taxes();
3651 3651
 
3652
-		if ( ! empty( $taxes ) && is_array( $taxes ) && count( $taxes ) == 1 && wpinv_display_individual_tax_rates() ) {
3652
+		if (!empty($taxes) && is_array($taxes) && count($taxes) == 1 && wpinv_display_individual_tax_rates()) {
3653 3653
 			$names = array();
3654 3654
 
3655
-			foreach ( $taxes as $key => $tax ) {
3656
-				if ( ! empty( $tax ) && ! empty( $tax['name'] ) ) {
3657
-					$name = __( $tax['name'], 'invoicing' );
3655
+			foreach ($taxes as $key => $tax) {
3656
+				if (!empty($tax) && !empty($tax['name'])) {
3657
+					$name = __($tax['name'], 'invoicing');
3658 3658
 
3659 3659
 					$names[] = $name;
3660 3660
 				}
3661 3661
 			}
3662 3662
 
3663
-			if ( ! empty( $names ) ) {
3664
-				$names = array_unique( $names );
3663
+			if (!empty($names)) {
3664
+				$names = array_unique($names);
3665 3665
 
3666
-				$tax_name = implode( $sep, $names );
3666
+				$tax_name = implode($sep, $names);
3667 3667
 			}
3668 3668
 
3669
-			if ( $percentage ) {
3670
-				$tax_name = wp_sprintf( _x( '%s (%%)', 'Tax name with %. Ex: Tax (%)', 'invoicing' ), $tax_name );
3669
+			if ($percentage) {
3670
+				$tax_name = wp_sprintf(_x('%s (%%)', 'Tax name with %. Ex: Tax (%)', 'invoicing'), $tax_name);
3671 3671
 			}
3672 3672
 		} else {
3673
-			$tax_name = $percentage ? __( 'Tax (%)', 'invoicing' ) : _x( 'Tax', 'Tax name', 'invoicing' );
3673
+			$tax_name = $percentage ? __('Tax (%)', 'invoicing') : _x('Tax', 'Tax name', 'invoicing');
3674 3674
 		}
3675 3675
 
3676
-		return apply_filters( 'wpinv_invoice_get_item_tax_name', $tax_name, $this, $percentage, $sep );
3676
+		return apply_filters('wpinv_invoice_get_item_tax_name', $tax_name, $this, $percentage, $sep);
3677 3677
 	}
3678 3678
 
3679 3679
     /**
@@ -3681,11 +3681,11 @@  discard block
 block discarded – undo
3681 3681
 	 *
3682 3682
 	 * @since 1.0.19
3683 3683
 	 */
3684
-	public function remove_tax( $tax ) {
3684
+	public function remove_tax($tax) {
3685 3685
         $taxes = $this->get_taxes();
3686
-        if ( isset( $taxes[ $tax ] ) ) {
3687
-            unset( $taxes[ $tax ] );
3688
-            $this->set_prop( 'taxes', $taxes );
3686
+        if (isset($taxes[$tax])) {
3687
+            unset($taxes[$tax]);
3688
+            $this->set_prop('taxes', $taxes);
3689 3689
         }
3690 3690
     }
3691 3691
 
@@ -3696,22 +3696,22 @@  discard block
 block discarded – undo
3696 3696
 	 * @return float The recalculated subtotal
3697 3697
 	 */
3698 3698
 	public function recalculate_subtotal() {
3699
-        $items     = $this->get_items();
3699
+        $items = $this->get_items();
3700 3700
 		$subtotal  = 0;
3701 3701
 		$recurring = 0;
3702 3702
 
3703
-        foreach ( $items as $item ) {
3704
-			$subtotal  += $item->get_sub_total( 'edit' );
3705
-			$recurring += $item->get_recurring_sub_total( 'edit' );
3703
+        foreach ($items as $item) {
3704
+			$subtotal  += $item->get_sub_total('edit');
3705
+			$recurring += $item->get_recurring_sub_total('edit');
3706 3706
         }
3707 3707
 
3708
-		if ( wpinv_prices_include_tax() ) {
3709
-			$subtotal  = max( 0, $subtotal - $this->totals['tax']['initial'] );
3710
-			$recurring = max( 0, $recurring - $this->totals['tax']['recurring'] );
3708
+		if (wpinv_prices_include_tax()) {
3709
+			$subtotal  = max(0, $subtotal - $this->totals['tax']['initial']);
3710
+			$recurring = max(0, $recurring - $this->totals['tax']['recurring']);
3711 3711
 		}
3712 3712
 
3713 3713
 		$current = $this->is_renewal() ? $recurring : $subtotal;
3714
-		$this->set_subtotal( $current );
3714
+		$this->set_subtotal($current);
3715 3715
 
3716 3716
 		$this->totals['subtotal'] = array(
3717 3717
 			'initial'   => $subtotal,
@@ -3729,12 +3729,12 @@  discard block
 block discarded – undo
3729 3729
 	 */
3730 3730
 	public function recalculate_total_discount() {
3731 3731
 		// Fix renewal invoice amount when tax + recurring discount applied.
3732
-		if ( $this->is_renewal() && $this->get_discount_code() ) {
3732
+		if ($this->is_renewal() && $this->get_discount_code()) {
3733 3733
 			// Maybe recalculate discount (Pre-GetPaid Fix).
3734
-			$discount = new WPInv_Discount( $this->get_discount_code() );
3734
+			$discount = new WPInv_Discount($this->get_discount_code());
3735 3735
 
3736
-			if ( $discount->exists() && $discount->is_recurring() ) {
3737
-				getpaid_calculate_invoice_discount( $this, $discount );
3736
+			if ($discount->exists() && $discount->is_recurring()) {
3737
+				getpaid_calculate_invoice_discount($this, $discount);
3738 3738
 			}
3739 3739
 		}
3740 3740
 
@@ -3742,14 +3742,14 @@  discard block
 block discarded – undo
3742 3742
 		$discount  = 0;
3743 3743
 		$recurring = 0;
3744 3744
 
3745
-        foreach ( $discounts as $data ) {
3746
-			$discount  += wpinv_sanitize_amount( $data['initial_discount'] );
3747
-			$recurring += wpinv_sanitize_amount( $data['recurring_discount'] );
3745
+        foreach ($discounts as $data) {
3746
+			$discount  += wpinv_sanitize_amount($data['initial_discount']);
3747
+			$recurring += wpinv_sanitize_amount($data['recurring_discount']);
3748 3748
 		}
3749 3749
 
3750 3750
 		$current = $this->is_renewal() ? $recurring : $discount;
3751 3751
 
3752
-		$this->set_total_discount( $current );
3752
+		$this->set_total_discount($current);
3753 3753
 
3754 3754
 		$this->totals['discount'] = array(
3755 3755
 			'initial'   => $discount,
@@ -3770,13 +3770,13 @@  discard block
 block discarded – undo
3770 3770
 
3771 3771
 		// Maybe disable taxes.
3772 3772
 		$vat_number = $this->get_vat_number();
3773
-		$skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $this->get_country() ) && ! empty( $vat_number );
3773
+		$skip_tax   = GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction($this->get_country()) && !empty($vat_number);
3774 3774
 
3775
-		if ( wpinv_is_base_country( $this->get_country() ) && 'vat_too' === wpinv_get_option( 'vat_same_country_rule', 'vat_too' ) ) {
3775
+		if (wpinv_is_base_country($this->get_country()) && 'vat_too' === wpinv_get_option('vat_same_country_rule', 'vat_too')) {
3776 3776
 			$skip_tax = false;
3777 3777
 		}
3778 3778
 
3779
-		if ( ! wpinv_use_taxes() || $this->get_disable_taxes() || ! wpinv_is_country_taxable( $this->get_country() ) || $skip_tax ) {
3779
+		if (!wpinv_use_taxes() || $this->get_disable_taxes() || !wpinv_is_country_taxable($this->get_country()) || $skip_tax) {
3780 3780
 
3781 3781
 			$this->totals['tax'] = array(
3782 3782
 				'initial'   => 0,
@@ -3785,36 +3785,36 @@  discard block
 block discarded – undo
3785 3785
 
3786 3786
 			$this->tax_rate = 0;
3787 3787
 
3788
-			$this->set_taxes( array() );
3788
+			$this->set_taxes(array());
3789 3789
 			$current = 0;
3790 3790
 		} else {
3791 3791
 
3792 3792
 			$item_taxes = array();
3793 3793
 
3794
-			foreach ( $this->get_items() as $item ) {
3795
-				$rates    = getpaid_get_item_tax_rates( $item, $this->get_country(), $this->get_state() );
3796
-				$rates    = getpaid_filter_item_tax_rates( $item, $rates );
3797
-				$taxes    = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, false ), $rates );
3798
-				$r_taxes  = getpaid_calculate_item_taxes( getpaid_get_taxable_amount( $item, true ), $rates );
3799
-				foreach ( $taxes as $name => $amount ) {
3800
-					$recurring = isset( $r_taxes[ $name ] ) ? $r_taxes[ $name ] : 0;
3801
-					$tax       = getpaid_prepare_item_tax( $item, $name, $amount, $recurring );
3802
-
3803
-					if ( ! isset( $item_taxes[ $name ] ) ) {
3804
-						$item_taxes[ $name ] = $tax;
3794
+			foreach ($this->get_items() as $item) {
3795
+				$rates    = getpaid_get_item_tax_rates($item, $this->get_country(), $this->get_state());
3796
+				$rates    = getpaid_filter_item_tax_rates($item, $rates);
3797
+				$taxes    = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, false), $rates);
3798
+				$r_taxes  = getpaid_calculate_item_taxes(getpaid_get_taxable_amount($item, true), $rates);
3799
+				foreach ($taxes as $name => $amount) {
3800
+					$recurring = isset($r_taxes[$name]) ? $r_taxes[$name] : 0;
3801
+					$tax       = getpaid_prepare_item_tax($item, $name, $amount, $recurring);
3802
+
3803
+					if (!isset($item_taxes[$name])) {
3804
+						$item_taxes[$name] = $tax;
3805 3805
 						continue;
3806 3806
 					}
3807 3807
 
3808
-					$item_taxes[ $name ]['initial_tax']   += $tax['initial_tax'];
3809
-					$item_taxes[ $name ]['recurring_tax'] += $tax['recurring_tax'];
3808
+					$item_taxes[$name]['initial_tax']   += $tax['initial_tax'];
3809
+					$item_taxes[$name]['recurring_tax'] += $tax['recurring_tax'];
3810 3810
 
3811 3811
 				}
3812 3812
 			}
3813 3813
 
3814
-			$this->set_taxes( $item_taxes );
3814
+			$this->set_taxes($item_taxes);
3815 3815
 
3816
-			$initial_tax   = array_sum( wp_list_pluck( $item_taxes, 'initial_tax' ) );
3817
-			$recurring_tax = array_sum( wp_list_pluck( $item_taxes, 'recurring_tax' ) );
3816
+			$initial_tax   = array_sum(wp_list_pluck($item_taxes, 'initial_tax'));
3817
+			$recurring_tax = array_sum(wp_list_pluck($item_taxes, 'recurring_tax'));
3818 3818
 
3819 3819
 			$current = $this->is_renewal() ? $recurring_tax : $initial_tax;
3820 3820
 
@@ -3825,7 +3825,7 @@  discard block
 block discarded – undo
3825 3825
 
3826 3826
 		}
3827 3827
 
3828
-		$this->set_total_tax( $current );
3828
+		$this->set_total_tax($current);
3829 3829
 
3830 3830
 		return $current;
3831 3831
 
@@ -3842,25 +3842,25 @@  discard block
 block discarded – undo
3842 3842
 		$fee       = 0;
3843 3843
 		$recurring = 0;
3844 3844
 
3845
-        foreach ( $fees as $data ) {
3846
-			if( isset( $data['initial_fee'] ) ){
3847
-				$fee += wpinv_sanitize_amount( $data['initial_fee'] );
3845
+        foreach ($fees as $data) {
3846
+			if (isset($data['initial_fee'])) {
3847
+				$fee += wpinv_sanitize_amount($data['initial_fee']);
3848 3848
 			}
3849 3849
 
3850
-			if( isset( $data['recurring_fee'] ) ){
3851
-				$recurring += wpinv_sanitize_amount( $data['recurring_fee'] );
3850
+			if (isset($data['recurring_fee'])) {
3851
+				$recurring += wpinv_sanitize_amount($data['recurring_fee']);
3852 3852
 			}
3853 3853
 		}
3854 3854
 
3855 3855
 		$current = $this->is_renewal() ? $recurring : $fee;
3856
-		$this->set_total_fees( $current );
3856
+		$this->set_total_fees($current);
3857 3857
 
3858 3858
 		$this->totals['fee'] = array(
3859 3859
 			'initial'   => $fee,
3860 3860
 			'recurring' => $recurring,
3861 3861
 		);
3862 3862
 
3863
-        $this->set_total_fees( $fee );
3863
+        $this->set_total_fees($fee);
3864 3864
         return $current;
3865 3865
     }
3866 3866
 
@@ -3875,7 +3875,7 @@  discard block
 block discarded – undo
3875 3875
         $this->recalculate_total_discount();
3876 3876
 		$this->recalculate_total_tax();
3877 3877
 		$this->recalculate_subtotal();
3878
-		$this->set_total( $this->get_total_tax( 'edit' ) + $this->get_total_fees( 'edit' ) + $this->get_subtotal( 'edit' ) - $this->get_total_discount( 'edit' ) );
3878
+		$this->set_total($this->get_total_tax('edit') + $this->get_total_fees('edit') + $this->get_subtotal('edit') - $this->get_total_discount('edit'));
3879 3879
 		return $this->get_total();
3880 3880
 	}
3881 3881
 
@@ -3884,7 +3884,7 @@  discard block
 block discarded – undo
3884 3884
 	 */
3885 3885
     public function recalculate_totals() {
3886 3886
         $this->recalculate_total();
3887
-        $this->save( true );
3887
+        $this->save(true);
3888 3888
         return $this;
3889 3889
     }
3890 3890
 
@@ -3902,8 +3902,8 @@  discard block
 block discarded – undo
3902 3902
 	 * @return int|false The new note's ID on success, false on failure.
3903 3903
      *
3904 3904
      */
3905
-    public function add_system_note( $note ) {
3906
-		return $this->add_note( $note, false, false, true );
3905
+    public function add_system_note($note) {
3906
+		return $this->add_note($note, false, false, true);
3907 3907
 	}
3908 3908
 
3909 3909
     /**
@@ -3913,10 +3913,10 @@  discard block
 block discarded – undo
3913 3913
 	 * @return int|false The new note's ID on success, false on failure.
3914 3914
      *
3915 3915
      */
3916
-    public function add_note( $note = '', $customer_type = false, $added_by_user = false, $system = false ) {
3916
+    public function add_note($note = '', $customer_type = false, $added_by_user = false, $system = false) {
3917 3917
 
3918 3918
         // Bail if no note specified or this invoice is not yet saved.
3919
-        if ( ! $note || $this->get_id() == 0 || ( ! is_user_logged_in() && ! $system ) ) {
3919
+        if (!$note || $this->get_id() == 0 || (!is_user_logged_in() && !$system)) {
3920 3920
             return false;
3921 3921
         }
3922 3922
 
@@ -3924,23 +3924,23 @@  discard block
 block discarded – undo
3924 3924
 		$author_email = '[email protected]';
3925 3925
 
3926 3926
 		// If this is an admin comment or it has been added by the user.
3927
-		if ( is_user_logged_in() && ( ! $system || $added_by_user ) ) {
3928
-			$user         = get_user_by( 'id', get_current_user_id() );
3927
+		if (is_user_logged_in() && (!$system || $added_by_user)) {
3928
+			$user = get_user_by('id', get_current_user_id());
3929 3929
             $author       = $user->display_name;
3930 3930
             $author_email = $user->user_email;
3931 3931
 		}
3932 3932
 
3933
-		return getpaid_notes()->add_invoice_note( $this, $note, $author, $author_email, $customer_type );
3933
+		return getpaid_notes()->add_invoice_note($this, $note, $author, $author_email, $customer_type);
3934 3934
 
3935 3935
 	}
3936 3936
 
3937 3937
 	/**
3938 3938
      * Generates a unique key for the invoice.
3939 3939
      */
3940
-    public function generate_key( $string = '' ) {
3941
-        $auth_key  = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
3940
+    public function generate_key($string = '') {
3941
+        $auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
3942 3942
         return strtolower(
3943
-            $string . md5( $this->get_id() . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'wpinv', true ) )
3943
+            $string . md5($this->get_id() . date('Y-m-d H:i:s') . $auth_key . uniqid('wpinv', true))
3944 3944
         );
3945 3945
     }
3946 3946
 
@@ -3950,11 +3950,11 @@  discard block
 block discarded – undo
3950 3950
     public function generate_number() {
3951 3951
         $number = $this->get_id();
3952 3952
 
3953
-        if ( wpinv_sequential_number_active( $this->get_post_type() ) ) {
3954
-            $number = wpinv_get_next_invoice_number( $this->get_post_type() );
3953
+        if (wpinv_sequential_number_active($this->get_post_type())) {
3954
+            $number = wpinv_get_next_invoice_number($this->get_post_type());
3955 3955
         }
3956 3956
 
3957
-		return wpinv_format_invoice_number( $number, $this->get_post_type() );
3957
+		return wpinv_format_invoice_number($number, $this->get_post_type());
3958 3958
 
3959 3959
 	}
3960 3960
 
@@ -3967,55 +3967,55 @@  discard block
 block discarded – undo
3967 3967
 		// Reset status transition variable.
3968 3968
 		$this->status_transition = false;
3969 3969
 
3970
-		if ( $status_transition ) {
3970
+		if ($status_transition) {
3971 3971
 			try {
3972 3972
 
3973 3973
 				// Fire a hook for the status change.
3974
-				do_action( 'getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition );
3974
+				do_action('getpaid_invoice_status_' . $status_transition['to'], $this, $status_transition);
3975 3975
 
3976 3976
 				// @deprecated this is deprecated and will be removed in the future.
3977
-				do_action( 'wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3977
+				do_action('wpinv_status_' . $status_transition['to'], $this->get_id(), $status_transition['from']);
3978 3978
 
3979
-				if ( ! empty( $status_transition['from'] ) ) {
3979
+				if (!empty($status_transition['from'])) {
3980 3980
 
3981 3981
 					/* translators: 1: old invoice status 2: new invoice status */
3982
-					$transition_note = sprintf( __( 'Status changed from %1$s to %2$s.', 'invoicing' ), wpinv_status_nicename( $status_transition['from'], $this ), wpinv_status_nicename( $status_transition['to'], $this ) );
3982
+					$transition_note = sprintf(__('Status changed from %1$s to %2$s.', 'invoicing'), wpinv_status_nicename($status_transition['from'], $this), wpinv_status_nicename($status_transition['to'], $this));
3983 3983
 
3984 3984
 					// Fire another hook.
3985
-					do_action( 'getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this );
3986
-					do_action( 'getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to'] );
3985
+					do_action('getpaid_invoice_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this);
3986
+					do_action('getpaid_invoice_status_changed', $this, $status_transition['from'], $status_transition['to']);
3987 3987
 
3988 3988
 					// @deprecated this is deprecated and will be removed in the future.
3989
-					do_action( 'wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from'] );
3989
+					do_action('wpinv_status_' . $status_transition['from'] . '_to_' . $status_transition['to'], $this->get_id(), $status_transition['from']);
3990 3990
 
3991 3991
 					// Note the transition occurred.
3992
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), false, $status_transition['manual'] );
3992
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), false, $status_transition['manual']);
3993 3993
 
3994 3994
 					// Work out if this was for a payment, and trigger a payment_status hook instead.
3995 3995
 					if (
3996
-						in_array( $status_transition['from'], array( 'wpi-cancelled', 'pending', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
3997
-						&& in_array( $status_transition['to'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
3996
+						in_array($status_transition['from'], array('wpi-cancelled', 'pending', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true)
3997
+						&& in_array($status_transition['to'], array('publish', 'wpi-processing', 'wpi-renewal'), true)
3998 3998
 					) {
3999
-						do_action( 'getpaid_invoice_payment_status_changed', $this, $status_transition );
3999
+						do_action('getpaid_invoice_payment_status_changed', $this, $status_transition);
4000 4000
 					}
4001 4001
 
4002 4002
 					// Work out if this was for a payment reversal, and trigger a payment_status_reversed hook instead.
4003 4003
 					if (
4004
-						in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ), true )
4005
-						&& in_array( $status_transition['to'], array( 'wpi-cancelled', 'pending', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold' ), true )
4004
+						in_array($status_transition['from'], array('publish', 'wpi-processing', 'wpi-renewal'), true)
4005
+						&& in_array($status_transition['to'], array('wpi-cancelled', 'pending', 'wpi-pending', 'wpi-failed', 'wpi-refunded', 'wpi-onhold'), true)
4006 4006
 					) {
4007
-						do_action( 'getpaid_invoice_payment_status_reversed', $this, $status_transition );
4007
+						do_action('getpaid_invoice_payment_status_reversed', $this, $status_transition);
4008 4008
 					}
4009 4009
 				} else {
4010 4010
 					/* translators: %s: new invoice status */
4011
-					$transition_note = sprintf( __( 'Status set to %s.', 'invoicing' ), wpinv_status_nicename( $status_transition['to'], $this ) );
4011
+					$transition_note = sprintf(__('Status set to %s.', 'invoicing'), wpinv_status_nicename($status_transition['to'], $this));
4012 4012
 
4013 4013
 					// Note the transition occurred.
4014
-					$this->add_note( trim( $status_transition['note'] . ' ' . $transition_note ), 0, $status_transition['manual'] );
4014
+					$this->add_note(trim($status_transition['note'] . ' ' . $transition_note), 0, $status_transition['manual']);
4015 4015
 
4016 4016
 				}
4017
-			} catch ( Exception $e ) {
4018
-				$this->add_note( __( 'Error during status transition.', 'invoicing' ) . ' ' . $e->getMessage() );
4017
+			} catch (Exception $e) {
4018
+				$this->add_note(__('Error during status transition.', 'invoicing') . ' ' . $e->getMessage());
4019 4019
 			}
4020 4020
 		}
4021 4021
 	}
@@ -4023,13 +4023,13 @@  discard block
 block discarded – undo
4023 4023
 	/**
4024 4024
 	 * Updates an invoice status.
4025 4025
 	 */
4026
-	public function update_status( $new_status = false, $note = '', $manual = false ) {
4026
+	public function update_status($new_status = false, $note = '', $manual = false) {
4027 4027
 
4028 4028
 		// Fires before updating a status.
4029
-		do_action( 'wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status( 'edit' ) );
4029
+		do_action('wpinv_before_invoice_status_change', $this->get_id(), $new_status, $this->get_status('edit'));
4030 4030
 
4031 4031
 		// Update the status.
4032
-		$this->set_status( $new_status, $note, $manual );
4032
+		$this->set_status($new_status, $note, $manual);
4033 4033
 
4034 4034
 		// Save the order.
4035 4035
 		return $this->save();
@@ -4040,18 +4040,18 @@  discard block
 block discarded – undo
4040 4040
 	 * @deprecated
4041 4041
 	 */
4042 4042
 	public function refresh_item_ids() {
4043
-        $item_ids = implode( ',', array_unique( wp_list_pluck( $this->get_cart_details(), 'item_id' ) ) );
4044
-        update_post_meta( $this->get_id(), '_wpinv_item_ids', $item_ids );
4043
+        $item_ids = implode(',', array_unique(wp_list_pluck($this->get_cart_details(), 'item_id')));
4044
+        update_post_meta($this->get_id(), '_wpinv_item_ids', $item_ids);
4045 4045
 	}
4046 4046
 
4047 4047
 	/**
4048 4048
 	 * @deprecated
4049 4049
 	 */
4050
-	public function update_items( $temp = false ) {
4050
+	public function update_items($temp = false) {
4051 4051
 
4052
-		$this->set_items( $this->get_items() );
4052
+		$this->set_items($this->get_items());
4053 4053
 
4054
-		if ( ! $temp ) {
4054
+		if (!$temp) {
4055 4055
 			$this->save();
4056 4056
 		}
4057 4057
 
@@ -4065,11 +4065,11 @@  discard block
 block discarded – undo
4065 4065
 
4066 4066
         $discount_code = $this->get_discount_code();
4067 4067
 
4068
-        if ( empty( $discount_code ) ) {
4068
+        if (empty($discount_code)) {
4069 4069
             return false;
4070 4070
         }
4071 4071
 
4072
-        $discount = wpinv_get_discount_obj( $discount_code );
4072
+        $discount = wpinv_get_discount_obj($discount_code);
4073 4073
 
4074 4074
         // Ensure it is active.
4075 4075
         return $discount->exists();
@@ -4080,7 +4080,7 @@  discard block
 block discarded – undo
4080 4080
 	 * Refunds an invoice.
4081 4081
 	 */
4082 4082
     public function refund() {
4083
-		$this->set_status( 'wpi-refunded' );
4083
+		$this->set_status('wpi-refunded');
4084 4084
         $this->save();
4085 4085
 	}
4086 4086
 
@@ -4089,53 +4089,53 @@  discard block
 block discarded – undo
4089 4089
 	 *
4090 4090
 	 * @param string $transaction_id
4091 4091
 	 */
4092
-    public function mark_paid( $transaction_id = null, $note = '' ) {
4092
+    public function mark_paid($transaction_id = null, $note = '') {
4093 4093
 
4094 4094
 		// Set the transaction id.
4095
-		if ( empty( $transaction_id ) ) {
4096
-			$transaction_id = $this->generate_key( 'trans_' );
4095
+		if (empty($transaction_id)) {
4096
+			$transaction_id = $this->generate_key('trans_');
4097 4097
 		}
4098 4098
 
4099
-		if ( ! $this->get_transaction_id() ) {
4100
-			$this->set_transaction_id( $transaction_id );
4099
+		if (!$this->get_transaction_id()) {
4100
+			$this->set_transaction_id($transaction_id);
4101 4101
 		}
4102 4102
 
4103
-		if ( $this->is_paid() && 'wpi-processing' !== $this->get_status() ) {
4103
+		if ($this->is_paid() && 'wpi-processing' !== $this->get_status()) {
4104 4104
 			return $this->save();
4105 4105
 		}
4106 4106
 
4107 4107
 		// Set the completed date.
4108
-		$this->set_date_completed( current_time( 'mysql' ) );
4108
+		$this->set_date_completed(current_time('mysql'));
4109 4109
 
4110 4110
 		// Set the new status.
4111
-		$gateway = sanitize_text_field( $this->get_gateway_title() );
4112
-		if ( $this->is_renewal() || ! $this->is_parent() ) {
4111
+		$gateway = sanitize_text_field($this->get_gateway_title());
4112
+		if ($this->is_renewal() || !$this->is_parent()) {
4113 4113
 
4114
-			$_note = wp_sprintf( __( 'Renewed via %s', 'invoicing' ), $gateway );
4115
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
4114
+			$_note = wp_sprintf(__('Renewed via %s', 'invoicing'), $gateway);
4115
+			$_note = $_note . empty($note) ? '' : " ($note)";
4116 4116
 
4117
-			if ( 'none' == $this->get_gateway() ) {
4117
+			if ('none' == $this->get_gateway()) {
4118 4118
 				$_note = $note;
4119 4119
 			}
4120 4120
 
4121
-			$this->set_status( 'wpi-renewal', $_note );
4121
+			$this->set_status('wpi-renewal', $_note);
4122 4122
 
4123 4123
 		} else {
4124 4124
 
4125
-			$_note = wp_sprintf( __( 'Paid via %s', 'invoicing' ), $gateway );
4126
-			$_note = $_note . empty( $note ) ? '' : " ($note)";
4125
+			$_note = wp_sprintf(__('Paid via %s', 'invoicing'), $gateway);
4126
+			$_note = $_note . empty($note) ? '' : " ($note)";
4127 4127
 
4128
-			if ( 'none' == $this->get_gateway() ) {
4128
+			if ('none' == $this->get_gateway()) {
4129 4129
 				$_note = $note;
4130 4130
 			}
4131 4131
 
4132
-			$this->set_status( 'publish', $_note );
4132
+			$this->set_status('publish', $_note);
4133 4133
 
4134 4134
 		}
4135 4135
 
4136 4136
 		// Set checkout mode.
4137
-		$mode = wpinv_is_test_mode( $this->get_gateway() ) ? 'test' : 'live';
4138
-		$this->set_mode( $mode );
4137
+		$mode = wpinv_is_test_mode($this->get_gateway()) ? 'test' : 'live';
4138
+		$this->set_mode($mode);
4139 4139
 
4140 4140
 		// Save the invoice.
4141 4141
         $this->save();
@@ -4160,16 +4160,16 @@  discard block
 block discarded – undo
4160 4160
      * Clears the subscription's cache.
4161 4161
      */
4162 4162
     public function clear_cache() {
4163
-		if ( $this->get_key() ) {
4164
-			wp_cache_delete( $this->get_key(), 'getpaid_invoice_keys_to_invoice_ids' );
4163
+		if ($this->get_key()) {
4164
+			wp_cache_delete($this->get_key(), 'getpaid_invoice_keys_to_invoice_ids');
4165 4165
 		}
4166 4166
 
4167
-		if ( $this->get_number() ) {
4168
-			wp_cache_delete( $this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids' );
4167
+		if ($this->get_number()) {
4168
+			wp_cache_delete($this->get_number(), 'getpaid_invoice_numbers_to_invoice_ids');
4169 4169
 		}
4170 4170
 
4171
-		if ( $this->get_transaction_id() ) {
4172
-			wp_cache_delete( $this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' );
4171
+		if ($this->get_transaction_id()) {
4172
+			wp_cache_delete($this->get_transaction_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids');
4173 4173
 		}
4174 4174
 	}
4175 4175
 
Please login to merge, or discard this patch.
widgets/subscriptions.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @version 1.0.0
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * Contains the subscriptions widget.
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 			'block-keywords' => "['invoicing','subscriptions', 'getpaid']",
28 28
 			'class_name'     => __CLASS__,
29 29
 			'base_id'        => 'wpinv_subscriptions',
30
-			'name'           => __( 'GetPaid > Subscriptions', 'invoicing' ),
30
+			'name'           => __('GetPaid > Subscriptions', 'invoicing'),
31 31
 			'widget_ops'     => array(
32 32
 				'classname'   => 'getpaid-subscriptions bsui',
33
-				'description' => esc_html__( "Displays the current user's subscriptions.", 'invoicing' ),
33
+				'description' => esc_html__("Displays the current user's subscriptions.", 'invoicing'),
34 34
 			),
35 35
 			'arguments'      => array(
36 36
 				'title' => array(
37
-					'title'    => __( 'Widget title', 'invoicing' ),
38
-					'desc'     => __( 'Enter widget title.', 'invoicing' ),
37
+					'title'    => __('Widget title', 'invoicing'),
38
+					'desc'     => __('Enter widget title.', 'invoicing'),
39 39
 					'type'     => 'text',
40 40
 					'desc_tip' => true,
41 41
 					'default'  => '',
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 		);
47 47
 
48
-		parent::__construct( $options );
48
+		parent::__construct($options);
49 49
 	}
50 50
 
51 51
 	/**
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 	public function get_subscriptions() {
57 57
 
58 58
 		// Prepare license args.
59
-		$args  = array(
59
+		$args = array(
60 60
 			'customer_in' => get_current_user_id(),
61
-			'paged'       => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1,
61
+			'paged'       => (get_query_var('paged')) ? absint(get_query_var('paged')) : 1,
62 62
 		);
63 63
 
64
-		return new GetPaid_Subscriptions_Query( $args );
64
+		return new GetPaid_Subscriptions_Query($args);
65 65
 
66 66
 	}
67 67
 
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @return mixed|string|bool
76 76
 	 */
77
-	public function output( $args = array(), $widget_args = array(), $content = '' ) {
77
+	public function output($args = array(), $widget_args = array(), $content = '') {
78 78
 
79 79
 		// Ensure that the user is logged in.
80
-		if ( ! is_user_logged_in() ) {
80
+		if (!is_user_logged_in()) {
81 81
 
82 82
 			return aui()->alert(
83 83
 				array(
84
-					'content' => wp_kses_post( __( 'You need to log-in or create an account to view this section.', 'invoicing' ) ),
84
+					'content' => wp_kses_post(__('You need to log-in or create an account to view this section.', 'invoicing')),
85 85
 					'type'    => 'error',
86 86
 				)
87 87
 			);
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 		}
90 90
 
91 91
 		// Are we displaying a single subscription?
92
-		if ( isset( $_GET['subscription'] ) ) {
93
-			return $this->display_single_subscription( intval( $_GET['subscription'] ) );
92
+		if (isset($_GET['subscription'])) {
93
+			return $this->display_single_subscription(intval($_GET['subscription']));
94 94
 		}
95 95
 
96 96
 		// Retrieve the user's subscriptions.
@@ -100,27 +100,27 @@  discard block
 block discarded – undo
100 100
 		ob_start();
101 101
 
102 102
 		// Backwards compatibility.
103
-		do_action( 'wpinv_before_user_subscriptions' );
103
+		do_action('wpinv_before_user_subscriptions');
104 104
 
105 105
 		// Display errors and notices.
106 106
 		wpinv_print_errors();
107 107
 
108
-		do_action( 'getpaid_license_manager_before_subscriptions', $subscriptions );
108
+		do_action('getpaid_license_manager_before_subscriptions', $subscriptions);
109 109
 
110 110
 		// Print the table header.
111 111
 		$this->print_table_header();
112 112
 
113 113
 		// Print table body.
114
-		$this->print_table_body( $subscriptions->get_results() );
114
+		$this->print_table_body($subscriptions->get_results());
115 115
 
116 116
 		// Print table footer.
117 117
 		$this->print_table_footer();
118 118
 
119 119
 		// Print the navigation.
120
-		$this->print_navigation( $subscriptions->get_total() );
120
+		$this->print_navigation($subscriptions->get_total());
121 121
 
122 122
 		// Backwards compatibility.
123
-		do_action( 'wpinv_after_user_subscriptions' );
123
+		do_action('wpinv_after_user_subscriptions');
124 124
 
125 125
 		// Return the output.
126 126
 		return ob_get_clean();
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
 	public function get_subscriptions_table_columns() {
136 136
 
137 137
 		$columns = array(
138
-			'subscription' => __( 'Subscription', 'invoicing' ),
139
-			'amount'       => __( 'Amount', 'invoicing' ),
140
-			'renewal-date' => __( 'Next payment', 'invoicing' ),
141
-			'status'       => __( 'Status', 'invoicing' ),
138
+			'subscription' => __('Subscription', 'invoicing'),
139
+			'amount'       => __('Amount', 'invoicing'),
140
+			'renewal-date' => __('Next payment', 'invoicing'),
141
+			'status'       => __('Status', 'invoicing'),
142 142
 			'actions'      => '',
143 143
 		);
144 144
 
145
-		return apply_filters( 'getpaid_frontend_subscriptions_table_columns', $columns );
145
+		return apply_filters('getpaid_frontend_subscriptions_table_columns', $columns);
146 146
 	}
147 147
 
148 148
 	/**
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 
158 158
 				<thead>
159 159
 					<tr>
160
-						<?php foreach ( $this->get_subscriptions_table_columns() as $key => $label ) : ?>
161
-							<th scope="col" class="font-weight-bold getpaid-subscriptions-table-<?php echo esc_attr( $key ); ?>">
162
-								<?php echo esc_html( $label ); ?>
160
+						<?php foreach ($this->get_subscriptions_table_columns() as $key => $label) : ?>
161
+							<th scope="col" class="font-weight-bold getpaid-subscriptions-table-<?php echo esc_attr($key); ?>">
162
+								<?php echo esc_html($label); ?>
163 163
 							</th>
164 164
 						<?php endforeach; ?>
165 165
 					</tr>
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
 	 *
175 175
 	 * @param WPInv_Subscription[] $subscriptions
176 176
 	 */
177
-	public function print_table_body( $subscriptions ) {
177
+	public function print_table_body($subscriptions) {
178 178
 
179
-		if ( empty( $subscriptions ) ) {
179
+		if (empty($subscriptions)) {
180 180
 			$this->print_table_body_no_subscriptions();
181 181
 		} else {
182
-			$this->print_table_body_subscriptions( $subscriptions );
182
+			$this->print_table_body_subscriptions($subscriptions);
183 183
 		}
184 184
 
185 185
 	}
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
 		<tbody>
195 195
 
196 196
 			<tr>
197
-				<td colspan="<?php echo count( $this->get_subscriptions_table_columns() ); ?>">
197
+				<td colspan="<?php echo count($this->get_subscriptions_table_columns()); ?>">
198 198
 
199 199
 					<?php
200 200
 						aui()->alert(
201 201
 							array(
202
-								'content' => wp_kses_post( __( 'No subscriptions found.', 'invoicing' ) ),
202
+								'content' => wp_kses_post(__('No subscriptions found.', 'invoicing')),
203 203
 								'type'    => 'warning',
204 204
 							),
205 205
                             true
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @param WPInv_Subscription[] $subscriptions
220 220
 	 */
221
-	public function print_table_body_subscriptions( $subscriptions ) {
221
+	public function print_table_body_subscriptions($subscriptions) {
222 222
 
223 223
 		?>
224 224
 		<tbody>
225 225
 
226
-			<?php foreach ( $subscriptions as $subscription ) : ?>
226
+			<?php foreach ($subscriptions as $subscription) : ?>
227 227
 				<tr class="getpaid-subscriptions-table-row subscription-<?php echo (int) $subscription->get_id(); ?>">
228 228
 					<?php
229 229
 						wpinv_get_template(
@@ -249,28 +249,28 @@  discard block
 block discarded – undo
249 249
 	 * @since       1.0.0
250 250
 	 * @return      string
251 251
 	 */
252
-	public function add_row_actions( $content, $subscription ) {
252
+	public function add_row_actions($content, $subscription) {
253 253
 
254 254
 		// Prepare row actions.
255 255
 		$actions = array();
256 256
 
257 257
 		// View subscription action.
258
-		$view_url        = getpaid_get_tab_url( 'gp-subscriptions', get_permalink( (int) wpinv_get_option( 'invoice_subscription_page' ) ) );
259
-		$view_url        = esc_url( add_query_arg( 'subscription', (int) $subscription->get_id(), $view_url ) );
260
-		$actions['view'] = "<a href='$view_url' class='btn btn-xs btn-outline-primary text-decoration-none'><i class='fa fa-cog'></i> " . __( 'Manage', 'invoicing' ) . '</a>';
258
+		$view_url        = getpaid_get_tab_url('gp-subscriptions', get_permalink((int) wpinv_get_option('invoice_subscription_page')));
259
+		$view_url        = esc_url(add_query_arg('subscription', (int) $subscription->get_id(), $view_url));
260
+		$actions['view'] = "<a href='$view_url' class='btn btn-xs btn-outline-primary text-decoration-none'><i class='fa fa-cog'></i> " . __('Manage', 'invoicing') . '</a>';
261 261
 
262 262
 		// Filter the actions.
263
-		$actions = apply_filters( 'getpaid_subscriptions_table_subscription_actions', $actions, $subscription );
263
+		$actions = apply_filters('getpaid_subscriptions_table_subscription_actions', $actions, $subscription);
264 264
 
265
-		$sanitized  = array();
266
-		foreach ( $actions as $key => $action ) {
267
-			$key         = sanitize_html_class( $key );
268
-			$action      = wp_kses_post( $action );
265
+		$sanitized = array();
266
+		foreach ($actions as $key => $action) {
267
+			$key         = sanitize_html_class($key);
268
+			$action      = wp_kses_post($action);
269 269
 			$sanitized[] = "<span class='$key'>$action</span>";
270 270
 		}
271 271
 
272 272
 		$row_actions  = "<small class='form-text getpaid-subscription-item-btn-actions'>";
273
-		$row_actions .= implode( ' | ', $sanitized );
273
+		$row_actions .= implode(' | ', $sanitized);
274 274
 		$row_actions .= '</small>';
275 275
 
276 276
 		return $content . $row_actions;
@@ -286,9 +286,9 @@  discard block
 block discarded – undo
286 286
 
287 287
 				<tfoot>
288 288
 					<tr>
289
-						<?php foreach ( $this->get_subscriptions_table_columns() as $key => $label ) : ?>
290
-							<th class="font-weight-bold getpaid-subscriptions-<?php echo esc_attr( $key ); ?>">
291
-								<?php echo esc_html( $label ); ?>
289
+						<?php foreach ($this->get_subscriptions_table_columns() as $key => $label) : ?>
290
+							<th class="font-weight-bold getpaid-subscriptions-<?php echo esc_attr($key); ?>">
291
+								<?php echo esc_html($label); ?>
292 292
 							</th>
293 293
 						<?php endforeach; ?>
294 294
 					</tr>
@@ -304,22 +304,22 @@  discard block
 block discarded – undo
304 304
 	 *
305 305
 	 * @param int $total
306 306
 	 */
307
-	public function print_navigation( $total ) {
307
+	public function print_navigation($total) {
308 308
 
309
-		if ( $total < 1 ) {
309
+		if ($total < 1) {
310 310
 
311 311
 			// Out-of-bounds, run the query again without LIMIT for total count.
312
-			$args  = array(
312
+			$args = array(
313 313
 				'customer_in' => get_current_user_id(),
314 314
 				'fields'      => 'id',
315 315
 			);
316 316
 
317
-			$count_query = new GetPaid_Subscriptions_Query( $args );
317
+			$count_query = new GetPaid_Subscriptions_Query($args);
318 318
 			$total       = $count_query->get_total();
319 319
 		}
320 320
 
321 321
 		// Abort if we do not have pages.
322
-		if ( 2 > $total ) {
322
+		if (2 > $total) {
323 323
 			return;
324 324
 		}
325 325
 
@@ -332,9 +332,9 @@  discard block
 block discarded – undo
332 332
 				echo wp_kses_post(
333 333
 					getpaid_paginate_links(
334 334
 						array(
335
-							'base'   => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
335
+							'base'   => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
336 336
 							'format' => '?paged=%#%',
337
-							'total'  => (int) ceil( $total / 10 ),
337
+							'total'  => (int) ceil($total / 10),
338 338
 						)
339 339
 					)
340 340
 				);
@@ -351,43 +351,43 @@  discard block
 block discarded – undo
351 351
 	 *
352 352
 	 * @return array
353 353
 	 */
354
-	public function get_single_subscription_columns( $subscription ) {
354
+	public function get_single_subscription_columns($subscription) {
355 355
 
356 356
 		// Prepare subscription detail columns.
357
-		$subscription_group = getpaid_get_invoice_subscription_group( $subscription->get_parent_invoice_id(), $subscription->get_id() );
358
-		$items_count        = empty( $subscription_group ) ? 1 : count( $subscription_group['items'] );
357
+		$subscription_group = getpaid_get_invoice_subscription_group($subscription->get_parent_invoice_id(), $subscription->get_id());
358
+		$items_count        = empty($subscription_group) ? 1 : count($subscription_group['items']);
359 359
 		$fields             = apply_filters(
360 360
 			'getpaid_single_subscription_details_fields',
361 361
 			array(
362
-				'status'           => __( 'Status', 'invoicing' ),
363
-				'initial_amount'   => __( 'Initial amount', 'invoicing' ),
364
-				'recurring_amount' => __( 'Recurring amount', 'invoicing' ),
365
-				'start_date'       => __( 'Start date', 'invoicing' ),
366
-				'expiry_date'      => __( 'Next payment', 'invoicing' ),
367
-				'payments'         => __( 'Payments', 'invoicing' ),
368
-				'item'             => $items_count > 1 ? __( 'Items', $items_count, 'invoicing' ) : __( 'Item', 'invoicing' )
362
+				'status'           => __('Status', 'invoicing'),
363
+				'initial_amount'   => __('Initial amount', 'invoicing'),
364
+				'recurring_amount' => __('Recurring amount', 'invoicing'),
365
+				'start_date'       => __('Start date', 'invoicing'),
366
+				'expiry_date'      => __('Next payment', 'invoicing'),
367
+				'payments'         => __('Payments', 'invoicing'),
368
+				'item'             => $items_count > 1 ? __('Items', $items_count, 'invoicing') : __('Item', 'invoicing')
369 369
 			),
370 370
 			$subscription,
371 371
 			$items_count
372 372
 		);
373 373
 
374
-		if ( isset( $fields['expiry_date'] ) ) {
374
+		if (isset($fields['expiry_date'])) {
375 375
 
376
-			if ( ! $subscription->is_active() || $subscription->is_last_renewal() ) {
377
-				$fields['expiry_date'] = __( 'End date', 'invoicing' );
376
+			if (!$subscription->is_active() || $subscription->is_last_renewal()) {
377
+				$fields['expiry_date'] = __('End date', 'invoicing');
378 378
 			}
379 379
 
380
-			if ( 'pending' === $subscription->get_status() ) {
381
-				unset( $fields['expiry_date'] );
380
+			if ('pending' === $subscription->get_status()) {
381
+				unset($fields['expiry_date']);
382 382
 			}
383 383
 		}
384 384
 
385
-		if ( isset( $fields['start_date'] ) && 'pending' === $subscription->get_status() ) {
386
-			unset( $fields['start_date'] );
385
+		if (isset($fields['start_date']) && 'pending' === $subscription->get_status()) {
386
+			unset($fields['start_date']);
387 387
 		}
388 388
 
389
-		if ( $subscription->get_initial_amount() === $subscription->get_recurring_amount() ) {
390
-			unset( $fields['initial_amount'] );
389
+		if ($subscription->get_initial_amount() === $subscription->get_recurring_amount()) {
390
+			unset($fields['initial_amount']);
391 391
 		}
392 392
 
393 393
 		return $fields;
@@ -400,16 +400,16 @@  discard block
 block discarded – undo
400 400
 	 *
401 401
 	 * @return string
402 402
 	 */
403
-	public function display_single_subscription( $subscription ) {
403
+	public function display_single_subscription($subscription) {
404 404
 
405 405
 		// Fetch the subscription.
406
-		$subscription = new WPInv_Subscription( (int) $subscription );
406
+		$subscription = new WPInv_Subscription((int) $subscription);
407 407
 
408
-		if ( ! $subscription->exists() ) {
408
+		if (!$subscription->exists()) {
409 409
 
410 410
 			return aui()->alert(
411 411
 				array(
412
-					'content' => wp_kses_post( __( 'Subscription not found.', 'invoicing' ) ),
412
+					'content' => wp_kses_post(__('Subscription not found.', 'invoicing')),
413 413
 					'type'    => 'error',
414 414
 				)
415 415
 			);
@@ -417,11 +417,11 @@  discard block
 block discarded – undo
417 417
 		}
418 418
 
419 419
 		// Ensure that the user owns this subscription key.
420
-		if ( get_current_user_id() != $subscription->get_customer_id() && ! wpinv_current_user_can_manage_invoicing() ) {
420
+		if (get_current_user_id() != $subscription->get_customer_id() && !wpinv_current_user_can_manage_invoicing()) {
421 421
 
422 422
 			return aui()->alert(
423 423
 				array(
424
-					'content' => wp_kses_post( __( 'You do not have permission to view this subscription. Ensure that you are logged in to the account that owns the subscription.', 'invoicing' ) ),
424
+					'content' => wp_kses_post(__('You do not have permission to view this subscription. Ensure that you are logged in to the account that owns the subscription.', 'invoicing')),
425 425
 					'type'    => 'error',
426 426
 				)
427 427
 			);
Please login to merge, or discard this patch.
includes/invoice-functions.php 1 patch
Spacing   +373 added lines, -373 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
  * Retrieves the current invoice.
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
 function getpaid_get_current_invoice_id() {
15 15
 
16 16
     // Ensure that we have an invoice key.
17
-    if ( empty( $_GET['invoice_key'] ) ) {
17
+    if (empty($_GET['invoice_key'])) {
18 18
         return 0;
19 19
     }
20 20
 
21 21
     // Retrieve an invoice using the key.
22
-    $invoice = new WPInv_Invoice( sanitize_text_field( $_GET['invoice_key'] ) );
22
+    $invoice = new WPInv_Invoice(sanitize_text_field($_GET['invoice_key']));
23 23
 
24 24
     // Compare the invoice key and the parsed key.
25
-    if ( $invoice->get_id() != 0 && $invoice->get_key() == sanitize_text_field( $_GET['invoice_key'] ) ) {
25
+    if ($invoice->get_id() != 0 && $invoice->get_key() == sanitize_text_field($_GET['invoice_key'])) {
26 26
         return $invoice->get_id();
27 27
     }
28 28
 
@@ -32,42 +32,42 @@  discard block
 block discarded – undo
32 32
 /**
33 33
  * Checks if the current user cna view an invoice.
34 34
  */
35
-function wpinv_user_can_view_invoice( $invoice ) {
36
-    $invoice = new WPInv_Invoice( $invoice );
35
+function wpinv_user_can_view_invoice($invoice) {
36
+    $invoice = new WPInv_Invoice($invoice);
37 37
 
38 38
     // Abort if the invoice does not exist.
39
-    if ( 0 == $invoice->get_id() ) {
39
+    if (0 == $invoice->get_id()) {
40 40
         return false;
41 41
     }
42 42
 
43 43
     // Don't allow trash, draft status
44
-    if ( $invoice->is_draft() ) {
44
+    if ($invoice->is_draft()) {
45 45
         return false;
46 46
     }
47 47
 
48 48
     // If users are not required to login to check out, compare the invoice keys.
49
-    if ( ! wpinv_require_login_to_checkout() && isset( $_GET['invoice_key'] ) && sanitize_text_field( $_GET['invoice_key'] ) == $invoice->get_key() ) {
49
+    if (!wpinv_require_login_to_checkout() && isset($_GET['invoice_key']) && sanitize_text_field($_GET['invoice_key']) == $invoice->get_key()) {
50 50
         return true;
51 51
     }
52 52
 
53 53
     // Always enable for admins..
54
-    if ( wpinv_current_user_can( 'view_invoice', array( 'invoice' => $invoice ) ) || current_user_can( 'view_invoices', $invoice->get_id() ) ) { // Admin user
54
+    if (wpinv_current_user_can('view_invoice', array('invoice' => $invoice)) || current_user_can('view_invoices', $invoice->get_id())) { // Admin user
55 55
         return true;
56 56
     }
57 57
 
58 58
     // Else, ensure that this is their invoice.
59
-    if ( is_user_logged_in() && $invoice->get_user_id() == get_current_user_id() ) {
59
+    if (is_user_logged_in() && $invoice->get_user_id() == get_current_user_id()) {
60 60
         return true;
61 61
     }
62 62
 
63
-    return apply_filters( 'wpinv_current_user_can_view_invoice', false, $invoice );
63
+    return apply_filters('wpinv_current_user_can_view_invoice', false, $invoice);
64 64
 }
65 65
 
66 66
 /**
67 67
  * Checks if the current user cna view an invoice receipt.
68 68
  */
69
-function wpinv_can_view_receipt( $invoice ) {
70
-	return (bool) apply_filters( 'wpinv_can_view_receipt', wpinv_user_can_view_invoice( $invoice ), $invoice );
69
+function wpinv_can_view_receipt($invoice) {
70
+	return (bool) apply_filters('wpinv_can_view_receipt', wpinv_user_can_view_invoice($invoice), $invoice);
71 71
 }
72 72
 
73 73
 /**
@@ -77,16 +77,16 @@  discard block
 block discarded – undo
77 77
  */
78 78
 function getpaid_get_invoice_post_types() {
79 79
     $post_types = array(
80
-        'wpi_quote'   => __( 'Quote', 'invoicing' ),
81
-        'wpi_invoice' => __( 'Invoice', 'invoicing' ),
80
+        'wpi_quote'   => __('Quote', 'invoicing'),
81
+        'wpi_invoice' => __('Invoice', 'invoicing'),
82 82
     );
83 83
 
84 84
     // Ensure the quotes addon is installed.
85
-    if ( ! defined( 'WPINV_QUOTES_VERSION' ) ) {
86
-        unset( $post_types['wpi_quote'] );
85
+    if (!defined('WPINV_QUOTES_VERSION')) {
86
+        unset($post_types['wpi_quote']);
87 87
     }
88 88
 
89
-    return apply_filters( 'getpaid_invoice_post_types', $post_types );
89
+    return apply_filters('getpaid_invoice_post_types', $post_types);
90 90
 }
91 91
 
92 92
 /**
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
  *
96 96
  * @param string $post_type The post type to check for.
97 97
  */
98
-function getpaid_is_invoice_post_type( $post_type ) {
99
-	return is_scalar( $post_type ) && ! empty( $post_type ) && strpos( $post_type, 'wpi_' ) === 0 && array_key_exists( $post_type, getpaid_get_invoice_post_types() );
98
+function getpaid_is_invoice_post_type($post_type) {
99
+	return is_scalar($post_type) && !empty($post_type) && strpos($post_type, 'wpi_') === 0 && array_key_exists($post_type, getpaid_get_invoice_post_types());
100 100
 }
101 101
 
102 102
 /**
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
  * @param  bool  $wp_error       Whether to return false or WP_Error on failure.
107 107
  * @return int|WP_Error|WPInv_Invoice The value 0 or WP_Error on failure. The WPInv_Invoice object on success.
108 108
  */
109
-function wpinv_create_invoice( $data = array(), $deprecated = null, $wp_error = false ) {
109
+function wpinv_create_invoice($data = array(), $deprecated = null, $wp_error = false) {
110 110
     $data['invoice_id'] = 0;
111
-    return wpinv_insert_invoice( $data, $wp_error );
111
+    return wpinv_insert_invoice($data, $wp_error);
112 112
 }
113 113
 
114 114
 /**
@@ -118,35 +118,35 @@  discard block
 block discarded – undo
118 118
  * @param  bool  $wp_error       Whether to return false or WP_Error on failure.
119 119
  * @return int|WP_Error|WPInv_Invoice The value 0 or WP_Error on failure. The WPInv_Invoice object on success.
120 120
  */
121
-function wpinv_update_invoice( $data = array(), $wp_error = false ) {
121
+function wpinv_update_invoice($data = array(), $wp_error = false) {
122 122
 
123 123
     // Backwards compatibility.
124
-    if ( ! empty( $data['ID'] ) ) {
124
+    if (!empty($data['ID'])) {
125 125
         $data['invoice_id'] = $data['ID'];
126 126
     }
127 127
 
128 128
     // Do we have an invoice id?
129
-    if ( empty( $data['invoice_id'] ) ) {
130
-        return $wp_error ? new WP_Error( 'invalid_invoice_id', __( 'Invalid invoice ID.', 'invoicing' ) ) : 0;
129
+    if (empty($data['invoice_id'])) {
130
+        return $wp_error ? new WP_Error('invalid_invoice_id', __('Invalid invoice ID.', 'invoicing')) : 0;
131 131
     }
132 132
 
133 133
     // Retrieve the invoice.
134
-    $invoice = wpinv_get_invoice( $data['invoice_id'] );
134
+    $invoice = wpinv_get_invoice($data['invoice_id']);
135 135
 
136 136
     // And abort if it does not exist.
137
-    if ( empty( $invoice ) ) {
138
-        return $wp_error ? new WP_Error( 'missing_invoice', __( 'Invoice not found.', 'invoicing' ) ) : 0;
137
+    if (empty($invoice)) {
138
+        return $wp_error ? new WP_Error('missing_invoice', __('Invoice not found.', 'invoicing')) : 0;
139 139
     }
140 140
 
141 141
     // Do not update totals for paid / refunded invoices.
142
-    if ( $invoice->is_paid() || $invoice->is_refunded() ) {
142
+    if ($invoice->is_paid() || $invoice->is_refunded()) {
143 143
 
144
-        if ( ! empty( $data['items'] ) || ! empty( $data['cart_details'] ) ) {
145
-            return $wp_error ? new WP_Error( 'paid_invoice', __( 'You can not update cart items for invoices that have already been paid for.', 'invoicing' ) ) : 0;
144
+        if (!empty($data['items']) || !empty($data['cart_details'])) {
145
+            return $wp_error ? new WP_Error('paid_invoice', __('You can not update cart items for invoices that have already been paid for.', 'invoicing')) : 0;
146 146
         }
147 147
 }
148 148
 
149
-    return wpinv_insert_invoice( $data, $wp_error );
149
+    return wpinv_insert_invoice($data, $wp_error);
150 150
 
151 151
 }
152 152
 
@@ -157,62 +157,62 @@  discard block
 block discarded – undo
157 157
  * @param  bool  $wp_error       Whether to return false or WP_Error on failure.
158 158
  * @return int|WP_Error|WPInv_Invoice The value 0 or WP_Error on failure. The WPInv_Invoice object on success.
159 159
  */
160
-function wpinv_insert_invoice( $data = array(), $wp_error = false ) {
160
+function wpinv_insert_invoice($data = array(), $wp_error = false) {
161 161
 
162 162
     // Ensure that we have invoice data.
163
-    if ( empty( $data ) ) {
163
+    if (empty($data)) {
164 164
         return false;
165 165
     }
166 166
 
167 167
     // The invoice id will be provided when updating an invoice.
168
-    $data['invoice_id'] = ! empty( $data['invoice_id'] ) ? (int) $data['invoice_id'] : false;
168
+    $data['invoice_id'] = !empty($data['invoice_id']) ? (int) $data['invoice_id'] : false;
169 169
 
170 170
     // Retrieve the invoice.
171
-    $invoice = new WPInv_Invoice( $data['invoice_id'] );
171
+    $invoice = new WPInv_Invoice($data['invoice_id']);
172 172
 
173 173
     // Do we have an error?
174
-    if ( ! empty( $invoice->last_error ) ) {
175
-        return $wp_error ? new WP_Error( 'invalid_invoice_id', $invoice->last_error ) : 0;
174
+    if (!empty($invoice->last_error)) {
175
+        return $wp_error ? new WP_Error('invalid_invoice_id', $invoice->last_error) : 0;
176 176
     }
177 177
 
178 178
     // Backwards compatibility (billing address).
179
-    if ( ! empty( $data['user_info'] ) ) {
179
+    if (!empty($data['user_info'])) {
180 180
 
181
-        foreach ( $data['user_info'] as $key => $value ) {
181
+        foreach ($data['user_info'] as $key => $value) {
182 182
 
183
-            if ( $key == 'discounts' ) {
183
+            if ($key == 'discounts') {
184 184
                 $value = (array) $value;
185
-                $data['discount_code'] = empty( $value ) ? null : $value[0];
185
+                $data['discount_code'] = empty($value) ? null : $value[0];
186 186
             } else {
187
-                $data[ $key ] = $value;
187
+                $data[$key] = $value;
188 188
             }
189 189
 }
190 190
 }
191 191
 
192 192
     // Backwards compatibility.
193
-    if ( ! empty( $data['payment_details'] ) ) {
193
+    if (!empty($data['payment_details'])) {
194 194
 
195
-        foreach ( $data['payment_details'] as $key => $value ) {
196
-            $data[ $key ] = $value;
195
+        foreach ($data['payment_details'] as $key => $value) {
196
+            $data[$key] = $value;
197 197
         }
198 198
 }
199 199
 
200 200
     // Set up the owner of the invoice.
201
-    $user_id = ! empty( $data['user_id'] ) ? wpinv_clean( $data['user_id'] ) : get_current_user_id();
201
+    $user_id = !empty($data['user_id']) ? wpinv_clean($data['user_id']) : get_current_user_id();
202 202
 
203 203
     // Make sure the user exists.
204
-    if ( ! get_userdata( $user_id ) ) {
205
-        return $wp_error ? new WP_Error( 'wpinv_invalid_user', __( 'There is no user with that ID.', 'invoicing' ) ) : 0;
204
+    if (!get_userdata($user_id)) {
205
+        return $wp_error ? new WP_Error('wpinv_invalid_user', __('There is no user with that ID.', 'invoicing')) : 0;
206 206
     }
207 207
 
208
-    $address = wpinv_get_user_address( $user_id );
208
+    $address = wpinv_get_user_address($user_id);
209 209
 
210
-    foreach ( $address as $key => $value ) {
210
+    foreach ($address as $key => $value) {
211 211
 
212
-        if ( $value == '' ) {
213
-            $address[ $key ] = null;
212
+        if ($value == '') {
213
+            $address[$key] = null;
214 214
         } else {
215
-            $address[ $key ] = wpinv_clean( $value );
215
+            $address[$key] = wpinv_clean($value);
216 216
         }
217 217
 }
218 218
 
@@ -221,101 +221,101 @@  discard block
 block discarded – undo
221 221
         array(
222 222
 
223 223
             // Basic info.
224
-            'template'          => isset( $data['template'] ) ? wpinv_clean( $data['template'] ) : null,
225
-            'email_cc'          => isset( $data['email_cc'] ) ? wpinv_clean( $data['email_cc'] ) : null,
226
-            'date_created'      => isset( $data['created_date'] ) ? wpinv_clean( $data['created_date'] ) : null,
227
-            'due_date'          => isset( $data['due_date'] ) ? wpinv_clean( $data['due_date'] ) : null,
228
-            'date_completed'    => isset( $data['date_completed'] ) ? wpinv_clean( $data['date_completed'] ) : null,
229
-            'number'            => isset( $data['number'] ) ? wpinv_clean( $data['number'] ) : null,
230
-            'key'               => isset( $data['key'] ) ? wpinv_clean( $data['key'] ) : null,
231
-            'status'            => isset( $data['status'] ) ? wpinv_clean( $data['status'] ) : null,
232
-            'post_type'         => isset( $data['post_type'] ) ? wpinv_clean( $data['post_type'] ) : null,
233
-            'user_ip'           => isset( $data['ip'] ) ? wpinv_clean( $data['ip'] ) : wpinv_get_ip(),
234
-            'parent_id'         => isset( $data['parent'] ) ? intval( $data['parent'] ) : null,
235
-            'mode'              => isset( $data['mode'] ) ? wpinv_clean( $data['mode'] ) : null,
236
-            'description'       => isset( $data['description'] ) ? wp_kses_post( $data['description'] ) : null,
224
+            'template'          => isset($data['template']) ? wpinv_clean($data['template']) : null,
225
+            'email_cc'          => isset($data['email_cc']) ? wpinv_clean($data['email_cc']) : null,
226
+            'date_created'      => isset($data['created_date']) ? wpinv_clean($data['created_date']) : null,
227
+            'due_date'          => isset($data['due_date']) ? wpinv_clean($data['due_date']) : null,
228
+            'date_completed'    => isset($data['date_completed']) ? wpinv_clean($data['date_completed']) : null,
229
+            'number'            => isset($data['number']) ? wpinv_clean($data['number']) : null,
230
+            'key'               => isset($data['key']) ? wpinv_clean($data['key']) : null,
231
+            'status'            => isset($data['status']) ? wpinv_clean($data['status']) : null,
232
+            'post_type'         => isset($data['post_type']) ? wpinv_clean($data['post_type']) : null,
233
+            'user_ip'           => isset($data['ip']) ? wpinv_clean($data['ip']) : wpinv_get_ip(),
234
+            'parent_id'         => isset($data['parent']) ? intval($data['parent']) : null,
235
+            'mode'              => isset($data['mode']) ? wpinv_clean($data['mode']) : null,
236
+            'description'       => isset($data['description']) ? wp_kses_post($data['description']) : null,
237 237
 
238 238
             // Payment info.
239
-            'disable_taxes'     => ! empty( $data['disable_taxes'] ),
240
-            'currency'          => isset( $data['currency'] ) ? wpinv_clean( $data['currency'] ) : wpinv_get_currency(),
241
-            'gateway'           => isset( $data['gateway'] ) ? wpinv_clean( $data['gateway'] ) : null,
242
-            'transaction_id'    => isset( $data['transaction_id'] ) ? wpinv_clean( $data['transaction_id'] ) : null,
243
-            'discount_code'     => isset( $data['discount_code'] ) ? wpinv_clean( $data['discount_code'] ) : null,
244
-            'payment_form'      => isset( $data['payment_form'] ) ? intval( $data['payment_form'] ) : null,
245
-            'submission_id'     => isset( $data['submission_id'] ) ? wpinv_clean( $data['submission_id'] ) : null,
246
-            'subscription_id'   => isset( $data['subscription_id'] ) ? wpinv_clean( $data['subscription_id'] ) : null,
247
-            'is_viewed'         => isset( $data['is_viewed'] ) ? wpinv_clean( $data['is_viewed'] ) : null,
248
-            'fees'              => isset( $data['fees'] ) ? wpinv_clean( $data['fees'] ) : null,
249
-            'discounts'         => isset( $data['discounts'] ) ? wpinv_clean( $data['discounts'] ) : null,
250
-            'taxes'             => isset( $data['taxes'] ) ? wpinv_clean( $data['taxes'] ) : null,
239
+            'disable_taxes'     => !empty($data['disable_taxes']),
240
+            'currency'          => isset($data['currency']) ? wpinv_clean($data['currency']) : wpinv_get_currency(),
241
+            'gateway'           => isset($data['gateway']) ? wpinv_clean($data['gateway']) : null,
242
+            'transaction_id'    => isset($data['transaction_id']) ? wpinv_clean($data['transaction_id']) : null,
243
+            'discount_code'     => isset($data['discount_code']) ? wpinv_clean($data['discount_code']) : null,
244
+            'payment_form'      => isset($data['payment_form']) ? intval($data['payment_form']) : null,
245
+            'submission_id'     => isset($data['submission_id']) ? wpinv_clean($data['submission_id']) : null,
246
+            'subscription_id'   => isset($data['subscription_id']) ? wpinv_clean($data['subscription_id']) : null,
247
+            'is_viewed'         => isset($data['is_viewed']) ? wpinv_clean($data['is_viewed']) : null,
248
+            'fees'              => isset($data['fees']) ? wpinv_clean($data['fees']) : null,
249
+            'discounts'         => isset($data['discounts']) ? wpinv_clean($data['discounts']) : null,
250
+            'taxes'             => isset($data['taxes']) ? wpinv_clean($data['taxes']) : null,
251 251
 
252 252
             // Billing details.
253 253
             'user_id'           => $data['user_id'],
254
-            'first_name'        => isset( $data['first_name'] ) ? wpinv_clean( $data['first_name'] ) : $address['first_name'],
255
-            'last_name'         => isset( $data['last_name'] ) ? wpinv_clean( $data['last_name'] ) : $address['last_name'],
256
-            'address'           => isset( $data['address'] ) ? wpinv_clean( $data['address'] ) : $address['address'],
257
-            'vat_number'        => isset( $data['vat_number'] ) ? wpinv_clean( $data['vat_number'] ) : $address['vat_number'],
258
-            'company'           => isset( $data['company'] ) ? wpinv_clean( $data['company'] ) : $address['company'],
259
-            'zip'               => isset( $data['zip'] ) ? wpinv_clean( $data['zip'] ) : $address['zip'],
260
-            'state'             => isset( $data['state'] ) ? wpinv_clean( $data['state'] ) : $address['state'],
261
-            'city'              => isset( $data['city'] ) ? wpinv_clean( $data['city'] ) : $address['city'],
262
-            'country'           => isset( $data['country'] ) ? wpinv_clean( $data['country'] ) : $address['country'],
263
-            'phone'             => isset( $data['phone'] ) ? wpinv_clean( $data['phone'] ) : $address['phone'],
264
-            'address_confirmed' => ! empty( $data['address_confirmed'] ),
254
+            'first_name'        => isset($data['first_name']) ? wpinv_clean($data['first_name']) : $address['first_name'],
255
+            'last_name'         => isset($data['last_name']) ? wpinv_clean($data['last_name']) : $address['last_name'],
256
+            'address'           => isset($data['address']) ? wpinv_clean($data['address']) : $address['address'],
257
+            'vat_number'        => isset($data['vat_number']) ? wpinv_clean($data['vat_number']) : $address['vat_number'],
258
+            'company'           => isset($data['company']) ? wpinv_clean($data['company']) : $address['company'],
259
+            'zip'               => isset($data['zip']) ? wpinv_clean($data['zip']) : $address['zip'],
260
+            'state'             => isset($data['state']) ? wpinv_clean($data['state']) : $address['state'],
261
+            'city'              => isset($data['city']) ? wpinv_clean($data['city']) : $address['city'],
262
+            'country'           => isset($data['country']) ? wpinv_clean($data['country']) : $address['country'],
263
+            'phone'             => isset($data['phone']) ? wpinv_clean($data['phone']) : $address['phone'],
264
+            'address_confirmed' => !empty($data['address_confirmed']),
265 265
 
266 266
         )
267 267
     );
268 268
 
269 269
     // Backwards compatibililty.
270
-    if ( ! empty( $data['cart_details'] ) && is_array( $data['cart_details'] ) ) {
270
+    if (!empty($data['cart_details']) && is_array($data['cart_details'])) {
271 271
         $data['items'] = array();
272 272
 
273
-        foreach ( $data['cart_details'] as $_item ) {
273
+        foreach ($data['cart_details'] as $_item) {
274 274
 
275 275
             // Ensure that we have an item id.
276
-            if ( empty( $_item['id'] ) ) {
276
+            if (empty($_item['id'])) {
277 277
                 continue;
278 278
             }
279 279
 
280 280
             // Retrieve the item.
281
-            $item = new GetPaid_Form_Item( $_item['id'] );
281
+            $item = new GetPaid_Form_Item($_item['id']);
282 282
 
283 283
             // Ensure that it is purchasable.
284
-            if ( ! $item->can_purchase() ) {
284
+            if (!$item->can_purchase()) {
285 285
                 continue;
286 286
             }
287 287
 
288 288
             // Set quantity.
289
-            if ( ! empty( $_item['quantity'] ) && is_numeric( $_item['quantity'] ) ) {
290
-                $item->set_quantity( $_item['quantity'] );
289
+            if (!empty($_item['quantity']) && is_numeric($_item['quantity'])) {
290
+                $item->set_quantity($_item['quantity']);
291 291
             }
292 292
 
293 293
             // Set price.
294
-            if ( isset( $_item['item_price'] ) ) {
295
-                $item->set_price( $_item['item_price'] );
294
+            if (isset($_item['item_price'])) {
295
+                $item->set_price($_item['item_price']);
296 296
             }
297 297
 
298
-            if ( isset( $_item['custom_price'] ) ) {
299
-                $item->set_price( $_item['custom_price'] );
298
+            if (isset($_item['custom_price'])) {
299
+                $item->set_price($_item['custom_price']);
300 300
             }
301 301
 
302 302
             // Set name.
303
-            if ( ! empty( $_item['name'] ) ) {
304
-                $item->set_name( $_item['name'] );
303
+            if (!empty($_item['name'])) {
304
+                $item->set_name($_item['name']);
305 305
             }
306 306
 
307 307
             // Set description.
308
-            if ( isset( $_item['description'] ) ) {
309
-                $item->set_custom_description( $_item['description'] );
308
+            if (isset($_item['description'])) {
309
+                $item->set_custom_description($_item['description']);
310 310
             }
311 311
 
312 312
             // Set meta.
313
-            if ( isset( $_item['meta'] ) && is_array( $_item['meta'] ) ) {
313
+            if (isset($_item['meta']) && is_array($_item['meta'])) {
314 314
 
315
-                $item->set_item_meta( $_item['meta'] );
315
+                $item->set_item_meta($_item['meta']);
316 316
 
317
-                if ( isset( $_item['meta']['description'] ) ) {
318
-                    $item->set_custom_description( $_item['meta']['description'] );
317
+                if (isset($_item['meta']['description'])) {
318
+                    $item->set_custom_description($_item['meta']['description']);
319 319
                 }
320 320
             }
321 321
 
@@ -325,14 +325,14 @@  discard block
 block discarded – undo
325 325
     }
326 326
 
327 327
     // Add invoice items.
328
-    if ( ! empty( $data['items'] ) && is_array( $data['items'] ) ) {
328
+    if (!empty($data['items']) && is_array($data['items'])) {
329 329
 
330
-        $invoice->set_items( array() );
330
+        $invoice->set_items(array());
331 331
 
332
-        foreach ( $data['items'] as $item ) {
332
+        foreach ($data['items'] as $item) {
333 333
 
334
-            if ( is_object( $item ) && is_a( $item, 'GetPaid_Form_Item' ) && $item->can_purchase() ) {
335
-                $invoice->add_item( $item );
334
+            if (is_object($item) && is_a($item, 'GetPaid_Form_Item') && $item->can_purchase()) {
335
+                $invoice->add_item($item);
336 336
             }
337 337
 }
338 338
 }
@@ -341,30 +341,30 @@  discard block
 block discarded – undo
341 341
     $invoice->recalculate_total();
342 342
     $invoice->save();
343 343
 
344
-    if ( ! $invoice->get_id() ) {
345
-        return $wp_error ? new WP_Error( 'wpinv_insert_invoice_error', __( 'An error occured when saving your invoice.', 'invoicing' ) ) : 0;
344
+    if (!$invoice->get_id()) {
345
+        return $wp_error ? new WP_Error('wpinv_insert_invoice_error', __('An error occured when saving your invoice.', 'invoicing')) : 0;
346 346
     }
347 347
 
348 348
     // Add private note.
349
-    if ( ! empty( $data['private_note'] ) ) {
350
-        $invoice->add_note( $data['private_note'] );
349
+    if (!empty($data['private_note'])) {
350
+        $invoice->add_note($data['private_note']);
351 351
     }
352 352
 
353 353
     // User notes.
354
-    if ( ! empty( $data['user_note'] ) ) {
355
-        $invoice->add_note( $data['user_note'], true );
354
+    if (!empty($data['user_note'])) {
355
+        $invoice->add_note($data['user_note'], true);
356 356
     }
357 357
 
358 358
     // Created via.
359
-    if ( isset( $data['created_via'] ) ) {
360
-        update_post_meta( $invoice->get_id(), 'wpinv_created_via', $data['created_via'] );
359
+    if (isset($data['created_via'])) {
360
+        update_post_meta($invoice->get_id(), 'wpinv_created_via', $data['created_via']);
361 361
     }
362 362
 
363 363
     // Backwards compatiblity.
364
-    if ( $invoice->is_quote() ) {
364
+    if ($invoice->is_quote()) {
365 365
 
366
-        if ( isset( $data['valid_until'] ) ) {
367
-            update_post_meta( $invoice->get_id(), 'wpinv_quote_valid_until', $data['valid_until'] );
366
+        if (isset($data['valid_until'])) {
367
+            update_post_meta($invoice->get_id(), 'wpinv_quote_valid_until', $data['valid_until']);
368 368
         }
369 369
 }
370 370
 
@@ -378,20 +378,20 @@  discard block
 block discarded – undo
378 378
  * @param $bool $deprecated
379 379
  * @return WPInv_Invoice|null
380 380
  */
381
-function wpinv_get_invoice( $invoice = 0, $deprecated = false ) {
381
+function wpinv_get_invoice($invoice = 0, $deprecated = false) {
382 382
 
383 383
     // If we are retrieving the invoice from the cart...
384
-    if ( $deprecated && empty( $invoice ) ) {
384
+    if ($deprecated && empty($invoice)) {
385 385
         $invoice = (int) getpaid_get_current_invoice_id();
386 386
     }
387 387
 
388 388
     // Retrieve the invoice.
389
-    if ( ! is_a( $invoice, 'WPInv_Invoice' ) ) {
390
-        $invoice = new WPInv_Invoice( $invoice );
389
+    if (!is_a($invoice, 'WPInv_Invoice')) {
390
+        $invoice = new WPInv_Invoice($invoice);
391 391
     }
392 392
 
393 393
     // Check if it exists.
394
-    if ( $invoice->exists() ) {
394
+    if ($invoice->exists()) {
395 395
         return $invoice;
396 396
     }
397 397
 
@@ -404,15 +404,15 @@  discard block
 block discarded – undo
404 404
  * @param array $args Args to search for.
405 405
  * @return WPInv_Invoice[]|int[]|object
406 406
  */
407
-function wpinv_get_invoices( $args ) {
407
+function wpinv_get_invoices($args) {
408 408
 
409 409
     // Prepare args.
410 410
     $args = wp_parse_args(
411 411
         $args,
412 412
         array(
413
-            'status' => array_keys( wpinv_get_invoice_statuses() ),
413
+            'status' => array_keys(wpinv_get_invoice_statuses()),
414 414
             'type'   => 'wpi_invoice',
415
-            'limit'  => get_option( 'posts_per_page' ),
415
+            'limit'  => get_option('posts_per_page'),
416 416
             'return' => 'objects',
417 417
         )
418 418
     );
@@ -430,24 +430,24 @@  discard block
 block discarded – undo
430 430
         'post__in'       => 'include',
431 431
     );
432 432
 
433
-    foreach ( $map_legacy as $to => $from ) {
434
-        if ( isset( $args[ $from ] ) ) {
435
-            $args[ $to ] = $args[ $from ];
436
-            unset( $args[ $from ] );
433
+    foreach ($map_legacy as $to => $from) {
434
+        if (isset($args[$from])) {
435
+            $args[$to] = $args[$from];
436
+            unset($args[$from]);
437 437
         }
438 438
     }
439 439
 
440 440
     // Backwards compatibility.
441
-    if ( ! empty( $args['email'] ) && empty( $args['user'] ) ) {
441
+    if (!empty($args['email']) && empty($args['user'])) {
442 442
         $args['user'] = $args['email'];
443
-        unset( $args['email'] );
443
+        unset($args['email']);
444 444
     }
445 445
 
446 446
     // Handle cases where the user is set as an email.
447
-    if ( ! empty( $args['author'] ) && is_email( $args['author'] ) ) {
448
-        $user = get_user_by( 'email', $args['user'] );
447
+    if (!empty($args['author']) && is_email($args['author'])) {
448
+        $user = get_user_by('email', $args['user']);
449 449
 
450
-        if ( $user ) {
450
+        if ($user) {
451 451
             $args['author'] = $user->user_email;
452 452
         }
453 453
 }
@@ -457,31 +457,31 @@  discard block
 block discarded – undo
457 457
 
458 458
     // Show all posts.
459 459
     $paginate = true;
460
-    if ( isset( $args['paginate'] ) ) {
460
+    if (isset($args['paginate'])) {
461 461
 
462 462
         $paginate = $args['paginate'];
463
-        $args['no_found_rows'] = empty( $args['paginate'] );
464
-        unset( $args['paginate'] );
463
+        $args['no_found_rows'] = empty($args['paginate']);
464
+        unset($args['paginate']);
465 465
 
466 466
     }
467 467
 
468 468
     // Whether to return objects or fields.
469 469
     $return = $args['return'];
470
-    unset( $args['return'] );
470
+    unset($args['return']);
471 471
 
472 472
     // Get invoices.
473
-    $invoices = new WP_Query( apply_filters( 'wpinv_get_invoices_args', $args ) );
473
+    $invoices = new WP_Query(apply_filters('wpinv_get_invoices_args', $args));
474 474
 
475 475
     // Prepare the results.
476
-    if ( 'objects' === $return ) {
477
-        $results = array_map( 'wpinv_get_invoice', $invoices->posts );
478
-    } elseif ( 'self' === $return ) {
476
+    if ('objects' === $return) {
477
+        $results = array_map('wpinv_get_invoice', $invoices->posts);
478
+    } elseif ('self' === $return) {
479 479
         return $invoices;
480 480
     } else {
481 481
         $results = $invoices->posts;
482 482
     }
483 483
 
484
-    if ( $paginate ) {
484
+    if ($paginate) {
485 485
         return (object) array(
486 486
             'invoices'      => $results,
487 487
             'total'         => $invoices->found_posts,
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
  * @param string $transaction_id The transaction id to check.
500 500
  * @return int Invoice id on success or 0 on failure
501 501
  */
502
-function wpinv_get_id_by_transaction_id( $transaction_id ) {
503
-    return WPInv_Invoice::get_invoice_id_by_field( $transaction_id, 'transaction_id' );
502
+function wpinv_get_id_by_transaction_id($transaction_id) {
503
+    return WPInv_Invoice::get_invoice_id_by_field($transaction_id, 'transaction_id');
504 504
 }
505 505
 
506 506
 /**
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
  * @param string $invoice_number The invoice number to check.
510 510
  * @return int Invoice id on success or 0 on failure
511 511
  */
512
-function wpinv_get_id_by_invoice_number( $invoice_number ) {
513
-    return WPInv_Invoice::get_invoice_id_by_field( $invoice_number, 'number' );
512
+function wpinv_get_id_by_invoice_number($invoice_number) {
513
+    return WPInv_Invoice::get_invoice_id_by_field($invoice_number, 'number');
514 514
 }
515 515
 
516 516
 /**
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
  * @param string $invoice_key The invoice key to check.
520 520
  * @return int Invoice id on success or 0 on failure
521 521
  */
522
-function wpinv_get_invoice_id_by_key( $invoice_key ) {
523
-    return WPInv_Invoice::get_invoice_id_by_field( $invoice_key, 'key' );
522
+function wpinv_get_invoice_id_by_key($invoice_key) {
523
+    return WPInv_Invoice::get_invoice_id_by_field($invoice_key, 'key');
524 524
 }
525 525
 
526 526
 /**
@@ -530,19 +530,19 @@  discard block
 block discarded – undo
530 530
  * @param string $type Optionally filter by type i.e customer|system
531 531
  * @return array|null
532 532
  */
533
-function wpinv_get_invoice_notes( $invoice = 0, $type = '' ) {
533
+function wpinv_get_invoice_notes($invoice = 0, $type = '') {
534 534
 
535 535
     // Prepare the invoice.
536
-    $invoice = wpinv_get_invoice( $invoice );
537
-    if ( empty( $invoice ) ) {
536
+    $invoice = wpinv_get_invoice($invoice);
537
+    if (empty($invoice)) {
538 538
         return null;
539 539
     }
540 540
 
541 541
     // Fetch notes.
542
-    $notes = getpaid_notes()->get_invoice_notes( $invoice->get_id(), $type );
542
+    $notes = getpaid_notes()->get_invoice_notes($invoice->get_id(), $type);
543 543
 
544 544
     // Filter the notes.
545
-    return apply_filters( 'wpinv_invoice_notes', $notes, $invoice->get_id(), $type );
545
+    return apply_filters('wpinv_invoice_notes', $notes, $invoice->get_id(), $type);
546 546
 }
547 547
 
548 548
 /**
@@ -550,10 +550,10 @@  discard block
 block discarded – undo
550 550
  *
551 551
  * @param string $post_type
552 552
  */
553
-function wpinv_get_user_invoices_columns( $post_type = 'wpi_invoice' ) {
553
+function wpinv_get_user_invoices_columns($post_type = 'wpi_invoice') {
554 554
 
555
-    $label   = getpaid_get_post_type_label( $post_type, false );
556
-    $label   = empty( $label ) ? __( 'Invoice', 'invoicing' ) : sanitize_text_field( $label );
555
+    $label   = getpaid_get_post_type_label($post_type, false);
556
+    $label   = empty($label) ? __('Invoice', 'invoicing') : sanitize_text_field($label);
557 557
     $columns = array(
558 558
 
559 559
 		'invoice-number'  => array(
@@ -562,22 +562,22 @@  discard block
 block discarded – undo
562 562
 		),
563 563
 
564 564
 		'created-date'    => array(
565
-			'title' => __( 'Created Date', 'invoicing' ),
565
+			'title' => __('Created Date', 'invoicing'),
566 566
 			'class' => 'text-left',
567 567
 		),
568 568
 
569 569
 		'payment-date'    => array(
570
-			'title' => __( 'Payment Date', 'invoicing' ),
570
+			'title' => __('Payment Date', 'invoicing'),
571 571
 			'class' => 'text-left',
572 572
 		),
573 573
 
574 574
 		'invoice-status'  => array(
575
-			'title' => __( 'Status', 'invoicing' ),
575
+			'title' => __('Status', 'invoicing'),
576 576
 			'class' => 'text-center',
577 577
 		),
578 578
 
579 579
 		'invoice-total'   => array(
580
-			'title' => __( 'Total', 'invoicing' ),
580
+			'title' => __('Total', 'invoicing'),
581 581
 			'class' => 'text-right',
582 582
 		),
583 583
 
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 
589 589
 	);
590 590
 
591
-    return apply_filters( 'wpinv_user_invoices_columns', $columns, $post_type );
591
+    return apply_filters('wpinv_user_invoices_columns', $columns, $post_type);
592 592
 }
593 593
 
594 594
 /**
@@ -598,59 +598,59 @@  discard block
 block discarded – undo
598 598
 
599 599
     // Find the invoice.
600 600
     $invoice_id = getpaid_get_current_invoice_id();
601
-    $invoice = new WPInv_Invoice( $invoice_id );
601
+    $invoice = new WPInv_Invoice($invoice_id);
602 602
 
603 603
     // Abort if non was found.
604
-    if ( empty( $invoice_id ) || $invoice->is_draft() ) {
604
+    if (empty($invoice_id) || $invoice->is_draft()) {
605 605
 
606 606
         return aui()->alert(
607 607
             array(
608 608
                 'type'    => 'warning',
609
-                'content' => __( 'We could not find your invoice', 'invoicing' ),
609
+                'content' => __('We could not find your invoice', 'invoicing'),
610 610
             )
611 611
         );
612 612
 
613 613
     }
614 614
 
615 615
     // Can the user view this invoice?
616
-    if ( ! wpinv_can_view_receipt( $invoice_id ) ) {
616
+    if (!wpinv_can_view_receipt($invoice_id)) {
617 617
 
618 618
         return aui()->alert(
619 619
             array(
620 620
                 'type'    => 'warning',
621
-                'content' => __( 'You are not allowed to view this receipt', 'invoicing' ),
621
+                'content' => __('You are not allowed to view this receipt', 'invoicing'),
622 622
             )
623 623
         );
624 624
 
625 625
     }
626 626
 
627 627
     // Load the template.
628
-    return wpinv_get_template_html( 'invoice-receipt.php', compact( 'invoice' ) );
628
+    return wpinv_get_template_html('invoice-receipt.php', compact('invoice'));
629 629
 
630 630
 }
631 631
 
632 632
 /**
633 633
  * Displays the invoice history.
634 634
  */
635
-function getpaid_invoice_history( $user_id = 0, $post_type = 'wpi_invoice' ) {
635
+function getpaid_invoice_history($user_id = 0, $post_type = 'wpi_invoice') {
636 636
 
637 637
     // Ensure that we have a user id.
638
-    if ( empty( $user_id ) || ! is_numeric( $user_id ) ) {
638
+    if (empty($user_id) || !is_numeric($user_id)) {
639 639
         $user_id = get_current_user_id();
640 640
     }
641 641
 
642
-    $label = getpaid_get_post_type_label( $post_type );
643
-    $label = empty( $label ) ? __( 'Invoices', 'invoicing' ) : sanitize_text_field( $label );
642
+    $label = getpaid_get_post_type_label($post_type);
643
+    $label = empty($label) ? __('Invoices', 'invoicing') : sanitize_text_field($label);
644 644
 
645 645
     // View user id.
646
-    if ( empty( $user_id ) ) {
646
+    if (empty($user_id)) {
647 647
 
648 648
         return aui()->alert(
649 649
             array(
650 650
                 'type'    => 'warning',
651 651
                 'content' => sprintf(
652
-                    __( 'You must be logged in to view your %s.', 'invoicing' ),
653
-                    strtolower( $label )
652
+                    __('You must be logged in to view your %s.', 'invoicing'),
653
+                    strtolower($label)
654 654
                 ),
655 655
             )
656 656
         );
@@ -660,22 +660,22 @@  discard block
 block discarded – undo
660 660
     // Fetch invoices.
661 661
     $invoices = wpinv_get_invoices(
662 662
         array(
663
-            'page'     => ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1,
663
+            'page'     => (get_query_var('paged')) ? absint(get_query_var('paged')) : 1,
664 664
             'user'     => $user_id,
665 665
             'paginate' => true,
666 666
             'type'     => $post_type,
667
-            'status'   => array_keys( wpinv_get_invoice_statuses( false, false, $post_type ) ),
667
+            'status'   => array_keys(wpinv_get_invoice_statuses(false, false, $post_type)),
668 668
         )
669 669
     );
670 670
 
671
-    if ( empty( $invoices->total ) ) {
671
+    if (empty($invoices->total)) {
672 672
 
673 673
         return aui()->alert(
674 674
             array(
675 675
                 'type'    => 'info',
676 676
                 'content' => sprintf(
677
-                    __( 'No %s found.', 'invoicing' ),
678
-                    strtolower( $label )
677
+                    __('No %s found.', 'invoicing'),
678
+                    strtolower($label)
679 679
                 ),
680 680
             )
681 681
         );
@@ -683,38 +683,38 @@  discard block
 block discarded – undo
683 683
     }
684 684
 
685 685
     // Load the template.
686
-    return wpinv_get_template_html( 'invoice-history.php', compact( 'invoices', 'post_type' ) );
686
+    return wpinv_get_template_html('invoice-history.php', compact('invoices', 'post_type'));
687 687
 
688 688
 }
689 689
 
690 690
 /**
691 691
  * Formats an invoice number given an invoice type.
692 692
  */
693
-function wpinv_format_invoice_number( $number, $type = '' ) {
693
+function wpinv_format_invoice_number($number, $type = '') {
694 694
 
695 695
     // Allow other plugins to overide this.
696
-    $check = apply_filters( 'wpinv_pre_format_invoice_number', null, $number, $type );
697
-    if ( null !== $check ) {
696
+    $check = apply_filters('wpinv_pre_format_invoice_number', null, $number, $type);
697
+    if (null !== $check) {
698 698
         return $check;
699 699
     }
700 700
 
701 701
     // Ensure that we have a numeric number.
702
-    if ( ! is_numeric( $number ) ) {
702
+    if (!is_numeric($number)) {
703 703
         return $number;
704 704
     }
705 705
 
706 706
     // Format the number.
707
-    $padd             = absint( (int) wpinv_get_option( 'invoice_number_padd', 5 ) );
708
-    $prefix           = sanitize_text_field( (string) wpinv_get_option( 'invoice_number_prefix', 'INV-' ) );
709
-    $prefix           = sanitize_text_field( apply_filters( 'getpaid_invoice_type_prefix', $prefix, $type ) );
710
-    $postfix          = sanitize_text_field( (string) wpinv_get_option( 'invoice_number_postfix' ) );
711
-    $postfix          = sanitize_text_field( apply_filters( 'getpaid_invoice_type_postfix', $postfix, $type ) );
712
-    $formatted_number = zeroise( absint( $number ), $padd );
707
+    $padd             = absint((int) wpinv_get_option('invoice_number_padd', 5));
708
+    $prefix           = sanitize_text_field((string) wpinv_get_option('invoice_number_prefix', 'INV-'));
709
+    $prefix           = sanitize_text_field(apply_filters('getpaid_invoice_type_prefix', $prefix, $type));
710
+    $postfix          = sanitize_text_field((string) wpinv_get_option('invoice_number_postfix'));
711
+    $postfix          = sanitize_text_field(apply_filters('getpaid_invoice_type_postfix', $postfix, $type));
712
+    $formatted_number = zeroise(absint($number), $padd);
713 713
 
714 714
     // Add the prefix and post fix.
715 715
     $formatted_number = $prefix . $formatted_number . $postfix;
716 716
 
717
-    return apply_filters( 'wpinv_format_invoice_number', $formatted_number, $number, $prefix, $postfix, $padd );
717
+    return apply_filters('wpinv_format_invoice_number', $formatted_number, $number, $prefix, $postfix, $padd);
718 718
 }
719 719
 
720 720
 /**
@@ -723,58 +723,58 @@  discard block
 block discarded – undo
723 723
  * @param string $type.
724 724
  * @return int|null|bool
725 725
  */
726
-function wpinv_get_next_invoice_number( $type = '' ) {
726
+function wpinv_get_next_invoice_number($type = '') {
727 727
 
728 728
     // Allow plugins to overide this.
729
-    $check = apply_filters( 'wpinv_get_pre_next_invoice_number', null, $type );
730
-    if ( null !== $check ) {
729
+    $check = apply_filters('wpinv_get_pre_next_invoice_number', null, $type);
730
+    if (null !== $check) {
731 731
         return $check;
732 732
     }
733 733
 
734 734
     // Ensure sequential invoice numbers is active.
735
-    if ( ! wpinv_sequential_number_active() ) {
735
+    if (!wpinv_sequential_number_active()) {
736 736
         return false;
737 737
     }
738 738
 
739 739
     // Retrieve the current number and the start number.
740
-    $number = (int) get_option( 'wpinv_last_invoice_number', 0 );
741
-    $start  = absint( (int) wpinv_get_option( 'invoice_sequence_start', 1 ) );
740
+    $number = (int) get_option('wpinv_last_invoice_number', 0);
741
+    $start  = absint((int) wpinv_get_option('invoice_sequence_start', 1));
742 742
 
743 743
     // Ensure that we are starting at a positive integer.
744
-    $start  = max( $start, 1 );
744
+    $start  = max($start, 1);
745 745
 
746 746
     // If this is the first invoice, use the start number.
747
-    $number = max( $start, $number );
747
+    $number = max($start, $number);
748 748
 
749 749
     // Format the invoice number.
750
-    $formatted_number = wpinv_format_invoice_number( $number, $type );
750
+    $formatted_number = wpinv_format_invoice_number($number, $type);
751 751
 
752 752
     // Ensure that this number is unique.
753
-    $invoice_id = WPInv_Invoice::get_invoice_id_by_field( $formatted_number, 'number' );
753
+    $invoice_id = WPInv_Invoice::get_invoice_id_by_field($formatted_number, 'number');
754 754
 
755 755
     // We found a match. Nice.
756
-    if ( empty( $invoice_id ) ) {
757
-        update_option( 'wpinv_last_invoice_number', $number );
758
-        return apply_filters( 'wpinv_get_next_invoice_number', $number );
756
+    if (empty($invoice_id)) {
757
+        update_option('wpinv_last_invoice_number', $number);
758
+        return apply_filters('wpinv_get_next_invoice_number', $number);
759 759
     }
760 760
 
761
-    update_option( 'wpinv_last_invoice_number', $number + 1 );
762
-    return wpinv_get_next_invoice_number( $type );
761
+    update_option('wpinv_last_invoice_number', $number + 1);
762
+    return wpinv_get_next_invoice_number($type);
763 763
 
764 764
 }
765 765
 
766 766
 /**
767 767
  * The prefix used for invoice paths.
768 768
  */
769
-function wpinv_post_name_prefix( $post_type = 'wpi_invoice' ) {
770
-    return apply_filters( 'wpinv_post_name_prefix', 'inv-', $post_type );
769
+function wpinv_post_name_prefix($post_type = 'wpi_invoice') {
770
+    return apply_filters('wpinv_post_name_prefix', 'inv-', $post_type);
771 771
 }
772 772
 
773
-function wpinv_generate_post_name( $post_ID ) {
774
-    $prefix = wpinv_post_name_prefix( get_post_type( $post_ID ) );
775
-    $post_name = sanitize_title( $prefix . $post_ID );
773
+function wpinv_generate_post_name($post_ID) {
774
+    $prefix = wpinv_post_name_prefix(get_post_type($post_ID));
775
+    $post_name = sanitize_title($prefix . $post_ID);
776 776
 
777
-    return apply_filters( 'wpinv_generate_post_name', $post_name, $post_ID, $prefix );
777
+    return apply_filters('wpinv_generate_post_name', $post_name, $post_ID, $prefix);
778 778
 }
779 779
 
780 780
 /**
@@ -782,8 +782,8 @@  discard block
 block discarded – undo
782 782
  *
783 783
  * @param int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object.
784 784
  */
785
-function wpinv_is_invoice_viewed( $invoice ) {
786
-    $invoice = new WPInv_Invoice( $invoice );
785
+function wpinv_is_invoice_viewed($invoice) {
786
+    $invoice = new WPInv_Invoice($invoice);
787 787
     return (bool) $invoice->get_is_viewed();
788 788
 }
789 789
 
@@ -792,17 +792,17 @@  discard block
 block discarded – undo
792 792
  *
793 793
  * @param int|string|object|WPInv_Invoice|WPInv_Legacy_Invoice|WP_Post $invoice Invoice id, key, transaction id, number or object.
794 794
  */
795
-function getpaid_maybe_mark_invoice_as_viewed( $invoice ) {
796
-    $invoice = new WPInv_Invoice( $invoice );
795
+function getpaid_maybe_mark_invoice_as_viewed($invoice) {
796
+    $invoice = new WPInv_Invoice($invoice);
797 797
 
798
-    if ( get_current_user_id() == $invoice->get_user_id() && ! $invoice->get_is_viewed() ) {
799
-        $invoice->set_is_viewed( true );
798
+    if (get_current_user_id() == $invoice->get_user_id() && !$invoice->get_is_viewed()) {
799
+        $invoice->set_is_viewed(true);
800 800
         $invoice->save();
801 801
     }
802 802
 
803 803
 }
804
-add_action( 'wpinv_invoice_print_before_display', 'getpaid_maybe_mark_invoice_as_viewed' );
805
-add_action( 'wpinv_before_receipt', 'getpaid_maybe_mark_invoice_as_viewed' );
804
+add_action('wpinv_invoice_print_before_display', 'getpaid_maybe_mark_invoice_as_viewed');
805
+add_action('wpinv_before_receipt', 'getpaid_maybe_mark_invoice_as_viewed');
806 806
 
807 807
 /**
808 808
  * Processes an invoice refund.
@@ -811,26 +811,26 @@  discard block
 block discarded – undo
811 811
  * @param array $status_transition
812 812
  * @todo: descrease customer/store earnings
813 813
  */
814
-function getpaid_maybe_process_refund( $invoice, $status_transition ) {
814
+function getpaid_maybe_process_refund($invoice, $status_transition) {
815 815
 
816
-    if ( empty( $status_transition['from'] ) || ! in_array( $status_transition['from'], array( 'publish', 'wpi-processing', 'wpi-renewal' ) ) ) {
816
+    if (empty($status_transition['from']) || !in_array($status_transition['from'], array('publish', 'wpi-processing', 'wpi-renewal'))) {
817 817
         return;
818 818
     }
819 819
 
820 820
     $discount_code = $invoice->get_discount_code();
821
-    if ( ! empty( $discount_code ) ) {
822
-        $discount = wpinv_get_discount_obj( $discount_code );
821
+    if (!empty($discount_code)) {
822
+        $discount = wpinv_get_discount_obj($discount_code);
823 823
 
824
-        if ( $discount->exists() ) {
824
+        if ($discount->exists()) {
825 825
             $discount->increase_usage( -1 );
826 826
         }
827 827
 }
828 828
 
829
-    do_action( 'wpinv_pre_refund_invoice', $invoice, $invoice->get_id() );
830
-    do_action( 'wpinv_refund_invoice', $invoice, $invoice->get_id() );
831
-    do_action( 'wpinv_post_refund_invoice', $invoice, $invoice->get_id() );
829
+    do_action('wpinv_pre_refund_invoice', $invoice, $invoice->get_id());
830
+    do_action('wpinv_refund_invoice', $invoice, $invoice->get_id());
831
+    do_action('wpinv_post_refund_invoice', $invoice, $invoice->get_id());
832 832
 }
833
-add_action( 'getpaid_invoice_status_wpi-refunded', 'getpaid_maybe_process_refund', 10, 2 );
833
+add_action('getpaid_invoice_status_wpi-refunded', 'getpaid_maybe_process_refund', 10, 2);
834 834
 
835 835
 
836 836
 /**
@@ -838,47 +838,47 @@  discard block
 block discarded – undo
838 838
  *
839 839
  * @param int $invoice_id
840 840
  */
841
-function getpaid_process_invoice_payment( $invoice_id ) {
841
+function getpaid_process_invoice_payment($invoice_id) {
842 842
 
843 843
     // Fetch the invoice.
844
-    $invoice = new WPInv_Invoice( $invoice_id );
844
+    $invoice = new WPInv_Invoice($invoice_id);
845 845
 
846 846
     // We only want to do this once.
847
-    if ( 1 == get_post_meta( $invoice->get_id(), 'wpinv_processed_payment', true ) ) {
847
+    if (1 == get_post_meta($invoice->get_id(), 'wpinv_processed_payment', true)) {
848 848
         return;
849 849
     }
850 850
 
851
-    update_post_meta( $invoice->get_id(), 'wpinv_processed_payment', 1 );
851
+    update_post_meta($invoice->get_id(), 'wpinv_processed_payment', 1);
852 852
 
853 853
     // Fires when processing a payment.
854
-    do_action( 'getpaid_process_payment', $invoice );
854
+    do_action('getpaid_process_payment', $invoice);
855 855
 
856 856
     // Fire an action for each invoice item.
857
-    foreach ( $invoice->get_items() as $item ) {
858
-        do_action( 'getpaid_process_item_payment', $item, $invoice );
857
+    foreach ($invoice->get_items() as $item) {
858
+        do_action('getpaid_process_item_payment', $item, $invoice);
859 859
     }
860 860
 
861 861
     // Increase discount usage.
862 862
     $discount_code = $invoice->get_discount_code();
863
-    if ( ! empty( $discount_code ) && ! $invoice->is_renewal() ) {
864
-        $discount = wpinv_get_discount_obj( $discount_code );
863
+    if (!empty($discount_code) && !$invoice->is_renewal()) {
864
+        $discount = wpinv_get_discount_obj($discount_code);
865 865
 
866
-        if ( $discount->exists() ) {
866
+        if ($discount->exists()) {
867 867
             $discount->increase_usage();
868 868
         }
869 869
 }
870 870
 
871 871
     // Record reverse vat.
872
-    if ( 'invoice' === $invoice->get_type() && wpinv_use_taxes() && ! $invoice->get_disable_taxes() ) {
872
+    if ('invoice' === $invoice->get_type() && wpinv_use_taxes() && !$invoice->get_disable_taxes()) {
873 873
 
874 874
         $taxes = $invoice->get_total_tax();
875
-        if ( empty( $taxes ) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction( $invoice->get_country() ) ) {
876
-            $invoice->add_note( __( 'VAT was reverse charged', 'invoicing' ), false, false, true );
875
+        if (empty($taxes) && GetPaid_Payment_Form_Submission_Taxes::is_eu_transaction($invoice->get_country())) {
876
+            $invoice->add_note(__('VAT was reverse charged', 'invoicing'), false, false, true);
877 877
         }
878 878
 }
879 879
 
880 880
 }
881
-add_action( 'getpaid_invoice_payment_status_changed', 'getpaid_process_invoice_payment' );
881
+add_action('getpaid_invoice_payment_status_changed', 'getpaid_process_invoice_payment');
882 882
 
883 883
 /**
884 884
  * Returns an array of invoice item columns
@@ -886,13 +886,13 @@  discard block
 block discarded – undo
886 886
  * @param int|WPInv_Invoice $invoice
887 887
  * @return array
888 888
  */
889
-function getpaid_invoice_item_columns( $invoice ) {
889
+function getpaid_invoice_item_columns($invoice) {
890 890
 
891 891
     // Prepare the invoice.
892
-    $invoice = new WPInv_Invoice( $invoice );
892
+    $invoice = new WPInv_Invoice($invoice);
893 893
 
894 894
     // Abort if there is no invoice.
895
-    if ( 0 == $invoice->get_id() ) {
895
+    if (0 == $invoice->get_id()) {
896 896
         return array();
897 897
     }
898 898
 
@@ -900,52 +900,52 @@  discard block
 block discarded – undo
900 900
     $columns = apply_filters(
901 901
         'getpaid_invoice_item_columns',
902 902
         array(
903
-            'name'     => __( 'Item', 'invoicing' ),
904
-            'price'    => __( 'Price', 'invoicing' ),
905
-            'tax_rate' => __( 'Tax Rate', 'invoicing' ),
906
-            'quantity' => __( 'Quantity', 'invoicing' ),
907
-            'subtotal' => __( 'Item Subtotal', 'invoicing' ),
903
+            'name'     => __('Item', 'invoicing'),
904
+            'price'    => __('Price', 'invoicing'),
905
+            'tax_rate' => __('Tax Rate', 'invoicing'),
906
+            'quantity' => __('Quantity', 'invoicing'),
907
+            'subtotal' => __('Item Subtotal', 'invoicing'),
908 908
         ),
909 909
         $invoice
910 910
     );
911 911
 
912 912
     // Quantities.
913
-    if ( isset( $columns['quantity'] ) ) {
913
+    if (isset($columns['quantity'])) {
914 914
 
915
-        if ( 'hours' == $invoice->get_template() ) {
916
-            $columns['quantity'] = __( 'Hours', 'invoicing' );
915
+        if ('hours' == $invoice->get_template()) {
916
+            $columns['quantity'] = __('Hours', 'invoicing');
917 917
         }
918 918
 
919
-        if ( ! wpinv_item_quantities_enabled() || 'amount' == $invoice->get_template() ) {
920
-            unset( $columns['quantity'] );
919
+        if (!wpinv_item_quantities_enabled() || 'amount' == $invoice->get_template()) {
920
+            unset($columns['quantity']);
921 921
         }
922 922
     }
923 923
 
924 924
     // Price.
925
-    if ( isset( $columns['price'] ) ) {
925
+    if (isset($columns['price'])) {
926 926
 
927
-        if ( 'amount' == $invoice->get_template() ) {
928
-            $columns['price'] = __( 'Amount', 'invoicing' );
927
+        if ('amount' == $invoice->get_template()) {
928
+            $columns['price'] = __('Amount', 'invoicing');
929 929
         }
930 930
 
931
-        if ( 'hours' == $invoice->get_template() ) {
932
-            $columns['price'] = __( 'Rate', 'invoicing' );
931
+        if ('hours' == $invoice->get_template()) {
932
+            $columns['price'] = __('Rate', 'invoicing');
933 933
         }
934 934
 }
935 935
 
936 936
     // Sub total.
937
-    if ( isset( $columns['subtotal'] ) ) {
937
+    if (isset($columns['subtotal'])) {
938 938
 
939
-        if ( 'amount' == $invoice->get_template() ) {
940
-            unset( $columns['subtotal'] );
939
+        if ('amount' == $invoice->get_template()) {
940
+            unset($columns['subtotal']);
941 941
         }
942 942
 }
943 943
 
944 944
     // Tax rates.
945
-    if ( isset( $columns['tax_rate'] ) ) {
945
+    if (isset($columns['tax_rate'])) {
946 946
 
947
-        if ( 0 == $invoice->get_total_tax() ) {
948
-            unset( $columns['tax_rate'] );
947
+        if (0 == $invoice->get_total_tax()) {
948
+            unset($columns['tax_rate']);
949 949
         }
950 950
     }
951 951
 
@@ -958,53 +958,53 @@  discard block
 block discarded – undo
958 958
  * @param int|WPInv_Invoice $invoice
959 959
  * @return array
960 960
  */
961
-function getpaid_invoice_totals_rows( $invoice ) {
961
+function getpaid_invoice_totals_rows($invoice) {
962 962
 
963 963
     // Prepare the invoice.
964
-    $invoice = new WPInv_Invoice( $invoice );
964
+    $invoice = new WPInv_Invoice($invoice);
965 965
 
966 966
     // Abort if there is no invoice.
967
-    if ( 0 == $invoice->get_id() ) {
967
+    if (0 == $invoice->get_id()) {
968 968
         return array();
969 969
     }
970 970
 
971 971
     $totals = apply_filters(
972 972
         'getpaid_invoice_totals_rows',
973 973
         array(
974
-            'subtotal' => __( 'Subtotal', 'invoicing' ),
975
-            'shipping' => __( 'Shipping', 'invoicing' ),
976
-            'tax'      => __( 'Tax', 'invoicing' ),
977
-            'fee'      => __( 'Fee', 'invoicing' ),
978
-            'discount' => __( 'Discount', 'invoicing' ),
979
-            'total'    => __( 'Total', 'invoicing' ),
974
+            'subtotal' => __('Subtotal', 'invoicing'),
975
+            'shipping' => __('Shipping', 'invoicing'),
976
+            'tax'      => __('Tax', 'invoicing'),
977
+            'fee'      => __('Fee', 'invoicing'),
978
+            'discount' => __('Discount', 'invoicing'),
979
+            'total'    => __('Total', 'invoicing'),
980 980
         ),
981 981
         $invoice
982 982
     );
983 983
 
984
-    if ( ! $invoice->has_shipping() ) {
985
-        unset( $totals['shipping'] );
984
+    if (!$invoice->has_shipping()) {
985
+        unset($totals['shipping']);
986 986
     }
987 987
 
988
-    if ( ( $invoice->get_disable_taxes() || ! wpinv_use_taxes() ) && isset( $totals['tax'] ) ) {
989
-        unset( $totals['tax'] );
988
+    if (($invoice->get_disable_taxes() || !wpinv_use_taxes()) && isset($totals['tax'])) {
989
+        unset($totals['tax']);
990 990
     }
991 991
 
992 992
     // If we have taxes, display individual taxes.
993
-    if ( isset( $totals['tax'] ) && wpinv_display_individual_tax_rates() ) {
993
+    if (isset($totals['tax']) && wpinv_display_individual_tax_rates()) {
994 994
 
995 995
         $new_totals = array();
996
-        foreach ( $totals as $key => $label ) {
996
+        foreach ($totals as $key => $label) {
997 997
 
998
-            if ( 'tax' !== $key ) {
999
-                $new_totals[ $key ] = $label;
998
+            if ('tax' !== $key) {
999
+                $new_totals[$key] = $label;
1000 1000
                 continue;
1001 1001
             }
1002 1002
 
1003
-            $taxes = array_keys( $invoice->get_taxes() );
1004
-            if ( ! empty( $taxes ) ) {
1003
+            $taxes = array_keys($invoice->get_taxes());
1004
+            if (!empty($taxes)) {
1005 1005
 
1006
-                foreach ( $taxes as $tax ) {
1007
-                    $new_totals[ 'tax__' . $tax ] = $tax;
1006
+                foreach ($taxes as $tax) {
1007
+                    $new_totals['tax__' . $tax] = $tax;
1008 1008
                 }
1009 1009
             }
1010 1010
         }
@@ -1012,12 +1012,12 @@  discard block
 block discarded – undo
1012 1012
         $totals = $new_totals;
1013 1013
     }
1014 1014
 
1015
-    if ( 0 == $invoice->get_total_fees() && isset( $totals['fee'] ) ) {
1016
-        unset( $totals['fee'] );
1015
+    if (0 == $invoice->get_total_fees() && isset($totals['fee'])) {
1016
+        unset($totals['fee']);
1017 1017
     }
1018 1018
 
1019
-    if ( 0 == $invoice->get_total_discount() && isset( $totals['discount'] ) ) {
1020
-        unset( $totals['discount'] );
1019
+    if (0 == $invoice->get_total_discount() && isset($totals['discount'])) {
1020
+        unset($totals['discount']);
1021 1021
     }
1022 1022
 
1023 1023
     return $totals;
@@ -1028,47 +1028,47 @@  discard block
 block discarded – undo
1028 1028
  *
1029 1029
  * @param WPInv_Invoice $invoice
1030 1030
  */
1031
-function getpaid_new_invoice( $invoice ) {
1031
+function getpaid_new_invoice($invoice) {
1032 1032
 
1033
-    if ( ! $invoice->get_status() ) {
1033
+    if (!$invoice->get_status()) {
1034 1034
         return;
1035 1035
     }
1036 1036
 
1037 1037
     // Add an invoice created note.
1038 1038
     $invoice->add_note(
1039 1039
         sprintf(
1040
-            __( '%1$s created with the status "%2$s".', 'invoicing' ),
1041
-            ucfirst( $invoice->get_invoice_quote_type() ),
1042
-            wpinv_status_nicename( $invoice->get_status(), $invoice )
1040
+            __('%1$s created with the status "%2$s".', 'invoicing'),
1041
+            ucfirst($invoice->get_invoice_quote_type()),
1042
+            wpinv_status_nicename($invoice->get_status(), $invoice)
1043 1043
         )
1044 1044
     );
1045 1045
 
1046 1046
 }
1047
-add_action( 'getpaid_new_invoice', 'getpaid_new_invoice' );
1047
+add_action('getpaid_new_invoice', 'getpaid_new_invoice');
1048 1048
 
1049 1049
 /**
1050 1050
  * This function updates invoice caches.
1051 1051
  *
1052 1052
  * @param WPInv_Invoice $invoice
1053 1053
  */
1054
-function getpaid_update_invoice_caches( $invoice ) {
1054
+function getpaid_update_invoice_caches($invoice) {
1055 1055
 
1056 1056
     // Cache invoice number.
1057
-    wp_cache_set( $invoice->get_number(), $invoice->get_id(), 'getpaid_invoice_numbers_to_invoice_ids' );
1057
+    wp_cache_set($invoice->get_number(), $invoice->get_id(), 'getpaid_invoice_numbers_to_invoice_ids');
1058 1058
 
1059 1059
     // Cache invoice key.
1060
-    wp_cache_set( $invoice->get_key(), $invoice->get_id(), 'getpaid_invoice_keys_to_invoice_ids' );
1060
+    wp_cache_set($invoice->get_key(), $invoice->get_id(), 'getpaid_invoice_keys_to_invoice_ids');
1061 1061
 
1062 1062
     // (Maybe) cache transaction id.
1063 1063
     $transaction_id = $invoice->get_transaction_id();
1064 1064
 
1065
-    if ( ! empty( $transaction_id ) ) {
1066
-        wp_cache_set( $transaction_id, $invoice->get_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids' );
1065
+    if (!empty($transaction_id)) {
1066
+        wp_cache_set($transaction_id, $invoice->get_id(), 'getpaid_invoice_transaction_ids_to_invoice_ids');
1067 1067
     }
1068 1068
 
1069 1069
 }
1070
-add_action( 'getpaid_new_invoice', 'getpaid_update_invoice_caches', 5 );
1071
-add_action( 'getpaid_update_invoice', 'getpaid_update_invoice_caches', 5 );
1070
+add_action('getpaid_new_invoice', 'getpaid_update_invoice_caches', 5);
1071
+add_action('getpaid_update_invoice', 'getpaid_update_invoice_caches', 5);
1072 1072
 
1073 1073
 /**
1074 1074
  * Duplicates an invoice.
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
  * @param  WPInv_Invoice $old_invoice The invoice to duplicate
1079 1079
  * @return WPInv_Invoice The new invoice.
1080 1080
  */
1081
-function getpaid_duplicate_invoice( $old_invoice ) {
1081
+function getpaid_duplicate_invoice($old_invoice) {
1082 1082
 
1083 1083
     // Create the new invoice.
1084 1084
     $invoice = new WPInv_Invoice();
@@ -1138,136 +1138,136 @@  discard block
 block discarded – undo
1138 1138
  * @param WPInv_Invoice $invoice
1139 1139
  * @return array
1140 1140
  */
1141
-function getpaid_get_invoice_meta( $invoice ) {
1141
+function getpaid_get_invoice_meta($invoice) {
1142 1142
 
1143 1143
     // Load the invoice meta.
1144 1144
     $meta = array(
1145 1145
 
1146 1146
         'number'         => array(
1147 1147
             'label' => sprintf(
1148
-                __( '%s Number', 'invoicing' ),
1149
-                ucfirst( $invoice->get_invoice_quote_type() )
1148
+                __('%s Number', 'invoicing'),
1149
+                ucfirst($invoice->get_invoice_quote_type())
1150 1150
             ),
1151
-            'value' => sanitize_text_field( $invoice->get_number() ),
1151
+            'value' => sanitize_text_field($invoice->get_number()),
1152 1152
         ),
1153 1153
 
1154 1154
         'status'         => array(
1155 1155
             'label' => sprintf(
1156
-                __( '%s Status', 'invoicing' ),
1157
-                ucfirst( $invoice->get_invoice_quote_type() )
1156
+                __('%s Status', 'invoicing'),
1157
+                ucfirst($invoice->get_invoice_quote_type())
1158 1158
             ),
1159 1159
             'value' => $invoice->get_status_label_html(),
1160 1160
         ),
1161 1161
 
1162 1162
         'date'           => array(
1163 1163
             'label' => sprintf(
1164
-                __( '%s Date', 'invoicing' ),
1165
-                ucfirst( $invoice->get_invoice_quote_type() )
1164
+                __('%s Date', 'invoicing'),
1165
+                ucfirst($invoice->get_invoice_quote_type())
1166 1166
             ),
1167
-            'value' => getpaid_format_date( $invoice->get_created_date() ),
1167
+            'value' => getpaid_format_date($invoice->get_created_date()),
1168 1168
         ),
1169 1169
 
1170 1170
         'date_paid'      => array(
1171
-            'label' => __( 'Paid On', 'invoicing' ),
1172
-            'value' => getpaid_format_date( $invoice->get_completed_date() ),
1171
+            'label' => __('Paid On', 'invoicing'),
1172
+            'value' => getpaid_format_date($invoice->get_completed_date()),
1173 1173
         ),
1174 1174
 
1175 1175
         'gateway'        => array(
1176
-            'label' => __( 'Payment Method', 'invoicing' ),
1177
-            'value' => sanitize_text_field( $invoice->get_gateway_title() ),
1176
+            'label' => __('Payment Method', 'invoicing'),
1177
+            'value' => sanitize_text_field($invoice->get_gateway_title()),
1178 1178
         ),
1179 1179
 
1180 1180
         'transaction_id' => array(
1181
-            'label' => __( 'Transaction ID', 'invoicing' ),
1182
-            'value' => sanitize_text_field( $invoice->get_transaction_id() ),
1181
+            'label' => __('Transaction ID', 'invoicing'),
1182
+            'value' => sanitize_text_field($invoice->get_transaction_id()),
1183 1183
         ),
1184 1184
 
1185 1185
         'due_date'       => array(
1186
-            'label' => __( 'Due Date', 'invoicing' ),
1187
-            'value' => getpaid_format_date( $invoice->get_due_date() ),
1186
+            'label' => __('Due Date', 'invoicing'),
1187
+            'value' => getpaid_format_date($invoice->get_due_date()),
1188 1188
         ),
1189 1189
 
1190 1190
         'vat_number'     => array(
1191
-            'label' => __( 'VAT Number', 'invoicing' ),
1192
-            'value' => sanitize_text_field( $invoice->get_vat_number() ),
1191
+            'label' => __('VAT Number', 'invoicing'),
1192
+            'value' => sanitize_text_field($invoice->get_vat_number()),
1193 1193
         ),
1194 1194
 
1195 1195
     );
1196 1196
 
1197
-    $additional_meta = get_post_meta( $invoice->get_id(), 'additional_meta_data', true );
1197
+    $additional_meta = get_post_meta($invoice->get_id(), 'additional_meta_data', true);
1198 1198
 
1199
-    if ( ! empty( $additional_meta ) ) {
1199
+    if (!empty($additional_meta)) {
1200 1200
 
1201
-        foreach ( $additional_meta as $label => $value ) {
1202
-            $meta[ sanitize_key( $label ) ] = array(
1203
-                'label' => esc_html( $label ),
1204
-                'value' => esc_html( $value ),
1201
+        foreach ($additional_meta as $label => $value) {
1202
+            $meta[sanitize_key($label)] = array(
1203
+                'label' => esc_html($label),
1204
+                'value' => esc_html($value),
1205 1205
             );
1206 1206
         }
1207 1207
 }
1208 1208
     // If it is not paid, remove the date of payment.
1209
-    if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
1210
-        unset( $meta['date_paid'] );
1211
-        unset( $meta['transaction_id'] );
1209
+    if (!$invoice->is_paid() && !$invoice->is_refunded()) {
1210
+        unset($meta['date_paid']);
1211
+        unset($meta['transaction_id']);
1212 1212
     }
1213 1213
 
1214
-    if ( ! $invoice->is_paid() || 'none' == $invoice->get_gateway() ) {
1215
-        unset( $meta['gateway'] );
1214
+    if (!$invoice->is_paid() || 'none' == $invoice->get_gateway()) {
1215
+        unset($meta['gateway']);
1216 1216
     }
1217 1217
 
1218 1218
     // Only display the due date if due dates are enabled.
1219
-    if ( ! $invoice->needs_payment() || ! wpinv_get_option( 'overdue_active' ) ) {
1220
-        unset( $meta['due_date'] );
1219
+    if (!$invoice->needs_payment() || !wpinv_get_option('overdue_active')) {
1220
+        unset($meta['due_date']);
1221 1221
     }
1222 1222
 
1223 1223
     // Only display the vat number if taxes are enabled.
1224
-    if ( ! wpinv_use_taxes() ) {
1225
-        unset( $meta['vat_number'] );
1224
+    if (!wpinv_use_taxes()) {
1225
+        unset($meta['vat_number']);
1226 1226
     }
1227 1227
 
1228 1228
     // Link to the parent invoice.
1229
-    if ( $invoice->get_parent_id() > 0 ) {
1229
+    if ($invoice->get_parent_id() > 0) {
1230 1230
 
1231 1231
         $meta['parent'] = array(
1232 1232
 
1233 1233
             'label' => sprintf(
1234
-                __( 'Parent %s', 'invoicing' ),
1235
-                ucfirst( $invoice->get_invoice_quote_type() )
1234
+                __('Parent %s', 'invoicing'),
1235
+                ucfirst($invoice->get_invoice_quote_type())
1236 1236
             ),
1237 1237
 
1238
-            'value' => wpinv_invoice_link( $invoice->get_parent_id() ),
1238
+            'value' => wpinv_invoice_link($invoice->get_parent_id()),
1239 1239
 
1240 1240
         );
1241 1241
 
1242 1242
     }
1243 1243
 
1244
-    if ( $invoice->is_recurring() ) {
1244
+    if ($invoice->is_recurring()) {
1245 1245
 
1246
-        $subscription = getpaid_get_invoice_subscriptions( $invoice );
1247
-        if ( ! empty( $subscription ) && ! is_array( $subscription ) && $subscription->exists() ) {
1246
+        $subscription = getpaid_get_invoice_subscriptions($invoice);
1247
+        if (!empty($subscription) && !is_array($subscription) && $subscription->exists()) {
1248 1248
 
1249 1249
             // Display the renewal date.
1250
-            if ( $subscription->is_active() && 'cancelled' != $subscription->get_status() ) {
1250
+            if ($subscription->is_active() && 'cancelled' != $subscription->get_status()) {
1251 1251
 
1252 1252
                 $meta['renewal_date'] = array(
1253
-                    'label' => __( 'Renews On', 'invoicing' ),
1254
-                    'value' => getpaid_format_date( $subscription->get_expiration() ) .
1253
+                    'label' => __('Renews On', 'invoicing'),
1254
+                    'value' => getpaid_format_date($subscription->get_expiration()) .
1255 1255
                     sprintf(
1256 1256
                         ' <a class="small" href="%s">%s<a>',
1257 1257
                         $subscription->get_view_url(),
1258
-                        __( '(View Subscription)', 'invoicing' )
1258
+                        __('(View Subscription)', 'invoicing')
1259 1259
                     ),
1260 1260
                 );
1261 1261
 
1262 1262
             }
1263 1263
 
1264
-            if ( $invoice->is_parent() ) {
1264
+            if ($invoice->is_parent()) {
1265 1265
 
1266 1266
                 // Display the recurring amount.
1267 1267
                 $meta['recurring_total'] = array(
1268 1268
 
1269
-                    'label' => __( 'Recurring Amount', 'invoicing' ),
1270
-                    'value' => wpinv_price( $subscription->get_recurring_amount(), $invoice->get_currency() ),
1269
+                    'label' => __('Recurring Amount', 'invoicing'),
1270
+                    'value' => wpinv_price($subscription->get_recurring_amount(), $invoice->get_currency()),
1271 1271
 
1272 1272
                 );
1273 1273
 
@@ -1278,13 +1278,13 @@  discard block
 block discarded – undo
1278 1278
     // Add the invoice total to the meta.
1279 1279
     $meta['invoice_total'] = array(
1280 1280
 
1281
-        'label' => __( 'Total Amount', 'invoicing' ),
1282
-        'value' => wpinv_price( $invoice->get_total(), $invoice->get_currency() ),
1281
+        'label' => __('Total Amount', 'invoicing'),
1282
+        'value' => wpinv_price($invoice->get_total(), $invoice->get_currency()),
1283 1283
 
1284 1284
     );
1285 1285
 
1286 1286
     // Provide a way for third party plugins to filter the meta.
1287
-    $meta = apply_filters( 'getpaid_invoice_meta_data', $meta, $invoice );
1287
+    $meta = apply_filters('getpaid_invoice_meta_data', $meta, $invoice);
1288 1288
 
1289 1289
     return $meta;
1290 1290
 
@@ -1323,12 +1323,12 @@  discard block
 block discarded – undo
1323 1323
  * @param GetPaid_Form_Item $item
1324 1324
  * @return float
1325 1325
  */
1326
-function getpaid_get_invoice_tax_rate( $invoice, $item ) {
1326
+function getpaid_get_invoice_tax_rate($invoice, $item) {
1327 1327
 
1328
-    $rates   = getpaid_get_item_tax_rates( $item, $invoice->get_country(), $invoice->get_state() );
1329
-	$rates   = getpaid_filter_item_tax_rates( $item, $rates );
1330
-    $rates   = wp_list_pluck( $rates, 'rate' );
1328
+    $rates   = getpaid_get_item_tax_rates($item, $invoice->get_country(), $invoice->get_state());
1329
+	$rates = getpaid_filter_item_tax_rates($item, $rates);
1330
+    $rates   = wp_list_pluck($rates, 'rate');
1331 1331
 
1332
-    return array_sum( $rates );
1332
+    return array_sum($rates);
1333 1333
 
1334 1334
 }
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php 1 patch
Spacing   +799 added lines, -799 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 /**
13 13
  * Bail if we are not in WP.
14 14
  */
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if (!defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19 19
 /**
20 20
  * Only add if the class does not already exist.
21 21
  */
22
-if ( ! class_exists( 'AyeCode_UI_Settings' ) ) {
22
+if (!class_exists('AyeCode_UI_Settings')) {
23 23
 
24 24
 	/**
25 25
 	 * A Class to be able to change settings for Font Awesome.
@@ -99,27 +99,27 @@  discard block
 block discarded – undo
99 99
 		 * @return AyeCode_UI_Settings - Main instance.
100 100
 		 */
101 101
 		public static function instance() {
102
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
102
+			if (!isset(self::$instance) && !(self::$instance instanceof AyeCode_UI_Settings)) {
103 103
 
104 104
 				self::$instance = new AyeCode_UI_Settings;
105 105
 
106
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
106
+				add_action('init', array(self::$instance, 'init')); // set settings
107 107
 
108
-				if ( is_admin() ) {
109
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
110
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
108
+				if (is_admin()) {
109
+					add_action('admin_menu', array(self::$instance, 'menu_item'));
110
+					add_action('admin_init', array(self::$instance, 'register_settings'));
111 111
 
112 112
 					// Maybe show example page
113
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
113
+					add_action('template_redirect', array(self::$instance, 'maybe_show_examples'));
114 114
 
115
-					if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
116
-						add_filter( 'sd_aui_colors', array( self::$instance,'sd_aui_colors' ), 10, 3 );
115
+					if (defined('BLOCKSTRAP_VERSION')) {
116
+						add_filter('sd_aui_colors', array(self::$instance, 'sd_aui_colors'), 10, 3);
117 117
 					}
118 118
 				}
119 119
 
120
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
120
+				add_action('customize_register', array(self::$instance, 'customizer_settings'));
121 121
 
122
-				do_action( 'ayecode_ui_settings_loaded' );
122
+				do_action('ayecode_ui_settings_loaded');
123 123
 			}
124 124
 
125 125
 			return self::$instance;
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 		 *
135 135
 		 * @return mixed
136 136
 		 */
137
-		public function sd_aui_colors( $theme_colors, $include_outlines, $include_branding ){
137
+		public function sd_aui_colors($theme_colors, $include_outlines, $include_branding) {
138 138
 
139 139
 
140 140
 			$setting = wp_get_global_settings();
141 141
 
142
-			if(!empty($setting['color']['palette']['custom'])){
143
-				foreach($setting['color']['palette']['custom'] as $color){
142
+			if (!empty($setting['color']['palette']['custom'])) {
143
+				foreach ($setting['color']['palette']['custom'] as $color) {
144 144
 					$theme_colors[$color['slug']] = esc_attr($color['name']);
145 145
 				}
146 146
 			}
@@ -151,81 +151,81 @@  discard block
 block discarded – undo
151 151
 		/**
152 152
 		 * Setup some constants.
153 153
 		 */
154
-		public function constants(){
155
-			define( 'AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be" );
156
-			define( 'AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d' );
157
-			define( 'AUI_INFO_COLOR_ORIGINAL', '#17a2b8' );
158
-			define( 'AUI_WARNING_COLOR_ORIGINAL', '#ffc107' );
159
-			define( 'AUI_DANGER_COLOR_ORIGINAL', '#dc3545' );
160
-			define( 'AUI_SUCCESS_COLOR_ORIGINAL', '#44c553' );
161
-			define( 'AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa' );
162
-			define( 'AUI_DARK_COLOR_ORIGINAL', '#343a40' );
163
-			define( 'AUI_WHITE_COLOR_ORIGINAL', '#fff' );
164
-			define( 'AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd' );
165
-			define( 'AUI_SALMON_COLOR_ORIGINAL', '#ff977a' );
166
-			define( 'AUI_CYAN_COLOR_ORIGINAL', '#35bdff' );
167
-			define( 'AUI_GRAY_COLOR_ORIGINAL', '#ced4da' );
168
-			define( 'AUI_INDIGO_COLOR_ORIGINAL', '#502c6c' );
169
-			define( 'AUI_ORANGE_COLOR_ORIGINAL', '#orange' );
170
-			define( 'AUI_BLACK_COLOR_ORIGINAL', '#000' );
154
+		public function constants() {
155
+			define('AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be");
156
+			define('AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d');
157
+			define('AUI_INFO_COLOR_ORIGINAL', '#17a2b8');
158
+			define('AUI_WARNING_COLOR_ORIGINAL', '#ffc107');
159
+			define('AUI_DANGER_COLOR_ORIGINAL', '#dc3545');
160
+			define('AUI_SUCCESS_COLOR_ORIGINAL', '#44c553');
161
+			define('AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa');
162
+			define('AUI_DARK_COLOR_ORIGINAL', '#343a40');
163
+			define('AUI_WHITE_COLOR_ORIGINAL', '#fff');
164
+			define('AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd');
165
+			define('AUI_SALMON_COLOR_ORIGINAL', '#ff977a');
166
+			define('AUI_CYAN_COLOR_ORIGINAL', '#35bdff');
167
+			define('AUI_GRAY_COLOR_ORIGINAL', '#ced4da');
168
+			define('AUI_INDIGO_COLOR_ORIGINAL', '#502c6c');
169
+			define('AUI_ORANGE_COLOR_ORIGINAL', '#orange');
170
+			define('AUI_BLACK_COLOR_ORIGINAL', '#000');
171 171
 
172
-			if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
173
-				define( 'AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL );
172
+			if (!defined('AUI_PRIMARY_COLOR')) {
173
+				define('AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL);
174 174
 			}
175
-			if ( ! defined( 'AUI_SECONDARY_COLOR' ) ) {
176
-				define( 'AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL );
175
+			if (!defined('AUI_SECONDARY_COLOR')) {
176
+				define('AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL);
177 177
 			}
178
-			if ( ! defined( 'AUI_INFO_COLOR' ) ) {
179
-				define( 'AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL );
178
+			if (!defined('AUI_INFO_COLOR')) {
179
+				define('AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL);
180 180
 			}
181
-			if ( ! defined( 'AUI_WARNING_COLOR' ) ) {
182
-				define( 'AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL );
181
+			if (!defined('AUI_WARNING_COLOR')) {
182
+				define('AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL);
183 183
 			}
184
-			if ( ! defined( 'AUI_DANGER_COLOR' ) ) {
185
-				define( 'AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL );
184
+			if (!defined('AUI_DANGER_COLOR')) {
185
+				define('AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL);
186 186
 			}
187
-			if ( ! defined( 'AUI_SUCCESS_COLOR' ) ) {
188
-				define( 'AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL );
187
+			if (!defined('AUI_SUCCESS_COLOR')) {
188
+				define('AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL);
189 189
 			}
190
-			if ( ! defined( 'AUI_LIGHT_COLOR' ) ) {
191
-				define( 'AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL );
190
+			if (!defined('AUI_LIGHT_COLOR')) {
191
+				define('AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL);
192 192
 			}
193
-			if ( ! defined( 'AUI_DARK_COLOR' ) ) {
194
-				define( 'AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL );
193
+			if (!defined('AUI_DARK_COLOR')) {
194
+				define('AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL);
195 195
 			}
196
-			if ( ! defined( 'AUI_WHITE_COLOR' ) ) {
197
-				define( 'AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL );
196
+			if (!defined('AUI_WHITE_COLOR')) {
197
+				define('AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL);
198 198
 			}
199
-			if ( ! defined( 'AUI_PURPLE_COLOR' ) ) {
200
-				define( 'AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL );
199
+			if (!defined('AUI_PURPLE_COLOR')) {
200
+				define('AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL);
201 201
 			}
202
-			if ( ! defined( 'AUI_SALMON_COLOR' ) ) {
203
-				define( 'AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL );
202
+			if (!defined('AUI_SALMON_COLOR')) {
203
+				define('AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL);
204 204
 			}
205
-			if ( ! defined( 'AUI_CYAN_COLOR' ) ) {
206
-				define( 'AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL );
205
+			if (!defined('AUI_CYAN_COLOR')) {
206
+				define('AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL);
207 207
 			}
208
-			if ( ! defined( 'AUI_GRAY_COLOR' ) ) {
209
-				define( 'AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL );
208
+			if (!defined('AUI_GRAY_COLOR')) {
209
+				define('AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL);
210 210
 			}
211
-			if ( ! defined( 'AUI_INDIGO_COLOR' ) ) {
212
-				define( 'AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL );
211
+			if (!defined('AUI_INDIGO_COLOR')) {
212
+				define('AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL);
213 213
 			}
214
-			if ( ! defined( 'AUI_ORANGE_COLOR' ) ) {
215
-				define( 'AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL );
214
+			if (!defined('AUI_ORANGE_COLOR')) {
215
+				define('AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL);
216 216
 			}
217
-			if ( ! defined( 'AUI_BLACK_COLOR' ) ) {
218
-				define( 'AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL );
217
+			if (!defined('AUI_BLACK_COLOR')) {
218
+				define('AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL);
219 219
 			}
220 220
 
221 221
 		}
222 222
 
223
-		public static function get_colors( $original = false){
223
+		public static function get_colors($original = false) {
224 224
 
225
-			if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
225
+			if (!defined('AUI_PRIMARY_COLOR')) {
226 226
 				return array();
227 227
 			}
228
-			if ( $original ) {
228
+			if ($original) {
229 229
 				return array(
230 230
 					'primary'   => AUI_PRIMARY_COLOR_ORIGINAL,
231 231
 					'secondary' => AUI_SECONDARY_COLOR_ORIGINAL,
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		 *
274 274
 		 * @return mixed
275 275
 		 */
276
-		public function add_bs5_admin_body_class( $classes = '' ) {
276
+		public function add_bs5_admin_body_class($classes = '') {
277 277
 			$classes .= ' aui_bs5';
278 278
 
279 279
 			return $classes;
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 		 *
287 287
 		 * @return mixed
288 288
 		 */
289
-		public function add_bs5_body_class( $classes ) {
289
+		public function add_bs5_body_class($classes) {
290 290
 			$classes[] = 'aui_bs5';
291 291
 
292 292
 			return $classes;
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
             global $aui_bs5;
300 300
 
301 301
 			// Maybe fix settings
302
-			if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
303
-				$db_settings = get_option( 'ayecode-ui-settings' );
304
-				if ( ! empty( $db_settings ) ) {
302
+			if (!empty($_REQUEST['aui-fix-admin']) && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], "aui-fix-admin")) {
303
+				$db_settings = get_option('ayecode-ui-settings');
304
+				if (!empty($db_settings)) {
305 305
 					$db_settings['css_backend'] = 'compatibility';
306 306
 					$db_settings['js_backend'] = 'core-popper';
307
-					update_option( 'ayecode-ui-settings', $db_settings );
307
+					update_option('ayecode-ui-settings', $db_settings);
308 308
 					wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
309 309
 				}
310 310
 			}
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
             // define the version
317 317
 			$aui_bs5 = $this->settings['bs_ver'] === '5';
318 318
 
319
-			if ( $aui_bs5 ) {
320
-				include_once( dirname( __FILE__ ) . '/inc/bs-conversion.php' );
321
-				add_filter( 'admin_body_class', array( $this, 'add_bs5_admin_body_class' ), 99, 1 );
322
-				add_filter( 'body_class', array( $this, 'add_bs5_body_class' ) );
319
+			if ($aui_bs5) {
320
+				include_once(dirname(__FILE__) . '/inc/bs-conversion.php');
321
+				add_filter('admin_body_class', array($this, 'add_bs5_admin_body_class'), 99, 1);
322
+				add_filter('body_class', array($this, 'add_bs5_body_class'));
323 323
 			}
324 324
 
325 325
 			/**
@@ -327,32 +327,32 @@  discard block
 block discarded – undo
327 327
 			 *
328 328
 			 * We load super early in case there is a theme version that might change the colors
329 329
 			 */
330
-			if ( $this->settings['css'] ) {
330
+			if ($this->settings['css']) {
331 331
 				$priority = $this->is_bs3_compat() ? 100 : 1;
332 332
                 $priority = $aui_bs5 ? 10 : $priority;
333
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
333
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_style'), $priority);
334 334
 			}
335
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
336
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
335
+			if ($this->settings['css_backend'] && $this->load_admin_scripts()) {
336
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_style'), 1);
337 337
 			}
338 338
 
339 339
 			// maybe load JS
340
-			if ( $this->settings['js'] ) {
340
+			if ($this->settings['js']) {
341 341
 				$priority = $this->is_bs3_compat() ? 100 : 1;
342
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
342
+				add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'), $priority);
343 343
 			}
344
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
345
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
344
+			if ($this->settings['js_backend'] && $this->load_admin_scripts()) {
345
+				add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'), 1);
346 346
 			}
347 347
 
348 348
 			// Maybe set the HTML font size
349
-			if ( $this->settings['html_font_size'] ) {
350
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
349
+			if ($this->settings['html_font_size']) {
350
+				add_action('wp_footer', array($this, 'html_font_size'), 10);
351 351
 			}
352 352
 
353 353
 			// Maybe show backend style error
354
-			if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
355
-				add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
354
+			if ($this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper') {
355
+				add_action('admin_notices', array($this, 'show_admin_style_notice'));
356 356
 			}
357 357
 
358 358
 		}
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
 		/**
361 361
 		 * Show admin notice if backend scripts not loaded.
362 362
 		 */
363
-		public function show_admin_style_notice(){
364
-			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
365
-			$button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
366
-			$message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
367
-			echo '<div class="notice notice-error aui-settings-error-notice"><p>'. wp_kses_post( $message ).'</p></div>';
363
+		public function show_admin_style_notice() {
364
+			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=" . wp_create_nonce('aui-fix-admin'));
365
+			$button = '<a href="' . esc_url($fix_url) . '" class="button-primary">Fix Now</a>';
366
+			$message = __('<b>Style Issue:</b> AyeCode UI is disable or set wrong.') . " " . $button;
367
+			echo '<div class="notice notice-error aui-settings-error-notice"><p>' . wp_kses_post($message) . '</p></div>';
368 368
 		}
369 369
 
370 370
 		/**
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 		 *
373 373
 		 * @return bool
374 374
 		 */
375
-		public function load_admin_scripts(){
375
+		public function load_admin_scripts() {
376 376
 			$result = true;
377 377
 
378 378
 			// check if specifically disabled
379
-			if(!empty($this->settings['disable_admin'])){
380
-				$url_parts = explode("\n",$this->settings['disable_admin']);
381
-				foreach($url_parts as $part){
382
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
379
+			if (!empty($this->settings['disable_admin'])) {
380
+				$url_parts = explode("\n", $this->settings['disable_admin']);
381
+				foreach ($url_parts as $part) {
382
+					if (strpos($_SERVER['REQUEST_URI'], trim($part)) !== false) {
383 383
 						return false; // return early, no point checking further
384 384
 					}
385 385
 				}
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
 		/**
392 392
 		 * Add a html font size to the footer.
393 393
 		 */
394
-		public function html_font_size(){
394
+		public function html_font_size() {
395 395
 			$this->settings = $this->get_settings();
396
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
396
+			echo "<style>html{font-size:" . absint($this->settings['html_font_size']) . "px;}</style>";
397 397
 		}
398 398
 
399 399
 		/**
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 		 *
402 402
 		 * @return bool
403 403
 		 */
404
-		public function is_aui_screen(){
404
+		public function is_aui_screen() {
405 405
 //			echo '###';exit;
406 406
 			$load = false;
407 407
 			// check if we should load or not
408
-			if ( is_admin() ) {
408
+			if (is_admin()) {
409 409
 				// Only enable on set pages
410 410
 				$aui_screens = array(
411 411
 					'page',
@@ -417,26 +417,26 @@  discard block
 block discarded – undo
417 417
 					'ayecode-ui-settings',
418 418
 					'site-editor'
419 419
 				);
420
-				$screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
420
+				$screen_ids = apply_filters('aui_screen_ids', $aui_screens);
421 421
 
422 422
 				$screen = get_current_screen();
423 423
 
424 424
 //				echo '###'.$screen->id;
425 425
 
426 426
 				// check if we are on a AUI screen
427
-				if ( $screen && in_array( $screen->id, $screen_ids ) ) {
427
+				if ($screen && in_array($screen->id, $screen_ids)) {
428 428
 					$load = true;
429 429
 				}
430 430
 
431 431
 				//load for widget previews in WP 5.8
432
-				if( !empty($_REQUEST['legacy-widget-preview'])){
432
+				if (!empty($_REQUEST['legacy-widget-preview'])) {
433 433
 					$load = true;
434 434
 				}
435 435
 			}
436 436
 
437 437
 
438 438
 
439
-			return apply_filters( 'aui_load_on_admin' , $load );
439
+			return apply_filters('aui_load_on_admin', $load);
440 440
 		}
441 441
 
442 442
 		/**
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 		 * @return bool
446 446
 		 */
447 447
 		public static function is_block_theme() {
448
-			if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) {
448
+			if (function_exists('wp_is_block_theme' && wp_is_block_theme())) {
449 449
 				return true;
450 450
 			}
451 451
 
@@ -460,32 +460,32 @@  discard block
 block discarded – undo
460 460
 
461 461
             $load_fse = false;
462 462
 
463
-			if ( is_admin() && ! $this->is_aui_screen() ) {
463
+			if (is_admin() && !$this->is_aui_screen()) {
464 464
 				// Don't add wp-admin scripts if not requested to.
465 465
 			} else {
466 466
 				$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
467
-				$rtl = is_rtl() && ! $aui_bs5 ? '-rtl' : '';
467
+				$rtl = is_rtl() && !$aui_bs5 ? '-rtl' : '';
468 468
                 $bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : '';
469 469
 
470
-				if ( $this->settings[ $css_setting ] ) {
471
-					$compatibility = $this->settings[$css_setting]=='core' ? false : true;
472
-					$url = $this->settings[$css_setting]=='core' ? $this->url.'assets'.$bs_ver.'/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets'.$bs_ver.'/css/ayecode-ui-compatibility'.$rtl.'.css';
470
+				if ($this->settings[$css_setting]) {
471
+					$compatibility = $this->settings[$css_setting] == 'core' ? false : true;
472
+					$url = $this->settings[$css_setting] == 'core' ? $this->url . 'assets' . $bs_ver . '/css/ayecode-ui' . $rtl . '.css' : $this->url . 'assets' . $bs_ver . '/css/ayecode-ui-compatibility' . $rtl . '.css';
473 473
 
474
-					wp_register_style( 'ayecode-ui', $url, array(), $this->version );
475
-					wp_enqueue_style( 'ayecode-ui' );
474
+					wp_register_style('ayecode-ui', $url, array(), $this->version);
475
+					wp_enqueue_style('ayecode-ui');
476 476
 
477
-					if ( is_admin() && ( !empty($_REQUEST['postType']) || self::is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) )  ) {
478
-						$url = $this->url.'assets'.$bs_ver.'/css/ayecode-ui-fse.css';
479
-						wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version );
480
-						wp_enqueue_style( 'ayecode-ui-fse' );
477
+					if (is_admin() && (!empty($_REQUEST['postType']) || self::is_block_editor()) && (defined('BLOCKSTRAP_VERSION') || defined('AUI_FSE'))) {
478
+						$url = $this->url . 'assets' . $bs_ver . '/css/ayecode-ui-fse.css';
479
+						wp_register_style('ayecode-ui-fse', $url, array(), $this->version);
480
+						wp_enqueue_style('ayecode-ui-fse');
481 481
 						$load_fse = true;
482 482
 					}
483 483
 
484 484
 					// flatpickr
485
-					wp_register_style( 'flatpickr', $this->url.'assets'.$bs_ver.'/css/flatpickr.min.css', array(), $this->version );
485
+					wp_register_style('flatpickr', $this->url . 'assets' . $bs_ver . '/css/flatpickr.min.css', array(), $this->version);
486 486
 
487 487
 					// fix some wp-admin issues
488
-					if(is_admin()){
488
+					if (is_admin()) {
489 489
 						$custom_css = "
490 490
                 body{
491 491
                     background-color: #f1f1f1;
@@ -532,14 +532,14 @@  discard block
 block discarded – undo
532 532
 						    padding: 0;
533 533
 						}
534 534
 					";
535
-						wp_add_inline_style( 'ayecode-ui', $custom_css );
535
+						wp_add_inline_style('ayecode-ui', $custom_css);
536 536
 					}
537 537
 
538 538
 					// custom changes
539
-					if ( $load_fse ) {
540
-						wp_add_inline_style( 'ayecode-ui-fse', self::custom_css($compatibility, true) );
541
-					}else{
542
-						wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
539
+					if ($load_fse) {
540
+						wp_add_inline_style('ayecode-ui-fse', self::custom_css($compatibility, true));
541
+					} else {
542
+						wp_add_inline_style('ayecode-ui', self::custom_css($compatibility));
543 543
 					}
544 544
 				}
545 545
 			}
@@ -556,10 +556,10 @@  discard block
 block discarded – undo
556 556
 			$flatpickr_locale = self::flatpickr_locale();
557 557
 
558 558
 			ob_start();
559
-			if ( $aui_bs5 ) {
560
-				include_once( dirname( __FILE__ ) . '/inc/bs5-js.php' );
561
-			}else{
562
-				include_once( dirname( __FILE__ ) . '/inc/bs4-js.php' );
559
+			if ($aui_bs5) {
560
+				include_once(dirname(__FILE__) . '/inc/bs5-js.php');
561
+			} else {
562
+				include_once(dirname(__FILE__) . '/inc/bs4-js.php');
563 563
             }
564 564
 
565 565
 			$output = ob_get_clean();
@@ -567,10 +567,10 @@  discard block
 block discarded – undo
567 567
 			/*
568 568
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
569 569
 			 */
570
-			return str_replace( array(
570
+			return str_replace(array(
571 571
 				'<script>',
572 572
 				'</script>'
573
-			), '', self::minify_js($output) );
573
+			), '', self::minify_js($output));
574 574
 		}
575 575
 
576 576
 
@@ -584,13 +584,13 @@  discard block
 block discarded – undo
584 584
 			ob_start();
585 585
 			?>
586 586
             <script>
587
-				<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
587
+				<?php if (defined('FUSION_BUILDER_VERSION')) { ?>
588 588
                 /* With Avada builder */
589 589
 
590 590
 				<?php } ?>
591 591
             </script>
592 592
 			<?php
593
-			return str_replace( array(
593
+			return str_replace(array(
594 594
 				'<script>',
595 595
 				'</script>'
596 596
 			), '', ob_get_clean());
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		 *
602 602
 		 * If this remains small then its best to use this than to add another JS file.
603 603
 		 */
604
-		public function inline_script_file_browser(){
604
+		public function inline_script_file_browser() {
605 605
 			ob_start();
606 606
 			?>
607 607
             <script>
@@ -616,17 +616,17 @@  discard block
 block discarded – undo
616 616
 			/*
617 617
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
618 618
 			 */
619
-			return str_replace( array(
619
+			return str_replace(array(
620 620
 				'<script>',
621 621
 				'</script>'
622
-			), '', $output );
622
+			), '', $output);
623 623
 		}
624 624
 
625 625
 		/**
626 626
 		 * Adds the Font Awesome JS.
627 627
 		 */
628 628
 		public function enqueue_scripts() {
629
-			if( is_admin() && !$this->is_aui_screen()){
629
+			if (is_admin() && !$this->is_aui_screen()) {
630 630
 				// Don't add wp-admin scripts if not requested to.
631 631
 			} else {
632 632
 				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
@@ -634,57 +634,57 @@  discard block
 block discarded – undo
634 634
 				$bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : '';
635 635
 
636 636
 				// select2
637
-				wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
637
+				wp_register_script('select2', $this->url . 'assets/js/select2.min.js', array('jquery'), $this->select2_version);
638 638
 
639 639
 				// flatpickr
640
-				wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
640
+				wp_register_script('flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version);
641 641
 
642 642
 				// iconpicker
643
-				if ( defined( 'FAS_ICONPICKER_JS_URL' ) ) {
644
-					wp_register_script( 'iconpicker', FAS_ICONPICKER_JS_URL, array(), $this->version );
645
-				}else{
646
-					wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
643
+				if (defined('FAS_ICONPICKER_JS_URL')) {
644
+					wp_register_script('iconpicker', FAS_ICONPICKER_JS_URL, array(), $this->version);
645
+				} else {
646
+					wp_register_script('iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version);
647 647
 				}
648 648
 
649 649
 				// Bootstrap file browser
650
-				wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
651
-				wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
650
+				wp_register_script('aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array('jquery'), $this->select2_version);
651
+				wp_add_inline_script('aui-custom-file-input', $this->inline_script_file_browser());
652 652
 
653 653
 				$load_inline = false;
654 654
 
655 655
 				// Load select2 only when required.
656
-				if ( $this->force_load_select2() ) {
657
-					$dependency = array( 'select2', 'jquery' );
656
+				if ($this->force_load_select2()) {
657
+					$dependency = array('select2', 'jquery');
658 658
 				} else {
659
-					$dependency = array( 'jquery' );
659
+					$dependency = array('jquery');
660 660
 				}
661 661
 
662
-				if ( $this->settings[ $js_setting ] == 'core-popper' ) {
662
+				if ($this->settings[$js_setting] == 'core-popper') {
663 663
 					// Bootstrap bundle
664 664
 					$url = $this->url . 'assets' . $bs_ver . '/js/bootstrap.bundle.min.js';
665
-					wp_register_script( 'bootstrap-js-bundle', $url, $dependency, $this->version, $this->is_bs3_compat() );
665
+					wp_register_script('bootstrap-js-bundle', $url, $dependency, $this->version, $this->is_bs3_compat());
666 666
 
667 667
 					// If in admin then add to footer for compatibility.
668
-					is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
668
+					is_admin() ? wp_enqueue_script('bootstrap-js-bundle', '', null, null, true) : wp_enqueue_script('bootstrap-js-bundle');
669 669
 
670 670
 					$script = $this->inline_script();
671
-					wp_add_inline_script( 'bootstrap-js-bundle', $script );
672
-				} elseif ( $this->settings[ $js_setting ] == 'popper' ) {
671
+					wp_add_inline_script('bootstrap-js-bundle', $script);
672
+				} elseif ($this->settings[$js_setting] == 'popper') {
673 673
 					$url = $this->url . 'assets/js/popper.min.js'; // @todo we need to update this to bs5
674
-					wp_register_script( 'bootstrap-js-popper', $url, $dependency, $this->version );
675
-					wp_enqueue_script( 'bootstrap-js-popper' );
674
+					wp_register_script('bootstrap-js-popper', $url, $dependency, $this->version);
675
+					wp_enqueue_script('bootstrap-js-popper');
676 676
 					$load_inline = true;
677 677
 				} else {
678 678
 					$load_inline = true;
679 679
 				}
680 680
 
681 681
 				// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
682
-				if ( $load_inline ) {
683
-					wp_register_script( 'bootstrap-dummy', '', $dependency );
684
-					wp_enqueue_script( 'bootstrap-dummy' );
682
+				if ($load_inline) {
683
+					wp_register_script('bootstrap-dummy', '', $dependency);
684
+					wp_enqueue_script('bootstrap-dummy');
685 685
 
686 686
 					$script = $this->inline_script();
687
-					wp_add_inline_script( 'bootstrap-dummy', $script );
687
+					wp_add_inline_script('bootstrap-dummy', $script);
688 688
 				}
689 689
 			}
690 690
 		}
@@ -697,15 +697,15 @@  discard block
 block discarded – undo
697 697
 		public function force_load_select2() {
698 698
 			global $aui_select2_enqueued;
699 699
 
700
-			$conditional_select2 = apply_filters( 'aui_is_conditional_select2', true );
700
+			$conditional_select2 = apply_filters('aui_is_conditional_select2', true);
701 701
 
702
-			if ( $conditional_select2 !== true ) {
702
+			if ($conditional_select2 !== true) {
703 703
 				return true;
704 704
 			}
705 705
 
706
-			$load = is_admin() && ! $aui_select2_enqueued;
706
+			$load = is_admin() && !$aui_select2_enqueued;
707 707
 
708
-			return apply_filters( 'aui_force_load_select2', $load );
708
+			return apply_filters('aui_force_load_select2', $load);
709 709
 		}
710 710
 
711 711
 		/**
@@ -714,23 +714,23 @@  discard block
 block discarded – undo
714 714
 		 * @since 0.2.29
715 715
 		 */
716 716
 		public function enqueue_select2() {
717
-			wp_enqueue_script( 'select2' );
717
+			wp_enqueue_script('select2');
718 718
 		}
719 719
 
720 720
 		/**
721 721
 		 * Enqueue flatpickr if called.
722 722
 		 */
723
-		public function enqueue_flatpickr(){
724
-			wp_enqueue_style( 'flatpickr' );
725
-			wp_enqueue_script( 'flatpickr' );
723
+		public function enqueue_flatpickr() {
724
+			wp_enqueue_style('flatpickr');
725
+			wp_enqueue_script('flatpickr');
726 726
 		}
727 727
 
728 728
 		/**
729 729
 		 * Enqueue iconpicker if called.
730 730
 		 */
731
-		public function enqueue_iconpicker(){
732
-			wp_enqueue_style( 'iconpicker' );
733
-			wp_enqueue_script( 'iconpicker' );
731
+		public function enqueue_iconpicker() {
732
+			wp_enqueue_style('iconpicker');
733
+			wp_enqueue_script('iconpicker');
734 734
 		}
735 735
 
736 736
         /**
@@ -742,17 +742,17 @@  discard block
 block discarded – undo
742 742
          * @return string
743 743
          */
744 744
         public function get_url() {
745
-            $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
746
-            $content_url = untrailingslashit( WP_CONTENT_URL );
745
+            $content_dir = wp_normalize_path(untrailingslashit(WP_CONTENT_DIR));
746
+            $content_url = untrailingslashit(WP_CONTENT_URL);
747 747
 
748 748
             // maybe Replace http:// to https://.
749
-            if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
750
-                $content_url = str_replace( 'http://', 'https://', $content_url );
749
+            if (strpos($content_url, 'http://') === 0 && strpos(plugins_url(), 'https://') === 0) {
750
+                $content_url = str_replace('http://', 'https://', $content_url);
751 751
             }
752 752
 
753 753
             // First find where in the path our content directory starts
754 754
             $content_basename = basename($content_dir);
755
-            $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
755
+            $file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__)));
756 756
 
757 757
             // Find the relative path by matching from content directory name
758 758
             $after_content = substr($file_dir, strpos($file_dir, '/' . $content_basename . '/') + strlen('/' . $content_basename . '/'));
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
             $url = trailingslashit($content_url) . $after_content;
762 762
 
763 763
             // some hosts end up with /wp-content/wp-content/
764
-            $url = str_replace( '/wp-content/wp-content/', '/wp-content/', $url );
764
+            $url = str_replace('/wp-content/wp-content/', '/wp-content/', $url);
765 765
 
766 766
             return trailingslashit($url);
767 767
         }
@@ -775,15 +775,15 @@  discard block
 block discarded – undo
775 775
 
776 776
 			$url = '';
777 777
 			// check if we are inside a plugin
778
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
778
+			$file_dir = str_replace("/includes", "", wp_normalize_path(dirname(__FILE__)));
779 779
 
780 780
 			// add check in-case user has changed wp-content dir name.
781 781
 			$wp_content_folder_name = basename(WP_CONTENT_DIR);
782
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
783
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
782
+			$dir_parts = explode("/$wp_content_folder_name/", $file_dir);
783
+			$url_parts = explode("/$wp_content_folder_name/", plugins_url());
784 784
 
785
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
786
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
785
+			if (!empty($url_parts[0]) && !empty($dir_parts[1])) {
786
+				$url = trailingslashit($url_parts[0] . "/$wp_content_folder_name/" . $dir_parts[1]);
787 787
 			}
788 788
 
789 789
 			return $url;
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
 		 * Register the database settings with WordPress.
794 794
 		 */
795 795
 		public function register_settings() {
796
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
796
+			register_setting('ayecode-ui-settings', 'ayecode-ui-settings');
797 797
 		}
798 798
 
799 799
 		/**
@@ -802,10 +802,10 @@  discard block
 block discarded – undo
802 802
 		 */
803 803
 		public function menu_item() {
804 804
 			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
805
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
805
+			call_user_func($menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
806 806
 				$this,
807 807
 				'settings_page'
808
-			) );
808
+			));
809 809
 		}
810 810
 
811 811
 		/**
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 		 *
814 814
 		 * @return array
815 815
 		 */
816
-		public function theme_js_settings(){
816
+		public function theme_js_settings() {
817 817
 			return array(
818 818
 				'ayetheme' => 'popper',
819 819
 				'listimia' => 'required',
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 	        $query = "SELECT MIN(user_registered) AS oldest_registration_date FROM {$wpdb->users}";
835 835
 
836 836
 	        // Execute the query
837
-	        $date = $wpdb->get_var( $query ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
837
+	        $date = $wpdb->get_var($query); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
838 838
 
839 839
 	        return $date ? $date : false;
840 840
         }
@@ -842,11 +842,11 @@  discard block
 block discarded – undo
842 842
 		/**
843 843
 		 * Show admin notice if backend scripts not loaded.
844 844
 		 */
845
-		public function show_admin_version_notice(){
846
-			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings" );
847
-			$button = '<a href="'.esc_url($fix_url).'" class="button-primary">View Settings</a>';
848
-			$message = __( '<b>Style Issue:</b> AyeCode UI has changed its default version from v4 to v5, if you notice unwanted style changes, please revert to v4 (saving the settings page will remove this notice)')." " .$button;
849
-			echo '<div class="notice notice-error aui-settings-error-notice"><p>'. wp_kses_post( $message ).'</p></div>';
845
+		public function show_admin_version_notice() {
846
+			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings");
847
+			$button = '<a href="' . esc_url($fix_url) . '" class="button-primary">View Settings</a>';
848
+			$message = __('<b>Style Issue:</b> AyeCode UI has changed its default version from v4 to v5, if you notice unwanted style changes, please revert to v4 (saving the settings page will remove this notice)') . " " . $button;
849
+			echo '<div class="notice notice-error aui-settings-error-notice"><p>' . wp_kses_post($message) . '</p></div>';
850 850
 		}
851 851
 
852 852
 		/**
@@ -855,15 +855,15 @@  discard block
 block discarded – undo
855 855
 		 * @return array The array of settings.
856 856
 		 */
857 857
 		public function get_settings() {
858
-			$db_settings = get_option( 'ayecode-ui-settings' );
858
+			$db_settings = get_option('ayecode-ui-settings');
859 859
 
860 860
 			// Maybe show default version notice
861
-			if ( empty( $db_settings ) ) {
862
-				$site_install_date = new DateTime( self::get_site_install_date() );
863
-				$switch_over_date = new DateTime( "2024-02-01" );
861
+			if (empty($db_settings)) {
862
+				$site_install_date = new DateTime(self::get_site_install_date());
863
+				$switch_over_date = new DateTime("2024-02-01");
864 864
 
865
-				if ( $site_install_date < $switch_over_date ) {
866
-					add_action( 'admin_notices', array( $this, 'show_admin_version_notice' ) );
865
+				if ($site_install_date < $switch_over_date) {
866
+					add_action('admin_notices', array($this, 'show_admin_version_notice'));
867 867
 				}
868 868
 			}
869 869
 
@@ -871,19 +871,19 @@  discard block
 block discarded – undo
871 871
 			$js_default_backend = $js_default;
872 872
 
873 873
 			// maybe set defaults (if no settings set)
874
-			if(empty($db_settings)){
875
-				$active_theme = strtolower( get_template() ); // active parent theme.
874
+			if (empty($db_settings)) {
875
+				$active_theme = strtolower(get_template()); // active parent theme.
876 876
 				$theme_js_settings = self::theme_js_settings();
877
-				if(isset($theme_js_settings[$active_theme])){
877
+				if (isset($theme_js_settings[$active_theme])) {
878 878
 					$js_default = $theme_js_settings[$active_theme];
879
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
879
+					$js_default_backend = isset($theme_js_settings[$active_theme . "_backend"]) ? $theme_js_settings[$active_theme . "_backend"] : $js_default;
880 880
 				}
881 881
 			}
882 882
 
883 883
 			/**
884 884
 			 * Filter the default settings.
885 885
 			 */
886
-			$defaults = apply_filters( 'ayecode-ui-default-settings', array(
886
+			$defaults = apply_filters('ayecode-ui-default-settings', array(
887 887
 				'css'            => 'compatibility', // core, compatibility
888 888
 				'js'             => $js_default, // js to load, core-popper, popper
889 889
 				'html_font_size' => '16', // js to load, core-popper, popper
@@ -891,16 +891,16 @@  discard block
 block discarded – undo
891 891
 				'js_backend'     => $js_default_backend, // js to load, core-popper, popper
892 892
 				'disable_admin'  => '', // URL snippets to disable loading on admin
893 893
                 'bs_ver'         => '5', // The default bootstrap version to sue by default
894
-			), $db_settings );
894
+			), $db_settings);
895 895
 
896
-			$settings = wp_parse_args( $db_settings, $defaults );
896
+			$settings = wp_parse_args($db_settings, $defaults);
897 897
 
898 898
 			/**
899 899
 			 * Filter the Bootstrap settings.
900 900
 			 *
901 901
 			 * @todo if we add this filer people might use it and then it defeats the purpose of this class :/
902 902
 			 */
903
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
903
+			return $this->settings = apply_filters('ayecode-ui-settings', $settings, $db_settings, $defaults);
904 904
 		}
905 905
 
906 906
 
@@ -908,109 +908,109 @@  discard block
 block discarded – undo
908 908
 		 * The settings page html output.
909 909
 		 */
910 910
 		public function settings_page() {
911
-			if ( ! current_user_can( 'manage_options' ) ) {
912
-				wp_die( esc_attr__( 'You do not have sufficient permissions to access this page.', 'ayecode-connect' ) );
911
+			if (!current_user_can('manage_options')) {
912
+				wp_die(esc_attr__('You do not have sufficient permissions to access this page.', 'ayecode-connect'));
913 913
 			}
914
-            $overrides = apply_filters( 'ayecode-ui-settings', array(), array(), array() );
914
+            $overrides = apply_filters('ayecode-ui-settings', array(), array(), array());
915 915
 
916 916
 			?>
917 917
             <div class="wrap">
918
-                <h1><?php echo esc_attr( $this->name ); ?></h1>
919
-                <p><?php echo esc_html( apply_filters( 'ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.", 'ayecode-connect' ) ) );?></p>
918
+                <h1><?php echo esc_attr($this->name); ?></h1>
919
+                <p><?php echo esc_html(apply_filters('ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.", 'ayecode-connect'))); ?></p>
920 920
                 <form method="post" action="options.php">
921 921
 					<?php
922
-					settings_fields( 'ayecode-ui-settings' );
923
-					do_settings_sections( 'ayecode-ui-settings' );
922
+					settings_fields('ayecode-ui-settings');
923
+					do_settings_sections('ayecode-ui-settings');
924 924
 					?>
925 925
 
926
-                    <h2><?php esc_html_e( 'BootStrap Version', 'ayecode-connect' ); ?></h2>
927
-                    <p><?php echo esc_html( apply_filters( 'ayecode-ui-version-settings-message', __("V5 is recommended, however if you have another plugin installed using v4, you may need to use v4 also.", 'ayecode-connect' ) ) );?></p>
926
+                    <h2><?php esc_html_e('BootStrap Version', 'ayecode-connect'); ?></h2>
927
+                    <p><?php echo esc_html(apply_filters('ayecode-ui-version-settings-message', __("V5 is recommended, however if you have another plugin installed using v4, you may need to use v4 also.", 'ayecode-connect'))); ?></p>
928 928
 	                <div class="bsui"><?php
929
-	                if ( ! empty( $overrides ) ) {
929
+	                if (!empty($overrides)) {
930 930
 		                echo aui()->alert(array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
931 931
 			                'type'=> 'info',
932
-			                'content'=> esc_attr__("Some options are disabled as your current theme is overriding them.", 'ayecode-connect' )
932
+			                'content'=> esc_attr__("Some options are disabled as your current theme is overriding them.", 'ayecode-connect')
933 933
 		                ));
934 934
 	                }
935 935
 	                ?>
936 936
                     </div>
937 937
                     <table class="form-table wpbs-table-version-settings">
938 938
                         <tr valign="top">
939
-                            <th scope="row"><label for="wpbs-css"><?php esc_html_e( 'Version', 'ayecode-connect' ); ?></label></th>
939
+                            <th scope="row"><label for="wpbs-css"><?php esc_html_e('Version', 'ayecode-connect'); ?></label></th>
940 940
                             <td>
941 941
                                 <select name="ayecode-ui-settings[bs_ver]" id="wpbs-css" <?php echo !empty($overrides['bs_ver']) ? 'disabled' : ''; ?>>
942
-                                    <option	value="5" <?php selected( $this->settings['bs_ver'], '5' ); ?>><?php esc_html_e( 'v5 (recommended)', 'ayecode-connect' ); ?></option>
943
-                                    <option value="4" <?php selected( $this->settings['bs_ver'], '4' ); ?>><?php esc_html_e( 'v4 (legacy)', 'ayecode-connect' ); ?></option>
942
+                                    <option	value="5" <?php selected($this->settings['bs_ver'], '5'); ?>><?php esc_html_e('v5 (recommended)', 'ayecode-connect'); ?></option>
943
+                                    <option value="4" <?php selected($this->settings['bs_ver'], '4'); ?>><?php esc_html_e('v4 (legacy)', 'ayecode-connect'); ?></option>
944 944
                                 </select>
945 945
                             </td>
946 946
                         </tr>
947 947
                     </table>
948 948
 
949
-                    <h2><?php esc_html_e( 'Frontend', 'ayecode-connect' ); ?></h2>
949
+                    <h2><?php esc_html_e('Frontend', 'ayecode-connect'); ?></h2>
950 950
                     <table class="form-table wpbs-table-settings">
951 951
                         <tr valign="top">
952
-                            <th scope="row"><label for="wpbs-css"><?php esc_html_e( 'Load CSS', 'ayecode-connect' ); ?></label></th>
952
+                            <th scope="row"><label for="wpbs-css"><?php esc_html_e('Load CSS', 'ayecode-connect'); ?></label></th>
953 953
                             <td>
954 954
                                 <select name="ayecode-ui-settings[css]" id="wpbs-css" <?php echo !empty($overrides['css']) ? 'disabled' : ''; ?>>
955
-                                    <option	value="compatibility" <?php selected( $this->settings['css'], 'compatibility' ); ?>><?php esc_html_e( 'Compatibility Mode (default)', 'ayecode-connect' ); ?></option>
956
-                                    <option value="core" <?php selected( $this->settings['css'], 'core' ); ?>><?php esc_html_e( 'Full Mode', 'ayecode-connect' ); ?></option>
957
-                                    <option	value="" <?php selected( $this->settings['css'], '' ); ?>><?php esc_html_e( 'Disabled', 'ayecode-connect' ); ?></option>
955
+                                    <option	value="compatibility" <?php selected($this->settings['css'], 'compatibility'); ?>><?php esc_html_e('Compatibility Mode (default)', 'ayecode-connect'); ?></option>
956
+                                    <option value="core" <?php selected($this->settings['css'], 'core'); ?>><?php esc_html_e('Full Mode', 'ayecode-connect'); ?></option>
957
+                                    <option	value="" <?php selected($this->settings['css'], ''); ?>><?php esc_html_e('Disabled', 'ayecode-connect'); ?></option>
958 958
                                 </select>
959 959
                             </td>
960 960
                         </tr>
961 961
 
962 962
                         <tr valign="top">
963
-                            <th scope="row"><label for="wpbs-js"><?php esc_html_e( 'Load JS', 'ayecode-connect' ); ?></label></th>
963
+                            <th scope="row"><label for="wpbs-js"><?php esc_html_e('Load JS', 'ayecode-connect'); ?></label></th>
964 964
                             <td>
965 965
                                 <select name="ayecode-ui-settings[js]" id="wpbs-js" <?php echo !empty($overrides['js']) ? 'disabled' : ''; ?>>
966
-                                    <option	value="core-popper" <?php selected( $this->settings['js'], 'core-popper' ); ?>><?php esc_html_e( 'Core + Popper (default)', 'ayecode-connect' ); ?></option>
967
-                                    <option value="popper" <?php selected( $this->settings['js'], 'popper' ); ?>><?php esc_html_e( 'Popper', 'ayecode-connect' ); ?></option>
968
-                                    <option value="required" <?php selected( $this->settings['js'], 'required' ); ?>><?php esc_html_e( 'Required functions only', 'ayecode-connect' ); ?></option>
969
-                                    <option	value="" <?php selected( $this->settings['js'], '' ); ?>><?php esc_html_e( 'Disabled (not recommended)', 'ayecode-connect' ); ?></option>
966
+                                    <option	value="core-popper" <?php selected($this->settings['js'], 'core-popper'); ?>><?php esc_html_e('Core + Popper (default)', 'ayecode-connect'); ?></option>
967
+                                    <option value="popper" <?php selected($this->settings['js'], 'popper'); ?>><?php esc_html_e('Popper', 'ayecode-connect'); ?></option>
968
+                                    <option value="required" <?php selected($this->settings['js'], 'required'); ?>><?php esc_html_e('Required functions only', 'ayecode-connect'); ?></option>
969
+                                    <option	value="" <?php selected($this->settings['js'], ''); ?>><?php esc_html_e('Disabled (not recommended)', 'ayecode-connect'); ?></option>
970 970
                                 </select>
971 971
                             </td>
972 972
                         </tr>
973 973
 
974 974
                         <tr valign="top">
975
-                            <th scope="row"><label for="wpbs-font_size"><?php esc_html_e( 'HTML Font Size (px)', 'ayecode-connect' ); ?></label></th>
975
+                            <th scope="row"><label for="wpbs-font_size"><?php esc_html_e('HTML Font Size (px)', 'ayecode-connect'); ?></label></th>
976 976
                             <td>
977
-                                <input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint( $this->settings['html_font_size']); ?>" placeholder="16" <?php echo !empty($overrides['html_font_size']) ? 'disabled' : ''; ?> />
978
-                                <p class="description" ><?php esc_html_e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", 'ayecode-connect' );?></p>
977
+                                <input type="number" name="ayecode-ui-settings[html_font_size]" id="wpbs-font_size" value="<?php echo absint($this->settings['html_font_size']); ?>" placeholder="16" <?php echo !empty($overrides['html_font_size']) ? 'disabled' : ''; ?> />
978
+                                <p class="description" ><?php esc_html_e("Our font sizing is rem (responsive based) here you can set the html font size in-case your theme is setting it too low.", 'ayecode-connect'); ?></p>
979 979
                             </td>
980 980
                         </tr>
981 981
 
982 982
                     </table>
983 983
 
984
-                    <h2><?php esc_html_e( 'Backend', 'ayecode-connect' ); ?> (wp-admin)</h2>
984
+                    <h2><?php esc_html_e('Backend', 'ayecode-connect'); ?> (wp-admin)</h2>
985 985
                     <table class="form-table wpbs-table-settings">
986 986
                         <tr valign="top">
987
-                            <th scope="row"><label for="wpbs-css-admin"><?php esc_html_e( 'Load CSS', 'ayecode-connect' ); ?></label></th>
987
+                            <th scope="row"><label for="wpbs-css-admin"><?php esc_html_e('Load CSS', 'ayecode-connect'); ?></label></th>
988 988
                             <td>
989 989
                                 <select name="ayecode-ui-settings[css_backend]" id="wpbs-css-admin" <?php echo !empty($overrides['css_backend']) ? 'disabled' : ''; ?>>
990
-                                    <option	value="compatibility" <?php selected( $this->settings['css_backend'], 'compatibility' ); ?>><?php esc_html_e( 'Compatibility Mode (default)', 'ayecode-connect' ); ?></option>
991
-                                    <option value="core" <?php selected( $this->settings['css_backend'], 'core' ); ?>><?php esc_html_e( 'Full Mode (will cause style issues)', 'ayecode-connect' ); ?></option>
992
-                                    <option	value="" <?php selected( $this->settings['css_backend'], '' ); ?>><?php esc_html_e( 'Disabled', 'ayecode-connect' ); ?></option>
990
+                                    <option	value="compatibility" <?php selected($this->settings['css_backend'], 'compatibility'); ?>><?php esc_html_e('Compatibility Mode (default)', 'ayecode-connect'); ?></option>
991
+                                    <option value="core" <?php selected($this->settings['css_backend'], 'core'); ?>><?php esc_html_e('Full Mode (will cause style issues)', 'ayecode-connect'); ?></option>
992
+                                    <option	value="" <?php selected($this->settings['css_backend'], ''); ?>><?php esc_html_e('Disabled', 'ayecode-connect'); ?></option>
993 993
                                 </select>
994 994
                             </td>
995 995
                         </tr>
996 996
 
997 997
                         <tr valign="top">
998
-                            <th scope="row"><label for="wpbs-js-admin"><?php esc_html_e( 'Load JS', 'ayecode-connect' ); ?></label></th>
998
+                            <th scope="row"><label for="wpbs-js-admin"><?php esc_html_e('Load JS', 'ayecode-connect'); ?></label></th>
999 999
                             <td>
1000 1000
                                 <select name="ayecode-ui-settings[js_backend]" id="wpbs-js-admin" <?php echo !empty($overrides['js_backend']) ? 'disabled' : ''; ?>>
1001
-                                    <option	value="core-popper" <?php selected( $this->settings['js_backend'], 'core-popper' ); ?>><?php esc_html_e( 'Core + Popper (default)', 'ayecode-connect' ); ?></option>
1002
-                                    <option value="popper" <?php selected( $this->settings['js_backend'], 'popper' ); ?>><?php esc_html_e( 'Popper', 'ayecode-connect' ); ?></option>
1003
-                                    <option value="required" <?php selected( $this->settings['js_backend'], 'required' ); ?>><?php esc_html_e( 'Required functions only', 'ayecode-connect' ); ?></option>
1004
-                                    <option	value="" <?php selected( $this->settings['js_backend'], '' ); ?>><?php esc_html_e( 'Disabled (not recommended)', 'ayecode-connect' ); ?></option>
1001
+                                    <option	value="core-popper" <?php selected($this->settings['js_backend'], 'core-popper'); ?>><?php esc_html_e('Core + Popper (default)', 'ayecode-connect'); ?></option>
1002
+                                    <option value="popper" <?php selected($this->settings['js_backend'], 'popper'); ?>><?php esc_html_e('Popper', 'ayecode-connect'); ?></option>
1003
+                                    <option value="required" <?php selected($this->settings['js_backend'], 'required'); ?>><?php esc_html_e('Required functions only', 'ayecode-connect'); ?></option>
1004
+                                    <option	value="" <?php selected($this->settings['js_backend'], ''); ?>><?php esc_html_e('Disabled (not recommended)', 'ayecode-connect'); ?></option>
1005 1005
                                 </select>
1006 1006
                             </td>
1007 1007
                         </tr>
1008 1008
 
1009 1009
                         <tr valign="top">
1010
-                            <th scope="row"><label for="wpbs-disable-admin"><?php esc_html_e( 'Disable load on URL', 'ayecode-connect' ); ?></label></th>
1010
+                            <th scope="row"><label for="wpbs-disable-admin"><?php esc_html_e('Disable load on URL', 'ayecode-connect'); ?></label></th>
1011 1011
                             <td>
1012
-                                <p><?php esc_html_e( 'If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'ayecode-connect' ); ?></p>
1013
-                                <textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php &#10;action=go"><?php echo esc_textarea( $this->settings['disable_admin'] );?></textarea>
1012
+                                <p><?php esc_html_e('If you have backend conflict you can enter a partial URL argument that will disable the loading of AUI on those pages. Add each argument on a new line.', 'ayecode-connect'); ?></p>
1013
+                                <textarea name="ayecode-ui-settings[disable_admin]" rows="10" cols="50" id="wpbs-disable-admin" class="large-text code" spellcheck="false" placeholder="myplugin.php &#10;action=go"><?php echo esc_textarea($this->settings['disable_admin']); ?></textarea>
1014 1014
                             </td>
1015 1015
                         </tr>
1016 1016
                     </table>
@@ -1019,33 +1019,33 @@  discard block
 block discarded – undo
1019 1019
 					submit_button();
1020 1020
 					?>
1021 1021
                 </form>
1022
-                <div id="wpbs-version" data-aui-source="<?php echo esc_attr( $this->get_load_source() ); ?>"><?php echo esc_html( $this->version ); ?></div>
1022
+                <div id="wpbs-version" data-aui-source="<?php echo esc_attr($this->get_load_source()); ?>"><?php echo esc_html($this->version); ?></div>
1023 1023
             </div>
1024 1024
 			<?php
1025 1025
 		}
1026 1026
 
1027
-        public function get_load_source(){
1028
-	        $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) );
1029
-	        $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) );
1027
+        public function get_load_source() {
1028
+	        $file = str_replace(array("/", "\\"), "/", realpath(__FILE__));
1029
+	        $plugins_dir = str_replace(array("/", "\\"), "/", realpath(WP_PLUGIN_DIR));
1030 1030
 
1031 1031
 	        // Find source plugin/theme of SD
1032 1032
 	        $source = array();
1033
-	        if ( strpos( $file, $plugins_dir ) !== false ) {
1034
-		        $source = explode( "/", plugin_basename( $file ) );
1035
-	        } else if ( function_exists( 'get_theme_root' ) ) {
1036
-		        $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) );
1033
+	        if (strpos($file, $plugins_dir) !== false) {
1034
+		        $source = explode("/", plugin_basename($file));
1035
+	        } else if (function_exists('get_theme_root')) {
1036
+		        $themes_dir = str_replace(array("/", "\\"), "/", realpath(get_theme_root()));
1037 1037
 
1038
-		        if ( strpos( $file, $themes_dir ) !== false ) {
1039
-			        $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) );
1038
+		        if (strpos($file, $themes_dir) !== false) {
1039
+			        $source = explode("/", ltrim(str_replace($themes_dir, "", $file), "/"));
1040 1040
 		        }
1041 1041
 	        }
1042 1042
 
1043 1043
             return isset($source[0]) ? esc_attr($source[0]) : '';
1044 1044
         }
1045 1045
 
1046
-		public function customizer_settings($wp_customize){
1046
+		public function customizer_settings($wp_customize) {
1047 1047
 			$wp_customize->add_section('aui_settings', array(
1048
-				'title'    => __('AyeCode UI', 'ayecode-connect' ),
1048
+				'title'    => __('AyeCode UI', 'ayecode-connect'),
1049 1049
 				'priority' => 120,
1050 1050
 			));
1051 1051
 
@@ -1059,8 +1059,8 @@  discard block
 block discarded – undo
1059 1059
 				'type'              => 'option',
1060 1060
 				'transport'         => 'refresh',
1061 1061
 			));
1062
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1063
-				'label'    => __('Primary Color', 'ayecode-connect' ),
1062
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1063
+				'label'    => __('Primary Color', 'ayecode-connect'),
1064 1064
 				'section'  => 'aui_settings',
1065 1065
 				'settings' => 'aui_options[color_primary]',
1066 1066
 			)));
@@ -1072,8 +1072,8 @@  discard block
 block discarded – undo
1072 1072
 				'type'              => 'option',
1073 1073
 				'transport'         => 'refresh',
1074 1074
 			));
1075
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1076
-				'label'    => __('Secondary Color', 'ayecode-connect' ),
1075
+			$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1076
+				'label'    => __('Secondary Color', 'ayecode-connect'),
1077 1077
 				'section'  => 'aui_settings',
1078 1078
 				'settings' => 'aui_options[color_secondary]',
1079 1079
 			)));
@@ -1099,12 +1099,12 @@  discard block
 block discarded – undo
1099 1099
                 .collapse.show:not(.in){display: inherit;}
1100 1100
                 .fade.show{opacity: 1;}
1101 1101
 
1102
-                <?php if( defined( 'SVQ_THEME_VERSION' ) ){ ?>
1102
+                <?php if (defined('SVQ_THEME_VERSION')) { ?>
1103 1103
                 /* KLEO theme specific */
1104 1104
                 .kleo-main-header .navbar-collapse.collapse.show:not(.in){display: block !important;}
1105 1105
                 <?php } ?>
1106 1106
 
1107
-                <?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
1107
+                <?php if (defined('FUSION_BUILDER_VERSION')) { ?>
1108 1108
                 /* With Avada builder */
1109 1109
                 body.modal-open .modal.in  {opacity:1;z-index: 99999}
1110 1110
                 body.modal-open .modal.bsui.in .modal-content  {box-shadow: none;}
@@ -1115,44 +1115,44 @@  discard block
 block discarded – undo
1115 1115
                 <?php } ?>
1116 1116
             </style>
1117 1117
 			<?php
1118
-			return str_replace( array(
1118
+			return str_replace(array(
1119 1119
 				'<style>',
1120 1120
 				'</style>'
1121
-			), '', self::minify_css( ob_get_clean() ) );
1121
+			), '', self::minify_css(ob_get_clean()));
1122 1122
 		}
1123 1123
 
1124
-		public static function custom_css( $compatibility = true, $is_fse = false ) {
1124
+		public static function custom_css($compatibility = true, $is_fse = false) {
1125 1125
 			global $aui_bs5;
1126 1126
 
1127 1127
 			$colors = array();
1128 1128
 
1129
-			if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1129
+			if (defined('BLOCKSTRAP_VERSION')) {
1130 1130
 				$setting = wp_get_global_settings();
1131 1131
 
1132
-				if ( ! empty( $setting['color']['palette']['theme'] ) ) {
1133
-					foreach ( $setting['color']['palette']['theme'] as $color ) {
1134
-						$colors[$color['slug']] = esc_attr( $color['color'] );
1132
+				if (!empty($setting['color']['palette']['theme'])) {
1133
+					foreach ($setting['color']['palette']['theme'] as $color) {
1134
+						$colors[$color['slug']] = esc_attr($color['color']);
1135 1135
 					}
1136 1136
 				}
1137 1137
 
1138
-				if ( ! empty( $setting['color']['palette']['custom'] ) ) {
1139
-					foreach ( $setting['color']['palette']['custom'] as $color ) {
1140
-						$colors[$color['slug']] = esc_attr( $color['color'] );
1138
+				if (!empty($setting['color']['palette']['custom'])) {
1139
+					foreach ($setting['color']['palette']['custom'] as $color) {
1140
+						$colors[$color['slug']] = esc_attr($color['color']);
1141 1141
 					}
1142 1142
 				}
1143 1143
 			} else {
1144
-				$settings = get_option( 'aui_options' );
1144
+				$settings = get_option('aui_options');
1145 1145
 
1146 1146
 				$colors = array(
1147
-					'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1148
-					'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1147
+					'primary'   => !empty($settings['color_primary']) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1148
+					'secondary' => !empty($settings['color_secondary']) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1149 1149
 				);
1150 1150
 			}
1151 1151
 
1152 1152
 			ob_start();
1153 1153
 			?><style><?php
1154 1154
 			// BS v3 compat
1155
-			if( self::is_bs3_compat() ){
1155
+			if (self::is_bs3_compat()) {
1156 1156
 				echo self::bs3_compat_css(); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1157 1157
 			}
1158 1158
 
@@ -1161,152 +1161,152 @@  discard block
 block discarded – undo
1161 1161
 				//$is_fse = true;
1162 1162
 			//}
1163 1163
 
1164
-			$custom_front = ! is_admin() ? true : apply_filters('ayecode_ui_custom_front', false );
1165
-			$custom_admin = $is_fse || self::is_preview() ? true : apply_filters('ayecode_ui_custom_admin', false );
1166
-            $bs_custom_css = apply_filters( 'ayecode_ui_bs_custom_css', $custom_admin || $custom_front );
1164
+			$custom_front = !is_admin() ? true : apply_filters('ayecode_ui_custom_front', false);
1165
+			$custom_admin = $is_fse || self::is_preview() ? true : apply_filters('ayecode_ui_custom_admin', false);
1166
+            $bs_custom_css = apply_filters('ayecode_ui_bs_custom_css', $custom_admin || $custom_front);
1167 1167
 			//$bs_custom_css = true; // Force true to fix any color issue.
1168 1168
 
1169 1169
 			$colors_css = '';
1170
-			if ( ! empty( $colors ) && $bs_custom_css ) {
1170
+			if (!empty($colors) && $bs_custom_css) {
1171 1171
 				$d_colors = self::get_colors(true);
1172 1172
 
1173
-				foreach ( $colors as $key => $color ) {
1174
-					if ( ( empty( $d_colors[$key]) || $d_colors[$key] != $color) || $is_fse ) {
1173
+				foreach ($colors as $key => $color) {
1174
+					if ((empty($d_colors[$key]) || $d_colors[$key] != $color) || $is_fse) {
1175 1175
 						$var = $is_fse ? "var(--wp--preset--color--$key)" : $color;
1176 1176
 						$compat = $is_fse ? '.editor-styles-wrapper' : $compatibility;
1177 1177
 
1178
-						$colors_css .= $aui_bs5 ? self::css_overwrite_bs5( $key,$var, $compat, $color ) : self::css_overwrite( $key, $var, $compat, $color );
1178
+						$colors_css .= $aui_bs5 ? self::css_overwrite_bs5($key, $var, $compat, $color) : self::css_overwrite($key, $var, $compat, $color);
1179 1179
 					}
1180 1180
 				}
1181 1181
 			}
1182 1182
 
1183
-			if ( $colors_css ) {
1183
+			if ($colors_css) {
1184 1184
 				echo $colors_css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1185 1185
 			}
1186 1186
 
1187 1187
 			// Set admin bar z-index lower when modal is open.
1188 1188
 			echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1189 1189
 
1190
-			if ( is_admin() ) {
1190
+			if (is_admin()) {
1191 1191
 				echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1192 1192
 			}
1193 1193
 
1194 1194
 			$custom_css = '';
1195 1195
 
1196
-			if ( $aui_bs5 && defined( 'BLOCKSTRAP_VERSION' ) && $bs_custom_css ) {
1196
+			if ($aui_bs5 && defined('BLOCKSTRAP_VERSION') && $bs_custom_css) {
1197 1197
 				$css = '';
1198 1198
 				$theme_settings = wp_get_global_styles();
1199 1199
 
1200 1200
 				// Font face
1201
-				if( !empty( $theme_settings['typography']['fontFamily'] ) ){
1202
-					$t_fontface = str_replace( array('var:preset|','font-family|'), array('--wp--preset--','font-family--'), $theme_settings['typography']['fontFamily']  ); //var(--wp--preset--font-family--poppins)
1201
+				if (!empty($theme_settings['typography']['fontFamily'])) {
1202
+					$t_fontface = str_replace(array('var:preset|', 'font-family|'), array('--wp--preset--', 'font-family--'), $theme_settings['typography']['fontFamily']); //var(--wp--preset--font-family--poppins)
1203 1203
 					$css .= '--bs-body-font-family: ' . esc_attr($t_fontface) . ';';
1204 1204
 				}
1205 1205
 
1206 1206
 				// font size
1207
-				if( !empty( $theme_settings['typography']['fontSize'] ) ){
1208
-					$css .= '--bs-body-font-size: ' . esc_attr( $theme_settings['typography']['fontSize'] ) . ' ;';
1207
+				if (!empty($theme_settings['typography']['fontSize'])) {
1208
+					$css .= '--bs-body-font-size: ' . esc_attr($theme_settings['typography']['fontSize']) . ' ;';
1209 1209
 				}
1210 1210
 
1211 1211
 				// line height
1212
-				 if( !empty( $theme_settings['typography']['lineHeight'] ) ){
1213
-					$css .= '--bs-body-line-height: ' . esc_attr( $theme_settings['typography']['lineHeight'] ) . ';';
1212
+				 if (!empty($theme_settings['typography']['lineHeight'])) {
1213
+					$css .= '--bs-body-line-height: ' . esc_attr($theme_settings['typography']['lineHeight']) . ';';
1214 1214
 				}
1215 1215
 
1216 1216
 
1217 1217
 				   // font weight
1218
-				 if( !empty( $theme_settings['typography']['fontWeight'] ) ){
1219
-					$css .= '--bs-body-font-weight: ' . esc_attr( $theme_settings['typography']['fontWeight'] ) . ';';
1218
+				 if (!empty($theme_settings['typography']['fontWeight'])) {
1219
+					$css .= '--bs-body-font-weight: ' . esc_attr($theme_settings['typography']['fontWeight']) . ';';
1220 1220
 				}
1221 1221
 
1222 1222
 				// Background
1223
-				 if( !empty( $theme_settings['color']['background'] ) ){
1224
-					$css .= '--bs-body-bg: ' . esc_attr( $theme_settings['color']['background'] ) . ';';
1223
+				 if (!empty($theme_settings['color']['background'])) {
1224
+					$css .= '--bs-body-bg: ' . esc_attr($theme_settings['color']['background']) . ';';
1225 1225
 				}
1226 1226
 
1227 1227
 				 // Background Gradient
1228
-				 if( !empty( $theme_settings['color']['gradient'] ) ){
1229
-					$css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';';
1228
+				 if (!empty($theme_settings['color']['gradient'])) {
1229
+					$css .= 'background: ' . esc_attr($theme_settings['color']['gradient']) . ';';
1230 1230
 				}
1231 1231
 
1232 1232
 				   // Background Gradient
1233
-				 if( !empty( $theme_settings['color']['gradient'] ) ){
1234
-					$css .= 'background: ' . esc_attr( $theme_settings['color']['gradient'] ) . ';';
1233
+				 if (!empty($theme_settings['color']['gradient'])) {
1234
+					$css .= 'background: ' . esc_attr($theme_settings['color']['gradient']) . ';';
1235 1235
 				}
1236 1236
 
1237 1237
 				// text color
1238
-				if( !empty( $theme_settings['color']['text'] ) ){
1239
-					$css .= '--bs-body-color: ' . esc_attr( $theme_settings['color']['text'] ) . ';';
1238
+				if (!empty($theme_settings['color']['text'])) {
1239
+					$css .= '--bs-body-color: ' . esc_attr($theme_settings['color']['text']) . ';';
1240 1240
 				}
1241 1241
 
1242 1242
 
1243 1243
 				// link colors
1244
-				if( !empty( $theme_settings['elements']['link']['color']['text'] ) ){
1245
-					$css .= '--bs-link-color: ' . esc_attr( $theme_settings['elements']['link']['color']['text'] ) . ';';
1244
+				if (!empty($theme_settings['elements']['link']['color']['text'])) {
1245
+					$css .= '--bs-link-color: ' . esc_attr($theme_settings['elements']['link']['color']['text']) . ';';
1246 1246
 				}
1247
-				if( !empty( $theme_settings['elements']['link'][':hover']['color']['text'] ) ){
1248
-					$css .= '--bs-link-hover-color: ' . esc_attr( $theme_settings['elements']['link'][':hover']['color']['text'] ) . ';';
1247
+				if (!empty($theme_settings['elements']['link'][':hover']['color']['text'])) {
1248
+					$css .= '--bs-link-hover-color: ' . esc_attr($theme_settings['elements']['link'][':hover']['color']['text']) . ';';
1249 1249
 				}
1250 1250
 
1251
-				if($css){
1252
-					$custom_css .= $is_fse ? 'body.editor-styles-wrapper{' . esc_attr( $css ) . '}' : 'body{' . esc_attr( $css ) . '}';
1251
+				if ($css) {
1252
+					$custom_css .= $is_fse ? 'body.editor-styles-wrapper{' . esc_attr($css) . '}' : 'body{' . esc_attr($css) . '}';
1253 1253
 				}
1254 1254
 
1255 1255
 				$bep = $is_fse ? 'body.editor-styles-wrapper ' : '';
1256 1256
 
1257 1257
 				// Headings
1258 1258
 				$headings_css = '';
1259
-				if( !empty( $theme_settings['elements']['heading']['color']['text'] ) ){
1260
-					$headings_css .= "color: " . esc_attr( $theme_settings['elements']['heading']['color']['text'] ) . ";";
1259
+				if (!empty($theme_settings['elements']['heading']['color']['text'])) {
1260
+					$headings_css .= "color: " . esc_attr($theme_settings['elements']['heading']['color']['text']) . ";";
1261 1261
 				}
1262 1262
 
1263 1263
 				// heading background
1264
-				if( !empty( $theme_settings['elements']['heading']['color']['background'] ) ){
1265
-					$headings_css .= 'background: ' . esc_attr( $theme_settings['elements']['heading']['color']['background'] ) . ';';
1264
+				if (!empty($theme_settings['elements']['heading']['color']['background'])) {
1265
+					$headings_css .= 'background: ' . esc_attr($theme_settings['elements']['heading']['color']['background']) . ';';
1266 1266
 				}
1267 1267
 
1268 1268
 				 // heading font family
1269
-				if( !empty( $theme_settings['elements']['heading']['typography']['fontFamily'] ) ){
1270
-					$headings_css .= 'font-family: ' . esc_attr( $theme_settings['elements']['heading']['typography']['fontFamily']  ) . ';';
1269
+				if (!empty($theme_settings['elements']['heading']['typography']['fontFamily'])) {
1270
+					$headings_css .= 'font-family: ' . esc_attr($theme_settings['elements']['heading']['typography']['fontFamily']) . ';';
1271 1271
 				}
1272 1272
 
1273
-				if( $headings_css ){
1274
-					$custom_css .= "$bep h1,$bep h2,$bep h3, $bep h4,$bep h5,$bep h6{ " . esc_attr( $headings_css ) . "}";
1273
+				if ($headings_css) {
1274
+					$custom_css .= "$bep h1,$bep h2,$bep h3, $bep h4,$bep h5,$bep h6{ " . esc_attr($headings_css) . "}";
1275 1275
 				}
1276 1276
 
1277
-				$hs = array('h1','h2','h3','h4','h5','h6');
1277
+				$hs = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6');
1278 1278
 
1279
-				foreach($hs as $hn){
1279
+				foreach ($hs as $hn) {
1280 1280
 					$h_css = '';
1281
-					 if( !empty( $theme_settings['elements'][$hn]['color']['text'] ) ){
1282
-						$h_css .= 'color: ' . esc_attr( $theme_settings['elements'][$hn]['color']['text'] ) . ';';
1281
+					 if (!empty($theme_settings['elements'][$hn]['color']['text'])) {
1282
+						$h_css .= 'color: ' . esc_attr($theme_settings['elements'][$hn]['color']['text']) . ';';
1283 1283
 					 }
1284 1284
 
1285
-					  if( !empty( $theme_settings['elements'][$hn]['typography']['fontSize'] ) ){
1286
-						$h_css .= 'font-size: ' . esc_attr( $theme_settings['elements'][$hn]['typography']['fontSize']  ) . ';';
1285
+					  if (!empty($theme_settings['elements'][$hn]['typography']['fontSize'])) {
1286
+						$h_css .= 'font-size: ' . esc_attr($theme_settings['elements'][$hn]['typography']['fontSize']) . ';';
1287 1287
 					 }
1288 1288
 
1289
-					  if( !empty( $theme_settings['elements'][$hn]['typography']['fontFamily'] ) ){
1290
-						$h_css .= 'font-family: ' . esc_attr( $theme_settings['elements'][$hn]['typography']['fontFamily']  ) . ';';
1289
+					  if (!empty($theme_settings['elements'][$hn]['typography']['fontFamily'])) {
1290
+						$h_css .= 'font-family: ' . esc_attr($theme_settings['elements'][$hn]['typography']['fontFamily']) . ';';
1291 1291
 					 }
1292 1292
 
1293
-					 if($h_css){
1294
-						$custom_css .= esc_attr( $bep  . $hn ) . '{'.esc_attr( $h_css ).'}';
1293
+					 if ($h_css) {
1294
+						$custom_css .= esc_attr($bep . $hn) . '{' . esc_attr($h_css) . '}';
1295 1295
 					 }
1296 1296
 				}
1297 1297
 			}
1298 1298
 			
1299
-			if ( $custom_css ) {
1299
+			if ($custom_css) {
1300 1300
 				echo $custom_css; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1301 1301
 			}
1302 1302
 
1303 1303
 			// Pagination on Hello Elementor theme.
1304
-			if ( function_exists( 'hello_elementor_setup' ) ) {
1304
+			if (function_exists('hello_elementor_setup')) {
1305 1305
 				echo '.aui-nav-links .pagination{justify-content:inherit}';
1306 1306
 			}
1307 1307
 
1308 1308
             // Astra theme - when woocommerce active they add compatibility CSS which breaks select2 in modals
1309
-            if( defined('ASTRA_THEME_VERSION')){
1309
+            if (defined('ASTRA_THEME_VERSION')) {
1310 1310
                 echo '.woocommerce-js.modal-open .select2-container .select2-dropdown, .woocommerce-js.modal-open .select2-container .select2-search__field, .woocommerce-page.modal-open .select2-container .select2-dropdown, .woocommerce-page.modal-open .select2-container .select2-search__field{z-index: 1056;}';
1311 1311
             }
1312 1312
 
@@ -1316,10 +1316,10 @@  discard block
 block discarded – undo
1316 1316
 			/*
1317 1317
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1318 1318
 			 */
1319
-			return str_replace( array(
1319
+			return str_replace(array(
1320 1320
 				'<style>',
1321 1321
 				'</style>'
1322
-			), '', self::minify_css( $custom_css ) );
1322
+			), '', self::minify_css($custom_css));
1323 1323
 		}
1324 1324
 
1325 1325
 		/**
@@ -1327,34 +1327,34 @@  discard block
 block discarded – undo
1327 1327
 		 *
1328 1328
 		 * @return bool
1329 1329
 		 */
1330
-		public static function is_bs3_compat(){
1330
+		public static function is_bs3_compat() {
1331 1331
 			return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1332 1332
 		}
1333 1333
 
1334
-		public static function hex_to_rgb( $hex ) {
1334
+		public static function hex_to_rgb($hex) {
1335 1335
 			// Remove '#' if present
1336
-			$hex = str_replace( '#', '', $hex );
1336
+			$hex = str_replace('#', '', $hex);
1337 1337
 
1338 1338
 			// Check if input is RGB
1339
-			if ( strpos( $hex, 'rgba(' ) === 0 || strpos( $hex, 'rgb(' ) === 0 ) {
1340
-				$_rgb = explode( ',', str_replace( array( 'rgba(', 'rgb(', ')' ), '', $hex ) );
1339
+			if (strpos($hex, 'rgba(') === 0 || strpos($hex, 'rgb(') === 0) {
1340
+				$_rgb = explode(',', str_replace(array('rgba(', 'rgb(', ')'), '', $hex));
1341 1341
 
1342
-				$rgb = ( isset( $_rgb[0] ) ? (int) trim( $_rgb[0] ) : '0' ) . ',';
1343
-				$rgb .= ( isset( $_rgb[1] ) ? (int) trim( $_rgb[1] ) : '0' ) . ',';
1344
-				$rgb .= ( isset( $_rgb[2] ) ? (int) trim( $_rgb[2] ) : '0' );
1342
+				$rgb = (isset($_rgb[0]) ? (int) trim($_rgb[0]) : '0') . ',';
1343
+				$rgb .= (isset($_rgb[1]) ? (int) trim($_rgb[1]) : '0') . ',';
1344
+				$rgb .= (isset($_rgb[2]) ? (int) trim($_rgb[2]) : '0');
1345 1345
 
1346 1346
 				return $rgb;
1347 1347
 			}
1348 1348
 
1349 1349
 			// Convert 3-digit hex to 6-digit hex
1350
-			if ( strlen( $hex ) == 3 ) {
1351
-				$hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 );
1350
+			if (strlen($hex) == 3) {
1351
+				$hex = str_repeat(substr($hex, 0, 1), 2) . str_repeat(substr($hex, 1, 1), 2) . str_repeat(substr($hex, 2, 1), 2);
1352 1352
 			}
1353 1353
 
1354 1354
 			// Convert hex to RGB
1355
-			$r = hexdec( substr( $hex, 0, 2 ) );
1356
-			$g = hexdec( substr( $hex, 2, 2 ) );
1357
-			$b = hexdec( substr( $hex, 4, 2 ) );
1355
+			$r = hexdec(substr($hex, 0, 2));
1356
+			$g = hexdec(substr($hex, 2, 2));
1357
+			$b = hexdec(substr($hex, 4, 2));
1358 1358
 
1359 1359
 			// Return RGB values as an array
1360 1360
 			return $r . ',' . $g . ',' . $b;
@@ -1369,13 +1369,13 @@  discard block
 block discarded – undo
1369 1369
 		 *
1370 1370
 		 * @return string
1371 1371
 		 */
1372
-		public static function css_overwrite_bs5($type,$color_code,$compatibility, $hex = '' ){
1372
+		public static function css_overwrite_bs5($type, $color_code, $compatibility, $hex = '') {
1373 1373
 			global $aui_bs5;
1374 1374
 
1375 1375
 			$is_var = false;
1376 1376
 			$is_custom = strpos($type, 'custom-') !== false ? true : false;
1377
-			if(!$color_code){return '';}
1378
-			if(strpos($color_code, 'var') !== false){
1377
+			if (!$color_code) {return ''; }
1378
+			if (strpos($color_code, 'var') !== false) {
1379 1379
 				//if(!sanitize_hex_color($color_code)){
1380 1380
 				$color_code = esc_attr($color_code);
1381 1381
 				$is_var = true;
@@ -1385,15 +1385,15 @@  discard block
 block discarded – undo
1385 1385
 
1386 1386
 //            echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit;
1387 1387
 
1388
-			if(!$color_code){return '';}
1388
+			if (!$color_code) {return ''; }
1389 1389
 
1390 1390
 			$rgb = self::hex_to_rgb($hex);
1391 1391
 
1392
-			if($compatibility===true || $compatibility===1){
1392
+			if ($compatibility === true || $compatibility === 1) {
1393 1393
 				$compatibility = '.bsui';
1394
-			}elseif(!$compatibility){
1394
+			}elseif (!$compatibility) {
1395 1395
 				$compatibility = '';
1396
-			}else{
1396
+			} else {
1397 1397
 				$compatibility = esc_attr($compatibility);
1398 1398
 			}
1399 1399
 
@@ -1410,30 +1410,30 @@  discard block
 block discarded – undo
1410 1410
 			 * c = color, b = background color, o = border-color, f = fill
1411 1411
 			 */
1412 1412
 			$selectors = array(
1413
-				".btn-{$type}"                                              => array( 'b', 'o' ),
1414
-				".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
1415
-				".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
1416
-				".btn-outline-{$type}"                                      => array( 'c', 'o' ),
1417
-				".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
1418
-				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
1419
-				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
1420
-				".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
1421
-				".badge-{$type}"                                            => array( 'b' ),
1422
-				".alert-{$type}"                                            => array( 'b', 'o' ),
1423
-				".bg-{$type}"                                               => array( 'b', 'f' ),
1424
-				".btn-link.btn-{$type}"                                     => array( 'c' ),
1425
-				".text-{$type}"                                     => array( 'c' ),
1413
+				".btn-{$type}"                                              => array('b', 'o'),
1414
+				".btn-{$type}.disabled"                                     => array('b', 'o'),
1415
+				".btn-{$type}:disabled"                                     => array('b', 'o'),
1416
+				".btn-outline-{$type}"                                      => array('c', 'o'),
1417
+				".btn-outline-{$type}:hover"                                => array('b', 'o'),
1418
+				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array('b', 'o'),
1419
+				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array('b', 'o'),
1420
+				".show>.btn-outline-{$type}.dropdown-toggle"                => array('b', 'o'),
1421
+				".badge-{$type}"                                            => array('b'),
1422
+				".alert-{$type}"                                            => array('b', 'o'),
1423
+				".bg-{$type}"                                               => array('b', 'f'),
1424
+				".btn-link.btn-{$type}"                                     => array('c'),
1425
+				".text-{$type}"                                     => array('c'),
1426 1426
 			);
1427 1427
 
1428
-			if ( $aui_bs5 ) {
1429
-				unset($selectors[".alert-{$type}" ]);
1428
+			if ($aui_bs5) {
1429
+				unset($selectors[".alert-{$type}"]);
1430 1430
 			}
1431 1431
 
1432
-			if ( $type == 'primary' ) {
1432
+			if ($type == 'primary') {
1433 1433
 				$selectors = $selectors + array(
1434
-						'a'                                                                                                    => array( 'c' ),
1435
-						'.btn-link'                                                                                            => array( 'c' ),
1436
-						'.dropdown-item.active'                                                                                => array( 'b' ),
1434
+						'a'                                                                                                    => array('c'),
1435
+						'.btn-link'                                                                                            => array('c'),
1436
+						'.dropdown-item.active'                                                                                => array('b'),
1437 1437
 						'.custom-control-input:checked~.custom-control-label::before'                                          => array(
1438 1438
 							'b',
1439 1439
 							'o'
@@ -1442,57 +1442,57 @@  discard block
 block discarded – undo
1442 1442
 							'b',
1443 1443
 							'o'
1444 1444
 						),
1445
-						'.nav-pills .nav-link.active'                                                                          => array( 'b' ),
1446
-						'.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
1447
-						'.page-link'                                                                                           => array( 'c' ),
1445
+						'.nav-pills .nav-link.active'                                                                          => array('b'),
1446
+						'.nav-pills .show>.nav-link'                                                                           => array('b'),
1447
+						'.page-link'                                                                                           => array('c'),
1448 1448
 						'.page-item.active .page-link'                                                                         => array(
1449 1449
 							'b',
1450 1450
 							'o'
1451 1451
 						),
1452
-						'.progress-bar'                                                                                        => array( 'b' ),
1452
+						'.progress-bar'                                                                                        => array('b'),
1453 1453
 						'.list-group-item.active'                                                                              => array(
1454 1454
 							'b',
1455 1455
 							'o'
1456 1456
 						),
1457
-						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
1457
+						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1458 1458
 					);
1459 1459
 			}
1460 1460
 
1461 1461
 
1462 1462
 
1463 1463
             // link
1464
-			if ( $type === 'primary' ) {
1465
-				$output .= 'html body {--bs-link-hover-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .75); --bs-link-color: var(--bs-'.esc_attr($type).'); }';
1466
-				$output .= $prefix . ' .breadcrumb{--bs-breadcrumb-item-active-color: '.esc_attr($color_code).';  }';
1467
-				$output .= $prefix . ' .navbar { --bs-nav-link-hover-color: '.esc_attr($color_code).'; --bs-navbar-hover-color: '.esc_attr($color_code).'; --bs-navbar-active-color: '.esc_attr($color_code).'; }';
1464
+			if ($type === 'primary') {
1465
+				$output .= 'html body {--bs-link-hover-color: rgba(var(--bs-' . esc_attr($type) . '-rgb), .75); --bs-link-color: var(--bs-' . esc_attr($type) . '); }';
1466
+				$output .= $prefix . ' .breadcrumb{--bs-breadcrumb-item-active-color: ' . esc_attr($color_code) . ';  }';
1467
+				$output .= $prefix . ' .navbar { --bs-nav-link-hover-color: ' . esc_attr($color_code) . '; --bs-navbar-hover-color: ' . esc_attr($color_code) . '; --bs-navbar-active-color: ' . esc_attr($color_code) . '; }';
1468 1468
 
1469
-				$output .= $prefix . ' a{color: var(--bs-'.esc_attr($type).');}';
1470
-				$output .= $prefix . ' .text-primary{color: var(--bs-'.esc_attr($type).') !important;}';
1469
+				$output .= $prefix . ' a{color: var(--bs-' . esc_attr($type) . ');}';
1470
+				$output .= $prefix . ' .text-primary{color: var(--bs-' . esc_attr($type) . ') !important;}';
1471 1471
 
1472 1472
                 // dropdown
1473
-				$output .= $prefix . ' .dropdown-menu{--bs-dropdown-link-hover-color: var(--bs-'.esc_attr($type).'); --bs-dropdown-link-active-color: var(--bs-'.esc_attr($type).');}';
1473
+				$output .= $prefix . ' .dropdown-menu{--bs-dropdown-link-hover-color: var(--bs-' . esc_attr($type) . '); --bs-dropdown-link-active-color: var(--bs-' . esc_attr($type) . ');}';
1474 1474
 
1475 1475
                 // pagination
1476
-				$output .= $prefix . ' .pagination{--bs-pagination-hover-color: var(--bs-'.esc_attr($type).'); --bs-pagination-active-bg: var(--bs-'.esc_attr($type).');}';
1476
+				$output .= $prefix . ' .pagination{--bs-pagination-hover-color: var(--bs-' . esc_attr($type) . '); --bs-pagination-active-bg: var(--bs-' . esc_attr($type) . ');}';
1477 1477
 
1478 1478
 			}
1479 1479
 
1480
-			$output .= $prefix . ' .link-'.esc_attr($type).' {color: var(--bs-'.esc_attr($type).'-rgb) !important;}';
1481
-			$output .= $prefix . ' .link-'.esc_attr($type).':hover {color: rgba(var(--bs-'.esc_attr($type).'-rgb), .8) !important;}';
1480
+			$output .= $prefix . ' .link-' . esc_attr($type) . ' {color: var(--bs-' . esc_attr($type) . '-rgb) !important;}';
1481
+			$output .= $prefix . ' .link-' . esc_attr($type) . ':hover {color: rgba(var(--bs-' . esc_attr($type) . '-rgb), .8) !important;}';
1482 1482
 
1483 1483
 			//  buttons
1484
-			$output .= $prefix . ' .btn-'.esc_attr($type).'{';
1484
+			$output .= $prefix . ' .btn-' . esc_attr($type) . '{';
1485 1485
 			$output .= ' 
1486
-            --bs-btn-bg: '.esc_attr($color_code).';
1487
-            --bs-btn-border-color: '.esc_attr($color_code).';
1488
-            --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1489
-            --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1490
-            --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type).'-rgb;
1491
-            --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1492
-            --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1486
+            --bs-btn-bg: '.esc_attr($color_code) . ';
1487
+            --bs-btn-border-color: '.esc_attr($color_code) . ';
1488
+            --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9);
1489
+            --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9);
1490
+            --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type) . '-rgb;
1491
+            --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9);
1492
+            --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9);
1493 1493
             --bs-btn-active-shadow: unset;
1494
-            --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .5);
1495
-            --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .1);
1494
+            --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .5);
1495
+            --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .1);
1496 1496
             ';
1497 1497
 //			$output .= '
1498 1498
 //		    --bs-btn-color: #fff;
@@ -1503,18 +1503,18 @@  discard block
 block discarded – undo
1503 1503
 			$output .= '}';
1504 1504
 
1505 1505
 			//  buttons outline
1506
-			$output .= $prefix . ' .btn-outline-'.esc_attr($type).'{';
1506
+			$output .= $prefix . ' .btn-outline-' . esc_attr($type) . '{';
1507 1507
 			$output .= ' 
1508
-			--bs-btn-color: '.esc_attr($color_code).';
1509
-            --bs-btn-border-color: '.esc_attr($color_code).';
1510
-            --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1511
-            --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1512
-            --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type).'-rgb;
1513
-            --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1514
-            --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1508
+			--bs-btn-color: '.esc_attr($color_code) . ';
1509
+            --bs-btn-border-color: '.esc_attr($color_code) . ';
1510
+            --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9);
1511
+            --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9);
1512
+            --bs-btn-focus-shadow-rgb: --bs-'.esc_attr($type) . '-rgb;
1513
+            --bs-btn-active-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9);
1514
+            --bs-btn-active-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .9);
1515 1515
             --bs-btn-active-shadow: unset;
1516
-            --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .5);
1517
-            --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .1);
1516
+            --bs-btn-disabled-bg: rgba(var(--bs-'.esc_attr($type) . '-rgb), .5);
1517
+            --bs-btn-disabled-border-color: rgba(var(--bs-'.esc_attr($type) . '-rgb), .1);
1518 1518
             ';
1519 1519
 //			$output .= '
1520 1520
 //		    --bs-btn-color: #fff;
@@ -1526,32 +1526,32 @@  discard block
 block discarded – undo
1526 1526
 
1527 1527
 
1528 1528
             // button hover
1529
-			$output .= $prefix . ' .btn-'.esc_attr($type).':hover{';
1529
+			$output .= $prefix . ' .btn-' . esc_attr($type) . ':hover{';
1530 1530
 			$output .= ' 
1531
-            box-shadow: 0 0.25rem 0.25rem 0.125rem rgb(var(--bs-'.esc_attr($type).'-rgb), .1), 0 0.375rem 0.75rem -0.125rem rgb(var(--bs-'.esc_attr($type).'-rgb) , .4);
1531
+            box-shadow: 0 0.25rem 0.25rem 0.125rem rgb(var(--bs-'.esc_attr($type) . '-rgb), .1), 0 0.375rem 0.75rem -0.125rem rgb(var(--bs-' . esc_attr($type) . '-rgb) , .4);
1532 1532
             }
1533 1533
             ';
1534 1534
 
1535 1535
 
1536
-			if ( $aui_bs5 ) {
1536
+			if ($aui_bs5) {
1537 1537
 //				$output .= $is_var ? 'html body {--bs-'.esc_attr($type).'-rgb: '.$color_code.'; }' : 'html body {--bs-'.esc_attr($type).'-rgb: '.self::hex_to_rgb($color_code).'; }';
1538
-				$output .= 'html body {--bs-'.esc_attr($type).': '.esc_attr($color_code).'; }';
1539
-				$output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }';
1538
+				$output .= 'html body {--bs-' . esc_attr($type) . ': ' . esc_attr($color_code) . '; }';
1539
+				$output .= 'html body {--bs-' . esc_attr($type) . '-rgb: ' . $rgb . '; }';
1540 1540
 			}
1541 1541
 
1542 1542
 
1543
-			if ( $is_custom ) {
1543
+			if ($is_custom) {
1544 1544
 
1545 1545
 //				echo '###'.$type;exit;
1546 1546
 
1547 1547
 				// build rules into each type
1548
-				foreach($selectors as $selector => $types){
1549
-					$selector = $compatibility ? $compatibility . " ".$selector : $selector;
1550
-					$types = array_combine($types,$types);
1551
-					if(isset($types['c'])){$color[] = $selector;}
1552
-					if(isset($types['b'])){$background[] = $selector;}
1553
-					if(isset($types['o'])){$border[] = $selector;}
1554
-					if(isset($types['f'])){$fill[] = $selector;}
1548
+				foreach ($selectors as $selector => $types) {
1549
+					$selector = $compatibility ? $compatibility . " " . $selector : $selector;
1550
+					$types = array_combine($types, $types);
1551
+					if (isset($types['c'])) {$color[] = $selector; }
1552
+					if (isset($types['b'])) {$background[] = $selector; }
1553
+					if (isset($types['o'])) {$border[] = $selector; }
1554
+					if (isset($types['f'])) {$fill[] = $selector; }
1555 1555
 				}
1556 1556
 
1557 1557
 //				// build rules into each type
@@ -1565,36 +1565,36 @@  discard block
 block discarded – undo
1565 1565
 //				}
1566 1566
 
1567 1567
 				// add any color rules
1568
-				if(!empty($color)){
1569
-					$output .= implode(",",$color) . "{color: $color_code;} ";
1568
+				if (!empty($color)) {
1569
+					$output .= implode(",", $color) . "{color: $color_code;} ";
1570 1570
 				}
1571
-				if(!empty($color_i)){
1572
-					$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1571
+				if (!empty($color_i)) {
1572
+					$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
1573 1573
 				}
1574 1574
 
1575 1575
 				// add any background color rules
1576
-				if(!empty($background)){
1577
-					$output .= implode(",",$background) . "{background-color: $color_code;} ";
1576
+				if (!empty($background)) {
1577
+					$output .= implode(",", $background) . "{background-color: $color_code;} ";
1578 1578
 				}
1579
-				if(!empty($background_i)){
1580
-					$output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} ";
1579
+				if (!empty($background_i)) {
1580
+					$output .= $aui_bs5 ? '' : implode(",", $background_i) . "{background-color: $color_code !important;} ";
1581 1581
 //				$output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} ";
1582 1582
 				}
1583 1583
 
1584 1584
 				// add any border color rules
1585
-				if(!empty($border)){
1586
-					$output .= implode(",",$border) . "{border-color: $color_code;} ";
1585
+				if (!empty($border)) {
1586
+					$output .= implode(",", $border) . "{border-color: $color_code;} ";
1587 1587
 				}
1588
-				if(!empty($border_i)){
1589
-					$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1588
+				if (!empty($border_i)) {
1589
+					$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
1590 1590
 				}
1591 1591
 
1592 1592
 				// add any fill color rules
1593
-				if(!empty($fill)){
1594
-					$output .= implode(",",$fill) . "{fill: $color_code;} ";
1593
+				if (!empty($fill)) {
1594
+					$output .= implode(",", $fill) . "{fill: $color_code;} ";
1595 1595
 				}
1596
-				if(!empty($fill_i)){
1597
-					$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1596
+				if (!empty($fill_i)) {
1597
+					$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
1598 1598
 				}
1599 1599
 
1600 1600
 			}
@@ -1604,26 +1604,26 @@  discard block
 block discarded – undo
1604 1604
 
1605 1605
 			$transition = $is_var ? 'transition: color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out,filter 0.15s ease-in-out;' : '';
1606 1606
 			// darken
1607
-			$darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
1608
-			$darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
1609
-			$darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
1610
-			$darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4");
1607
+			$darker_075 = $is_var ? $color_code . ';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code, "-0.075");
1608
+			$darker_10 = $is_var ? $color_code . ';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code, "-0.10");
1609
+			$darker_125 = $is_var ? $color_code . ';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code, "-0.125");
1610
+			$darker_40 = $is_var ? $color_code . ';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code, "-0.4");
1611 1611
 
1612 1612
 			// lighten
1613
-			$lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
1613
+			$lighten_25 = $is_var ? $color_code . ';filter:brightness(1.25)' : self::css_hex_lighten_darken($color_code, "0.25");
1614 1614
 
1615 1615
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
1616
-			$op_25 = $color_code."40"; // 25% opacity
1616
+			$op_25 = $color_code . "40"; // 25% opacity
1617 1617
 
1618 1618
 
1619 1619
 			// button states
1620
-			$output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
1621
-			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1620
+			$output .= $is_var ? $prefix . " .btn-{$type}{{$transition }} " : '';
1621
+			$output .= $prefix . " .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
1622 1622
 //			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000;    border-color: #000;} ";
1623
-			$output .= $prefix ." .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1624
-			$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1625
-            $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1626
-            $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled):focus {box-shadow: 0 0.25rem 0.25rem 0.125rem rgba(var(--bs-{$type}-rgb), 0.1), 0 0.375rem 0.75rem -0.125rem rgba(var(--bs-{$type}-rgb), 0.4);} ";
1623
+			$output .= $prefix . " .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1624
+			$output .= $prefix . " .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: " . $darker_10 . ";    border-color: " . $darker_125 . ";} ";
1625
+            $output .= $prefix . " .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1626
+            $output .= $prefix . " .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled):focus {box-shadow: 0 0.25rem 0.25rem 0.125rem rgba(var(--bs-{$type}-rgb), 0.1), 0 0.375rem 0.75rem -0.125rem rgba(var(--bs-{$type}-rgb), 0.4);} ";
1627 1627
 
1628 1628
 			// text
1629 1629
 //			$output .= $prefix .".xxx, .text-{$type} {color: var(--bs-".esc_attr($type).");} ";
@@ -1641,9 +1641,9 @@  discard block
 block discarded – undo
1641 1641
 //			}
1642 1642
 
1643 1643
 			// alerts
1644
-			if ( $aui_bs5 ) {
1644
+			if ($aui_bs5) {
1645 1645
 //				$output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20;    border-color: ".$color_code."30;color:$darker_40} ";
1646
-				$output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1646
+				$output .= $prefix . " .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1647 1647
 			}
1648 1648
 
1649 1649
 			return $output;
@@ -1658,12 +1658,12 @@  discard block
 block discarded – undo
1658 1658
 		 *
1659 1659
 		 * @return string
1660 1660
 		 */
1661
-		public static function css_overwrite($type,$color_code,$compatibility, $hex = '' ){
1661
+		public static function css_overwrite($type, $color_code, $compatibility, $hex = '') {
1662 1662
             global $aui_bs5;
1663 1663
 
1664 1664
 			$is_var = false;
1665
-			if(!$color_code){return '';}
1666
-			if(strpos($color_code, 'var') !== false){
1665
+			if (!$color_code) {return ''; }
1666
+			if (strpos($color_code, 'var') !== false) {
1667 1667
 				//if(!sanitize_hex_color($color_code)){
1668 1668
 				$color_code = esc_attr($color_code);
1669 1669
 				$is_var = true;
@@ -1673,15 +1673,15 @@  discard block
 block discarded – undo
1673 1673
 
1674 1674
 //            echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit;
1675 1675
 
1676
-			if(!$color_code){return '';}
1676
+			if (!$color_code) {return ''; }
1677 1677
 
1678 1678
             $rgb = self::hex_to_rgb($hex);
1679 1679
 
1680
-			if($compatibility===true || $compatibility===1){
1680
+			if ($compatibility === true || $compatibility === 1) {
1681 1681
 				$compatibility = '.bsui';
1682
-			}elseif(!$compatibility){
1682
+			}elseif (!$compatibility) {
1683 1683
 				$compatibility = '';
1684
-			}else{
1684
+			} else {
1685 1685
 				$compatibility = esc_attr($compatibility);
1686 1686
 			}
1687 1687
 
@@ -1695,29 +1695,29 @@  discard block
 block discarded – undo
1695 1695
 			 * c = color, b = background color, o = border-color, f = fill
1696 1696
 			 */
1697 1697
 			$selectors = array(
1698
-				".btn-{$type}"                                              => array( 'b', 'o' ),
1699
-				".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
1700
-				".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
1701
-				".btn-outline-{$type}"                                      => array( 'c', 'o' ),
1702
-				".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
1703
-				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
1704
-				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
1705
-				".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
1706
-				".badge-{$type}"                                            => array( 'b' ),
1707
-				".alert-{$type}"                                            => array( 'b', 'o' ),
1708
-				".bg-{$type}"                                               => array( 'b', 'f' ),
1709
-				".btn-link.btn-{$type}"                                     => array( 'c' ),
1698
+				".btn-{$type}"                                              => array('b', 'o'),
1699
+				".btn-{$type}.disabled"                                     => array('b', 'o'),
1700
+				".btn-{$type}:disabled"                                     => array('b', 'o'),
1701
+				".btn-outline-{$type}"                                      => array('c', 'o'),
1702
+				".btn-outline-{$type}:hover"                                => array('b', 'o'),
1703
+				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array('b', 'o'),
1704
+				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array('b', 'o'),
1705
+				".show>.btn-outline-{$type}.dropdown-toggle"                => array('b', 'o'),
1706
+				".badge-{$type}"                                            => array('b'),
1707
+				".alert-{$type}"                                            => array('b', 'o'),
1708
+				".bg-{$type}"                                               => array('b', 'f'),
1709
+				".btn-link.btn-{$type}"                                     => array('c'),
1710 1710
 			);
1711 1711
 
1712
-			if ( $aui_bs5 ) {
1713
-                unset($selectors[".alert-{$type}" ]);
1712
+			if ($aui_bs5) {
1713
+                unset($selectors[".alert-{$type}"]);
1714 1714
 			}
1715 1715
 
1716
-			if ( $type == 'primary' ) {
1716
+			if ($type == 'primary') {
1717 1717
 				$selectors = $selectors + array(
1718
-						'a'                                                                                                    => array( 'c' ),
1719
-						'.btn-link'                                                                                            => array( 'c' ),
1720
-						'.dropdown-item.active'                                                                                => array( 'b' ),
1718
+						'a'                                                                                                    => array('c'),
1719
+						'.btn-link'                                                                                            => array('c'),
1720
+						'.dropdown-item.active'                                                                                => array('b'),
1721 1721
 						'.custom-control-input:checked~.custom-control-label::before'                                          => array(
1722 1722
 							'b',
1723 1723
 							'o'
@@ -1726,19 +1726,19 @@  discard block
 block discarded – undo
1726 1726
 							'b',
1727 1727
 							'o'
1728 1728
 						),
1729
-						'.nav-pills .nav-link.active'                                                                          => array( 'b' ),
1730
-						'.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
1731
-						'.page-link'                                                                                           => array( 'c' ),
1729
+						'.nav-pills .nav-link.active'                                                                          => array('b'),
1730
+						'.nav-pills .show>.nav-link'                                                                           => array('b'),
1731
+						'.page-link'                                                                                           => array('c'),
1732 1732
 						'.page-item.active .page-link'                                                                         => array(
1733 1733
 							'b',
1734 1734
 							'o'
1735 1735
 						),
1736
-						'.progress-bar'                                                                                        => array( 'b' ),
1736
+						'.progress-bar'                                                                                        => array('b'),
1737 1737
 						'.list-group-item.active'                                                                              => array(
1738 1738
 							'b',
1739 1739
 							'o'
1740 1740
 						),
1741
-						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
1741
+						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1742 1742
 //				    '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1743 1743
 //				    '.custom-range::-moz-range-thumb' => array('b'),
1744 1744
 //				    '.custom-range::-ms-thumb' => array('b'),
@@ -1746,7 +1746,7 @@  discard block
 block discarded – undo
1746 1746
 			}
1747 1747
 
1748 1748
 			$important_selectors = array(
1749
-				".bg-{$type}" => array('b','f'),
1749
+				".bg-{$type}" => array('b', 'f'),
1750 1750
 				".border-{$type}" => array('o'),
1751 1751
 				".text-{$type}" => array('c'),
1752 1752
 			);
@@ -1762,62 +1762,62 @@  discard block
 block discarded – undo
1762 1762
 
1763 1763
 			$output = '';
1764 1764
 
1765
-			if ( $aui_bs5 ) {
1765
+			if ($aui_bs5) {
1766 1766
 //				$output .= $is_var ? 'html body {--bs-'.esc_attr($type).'-rgb: '.$color_code.'; }' : 'html body {--bs-'.esc_attr($type).'-rgb: '.self::hex_to_rgb($color_code).'; }';
1767
-				$output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }';
1767
+				$output .= 'html body {--bs-' . esc_attr($type) . '-rgb: ' . $rgb . '; }';
1768 1768
 			}
1769 1769
 
1770 1770
 			// build rules into each type
1771
-			foreach($selectors as $selector => $types){
1772
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
1773
-				$types = array_combine($types,$types);
1774
-				if(isset($types['c'])){$color[] = $selector;}
1775
-				if(isset($types['b'])){$background[] = $selector;}
1776
-				if(isset($types['o'])){$border[] = $selector;}
1777
-				if(isset($types['f'])){$fill[] = $selector;}
1771
+			foreach ($selectors as $selector => $types) {
1772
+				$selector = $compatibility ? $compatibility . " " . $selector : $selector;
1773
+				$types = array_combine($types, $types);
1774
+				if (isset($types['c'])) {$color[] = $selector; }
1775
+				if (isset($types['b'])) {$background[] = $selector; }
1776
+				if (isset($types['o'])) {$border[] = $selector; }
1777
+				if (isset($types['f'])) {$fill[] = $selector; }
1778 1778
 			}
1779 1779
 
1780 1780
 			// build rules into each type
1781
-			foreach($important_selectors as $selector => $types){
1782
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
1783
-				$types = array_combine($types,$types);
1784
-				if(isset($types['c'])){$color_i[] = $selector;}
1785
-				if(isset($types['b'])){$background_i[] = $selector;}
1786
-				if(isset($types['o'])){$border_i[] = $selector;}
1787
-				if(isset($types['f'])){$fill_i[] = $selector;}
1781
+			foreach ($important_selectors as $selector => $types) {
1782
+				$selector = $compatibility ? $compatibility . " " . $selector : $selector;
1783
+				$types = array_combine($types, $types);
1784
+				if (isset($types['c'])) {$color_i[] = $selector; }
1785
+				if (isset($types['b'])) {$background_i[] = $selector; }
1786
+				if (isset($types['o'])) {$border_i[] = $selector; }
1787
+				if (isset($types['f'])) {$fill_i[] = $selector; }
1788 1788
 			}
1789 1789
 
1790 1790
 			// add any color rules
1791
-			if(!empty($color)){
1792
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1791
+			if (!empty($color)) {
1792
+				$output .= implode(",", $color) . "{color: $color_code;} ";
1793 1793
 			}
1794
-			if(!empty($color_i)){
1795
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1794
+			if (!empty($color_i)) {
1795
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
1796 1796
 			}
1797 1797
 
1798 1798
 			// add any background color rules
1799
-			if(!empty($background)){
1800
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1799
+			if (!empty($background)) {
1800
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
1801 1801
 			}
1802
-			if(!empty($background_i)){
1803
-				$output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} ";
1802
+			if (!empty($background_i)) {
1803
+				$output .= $aui_bs5 ? '' : implode(",", $background_i) . "{background-color: $color_code !important;} ";
1804 1804
 //				$output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} ";
1805 1805
 			}
1806 1806
 
1807 1807
 			// add any border color rules
1808
-			if(!empty($border)){
1809
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1808
+			if (!empty($border)) {
1809
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
1810 1810
 			}
1811
-			if(!empty($border_i)){
1812
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1811
+			if (!empty($border_i)) {
1812
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
1813 1813
 			}
1814 1814
 
1815 1815
 			// add any fill color rules
1816
-			if(!empty($fill)){
1817
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1816
+			if (!empty($fill)) {
1817
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
1818 1818
 			}
1819
-			if(!empty($fill_i)){
1820
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1819
+			if (!empty($fill_i)) {
1820
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
1821 1821
 			}
1822 1822
 
1823 1823
 
@@ -1825,27 +1825,27 @@  discard block
 block discarded – undo
1825 1825
 
1826 1826
 			$transition = $is_var ? 'transition: color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out,filter 0.15s ease-in-out;' : '';
1827 1827
 			// darken
1828
-			$darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
1829
-			$darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
1830
-			$darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
1831
-			$darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4");
1828
+			$darker_075 = $is_var ? $color_code . ';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code, "-0.075");
1829
+			$darker_10 = $is_var ? $color_code . ';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code, "-0.10");
1830
+			$darker_125 = $is_var ? $color_code . ';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code, "-0.125");
1831
+			$darker_40 = $is_var ? $color_code . ';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code, "-0.4");
1832 1832
 
1833 1833
 			// lighten
1834
-			$lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
1834
+			$lighten_25 = $is_var ? $color_code . ';filter:brightness(1.25)' : self::css_hex_lighten_darken($color_code, "0.25");
1835 1835
 
1836 1836
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
1837
-			$op_25 = $color_code."40"; // 25% opacity
1837
+			$op_25 = $color_code . "40"; // 25% opacity
1838 1838
 
1839 1839
 
1840 1840
 			// button states
1841
-			$output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
1842
-			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1841
+			$output .= $is_var ? $prefix . " .btn-{$type}{{$transition }} " : '';
1842
+			$output .= $prefix . " .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
1843 1843
 //			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000;    border-color: #000;} ";
1844
-			$output .= $prefix ." .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1845
-			$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1846
-			$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1844
+			$output .= $prefix . " .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1845
+			$output .= $prefix . " .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: " . $darker_10 . ";    border-color: " . $darker_125 . ";} ";
1846
+			$output .= $prefix . " .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1847 1847
 
1848
-			if ( $type == 'primary' ) {
1848
+			if ($type == 'primary') {
1849 1849
 				// dropdown's
1850 1850
 				$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1851 1851
 
@@ -1857,9 +1857,9 @@  discard block
 block discarded – undo
1857 1857
 			}
1858 1858
 
1859 1859
             // alerts
1860
-			if ( $aui_bs5 ) {
1860
+			if ($aui_bs5) {
1861 1861
 //				$output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20;    border-color: ".$color_code."30;color:$darker_40} ";
1862
-				$output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1862
+				$output .= $prefix . " .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1863 1863
 			}
1864 1864
 
1865 1865
 			return $output;
@@ -1875,11 +1875,11 @@  discard block
 block discarded – undo
1875 1875
 		 *
1876 1876
 		 * @return string
1877 1877
 		 */
1878
-		public static function css_primary($color_code,$compatibility, $use_variable = false){
1878
+		public static function css_primary($color_code, $compatibility, $use_variable = false) {
1879 1879
 
1880
-			if(!$use_variable){
1880
+			if (!$use_variable) {
1881 1881
 				$color_code = sanitize_hex_color($color_code);
1882
-				if(!$color_code){return '';}
1882
+				if (!$color_code) {return ''; }
1883 1883
 			}
1884 1884
 
1885 1885
 			/**
@@ -1887,36 +1887,36 @@  discard block
 block discarded – undo
1887 1887
 			 */
1888 1888
 			$selectors = array(
1889 1889
 				'a' => array('c'),
1890
-				'.btn-primary' => array('b','o'),
1891
-				'.btn-primary.disabled' => array('b','o'),
1892
-				'.btn-primary:disabled' => array('b','o'),
1893
-				'.btn-outline-primary' => array('c','o'),
1894
-				'.btn-outline-primary:hover' => array('b','o'),
1895
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1896
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1897
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1890
+				'.btn-primary' => array('b', 'o'),
1891
+				'.btn-primary.disabled' => array('b', 'o'),
1892
+				'.btn-primary:disabled' => array('b', 'o'),
1893
+				'.btn-outline-primary' => array('c', 'o'),
1894
+				'.btn-outline-primary:hover' => array('b', 'o'),
1895
+				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b', 'o'),
1896
+				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b', 'o'),
1897
+				'.show>.btn-outline-primary.dropdown-toggle' => array('b', 'o'),
1898 1898
 				'.btn-link' => array('c'),
1899 1899
 				'.dropdown-item.active' => array('b'),
1900
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1901
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1900
+				'.custom-control-input:checked~.custom-control-label::before' => array('b', 'o'),
1901
+				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b', 'o'),
1902 1902
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1903 1903
 //				'.custom-range::-moz-range-thumb' => array('b'),
1904 1904
 //				'.custom-range::-ms-thumb' => array('b'),
1905 1905
 				'.nav-pills .nav-link.active' => array('b'),
1906 1906
 				'.nav-pills .show>.nav-link' => array('b'),
1907 1907
 				'.page-link' => array('c'),
1908
-				'.page-item.active .page-link' => array('b','o'),
1908
+				'.page-item.active .page-link' => array('b', 'o'),
1909 1909
 				'.badge-primary' => array('b'),
1910
-				'.alert-primary' => array('b','o'),
1910
+				'.alert-primary' => array('b', 'o'),
1911 1911
 				'.progress-bar' => array('b'),
1912
-				'.list-group-item.active' => array('b','o'),
1913
-				'.bg-primary' => array('b','f'),
1912
+				'.list-group-item.active' => array('b', 'o'),
1913
+				'.bg-primary' => array('b', 'f'),
1914 1914
 				'.btn-link.btn-primary' => array('c'),
1915 1915
 				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1916 1916
 			);
1917 1917
 
1918 1918
 			$important_selectors = array(
1919
-				'.bg-primary' => array('b','f'),
1919
+				'.bg-primary' => array('b', 'f'),
1920 1920
 				'.border-primary' => array('o'),
1921 1921
 				'.text-primary' => array('c'),
1922 1922
 			);
@@ -1933,88 +1933,88 @@  discard block
 block discarded – undo
1933 1933
 			$output = '';
1934 1934
 
1935 1935
 			// build rules into each type
1936
-			foreach($selectors as $selector => $types){
1937
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1938
-				$types = array_combine($types,$types);
1939
-				if(isset($types['c'])){$color[] = $selector;}
1940
-				if(isset($types['b'])){$background[] = $selector;}
1941
-				if(isset($types['o'])){$border[] = $selector;}
1942
-				if(isset($types['f'])){$fill[] = $selector;}
1936
+			foreach ($selectors as $selector => $types) {
1937
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1938
+				$types = array_combine($types, $types);
1939
+				if (isset($types['c'])) {$color[] = $selector; }
1940
+				if (isset($types['b'])) {$background[] = $selector; }
1941
+				if (isset($types['o'])) {$border[] = $selector; }
1942
+				if (isset($types['f'])) {$fill[] = $selector; }
1943 1943
 			}
1944 1944
 
1945 1945
 			// build rules into each type
1946
-			foreach($important_selectors as $selector => $types){
1947
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1948
-				$types = array_combine($types,$types);
1949
-				if(isset($types['c'])){$color_i[] = $selector;}
1950
-				if(isset($types['b'])){$background_i[] = $selector;}
1951
-				if(isset($types['o'])){$border_i[] = $selector;}
1952
-				if(isset($types['f'])){$fill_i[] = $selector;}
1946
+			foreach ($important_selectors as $selector => $types) {
1947
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
1948
+				$types = array_combine($types, $types);
1949
+				if (isset($types['c'])) {$color_i[] = $selector; }
1950
+				if (isset($types['b'])) {$background_i[] = $selector; }
1951
+				if (isset($types['o'])) {$border_i[] = $selector; }
1952
+				if (isset($types['f'])) {$fill_i[] = $selector; }
1953 1953
 			}
1954 1954
 
1955 1955
 			// add any color rules
1956
-			if(!empty($color)){
1957
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1956
+			if (!empty($color)) {
1957
+				$output .= implode(",", $color) . "{color: $color_code;} ";
1958 1958
 			}
1959
-			if(!empty($color_i)){
1960
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1959
+			if (!empty($color_i)) {
1960
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
1961 1961
 			}
1962 1962
 
1963 1963
 			// add any background color rules
1964
-			if(!empty($background)){
1965
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1964
+			if (!empty($background)) {
1965
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
1966 1966
 			}
1967
-			if(!empty($background_i)){
1968
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1967
+			if (!empty($background_i)) {
1968
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
1969 1969
 			}
1970 1970
 
1971 1971
 			// add any border color rules
1972
-			if(!empty($border)){
1973
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1972
+			if (!empty($border)) {
1973
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
1974 1974
 			}
1975
-			if(!empty($border_i)){
1976
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1975
+			if (!empty($border_i)) {
1976
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
1977 1977
 			}
1978 1978
 
1979 1979
 			// add any fill color rules
1980
-			if(!empty($fill)){
1981
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1980
+			if (!empty($fill)) {
1981
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
1982 1982
 			}
1983
-			if(!empty($fill_i)){
1984
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1983
+			if (!empty($fill_i)) {
1984
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
1985 1985
 			}
1986 1986
 
1987 1987
 
1988 1988
 			$prefix = $compatibility ? ".bsui " : "";
1989 1989
 
1990 1990
 			// darken
1991
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1992
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1993
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1991
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
1992
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
1993
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
1994 1994
 
1995 1995
 			// lighten
1996
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1996
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
1997 1997
 
1998 1998
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
1999
-			$op_25 = $color_code."40"; // 25% opacity
1999
+			$op_25 = $color_code . "40"; // 25% opacity
2000 2000
 
2001 2001
 
2002 2002
 			// button states
2003
-			$output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2004
-			$output .= $prefix ." .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2005
-			$output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
2006
-			$output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
2003
+			$output .= $prefix . " .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
2004
+			$output .= $prefix . " .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2005
+			$output .= $prefix . " .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: " . $darker_10 . ";    border-color: " . $darker_125 . ";} ";
2006
+			$output .= $prefix . " .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
2007 2007
 
2008 2008
 
2009 2009
 			// dropdown's
2010
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2010
+			$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2011 2011
 
2012 2012
 
2013 2013
 			// input states
2014
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
2014
+			$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
2015 2015
 
2016 2016
 			// page link
2017
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2017
+			$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2018 2018
 
2019 2019
 			return $output;
2020 2020
 		}
@@ -2028,30 +2028,30 @@  discard block
 block discarded – undo
2028 2028
 		 *
2029 2029
 		 * @return string
2030 2030
 		 */
2031
-		public static function css_secondary($color_code,$compatibility){;
2031
+		public static function css_secondary($color_code, $compatibility) {;
2032 2032
 			$color_code = sanitize_hex_color($color_code);
2033
-			if(!$color_code){return '';}
2033
+			if (!$color_code) {return ''; }
2034 2034
 			/**
2035 2035
 			 * c = color, b = background color, o = border-color, f = fill
2036 2036
 			 */
2037 2037
 			$selectors = array(
2038
-				'.btn-secondary' => array('b','o'),
2039
-				'.btn-secondary.disabled' => array('b','o'),
2040
-				'.btn-secondary:disabled' => array('b','o'),
2041
-				'.btn-outline-secondary' => array('c','o'),
2042
-				'.btn-outline-secondary:hover' => array('b','o'),
2038
+				'.btn-secondary' => array('b', 'o'),
2039
+				'.btn-secondary.disabled' => array('b', 'o'),
2040
+				'.btn-secondary:disabled' => array('b', 'o'),
2041
+				'.btn-outline-secondary' => array('c', 'o'),
2042
+				'.btn-outline-secondary:hover' => array('b', 'o'),
2043 2043
 				'.btn-outline-secondary.disabled' => array('c'),
2044 2044
 				'.btn-outline-secondary:disabled' => array('c'),
2045
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
2046
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
2047
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
2045
+				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b', 'o'),
2046
+				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b', 'o'),
2047
+				'.btn-outline-secondary.dropdown-toggle' => array('b', 'o'),
2048 2048
 				'.badge-secondary' => array('b'),
2049
-				'.alert-secondary' => array('b','o'),
2049
+				'.alert-secondary' => array('b', 'o'),
2050 2050
 				'.btn-link.btn-secondary' => array('c'),
2051 2051
 			);
2052 2052
 
2053 2053
 			$important_selectors = array(
2054
-				'.bg-secondary' => array('b','f'),
2054
+				'.bg-secondary' => array('b', 'f'),
2055 2055
 				'.border-secondary' => array('o'),
2056 2056
 				'.text-secondary' => array('c'),
2057 2057
 			);
@@ -2068,77 +2068,77 @@  discard block
 block discarded – undo
2068 2068
 			$output = '';
2069 2069
 
2070 2070
 			// build rules into each type
2071
-			foreach($selectors as $selector => $types){
2072
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2073
-				$types = array_combine($types,$types);
2074
-				if(isset($types['c'])){$color[] = $selector;}
2075
-				if(isset($types['b'])){$background[] = $selector;}
2076
-				if(isset($types['o'])){$border[] = $selector;}
2077
-				if(isset($types['f'])){$fill[] = $selector;}
2071
+			foreach ($selectors as $selector => $types) {
2072
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
2073
+				$types = array_combine($types, $types);
2074
+				if (isset($types['c'])) {$color[] = $selector; }
2075
+				if (isset($types['b'])) {$background[] = $selector; }
2076
+				if (isset($types['o'])) {$border[] = $selector; }
2077
+				if (isset($types['f'])) {$fill[] = $selector; }
2078 2078
 			}
2079 2079
 
2080 2080
 			// build rules into each type
2081
-			foreach($important_selectors as $selector => $types){
2082
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2083
-				$types = array_combine($types,$types);
2084
-				if(isset($types['c'])){$color_i[] = $selector;}
2085
-				if(isset($types['b'])){$background_i[] = $selector;}
2086
-				if(isset($types['o'])){$border_i[] = $selector;}
2087
-				if(isset($types['f'])){$fill_i[] = $selector;}
2081
+			foreach ($important_selectors as $selector => $types) {
2082
+				$selector = $compatibility ? ".bsui " . $selector : $selector;
2083
+				$types = array_combine($types, $types);
2084
+				if (isset($types['c'])) {$color_i[] = $selector; }
2085
+				if (isset($types['b'])) {$background_i[] = $selector; }
2086
+				if (isset($types['o'])) {$border_i[] = $selector; }
2087
+				if (isset($types['f'])) {$fill_i[] = $selector; }
2088 2088
 			}
2089 2089
 
2090 2090
 			// add any color rules
2091
-			if(!empty($color)){
2092
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2091
+			if (!empty($color)) {
2092
+				$output .= implode(",", $color) . "{color: $color_code;} ";
2093 2093
 			}
2094
-			if(!empty($color_i)){
2095
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2094
+			if (!empty($color_i)) {
2095
+				$output .= implode(",", $color_i) . "{color: $color_code !important;} ";
2096 2096
 			}
2097 2097
 
2098 2098
 			// add any background color rules
2099
-			if(!empty($background)){
2100
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2099
+			if (!empty($background)) {
2100
+				$output .= implode(",", $background) . "{background-color: $color_code;} ";
2101 2101
 			}
2102
-			if(!empty($background_i)){
2103
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2102
+			if (!empty($background_i)) {
2103
+				$output .= implode(",", $background_i) . "{background-color: $color_code !important;} ";
2104 2104
 			}
2105 2105
 
2106 2106
 			// add any border color rules
2107
-			if(!empty($border)){
2108
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2107
+			if (!empty($border)) {
2108
+				$output .= implode(",", $border) . "{border-color: $color_code;} ";
2109 2109
 			}
2110
-			if(!empty($border_i)){
2111
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2110
+			if (!empty($border_i)) {
2111
+				$output .= implode(",", $border_i) . "{border-color: $color_code !important;} ";
2112 2112
 			}
2113 2113
 
2114 2114
 			// add any fill color rules
2115
-			if(!empty($fill)){
2116
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2115
+			if (!empty($fill)) {
2116
+				$output .= implode(",", $fill) . "{fill: $color_code;} ";
2117 2117
 			}
2118
-			if(!empty($fill_i)){
2119
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2118
+			if (!empty($fill_i)) {
2119
+				$output .= implode(",", $fill_i) . "{fill: $color_code !important;} ";
2120 2120
 			}
2121 2121
 
2122 2122
 
2123 2123
 			$prefix = $compatibility ? ".bsui " : "";
2124 2124
 
2125 2125
 			// darken
2126
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2127
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2128
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2126
+			$darker_075 = self::css_hex_lighten_darken($color_code, "-0.075");
2127
+			$darker_10 = self::css_hex_lighten_darken($color_code, "-0.10");
2128
+			$darker_125 = self::css_hex_lighten_darken($color_code, "-0.125");
2129 2129
 
2130 2130
 			// lighten
2131
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2131
+			$lighten_25 = self::css_hex_lighten_darken($color_code, "0.25");
2132 2132
 
2133 2133
 			// opacity see https://css-tricks.com/8-digit-hex-codes/
2134
-			$op_25 = $color_code."40"; // 25% opacity
2134
+			$op_25 = $color_code . "40"; // 25% opacity
2135 2135
 
2136 2136
 
2137 2137
 			// button states
2138
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2139
-			$output .= $prefix ." .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2140
-			$output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
2141
-			$output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
2138
+			$output .= $prefix . " .btn-secondary:hover{background-color: " . $darker_075 . ";    border-color: " . $darker_10 . ";} ";
2139
+			$output .= $prefix . " .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2140
+			$output .= $prefix . " .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: " . $darker_10 . ";    border-color: " . $darker_125 . ";} ";
2141
+			$output .= $prefix . " .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
2142 2142
 
2143 2143
 
2144 2144
 			return $output;
@@ -2155,7 +2155,7 @@  discard block
 block discarded – undo
2155 2155
 		public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
2156 2156
 			$hexCode = ltrim($hexCode, '#');
2157 2157
 
2158
-			if ( strpos( $hexCode, 'rgba(' ) !== false || strpos( $hexCode, 'rgb(' ) !== false ) {
2158
+			if (strpos($hexCode, 'rgba(') !== false || strpos($hexCode, 'rgb(') !== false) {
2159 2159
 				return $hexCode;
2160 2160
 			}
2161 2161
 
@@ -2178,8 +2178,8 @@  discard block
 block discarded – undo
2178 2178
 		/**
2179 2179
 		 * Check if we should display examples.
2180 2180
 		 */
2181
-		public function maybe_show_examples(){
2182
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
2181
+		public function maybe_show_examples() {
2182
+			if (current_user_can('manage_options') && isset($_REQUEST['preview-aui'])) {
2183 2183
 				echo "<head>";
2184 2184
 				wp_head();
2185 2185
 				echo "</head>";
@@ -2195,7 +2195,7 @@  discard block
 block discarded – undo
2195 2195
 		 *
2196 2196
 		 * @return string
2197 2197
 		 */
2198
-		public function get_examples(){
2198
+		public function get_examples() {
2199 2199
 			$output = '';
2200 2200
 
2201 2201
 
@@ -2301,74 +2301,74 @@  discard block
 block discarded – undo
2301 2301
 		 */
2302 2302
 		public static function calendar_params() {
2303 2303
 			$params = array(
2304
-				'month_long_1' => __( 'January', 'ayecode-connect' ),
2305
-				'month_long_2' => __( 'February', 'ayecode-connect' ),
2306
-				'month_long_3' => __( 'March', 'ayecode-connect' ),
2307
-				'month_long_4' => __( 'April', 'ayecode-connect' ),
2308
-				'month_long_5' => __( 'May', 'ayecode-connect' ),
2309
-				'month_long_6' => __( 'June', 'ayecode-connect' ),
2310
-				'month_long_7' => __( 'July', 'ayecode-connect' ),
2311
-				'month_long_8' => __( 'August', 'ayecode-connect' ),
2312
-				'month_long_9' => __( 'September', 'ayecode-connect' ),
2313
-				'month_long_10' => __( 'October', 'ayecode-connect' ),
2314
-				'month_long_11' => __( 'November', 'ayecode-connect' ),
2315
-				'month_long_12' => __( 'December', 'ayecode-connect' ),
2316
-				'month_s_1' => _x( 'Jan', 'January abbreviation', 'ayecode-connect' ),
2317
-				'month_s_2' => _x( 'Feb', 'February abbreviation', 'ayecode-connect' ),
2318
-				'month_s_3' => _x( 'Mar', 'March abbreviation', 'ayecode-connect' ),
2319
-				'month_s_4' => _x( 'Apr', 'April abbreviation', 'ayecode-connect' ),
2320
-				'month_s_5' => _x( 'May', 'May abbreviation', 'ayecode-connect' ),
2321
-				'month_s_6' => _x( 'Jun', 'June abbreviation', 'ayecode-connect' ),
2322
-				'month_s_7' => _x( 'Jul', 'July abbreviation', 'ayecode-connect' ),
2323
-				'month_s_8' => _x( 'Aug', 'August abbreviation', 'ayecode-connect' ),
2324
-				'month_s_9' => _x( 'Sep', 'September abbreviation', 'ayecode-connect' ),
2325
-				'month_s_10' => _x( 'Oct', 'October abbreviation', 'ayecode-connect' ),
2326
-				'month_s_11' => _x( 'Nov', 'November abbreviation', 'ayecode-connect' ),
2327
-				'month_s_12' => _x( 'Dec', 'December abbreviation', 'ayecode-connect' ),
2328
-				'day_s1_1' => _x( 'S', 'Sunday initial', 'ayecode-connect' ),
2329
-				'day_s1_2' => _x( 'M', 'Monday initial', 'ayecode-connect' ),
2330
-				'day_s1_3' => _x( 'T', 'Tuesday initial', 'ayecode-connect' ),
2331
-				'day_s1_4' => _x( 'W', 'Wednesday initial', 'ayecode-connect' ),
2332
-				'day_s1_5' => _x( 'T', 'Friday initial', 'ayecode-connect' ),
2333
-				'day_s1_6' => _x( 'F', 'Thursday initial', 'ayecode-connect' ),
2334
-				'day_s1_7' => _x( 'S', 'Saturday initial', 'ayecode-connect' ),
2335
-				'day_s2_1' => __( 'Su', 'ayecode-connect' ),
2336
-				'day_s2_2' => __( 'Mo', 'ayecode-connect' ),
2337
-				'day_s2_3' => __( 'Tu', 'ayecode-connect' ),
2338
-				'day_s2_4' => __( 'We', 'ayecode-connect' ),
2339
-				'day_s2_5' => __( 'Th', 'ayecode-connect' ),
2340
-				'day_s2_6' => __( 'Fr', 'ayecode-connect' ),
2341
-				'day_s2_7' => __( 'Sa', 'ayecode-connect' ),
2342
-				'day_s3_1' => __( 'Sun', 'ayecode-connect' ),
2343
-				'day_s3_2' => __( 'Mon', 'ayecode-connect' ),
2344
-				'day_s3_3' => __( 'Tue', 'ayecode-connect' ),
2345
-				'day_s3_4' => __( 'Wed', 'ayecode-connect' ),
2346
-				'day_s3_5' => __( 'Thu', 'ayecode-connect' ),
2347
-				'day_s3_6' => __( 'Fri', 'ayecode-connect' ),
2348
-				'day_s3_7' => __( 'Sat', 'ayecode-connect' ),
2349
-				'day_s5_1' => __( 'Sunday', 'ayecode-connect' ),
2350
-				'day_s5_2' => __( 'Monday', 'ayecode-connect' ),
2351
-				'day_s5_3' => __( 'Tuesday', 'ayecode-connect' ),
2352
-				'day_s5_4' => __( 'Wednesday', 'ayecode-connect' ),
2353
-				'day_s5_5' => __( 'Thursday', 'ayecode-connect' ),
2354
-				'day_s5_6' => __( 'Friday', 'ayecode-connect' ),
2355
-				'day_s5_7' => __( 'Saturday', 'ayecode-connect' ),
2356
-				'am_lower' => __( 'am', 'ayecode-connect' ),
2357
-				'pm_lower' => __( 'pm', 'ayecode-connect' ),
2358
-				'am_upper' => __( 'AM', 'ayecode-connect' ),
2359
-				'pm_upper' => __( 'PM', 'ayecode-connect' ),
2360
-				'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2304
+				'month_long_1' => __('January', 'ayecode-connect'),
2305
+				'month_long_2' => __('February', 'ayecode-connect'),
2306
+				'month_long_3' => __('March', 'ayecode-connect'),
2307
+				'month_long_4' => __('April', 'ayecode-connect'),
2308
+				'month_long_5' => __('May', 'ayecode-connect'),
2309
+				'month_long_6' => __('June', 'ayecode-connect'),
2310
+				'month_long_7' => __('July', 'ayecode-connect'),
2311
+				'month_long_8' => __('August', 'ayecode-connect'),
2312
+				'month_long_9' => __('September', 'ayecode-connect'),
2313
+				'month_long_10' => __('October', 'ayecode-connect'),
2314
+				'month_long_11' => __('November', 'ayecode-connect'),
2315
+				'month_long_12' => __('December', 'ayecode-connect'),
2316
+				'month_s_1' => _x('Jan', 'January abbreviation', 'ayecode-connect'),
2317
+				'month_s_2' => _x('Feb', 'February abbreviation', 'ayecode-connect'),
2318
+				'month_s_3' => _x('Mar', 'March abbreviation', 'ayecode-connect'),
2319
+				'month_s_4' => _x('Apr', 'April abbreviation', 'ayecode-connect'),
2320
+				'month_s_5' => _x('May', 'May abbreviation', 'ayecode-connect'),
2321
+				'month_s_6' => _x('Jun', 'June abbreviation', 'ayecode-connect'),
2322
+				'month_s_7' => _x('Jul', 'July abbreviation', 'ayecode-connect'),
2323
+				'month_s_8' => _x('Aug', 'August abbreviation', 'ayecode-connect'),
2324
+				'month_s_9' => _x('Sep', 'September abbreviation', 'ayecode-connect'),
2325
+				'month_s_10' => _x('Oct', 'October abbreviation', 'ayecode-connect'),
2326
+				'month_s_11' => _x('Nov', 'November abbreviation', 'ayecode-connect'),
2327
+				'month_s_12' => _x('Dec', 'December abbreviation', 'ayecode-connect'),
2328
+				'day_s1_1' => _x('S', 'Sunday initial', 'ayecode-connect'),
2329
+				'day_s1_2' => _x('M', 'Monday initial', 'ayecode-connect'),
2330
+				'day_s1_3' => _x('T', 'Tuesday initial', 'ayecode-connect'),
2331
+				'day_s1_4' => _x('W', 'Wednesday initial', 'ayecode-connect'),
2332
+				'day_s1_5' => _x('T', 'Friday initial', 'ayecode-connect'),
2333
+				'day_s1_6' => _x('F', 'Thursday initial', 'ayecode-connect'),
2334
+				'day_s1_7' => _x('S', 'Saturday initial', 'ayecode-connect'),
2335
+				'day_s2_1' => __('Su', 'ayecode-connect'),
2336
+				'day_s2_2' => __('Mo', 'ayecode-connect'),
2337
+				'day_s2_3' => __('Tu', 'ayecode-connect'),
2338
+				'day_s2_4' => __('We', 'ayecode-connect'),
2339
+				'day_s2_5' => __('Th', 'ayecode-connect'),
2340
+				'day_s2_6' => __('Fr', 'ayecode-connect'),
2341
+				'day_s2_7' => __('Sa', 'ayecode-connect'),
2342
+				'day_s3_1' => __('Sun', 'ayecode-connect'),
2343
+				'day_s3_2' => __('Mon', 'ayecode-connect'),
2344
+				'day_s3_3' => __('Tue', 'ayecode-connect'),
2345
+				'day_s3_4' => __('Wed', 'ayecode-connect'),
2346
+				'day_s3_5' => __('Thu', 'ayecode-connect'),
2347
+				'day_s3_6' => __('Fri', 'ayecode-connect'),
2348
+				'day_s3_7' => __('Sat', 'ayecode-connect'),
2349
+				'day_s5_1' => __('Sunday', 'ayecode-connect'),
2350
+				'day_s5_2' => __('Monday', 'ayecode-connect'),
2351
+				'day_s5_3' => __('Tuesday', 'ayecode-connect'),
2352
+				'day_s5_4' => __('Wednesday', 'ayecode-connect'),
2353
+				'day_s5_5' => __('Thursday', 'ayecode-connect'),
2354
+				'day_s5_6' => __('Friday', 'ayecode-connect'),
2355
+				'day_s5_7' => __('Saturday', 'ayecode-connect'),
2356
+				'am_lower' => __('am', 'ayecode-connect'),
2357
+				'pm_lower' => __('pm', 'ayecode-connect'),
2358
+				'am_upper' => __('AM', 'ayecode-connect'),
2359
+				'pm_upper' => __('PM', 'ayecode-connect'),
2360
+				'firstDayOfWeek' => (int) get_option('start_of_week'),
2361 2361
 				'time_24hr' => false,
2362
-				'year' => __( 'Year', 'ayecode-connect' ),
2363
-				'hour' => __( 'Hour', 'ayecode-connect' ),
2364
-				'minute' => __( 'Minute', 'ayecode-connect' ),
2365
-				'weekAbbreviation' => __( 'Wk', 'ayecode-connect' ),
2366
-				'rangeSeparator' => __( ' to ', 'ayecode-connect' ),
2367
-				'scrollTitle' => __( 'Scroll to increment', 'ayecode-connect' ),
2368
-				'toggleTitle' => __( 'Click to toggle', 'ayecode-connect' )
2362
+				'year' => __('Year', 'ayecode-connect'),
2363
+				'hour' => __('Hour', 'ayecode-connect'),
2364
+				'minute' => __('Minute', 'ayecode-connect'),
2365
+				'weekAbbreviation' => __('Wk', 'ayecode-connect'),
2366
+				'rangeSeparator' => __(' to ', 'ayecode-connect'),
2367
+				'scrollTitle' => __('Scroll to increment', 'ayecode-connect'),
2368
+				'toggleTitle' => __('Click to toggle', 'ayecode-connect')
2369 2369
 			);
2370 2370
 
2371
-			return apply_filters( 'ayecode_ui_calendar_params', $params );
2371
+			return apply_filters('ayecode_ui_calendar_params', $params);
2372 2372
 		}
2373 2373
 
2374 2374
 		/**
@@ -2381,47 +2381,47 @@  discard block
 block discarded – undo
2381 2381
 		public static function flatpickr_locale() {
2382 2382
 			$params = self::calendar_params();
2383 2383
 
2384
-			if ( is_string( $params ) ) {
2385
-				$params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2384
+			if (is_string($params)) {
2385
+				$params = html_entity_decode($params, ENT_QUOTES, 'UTF-8');
2386 2386
 			} else {
2387
-				foreach ( (array) $params as $key => $value ) {
2388
-					if ( ! is_scalar( $value ) ) {
2387
+				foreach ((array) $params as $key => $value) {
2388
+					if (!is_scalar($value)) {
2389 2389
 						continue;
2390 2390
 					}
2391 2391
 
2392
-					$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2392
+					$params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
2393 2393
 				}
2394 2394
 			}
2395 2395
 
2396 2396
 			$day_s3 = array();
2397 2397
 			$day_s5 = array();
2398 2398
 
2399
-			for ( $i = 1; $i <= 7; $i ++ ) {
2400
-				$day_s3[] = addslashes( $params[ 'day_s3_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2401
-				$day_s5[] = addslashes( $params[ 'day_s3_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2399
+			for ($i = 1; $i <= 7; $i++) {
2400
+				$day_s3[] = addslashes($params['day_s3_' . $i]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2401
+				$day_s5[] = addslashes($params['day_s3_' . $i]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2402 2402
 			}
2403 2403
 
2404 2404
 			$month_s = array();
2405 2405
 			$month_long = array();
2406 2406
 
2407
-			for ( $i = 1; $i <= 12; $i ++ ) {
2408
-				$month_s[] = addslashes( $params[ 'month_s_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2409
-				$month_long[] = addslashes( $params[ 'month_long_' . $i ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2407
+			for ($i = 1; $i <= 12; $i++) {
2408
+				$month_s[] = addslashes($params['month_s_' . $i]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2409
+				$month_long[] = addslashes($params['month_long_' . $i]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
2410 2410
 			}
2411 2411
 
2412 2412
 			ob_start();
2413
-		if ( 0 ) { ?><script><?php } ?>
2413
+		if (0) { ?><script><?php } ?>
2414 2414
                 {
2415 2415
                     weekdays: {
2416
-                        shorthand: ['<?php echo implode( "','", $day_s3 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'],
2417
-                            longhand: ['<?php echo implode( "','", $day_s5 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'],
2416
+                        shorthand: ['<?php echo implode("','", $day_s3); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'],
2417
+                            longhand: ['<?php echo implode("','", $day_s5); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'],
2418 2418
                     },
2419 2419
                     months: {
2420
-                        shorthand: ['<?php echo implode( "','", $month_s ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'],
2421
-                            longhand: ['<?php echo implode( "','", $month_long ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'],
2420
+                        shorthand: ['<?php echo implode("','", $month_s); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'],
2421
+                            longhand: ['<?php echo implode("','", $month_long); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>'],
2422 2422
                     },
2423 2423
                     daysInMonth: [31,28,31,30,31,30,31,31,30,31,30,31],
2424
-                        firstDayOfWeek: <?php echo (int) $params[ 'firstDayOfWeek' ]; ?>,
2424
+                        firstDayOfWeek: <?php echo (int) $params['firstDayOfWeek']; ?>,
2425 2425
                     ordinal: function (nth) {
2426 2426
                         var s = nth % 100;
2427 2427
                         if (s > 3 && s < 21)
@@ -2437,21 +2437,21 @@  discard block
 block discarded – undo
2437 2437
                                 return "th";
2438 2438
                         }
2439 2439
                     },
2440
-                    rangeSeparator: '<?php echo esc_attr( $params[ 'rangeSeparator' ] ); ?>',
2441
-                        weekAbbreviation: '<?php echo esc_attr( $params[ 'weekAbbreviation' ] ); ?>',
2442
-                    scrollTitle: '<?php echo esc_attr( $params[ 'scrollTitle' ] ); ?>',
2443
-                    toggleTitle: '<?php echo esc_attr( $params[ 'toggleTitle' ] ); ?>',
2444
-                    amPM: ['<?php echo esc_attr( $params[ 'am_upper' ] ); ?>','<?php echo esc_attr( $params[ 'pm_upper' ] ); ?>'],
2445
-                    yearAriaLabel: '<?php echo esc_attr( $params[ 'year' ] ); ?>',
2446
-                    hourAriaLabel: '<?php echo esc_attr( $params[ 'hour' ] ); ?>',
2447
-                    minuteAriaLabel: '<?php echo esc_attr( $params[ 'minute' ] ); ?>',
2448
-                    time_24hr: <?php echo ( $params[ 'time_24hr' ] ? 'true' : 'false' ) ; ?>
2440
+                    rangeSeparator: '<?php echo esc_attr($params['rangeSeparator']); ?>',
2441
+                        weekAbbreviation: '<?php echo esc_attr($params['weekAbbreviation']); ?>',
2442
+                    scrollTitle: '<?php echo esc_attr($params['scrollTitle']); ?>',
2443
+                    toggleTitle: '<?php echo esc_attr($params['toggleTitle']); ?>',
2444
+                    amPM: ['<?php echo esc_attr($params['am_upper']); ?>','<?php echo esc_attr($params['pm_upper']); ?>'],
2445
+                    yearAriaLabel: '<?php echo esc_attr($params['year']); ?>',
2446
+                    hourAriaLabel: '<?php echo esc_attr($params['hour']); ?>',
2447
+                    minuteAriaLabel: '<?php echo esc_attr($params['minute']); ?>',
2448
+                    time_24hr: <?php echo ($params['time_24hr'] ? 'true' : 'false'); ?>
2449 2449
                 }
2450
-				<?php if ( 0 ) { ?></script><?php } ?>
2450
+				<?php if (0) { ?></script><?php } ?>
2451 2451
 			<?php
2452 2452
 			$locale = ob_get_clean();
2453 2453
 
2454
-			return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2454
+			return apply_filters('ayecode_ui_flatpickr_locale', trim($locale));
2455 2455
 		}
2456 2456
 
2457 2457
 		/**
@@ -2463,20 +2463,20 @@  discard block
 block discarded – undo
2463 2463
 		 */
2464 2464
 		public static function select2_params() {
2465 2465
 			$params = array(
2466
-				'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'ayecode-connect' ),
2467
-				'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'ayecode-connect' ),
2468
-				'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'ayecode-connect' ),
2469
-				'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'ayecode-connect' ),
2470
-				'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'ayecode-connect' ),
2471
-				'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'ayecode-connect' ),
2472
-				'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'ayecode-connect' ),
2473
-				'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'ayecode-connect' ),
2474
-				'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'ayecode-connect' ),
2475
-				'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'ayecode-connect' ),
2476
-				'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'ayecode-connect' )
2466
+				'i18n_select_state_text'    => esc_attr__('Select an option&hellip;', 'ayecode-connect'),
2467
+				'i18n_no_matches'           => _x('No matches found', 'enhanced select', 'ayecode-connect'),
2468
+				'i18n_ajax_error'           => _x('Loading failed', 'enhanced select', 'ayecode-connect'),
2469
+				'i18n_input_too_short_1'    => _x('Please enter 1 or more characters', 'enhanced select', 'ayecode-connect'),
2470
+				'i18n_input_too_short_n'    => _x('Please enter %item% or more characters', 'enhanced select', 'ayecode-connect'),
2471
+				'i18n_input_too_long_1'     => _x('Please delete 1 character', 'enhanced select', 'ayecode-connect'),
2472
+				'i18n_input_too_long_n'     => _x('Please delete %item% characters', 'enhanced select', 'ayecode-connect'),
2473
+				'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'ayecode-connect'),
2474
+				'i18n_selection_too_long_n' => _x('You can only select %item% items', 'enhanced select', 'ayecode-connect'),
2475
+				'i18n_load_more'            => _x('Loading more results&hellip;', 'enhanced select', 'ayecode-connect'),
2476
+				'i18n_searching'            => _x('Searching&hellip;', 'enhanced select', 'ayecode-connect')
2477 2477
 			);
2478 2478
 
2479
-			return apply_filters( 'ayecode_ui_select2_params', $params );
2479
+			return apply_filters('ayecode_ui_select2_params', $params);
2480 2480
 		}
2481 2481
 
2482 2482
 		/**
@@ -2489,17 +2489,17 @@  discard block
 block discarded – undo
2489 2489
 		public static function select2_locale() {
2490 2490
 			$params = self::select2_params();
2491 2491
 
2492
-			foreach ( (array) $params as $key => $value ) {
2493
-				if ( ! is_scalar( $value ) ) {
2492
+			foreach ((array) $params as $key => $value) {
2493
+				if (!is_scalar($value)) {
2494 2494
 					continue;
2495 2495
 				}
2496 2496
 
2497
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2497
+				$params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
2498 2498
 			}
2499 2499
 
2500
-			$locale = json_encode( $params );
2500
+			$locale = json_encode($params);
2501 2501
 
2502
-			return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2502
+			return apply_filters('ayecode_ui_select2_locale', trim($locale));
2503 2503
 		}
2504 2504
 
2505 2505
 		/**
@@ -2512,35 +2512,35 @@  discard block
 block discarded – undo
2512 2512
 		public static function timeago_locale() {
2513 2513
 			$params = array(
2514 2514
 				'prefix_ago' => '',
2515
-				'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'ayecode-connect' ),
2516
-				'prefix_after' => _x( 'after', 'time ago', 'ayecode-connect' ) . ' ',
2515
+				'suffix_ago' => ' ' . _x('ago', 'time ago', 'ayecode-connect'),
2516
+				'prefix_after' => _x('after', 'time ago', 'ayecode-connect') . ' ',
2517 2517
 				'suffix_after' => '',
2518
-				'seconds' => _x( 'less than a minute', 'time ago', 'ayecode-connect' ),
2519
-				'minute' => _x( 'about a minute', 'time ago', 'ayecode-connect' ),
2520
-				'minutes' => _x( '%d minutes', 'time ago', 'ayecode-connect' ),
2521
-				'hour' => _x( 'about an hour', 'time ago', 'ayecode-connect' ),
2522
-				'hours' => _x( 'about %d hours', 'time ago', 'ayecode-connect' ),
2523
-				'day' => _x( 'a day', 'time ago', 'ayecode-connect' ),
2524
-				'days' => _x( '%d days', 'time ago', 'ayecode-connect' ),
2525
-				'month' => _x( 'about a month', 'time ago', 'ayecode-connect' ),
2526
-				'months' => _x( '%d months', 'time ago', 'ayecode-connect' ),
2527
-				'year' => _x( 'about a year', 'time ago', 'ayecode-connect' ),
2528
-				'years' => _x( '%d years', 'time ago', 'ayecode-connect' ),
2518
+				'seconds' => _x('less than a minute', 'time ago', 'ayecode-connect'),
2519
+				'minute' => _x('about a minute', 'time ago', 'ayecode-connect'),
2520
+				'minutes' => _x('%d minutes', 'time ago', 'ayecode-connect'),
2521
+				'hour' => _x('about an hour', 'time ago', 'ayecode-connect'),
2522
+				'hours' => _x('about %d hours', 'time ago', 'ayecode-connect'),
2523
+				'day' => _x('a day', 'time ago', 'ayecode-connect'),
2524
+				'days' => _x('%d days', 'time ago', 'ayecode-connect'),
2525
+				'month' => _x('about a month', 'time ago', 'ayecode-connect'),
2526
+				'months' => _x('%d months', 'time ago', 'ayecode-connect'),
2527
+				'year' => _x('about a year', 'time ago', 'ayecode-connect'),
2528
+				'years' => _x('%d years', 'time ago', 'ayecode-connect'),
2529 2529
 			);
2530 2530
 
2531
-			$params = apply_filters( 'ayecode_ui_timeago_params', $params );
2531
+			$params = apply_filters('ayecode_ui_timeago_params', $params);
2532 2532
 
2533
-			foreach ( (array) $params as $key => $value ) {
2534
-				if ( ! is_scalar( $value ) ) {
2533
+			foreach ((array) $params as $key => $value) {
2534
+				if (!is_scalar($value)) {
2535 2535
 					continue;
2536 2536
 				}
2537 2537
 
2538
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2538
+				$params[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
2539 2539
 			}
2540 2540
 
2541
-			$locale = json_encode( $params );
2541
+			$locale = json_encode($params);
2542 2542
 
2543
-			return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2543
+			return apply_filters('ayecode_ui_timeago_locale', trim($locale));
2544 2544
 		}
2545 2545
 
2546 2546
 		/**
@@ -2551,7 +2551,7 @@  discard block
 block discarded – undo
2551 2551
 		 * @return mixed
2552 2552
 		 */
2553 2553
 		public static function minify_js($input) {
2554
-			if(trim($input) === "") return $input;
2554
+			if (trim($input) === "") return $input;
2555 2555
 			return preg_replace(
2556 2556
 				array(
2557 2557
 					// Remove comment(s)
@@ -2583,7 +2583,7 @@  discard block
 block discarded – undo
2583 2583
 		 * @return mixed
2584 2584
 		 */
2585 2585
 		public static function minify_css($input) {
2586
-			if(trim($input) === "") return $input;
2586
+			if (trim($input) === "") return $input;
2587 2587
 			return preg_replace(
2588 2588
 				array(
2589 2589
 					// Remove comment(s)
@@ -3163,12 +3163,12 @@  discard block
 block discarded – undo
3163 3163
                         });
3164 3164
                     }
3165 3165
                 }
3166
-				<?php do_action( 'aui_conditional_fields_js', $this ); ?>
3166
+				<?php do_action('aui_conditional_fields_js', $this); ?>
3167 3167
             </script>
3168 3168
 			<?php
3169 3169
 			$output = ob_get_clean();
3170 3170
 
3171
-			return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
3171
+			return str_replace(array('<script>', '</script>'), '', self::minify_js($output));
3172 3172
 		}
3173 3173
 
3174 3174
 		/**
@@ -3179,10 +3179,10 @@  discard block
 block discarded – undo
3179 3179
 		 * @return bool
3180 3180
 		 */
3181 3181
 		public static function is_block_editor() {
3182
-			if ( is_admin() ) {
3183
-				$current_screen = function_exists('get_current_screen' ) ? get_current_screen() : array();
3182
+			if (is_admin()) {
3183
+				$current_screen = function_exists('get_current_screen') ? get_current_screen() : array();
3184 3184
 
3185
-				if ( ! empty( $current_screen ) && $current_screen->is_block_editor() ) {
3185
+				if (!empty($current_screen) && $current_screen->is_block_editor()) {
3186 3186
 					return true;
3187 3187
 				}
3188 3188
 			}
@@ -3201,7 +3201,7 @@  discard block
 block discarded – undo
3201 3201
 		 */
3202 3202
 		public static function is_block_content_call() {
3203 3203
 			$result = false;
3204
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
3204
+			if (wp_doing_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'super_duper_output_shortcode') {
3205 3205
 				$result = true;
3206 3206
 			}
3207 3207
 
@@ -3217,7 +3217,7 @@  discard block
 block discarded – undo
3217 3217
 		 */
3218 3218
 		public static function is_divi_preview() {
3219 3219
 			$result = false;
3220
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
3220
+			if (isset($_REQUEST['et_fb']) || isset($_REQUEST['et_pb_preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor')) {
3221 3221
 				$result = true;
3222 3222
 			}
3223 3223
 
@@ -3234,7 +3234,7 @@  discard block
 block discarded – undo
3234 3234
 		 */
3235 3235
 		public static function is_elementor_preview() {
3236 3236
 			$result = false;
3237
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
3237
+			if (isset($_REQUEST['elementor-preview']) || (is_admin() && isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor') || (isset($_REQUEST['action']) && $_REQUEST['action'] == 'elementor_ajax')) {
3238 3238
 				$result = true;
3239 3239
 			}
3240 3240
 
@@ -3250,7 +3250,7 @@  discard block
 block discarded – undo
3250 3250
 		 */
3251 3251
 		public static function is_beaver_preview() {
3252 3252
 			$result = false;
3253
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
3253
+			if (isset($_REQUEST['fl_builder'])) {
3254 3254
 				$result = true;
3255 3255
 			}
3256 3256
 
@@ -3266,7 +3266,7 @@  discard block
 block discarded – undo
3266 3266
 		 */
3267 3267
 		public static function is_siteorigin_preview() {
3268 3268
 			$result = false;
3269
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
3269
+			if (!empty($_REQUEST['siteorigin_panels_live_editor'])) {
3270 3270
 				$result = true;
3271 3271
 			}
3272 3272
 
@@ -3282,7 +3282,7 @@  discard block
 block discarded – undo
3282 3282
 		 */
3283 3283
 		public static function is_cornerstone_preview() {
3284 3284
 			$result = false;
3285
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
3285
+			if (!empty($_REQUEST['cornerstone_preview']) || basename($_SERVER['REQUEST_URI']) == 'cornerstone-endpoint') {
3286 3286
 				$result = true;
3287 3287
 			}
3288 3288
 
@@ -3297,7 +3297,7 @@  discard block
 block discarded – undo
3297 3297
 		 */
3298 3298
 		public static function is_fusion_preview() {
3299 3299
 			$result = false;
3300
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
3300
+			if (!empty($_REQUEST['fb-edit']) || !empty($_REQUEST['fusion_load_nonce'])) {
3301 3301
 				$result = true;
3302 3302
 			}
3303 3303
 
@@ -3312,7 +3312,7 @@  discard block
 block discarded – undo
3312 3312
 		 */
3313 3313
 		public static function is_oxygen_preview() {
3314 3314
 			$result = false;
3315
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
3315
+			if (!empty($_REQUEST['ct_builder']) || (!empty($_REQUEST['action']) && (substr($_REQUEST['action'], 0, 11) === "oxy_render_" || substr($_REQUEST['action'], 0, 10) === "ct_render_"))) {
3316 3316
 				$result = true;
3317 3317
 			}
3318 3318
 
@@ -3329,7 +3329,7 @@  discard block
 block discarded – undo
3329 3329
 		public static function is_kallyas_zion_preview() {
3330 3330
 			$result = false;
3331 3331
 
3332
-			if ( function_exists( 'znhg_kallyas_theme_config' ) && ! empty( $_REQUEST['zn_pb_edit'] ) ) {
3332
+			if (function_exists('znhg_kallyas_theme_config') && !empty($_REQUEST['zn_pb_edit'])) {
3333 3333
 				$result = true;
3334 3334
 			}
3335 3335
 
@@ -3346,7 +3346,7 @@  discard block
 block discarded – undo
3346 3346
 		public static function is_bricks_preview() {
3347 3347
 			$result = false;
3348 3348
 
3349
-			if ( function_exists( 'bricks_is_builder' ) && ( bricks_is_builder() || bricks_is_builder_call() ) ) {
3349
+			if (function_exists('bricks_is_builder') && (bricks_is_builder() || bricks_is_builder_call())) {
3350 3350
 				$result = true;
3351 3351
 			}
3352 3352
 
@@ -3363,29 +3363,29 @@  discard block
 block discarded – undo
3363 3363
 		public static function is_preview() {
3364 3364
 			$preview = false;
3365 3365
 
3366
-			if ( self::is_block_editor() ) {
3366
+			if (self::is_block_editor()) {
3367 3367
 				return true;
3368 3368
 			}
3369 3369
 
3370
-			if( self::is_block_content_call() ) {
3370
+			if (self::is_block_content_call()) {
3371 3371
 				$preview = true;
3372
-			} elseif ( self::is_divi_preview() ) {
3372
+			} elseif (self::is_divi_preview()) {
3373 3373
 				$preview = true;
3374
-			} elseif ( self::is_elementor_preview() ) {
3374
+			} elseif (self::is_elementor_preview()) {
3375 3375
 				$preview = true;
3376
-			} elseif ( self::is_beaver_preview() ) {
3376
+			} elseif (self::is_beaver_preview()) {
3377 3377
 				$preview = true;
3378
-			} elseif ( self::is_siteorigin_preview() ) {
3378
+			} elseif (self::is_siteorigin_preview()) {
3379 3379
 				$preview = true;
3380
-			} elseif ( self::is_cornerstone_preview() ) {
3380
+			} elseif (self::is_cornerstone_preview()) {
3381 3381
 				$preview = true;
3382
-			} elseif ( self::is_fusion_preview() ) {
3382
+			} elseif (self::is_fusion_preview()) {
3383 3383
 				$preview = true;
3384
-			} elseif ( self::is_oxygen_preview() ) {
3384
+			} elseif (self::is_oxygen_preview()) {
3385 3385
 				$preview = true;
3386
-			} elseif( self::is_kallyas_zion_preview() ) {
3386
+			} elseif (self::is_kallyas_zion_preview()) {
3387 3387
 				$preview = true;
3388
-			} elseif( self::is_bricks_preview() ) {
3388
+			} elseif (self::is_bricks_preview()) {
3389 3389
 				$preview = true;
3390 3390
 			}
3391 3391
 
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/sd-plugin.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,26 +14,26 @@
 block discarded – undo
14 14
  * Tested up to: 6.8
15 15
  */
16 16
 
17
-if ( ! defined( 'ABSPATH' ) ) {
17
+if (!defined('ABSPATH')) {
18 18
 	exit;
19 19
 }
20 20
 
21
-if ( ! class_exists( 'WP_Super_Duper' ) ) {
21
+if (!class_exists('WP_Super_Duper')) {
22 22
 	// include the class if needed
23
-	include_once( dirname( __FILE__ ) . "/wp-super-duper.php" );
23
+	include_once(dirname(__FILE__) . "/wp-super-duper.php");
24 24
 }
25 25
 
26 26
 /*
27 27
  * Hello world example.
28 28
  */
29
-include_once( dirname( __FILE__ ) . "/hello-world.php" );
29
+include_once(dirname(__FILE__) . "/hello-world.php");
30 30
 
31 31
 /*
32 32
  * Map example.
33 33
  */
34
-include_once( dirname( __FILE__ ) . "/map.php" );
34
+include_once(dirname(__FILE__) . "/map.php");
35 35
 
36 36
 
37
-if ( ! function_exists( 'sd_get_class_build_keys' ) ) {
38
-	include_once( dirname( __FILE__ ) . "/sd-functions.php" );
37
+if (!function_exists('sd_get_class_build_keys')) {
38
+	include_once(dirname(__FILE__) . "/sd-functions.php");
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.