Passed
Pull Request — master (#839)
by Kiran
05:08
created
templates/emails/invoice-item.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -10,73 +10,73 @@
 block discarded – undo
10 10
  * @var array $columns
11 11
  */
12 12
 
13
-defined( 'ABSPATH' ) || exit;
13
+defined('ABSPATH') || exit;
14 14
 
15
-do_action( 'getpaid_before_email_line_item', $invoice, $item );
15
+do_action('getpaid_before_email_line_item', $invoice, $item);
16 16
 ?>
17
-<tr class="wpinv_cart_item item-type-<?php echo esc_attr( $item->get_type() ); ?>">
18
-	<?php foreach ( array_keys( $columns ) as $column ) : ?>
19
-	<td class="<?php echo 'name' == $column ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr( $column ); ?>">
17
+<tr class="wpinv_cart_item item-type-<?php echo esc_attr($item->get_type()); ?>">
18
+	<?php foreach (array_keys($columns) as $column) : ?>
19
+	<td class="<?php echo 'name' == $column ? 'text-left' : 'text-right'; ?> wpinv_cart_item_<?php echo esc_attr($column); ?>">
20 20
 		<?php
21 21
 		// Fires before printing a line item column.
22
-		do_action( "getpaid_email_line_item_before_$column", $item, $invoice );
22
+		do_action("getpaid_email_line_item_before_$column", $item, $invoice);
23 23
 
24 24
 		// Item name.
25
-		if ( 'name' == $column ) {
26
-			$has_featured_image = has_post_thumbnail( $item->get_id() );
25
+		if ('name' == $column) {
26
+			$has_featured_image = has_post_thumbnail($item->get_id());
27 27
 
28
-			if ( $has_featured_image ) {
28
+			if ($has_featured_image) {
29 29
 				echo '<div class="getpaid-email-item-image-wrap" style="min-height:80px">';
30 30
 					echo '<div class="getpaid-email-image-wrap" style="display:inline-block;width:80px;height:80px;">';
31
-						echo get_the_post_thumbnail( $item->get_id(), array( 75, 75 ), array( 'class' => 'wpinv-email-item-image' ) );
31
+						echo get_the_post_thumbnail($item->get_id(), array(75, 75), array('class' => 'wpinv-email-item-image'));
32 32
 					echo '</div>';
33 33
 					echo '<div class="getpaid-email-item-name-wrap" style="display:inline-block;vertical-align:top;max-width:360px;">';
34 34
 			}
35 35
 
36 36
 			// Display the name.
37
-			echo '<div class="wpinv_email_cart_item_title">' . esc_html( $item->get_name() ) . '</div>';
37
+			echo '<div class="wpinv_email_cart_item_title">' . esc_html($item->get_name()) . '</div>';
38 38
 
39 39
 			// And an optional description.
40 40
 			$description = $item->get_description();
41 41
 
42
-			if ( ! empty( $description ) ) {
43
-				echo "<p class='small'>" . wp_kses_post( $description ) . "</p>";
42
+			if (!empty($description)) {
43
+				echo "<p class='small'>" . wp_kses_post($description) . "</p>";
44 44
 			}
45 45
 
46
-			if ( $has_featured_image ) {
46
+			if ($has_featured_image) {
47 47
 					echo '</div>';
48 48
 				echo '</div>';
49 49
 			}
50 50
 		}
51 51
 
52 52
 		// Item price.
53
-		if ( 'price' == $column ) {
53
+		if ('price' == $column) {
54 54
 			// Display the item price (or recurring price if this is a renewal invoice)
55 55
 			$price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price();
56
-			wpinv_the_price( $price, $invoice->get_currency() );
56
+			wpinv_the_price($price, $invoice->get_currency());
57 57
 		}
58 58
 
59 59
 		// Item quantity.
60
-		if ( 'quantity' == $column ) {
60
+		if ('quantity' == $column) {
61 61
 			echo (float) $item->get_quantity();
62 62
 		}
63 63
 
64 64
 		// Tax rate.
65
-		if ( 'tax_rate' == $column ) {
66
-			echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';
65
+		if ('tax_rate' == $column) {
66
+			echo floatval(round(getpaid_get_invoice_tax_rate($invoice, $item), 2)) . '%';
67 67
 		}
68 68
 
69 69
 		// Item sub total.
70
-		if ( 'subtotal' == $column ) {
70
+		if ('subtotal' == $column) {
71 71
 			$subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total();
72
-			wpinv_the_price( $subtotal, $invoice->get_currency() );
72
+			wpinv_the_price($subtotal, $invoice->get_currency());
73 73
 		}
74 74
 
75 75
 		// Fires when printing a line item column.
76
-		do_action( "getpaid_email_line_item_$column", $item, $invoice );
76
+		do_action("getpaid_email_line_item_$column", $item, $invoice);
77 77
 		?>
78 78
 	</td>
79 79
 	<?php endforeach; ?>
80 80
 </tr>
81 81
 
82
-<?php do_action( 'getpaid_after_email_line_item', $invoice, $item ); ?>
82
+<?php do_action('getpaid_after_email_line_item', $invoice, $item); ?>
Please login to merge, or discard this patch.
templates/invoice/line-item.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -10,104 +10,104 @@
 block discarded – undo
10 10
  * @var array $columns
11 11
  */
12 12
 
13
-defined( 'ABSPATH' ) || exit;
13
+defined('ABSPATH') || exit;
14 14
 
15
-do_action( 'getpaid_before_invoice_line_item', $invoice, $item );
15
+do_action('getpaid_before_invoice_line_item', $invoice, $item);
16 16
 
17 17
 ?>
18 18
 
19
-<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo esc_attr( $item->get_type() ); ?> border-bottom'>
19
+<div class='getpaid-invoice-item item-<?php echo (int) $item->get_id(); ?> item-type-<?php echo esc_attr($item->get_type()); ?> border-bottom'>
20 20
 
21 21
 	<div class="form-row row align-items-center">
22 22
 
23
-		<?php foreach ( array_keys( $columns ) as $column ) : ?>
23
+		<?php foreach (array_keys($columns) as $column) : ?>
24 24
 
25
-			<div class="<?php echo 'name' === $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr( $column ); ?>">
25
+			<div class="<?php echo 'name' === $column ? 'col-12 col-sm-6' : 'col-12 col-sm'; ?> getpaid-invoice-item-<?php echo esc_attr($column); ?>">
26 26
 
27 27
 				<?php
28 28
 
29 29
 					// Fires before printing a line item column.
30
-					do_action( "getpaid_invoice_line_item_before_$column", $item, $invoice );
30
+					do_action("getpaid_invoice_line_item_before_$column", $item, $invoice);
31 31
 
32 32
 					// Item name.
33
-					if ( 'name' === $column ) {
33
+					if ('name' === $column) {
34 34
 
35
-						$has_featured_image = has_post_thumbnail( $item->get_id() );
35
+						$has_featured_image = has_post_thumbnail($item->get_id());
36 36
 
37
-						if ( $has_featured_image ) {
37
+						if ($has_featured_image) {
38 38
 							echo '<div class="d-flex align-items-center getpaid-form-item-has-featured-image">';
39 39
 							echo '<div class="getpaid-form-item-image-container mr-2" style="width:85px;">';
40
-							echo get_the_post_thumbnail( $item->get_id(), array( 75, 75 ), array( 'class' => 'getpaid-form-item-image mb-0' ) );
40
+							echo get_the_post_thumbnail($item->get_id(), array(75, 75), array('class' => 'getpaid-form-item-image mb-0'));
41 41
 							echo '</div>';
42 42
 							echo '<div class="getpaid-form-item-name-container">';
43 43
 						}
44 44
 
45 45
 						// Display the name.
46
-						echo '<div class="mb-1">' . esc_html( $item->get_name() ) . '</div>';
46
+						echo '<div class="mb-1">' . esc_html($item->get_name()) . '</div>';
47 47
 
48 48
 						// And an optional description.
49 49
 						$description = $item->get_description();
50 50
 
51
-						if ( ! empty( $description ) ) {
52
-							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post( $description ) . '</small>';
51
+						if (!empty($description)) {
52
+							echo "<small class='form-text text-muted pr-2 m-0'>" . wp_kses_post($description) . '</small>';
53 53
 						}
54 54
 
55 55
 						// Fires before printing the line item actions.
56
-						do_action( 'getpaid_before_invoice_line_item_actions', $item, $invoice );
56
+						do_action('getpaid_before_invoice_line_item_actions', $item, $invoice);
57 57
 
58
-						$actions = apply_filters( 'getpaid-invoice-page-line-item-actions', array(), $item, $invoice );
58
+						$actions = apply_filters('getpaid-invoice-page-line-item-actions', array(), $item, $invoice);
59 59
 
60
-						if ( ! empty( $actions ) ) {
60
+						if (!empty($actions)) {
61 61
 
62
-							$sanitized  = array();
63
-							foreach ( $actions as $key => $item_action ) {
64
-								$key         = sanitize_html_class( $key );
65
-								$item_action = wp_kses_post( $item_action );
62
+							$sanitized = array();
63
+							foreach ($actions as $key => $item_action) {
64
+								$key         = sanitize_html_class($key);
65
+								$item_action = wp_kses_post($item_action);
66 66
 								$sanitized[] = "<span class='$key'>$item_action</span>";
67 67
 							}
68 68
 
69 69
 							echo "<small class='form-text getpaid-line-item-actions'>";
70
-							echo wp_kses_post( implode( ' | ', $sanitized ) );
70
+							echo wp_kses_post(implode(' | ', $sanitized));
71 71
 							echo '</small>';
72 72
 
73 73
 						}
74 74
 
75
-						if ( $has_featured_image ) {
75
+						if ($has_featured_image) {
76 76
 							echo '</div>';
77 77
 							echo '</div>';
78 78
 						}
79 79
 					}
80 80
 
81 81
 					// Item price.
82
-					if ( 'price' === $column ) {
82
+					if ('price' === $column) {
83 83
 
84 84
 					// Display the item price (or recurring price if this is a renewal invoice)
85 85
 					$price = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price();
86
-					wpinv_the_price( $price, $invoice->get_currency() );
86
+					wpinv_the_price($price, $invoice->get_currency());
87 87
 
88 88
 					}
89 89
 
90 90
 					// Tax rate.
91
-					if ( 'tax_rate' === $column ) {
92
-					echo floatval( round( getpaid_get_invoice_tax_rate( $invoice, $item ), 2 ) ) . '%';
91
+					if ('tax_rate' === $column) {
92
+					echo floatval(round(getpaid_get_invoice_tax_rate($invoice, $item), 2)) . '%';
93 93
 					}
94 94
 
95 95
 					// Item quantity.
96
-					if ( 'quantity' === $column ) {
96
+					if ('quantity' === $column) {
97 97
 					echo (float) $item->get_quantity();
98 98
 					}
99 99
 
100 100
 					// Item sub total.
101
-					if ( 'subtotal' === $column ) {
101
+					if ('subtotal' === $column) {
102 102
 					$subtotal = $invoice->is_renewal() ? $item->get_recurring_sub_total() : $item->get_sub_total();
103
-					wpinv_the_price( $subtotal, $invoice->get_currency() );
103
+					wpinv_the_price($subtotal, $invoice->get_currency());
104 104
 					}
105 105
 
106 106
 					// Fires when printing a line item column.
107
-					do_action( "getpaid_invoice_line_item_$column", $item, $invoice );
107
+					do_action("getpaid_invoice_line_item_$column", $item, $invoice);
108 108
 
109 109
 					// Fires after printing a line item column.
110
-					do_action( "getpaid_invoice_line_item_after_$column", $item, $invoice );
110
+					do_action("getpaid_invoice_line_item_after_$column", $item, $invoice);
111 111
 
112 112
 				?>
113 113
 
Please login to merge, or discard this patch.
includes/wpinv-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'>$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.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-input.php 1 patch
Spacing   +313 added lines, -313 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if (!defined('ABSPATH')) {
4 4
 	exit; // Exit if accessed directly
5 5
 }
6 6
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string The rendered component.
20 20
 	 */
21
-	public static function input( $args = array() ) {
21
+	public static function input($args = array()) {
22 22
 		global $aui_bs5;
23 23
 
24 24
 		$defaults = array(
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 		/**
70 70
 		 * Parse incoming $args into an array and merge it with $defaults
71 71
 		 */
72
-		$args   = wp_parse_args( $args, $defaults );
72
+		$args   = wp_parse_args($args, $defaults);
73 73
 		$output = '';
74
-		if ( ! empty( $args['type'] ) ) {
74
+		if (!empty($args['type'])) {
75 75
 			// hidden label option needs to be empty
76 76
 			$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
77 77
 
78
-			$type = sanitize_html_class( $args['type'] );
78
+			$type = sanitize_html_class($args['type']);
79 79
 
80 80
 			$help_text   = '';
81 81
 			$label       = '';
@@ -89,17 +89,17 @@  discard block
 block discarded – undo
89 89
 			);
90 90
 
91 91
 			// floating labels need label after
92
-			if ( $args['label_type'] == 'floating' && $type != 'checkbox' ) {
92
+			if ($args['label_type'] == 'floating' && $type != 'checkbox') {
93 93
 				$label_after         = true;
94 94
 				$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
95 95
 			}
96 96
 
97 97
 			// size
98 98
 			$size = '';
99
-			if ( $args['size'] == 'lg' || $args['size'] == 'large' ) {
99
+			if ($args['size'] == 'lg' || $args['size'] == 'large') {
100 100
 				$size = 'lg';
101 101
 				$args['class'] .= ' form-control-lg';
102
-			}elseif ( $args['size'] == 'sm' || $args['size'] == 'small' ) {
102
+			}elseif ($args['size'] == 'sm' || $args['size'] == 'small') {
103 103
 				$size = 'sm';
104 104
 				$args['class'] .= ' form-control-sm';
105 105
 			}
@@ -108,28 +108,28 @@  discard block
 block discarded – undo
108 108
 			$clear_function = 'jQuery(this).parent().parent().find(\'input\').val(\'\');';
109 109
 
110 110
 			// Some special sauce for files
111
-			if ( $type == 'file' ) {
111
+			if ($type == 'file') {
112 112
 				$label_after = true; // if type file we need the label after
113 113
 				$args['class'] .= ' custom-file-input ';
114
-			} elseif ( $type == 'checkbox' ) {
114
+			} elseif ($type == 'checkbox') {
115 115
 				$label_after = true; // if type file we need the label after
116 116
 				$args['class'] .= $aui_bs5 ? ' form-check-input c-pointer ' : ' custom-control-input c-pointer ';
117
-			} elseif ( $type == 'datepicker' || $type == 'timepicker' ) {
117
+			} elseif ($type == 'datepicker' || $type == 'timepicker') {
118 118
 				$orig_type = $type;
119 119
 				$type = 'text';
120 120
 				$args['class'] .= ' bg-initial '; // @todo not sure why we have this?
121
-				$clear_function .= "jQuery(this).parent().parent().find('input[name=\'" . esc_attr( $args['name'] ) . "\']').trigger('change');";
121
+				$clear_function .= "jQuery(this).parent().parent().find('input[name=\'" . esc_attr($args['name']) . "\']').trigger('change');";
122 122
 
123 123
 				$args['extra_attributes']['data-aui-init'] = 'flatpickr';
124 124
 
125 125
 				// Disable native datetime inputs.
126
-				$disable_mobile_attr = isset( $args['extra_attributes']['data-disable-mobile'] ) ? $args['extra_attributes']['data-disable-mobile'] : 'true';
127
-				$disable_mobile_attr = apply_filters( 'aui_flatpickr_disable_disable_mobile_attr', $disable_mobile_attr, $args );
126
+				$disable_mobile_attr = isset($args['extra_attributes']['data-disable-mobile']) ? $args['extra_attributes']['data-disable-mobile'] : 'true';
127
+				$disable_mobile_attr = apply_filters('aui_flatpickr_disable_disable_mobile_attr', $disable_mobile_attr, $args);
128 128
 
129 129
 				$args['extra_attributes']['data-disable-mobile'] = $disable_mobile_attr;
130 130
 
131 131
 				// set a way to clear field if empty
132
-				if ( $args['input_group_right'] === '' && $args['clear_icon'] !== false ) {
132
+				if ($args['input_group_right'] === '' && $args['clear_icon'] !== false) {
133 133
 					$args['input_group_right_inside'] = true;
134 134
 					$args['clear_icon'] = true;
135 135
 				}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 				// enqueue the script
138 138
 				$aui_settings = AyeCode_UI_Settings::instance();
139 139
 				$aui_settings->enqueue_flatpickr();
140
-			} elseif ( $type == 'iconpicker' ) {
140
+			} elseif ($type == 'iconpicker') {
141 141
 				$type = 'text';
142 142
 				//$args['class'] .= ' aui-flatpickr bg-initial ';
143 143
 //				$args['class'] .= ' bg-initial ';
@@ -152,104 +152,104 @@  discard block
 block discarded – undo
152 152
 				$aui_settings->enqueue_iconpicker();
153 153
 			}
154 154
 
155
-			if ( $type == 'checkbox' && ( ( ! empty( $args['name'] ) && strpos( $args['name'], '[' ) === false ) || ! empty( $args['with_hidden'] ) ) ) {
156
-				$output .= '<input type="hidden" name="' . esc_attr( $args['name'] ) . '" value="0" />';
155
+			if ($type == 'checkbox' && ((!empty($args['name']) && strpos($args['name'], '[') === false) || !empty($args['with_hidden']))) {
156
+				$output .= '<input type="hidden" name="' . esc_attr($args['name']) . '" value="0" />';
157 157
 			}
158 158
 
159 159
 			// allow clear icon
160
-			if ( $args['input_group_right'] === '' && $args['clear_icon'] ) {
161
-				$font_size = $size == 'sm' ? '1.3' : ( $size == 'lg' ? '1.65' : '1.5' );
160
+			if ($args['input_group_right'] === '' && $args['clear_icon']) {
161
+				$font_size = $size == 'sm' ? '1.3' : ($size == 'lg' ? '1.65' : '1.5');
162 162
 				$args['input_group_right_inside'] = true;
163 163
 				$align_class = $aui_bs5 ? ' h-100 py-0' : '';
164
-				$args['input_group_right'] = '<span class="input-group-text aui-clear-input c-pointer bg-initial border-0 px-2 d-none ' . $align_class . '" onclick="' . $clear_function . '"><span style="font-size: ' . $font_size . 'rem" aria-hidden="true" class="' . ( $aui_bs5 ? 'btn-close' : 'close' ) . '">' . ( $aui_bs5 ? '' : '&times;' ) . '</span></span>';
164
+				$args['input_group_right'] = '<span class="input-group-text aui-clear-input c-pointer bg-initial border-0 px-2 d-none ' . $align_class . '" onclick="' . $clear_function . '"><span style="font-size: ' . $font_size . 'rem" aria-hidden="true" class="' . ($aui_bs5 ? 'btn-close' : 'close') . '">' . ($aui_bs5 ? '' : '&times;') . '</span></span>';
165 165
 			}
166 166
 
167 167
 			// open/type
168 168
 			$output .= '<input type="' . $type . '" ';
169 169
 
170 170
 			// name
171
-			if ( ! empty( $args['name'] ) ) {
172
-				$output .= ' name="' . esc_attr( $args['name'] ) . '" ';
171
+			if (!empty($args['name'])) {
172
+				$output .= ' name="' . esc_attr($args['name']) . '" ';
173 173
 			}
174 174
 
175 175
 			// id
176
-			if ( ! empty( $args['id'] ) ) {
177
-				$output .= ' id="' . sanitize_html_class( $args['id'] ) . '" ';
176
+			if (!empty($args['id'])) {
177
+				$output .= ' id="' . sanitize_html_class($args['id']) . '" ';
178 178
 			}
179 179
 
180 180
 			// placeholder
181
-			if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) {
182
-				$output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" ';
181
+			if (isset($args['placeholder']) && '' != $args['placeholder']) {
182
+				$output .= ' placeholder="' . esc_attr($args['placeholder']) . '" ';
183 183
 			}
184 184
 
185 185
 			// title
186
-			if ( ! empty( $args['title'] ) ) {
187
-				$output .= ' title="' . esc_attr( $args['title'] ) . '" ';
186
+			if (!empty($args['title'])) {
187
+				$output .= ' title="' . esc_attr($args['title']) . '" ';
188 188
 			}
189 189
 
190 190
 			// value
191
-			if ( ! empty( $args['value'] ) ) {
192
-				$output .= AUI_Component_Helper::value( $args['value'] );
191
+			if (!empty($args['value'])) {
192
+				$output .= AUI_Component_Helper::value($args['value']);
193 193
 			}
194 194
 
195 195
 			// checked, for radio and checkboxes
196
-			if ( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ) {
196
+			if (($type == 'checkbox' || $type == 'radio') && $args['checked']) {
197 197
 				$output .= ' checked ';
198 198
 			}
199 199
 
200 200
 			// validation text
201
-			if ( ! empty( $args['validation_text'] ) ) {
202
-				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr( addslashes( $args['validation_text'] ) ) . '\')" ';
201
+			if (!empty($args['validation_text'])) {
202
+				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr(addslashes($args['validation_text'])) . '\')" ';
203 203
 				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
204 204
 			}
205 205
 
206 206
 			// validation_pattern
207
-			if ( ! empty( $args['validation_pattern'] ) ) {
208
-				$output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" ';
207
+			if (!empty($args['validation_pattern'])) {
208
+				$output .= ' pattern="' . esc_attr($args['validation_pattern']) . '" ';
209 209
 			}
210 210
 
211 211
 			// step (for numbers)
212
-			if ( ! empty( $args['step'] ) ) {
212
+			if (!empty($args['step'])) {
213 213
 				$output .= ' step="' . $args['step'] . '" ';
214 214
 			}
215 215
 
216 216
 			// required
217
-			if ( ! empty( $args['required'] ) ) {
217
+			if (!empty($args['required'])) {
218 218
 				$output .= ' required ';
219 219
 			}
220 220
 
221 221
 			// class
222
-			$class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
223
-			$output .= $aui_bs5 &&  $type == 'checkbox' ? ' class="' . $class . '" ' : ' class="form-control ' . $class . '" ';
222
+			$class = !empty($args['class']) ? AUI_Component_Helper::esc_classes($args['class']) : '';
223
+			$output .= $aui_bs5 && $type == 'checkbox' ? ' class="' . $class . '" ' : ' class="form-control ' . $class . '" ';
224 224
 
225 225
 			// data-attributes
226
-			$output .= AUI_Component_Helper::data_attributes( $args );
226
+			$output .= AUI_Component_Helper::data_attributes($args);
227 227
 
228 228
 			// extra attributes
229
-			if ( ! empty( $args['extra_attributes'] ) ) {
230
-				$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
229
+			if (!empty($args['extra_attributes'])) {
230
+				$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
231 231
 			}
232 232
 
233 233
 			// close
234 234
 			$output .= ' >';
235 235
 
236 236
 			// help text
237
-			if ( ! empty( $args['help_text'] ) ) {
238
-				$help_text = AUI_Component_Helper::help_text( $args['help_text'] );
237
+			if (!empty($args['help_text'])) {
238
+				$help_text = AUI_Component_Helper::help_text($args['help_text']);
239 239
 			}
240 240
 
241 241
 			// label
242
-			if ( ! empty( $args['label'] ) ) {
242
+			if (!empty($args['label'])) {
243 243
 				$label_base_class = '';
244
-				if ( $type == 'file' ) {
244
+				if ($type == 'file') {
245 245
 					$label_base_class = ' custom-file-label';
246
-				} elseif ( $type == 'checkbox' ) {
247
-					if ( ! empty( $args['label_force_left'] ) ) {
248
-						$label_args['title'] = wp_kses_post( $args['help_text'] );
246
+				} elseif ($type == 'checkbox') {
247
+					if (!empty($args['label_force_left'])) {
248
+						$label_args['title'] = wp_kses_post($args['help_text']);
249 249
 						$help_text = '';
250 250
 						//$label_args['class'] .= ' d-inline ';
251 251
 						$args['wrap_class'] .= ' align-items-center ';
252
-					}else{
252
+					} else {
253 253
 
254 254
 					}
255 255
 
@@ -257,49 +257,49 @@  discard block
 block discarded – undo
257 257
 				}
258 258
 				$label_args['class'] .= $label_base_class;
259 259
 				$temp_label_args = $label_args;
260
-				if(! empty( $args['label_force_left'] )){$temp_label_args['class'] = $label_base_class." text-muted";}
261
-				$label = self::label( $temp_label_args, $type );
260
+				if (!empty($args['label_force_left'])) {$temp_label_args['class'] = $label_base_class . " text-muted"; }
261
+				$label = self::label($temp_label_args, $type);
262 262
 			}
263 263
 
264 264
 
265 265
 
266 266
 
267 267
 			// set help text in the correct position
268
-			if ( $label_after ) {
268
+			if ($label_after) {
269 269
 				$output .= $label . $help_text;
270 270
 			}
271 271
 
272 272
 			// some input types need a separate wrap
273
-			if ( $type == 'file' ) {
274
-				$output = self::wrap( array(
273
+			if ($type == 'file') {
274
+				$output = self::wrap(array(
275 275
 					'content' => $output,
276 276
 					'class'   => $aui_bs5 ? 'mb-3 custom-file' : 'form-group custom-file'
277
-				) );
278
-			} elseif ( $type == 'checkbox' ) {
277
+				));
278
+			} elseif ($type == 'checkbox') {
279 279
 
280 280
 				$label_args['title'] = $args['label'];
281
-				$label_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'label' );
282
-				$label = !empty( $args['label_force_left'] ) ? self::label( $label_args, 'cb' ) : '<div class="' . $label_col . ' col-form-label"></div>';
283
-				$switch_size_class = $args['switch'] && !is_bool( $args['switch'] ) ? ' custom-switch-'.esc_attr( $args['switch'] ) : '';
284
-				if ( $aui_bs5 ) {
281
+				$label_col = AUI_Component_Helper::get_column_class($args['label_col'], 'label');
282
+				$label = !empty($args['label_force_left']) ? self::label($label_args, 'cb') : '<div class="' . $label_col . ' col-form-label"></div>';
283
+				$switch_size_class = $args['switch'] && !is_bool($args['switch']) ? ' custom-switch-' . esc_attr($args['switch']) : '';
284
+				if ($aui_bs5) {
285 285
 					$wrap_class = $args['switch'] ? 'form-check form-switch' . $switch_size_class : 'form-check';
286
-				}else{
287
-					$wrap_class = $args['switch'] ? 'custom-switch' . $switch_size_class :  'custom-checkbox' ;
286
+				} else {
287
+					$wrap_class = $args['switch'] ? 'custom-switch' . $switch_size_class : 'custom-checkbox';
288 288
 				}
289
-				if ( ! empty( $args['label_force_left'] ) ) {
289
+				if (!empty($args['label_force_left'])) {
290 290
 					$wrap_class .= $aui_bs5 ? '' : ' d-flex align-content-center';
291
-					$label = str_replace(array("form-check-label","custom-control-label"),"", self::label( $label_args, 'cb' ) );
291
+					$label = str_replace(array("form-check-label", "custom-control-label"), "", self::label($label_args, 'cb'));
292 292
 				}
293
-				$output     = self::wrap( array(
293
+				$output = self::wrap(array(
294 294
 					'content' => $output,
295 295
 					'class'   => $aui_bs5 ? $wrap_class : 'custom-control ' . $wrap_class
296
-				) );
296
+				));
297 297
 
298
-				if ( $args['label_type'] == 'horizontal' ) {
299
-					$input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
298
+				if ($args['label_type'] == 'horizontal') {
299
+					$input_col = AUI_Component_Helper::get_column_class($args['label_col'], 'input');
300 300
 					$output    = $label . '<div class="' . $input_col . '">' . $output . '</div>';
301 301
 				}
302
-			} elseif ( $type == 'password' && $args['password_toggle'] && ! $args['input_group_right'] ) {
302
+			} elseif ($type == 'password' && $args['password_toggle'] && !$args['input_group_right']) {
303 303
 
304 304
 
305 305
 				// allow password field to toggle view
@@ -313,70 +313,70 @@  discard block
 block discarded – undo
313 313
 			}
314 314
 
315 315
 			// input group wraps
316
-			if ( $args['input_group_left'] || $args['input_group_right'] ) {
317
-				$w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
316
+			if ($args['input_group_left'] || $args['input_group_right']) {
317
+				$w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : '';
318 318
 				$group_size = $size == 'lg' ? ' input-group-lg' : '';
319 319
 				$group_size = !$group_size && $size == 'sm' ? ' input-group-sm' : $group_size;
320 320
 
321
-				if ( $args['input_group_left'] ) {
322
-					$output = self::wrap( array(
321
+				if ($args['input_group_left']) {
322
+					$output = self::wrap(array(
323 323
 						'content'                 => $output,
324 324
 						'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 . $group_size : 'input-group' . $group_size,
325 325
 						'input_group_left'        => $args['input_group_left'],
326 326
 						'input_group_left_inside' => $args['input_group_left_inside']
327
-					) );
327
+					));
328 328
 				}
329
-				if ( $args['input_group_right'] ) {
330
-					$output = self::wrap( array(
329
+				if ($args['input_group_right']) {
330
+					$output = self::wrap(array(
331 331
 						'content'                  => $output,
332 332
 						'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 . $group_size : 'input-group' . $group_size,
333 333
 						'input_group_right'        => $args['input_group_right'],
334 334
 						'input_group_right_inside' => $args['input_group_right_inside']
335
-					) );
335
+					));
336 336
 				}
337 337
 
338 338
 			}
339 339
 
340
-			if ( ! $label_after ) {
340
+			if (!$label_after) {
341 341
 				$output .= $help_text;
342 342
 			}
343 343
 
344 344
 
345
-			if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) {
346
-				$output = self::wrap( array(
345
+			if ($args['label_type'] == 'horizontal' && $type != 'checkbox') {
346
+				$output = self::wrap(array(
347 347
 					'content' => $output,
348
-					'class'   => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' )
349
-				) );
348
+					'class'   => AUI_Component_Helper::get_column_class($args['label_col'], 'input')
349
+				));
350 350
 			}
351 351
 
352
-			if ( ! $label_after ) {
352
+			if (!$label_after) {
353 353
 				$output = $label . $output;
354 354
 			}
355 355
 
356 356
 			// wrap
357
-			if ( ! $args['no_wrap'] ) {
358
-				if ( ! empty( $args['form_group_class'] ) ) {
359
-					$fg_class = esc_attr( $args['form_group_class'] );
360
-				}else{
357
+			if (!$args['no_wrap']) {
358
+				if (!empty($args['form_group_class'])) {
359
+					$fg_class = esc_attr($args['form_group_class']);
360
+				} else {
361 361
 					$fg_class = $aui_bs5 ? 'mb-3' : 'form-group';
362 362
 				}
363 363
 				$form_group_class = $args['label_type'] == 'floating' && $type != 'checkbox' ? 'form-label-group' : $fg_class;
364 364
 				$wrap_class       = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
365
-				$wrap_class       = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
366
-				$output           = self::wrap( array(
365
+				$wrap_class       = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
366
+				$output           = self::wrap(array(
367 367
 					'content'         => $output,
368 368
 					'class'           => $wrap_class,
369 369
 					'element_require' => $args['element_require'],
370 370
 					'argument_id'     => $args['id'],
371 371
 					'wrap_attributes' => $args['wrap_attributes'],
372
-				) );
372
+				));
373 373
 			}
374 374
 		}
375 375
 
376 376
 		return $output;
377 377
 	}
378 378
 
379
-	public static function label( $args = array(), $type = '' ) {
379
+	public static function label($args = array(), $type = '') {
380 380
 		global $aui_bs5;
381 381
 		//<label for="exampleInputEmail1">Email address</label>
382 382
 		$defaults = array(
@@ -390,35 +390,35 @@  discard block
 block discarded – undo
390 390
 		/**
391 391
 		 * Parse incoming $args into an array and merge it with $defaults
392 392
 		 */
393
-		$args   = wp_parse_args( $args, $defaults );
393
+		$args   = wp_parse_args($args, $defaults);
394 394
 		$output = '';
395 395
 
396
-		if ( $args['title'] ) {
396
+		if ($args['title']) {
397 397
 
398 398
 			// maybe hide labels //@todo set a global option for visibility class
399
-			if ( $type == 'file' || $type == 'checkbox' || $type == 'radio' || ! empty( $args['label_type'] ) ) {
399
+			if ($type == 'file' || $type == 'checkbox' || $type == 'radio' || !empty($args['label_type'])) {
400 400
 				$class = $args['class'];
401 401
 			} else {
402 402
 				$class = 'sr-only ' . $args['class'];
403 403
 			}
404 404
 
405 405
 			// maybe horizontal
406
-			if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) {
407
-				$class .= ' ' . AUI_Component_Helper::get_column_class( $args['label_col'], 'label' ) . ' col-form-label '.$type;
406
+			if ($args['label_type'] == 'horizontal' && $type != 'checkbox') {
407
+				$class .= ' ' . AUI_Component_Helper::get_column_class($args['label_col'], 'label') . ' col-form-label ' . $type;
408 408
 			}
409 409
 
410
-			if( $aui_bs5 ){ $class .= ' form-label'; }
410
+			if ($aui_bs5) { $class .= ' form-label'; }
411 411
 
412 412
 			// open
413 413
 			$output .= '<label ';
414 414
 
415 415
 			// for
416
-			if ( ! empty( $args['for'] ) ) {
417
-				$output .= ' for="' . esc_attr( $args['for'] ) . '" ';
416
+			if (!empty($args['for'])) {
417
+				$output .= ' for="' . esc_attr($args['for']) . '" ';
418 418
 			}
419 419
 
420 420
 			// class
421
-			$class = $class ? AUI_Component_Helper::esc_classes( $class ) : '';
421
+			$class = $class ? AUI_Component_Helper::esc_classes($class) : '';
422 422
 			$output .= ' class="' . $class . '" ';
423 423
 
424 424
 			// close
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 
427 427
 
428 428
 			// title, don't escape fully as can contain html
429
-			if ( ! empty( $args['title'] ) ) {
430
-				$output .= wp_kses_post( $args['title'] );
429
+			if (!empty($args['title'])) {
430
+				$output .= wp_kses_post($args['title']);
431 431
 			}
432 432
 
433 433
 			// close wrap
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 *
448 448
 	 * @return string
449 449
 	 */
450
-	public static function wrap( $args = array() ) {
450
+	public static function wrap($args = array()) {
451 451
 		global $aui_bs5;
452 452
 		$defaults = array(
453 453
 			'type'                     => 'div',
@@ -465,31 +465,31 @@  discard block
 block discarded – undo
465 465
 		/**
466 466
 		 * Parse incoming $args into an array and merge it with $defaults
467 467
 		 */
468
-		$args   = wp_parse_args( $args, $defaults );
468
+		$args   = wp_parse_args($args, $defaults);
469 469
 		$output = '';
470
-		if ( $args['type'] ) {
470
+		if ($args['type']) {
471 471
 
472 472
 			// open
473
-			$output .= '<' . sanitize_html_class( $args['type'] );
473
+			$output .= '<' . sanitize_html_class($args['type']);
474 474
 
475 475
 			// element require
476
-			if ( ! empty( $args['element_require'] ) ) {
477
-				$output .= AUI_Component_Helper::element_require( $args['element_require'] );
476
+			if (!empty($args['element_require'])) {
477
+				$output .= AUI_Component_Helper::element_require($args['element_require']);
478 478
 				$args['class'] .= " aui-conditional-field";
479 479
 			}
480 480
 
481 481
 			// argument_id
482
-			if ( ! empty( $args['argument_id'] ) ) {
483
-				$output .= ' data-argument="' . esc_attr( $args['argument_id'] ) . '"';
482
+			if (!empty($args['argument_id'])) {
483
+				$output .= ' data-argument="' . esc_attr($args['argument_id']) . '"';
484 484
 			}
485 485
 
486 486
 			// class
487
-			$class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
487
+			$class = !empty($args['class']) ? AUI_Component_Helper::esc_classes($args['class']) : '';
488 488
 			$output .= ' class="' . $class . '" ';
489 489
 
490 490
 			// Attributes
491
-			if ( ! empty( $args['wrap_attributes'] ) ) {
492
-				$output .= AUI_Component_Helper::extra_attributes( $args['wrap_attributes'] );
491
+			if (!empty($args['wrap_attributes'])) {
492
+				$output .= AUI_Component_Helper::extra_attributes($args['wrap_attributes']);
493 493
 			}
494 494
 
495 495
 			// close wrap
@@ -497,9 +497,9 @@  discard block
 block discarded – undo
497 497
 
498 498
 
499 499
 			// Input group left
500
-			if ( ! empty( $args['input_group_left'] ) ) {
501
-				$position_class   = ! empty( $args['input_group_left_inside'] ) ? 'position-absolute h-100' : '';
502
-				$input_group_left = strpos( $args['input_group_left'], '<' ) !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>';
500
+			if (!empty($args['input_group_left'])) {
501
+				$position_class   = !empty($args['input_group_left_inside']) ? 'position-absolute h-100' : '';
502
+				$input_group_left = strpos($args['input_group_left'], '<') !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>';
503 503
 				$output .= $aui_bs5 ? $input_group_left : '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>';
504 504
 //				$output .= '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>';
505 505
 			}
@@ -508,16 +508,16 @@  discard block
 block discarded – undo
508 508
 			$output .= $args['content'];
509 509
 
510 510
 			// Input group right
511
-			if ( ! empty( $args['input_group_right'] ) ) {
512
-				$position_class    = ! empty( $args['input_group_right_inside'] ) ? 'position-absolute h-100' : '';
513
-				$input_group_right = strpos( $args['input_group_right'], '<' ) !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>';
514
-				$output .= $aui_bs5 ? str_replace( 'input-group-text','input-group-text top-0 end-0', $input_group_right ) : '<div class="input-group-append ' . $position_class . '" style="top:0;right:0;">' . $input_group_right . '</div>';
511
+			if (!empty($args['input_group_right'])) {
512
+				$position_class    = !empty($args['input_group_right_inside']) ? 'position-absolute h-100' : '';
513
+				$input_group_right = strpos($args['input_group_right'], '<') !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>';
514
+				$output .= $aui_bs5 ? str_replace('input-group-text', 'input-group-text top-0 end-0', $input_group_right) : '<div class="input-group-append ' . $position_class . '" style="top:0;right:0;">' . $input_group_right . '</div>';
515 515
 //				$output .= '<div class="input-group-append ' . $position_class . '" style="top:0;right:0;">' . $input_group_right . '</div>';
516 516
 			}
517 517
 
518 518
 
519 519
 			// close wrap
520
-			$output .= '</' . sanitize_html_class( $args['type'] ) . '>';
520
+			$output .= '</' . sanitize_html_class($args['type']) . '>';
521 521
 
522 522
 
523 523
 		} else {
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 	 *
535 535
 	 * @return string The rendered component.
536 536
 	 */
537
-	public static function textarea( $args = array() ) {
537
+	public static function textarea($args = array()) {
538 538
 		global $aui_bs5;
539 539
 
540 540
 		$defaults = array(
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 		/**
575 575
 		 * Parse incoming $args into an array and merge it with $defaults
576 576
 		 */
577
-		$args   = wp_parse_args( $args, $defaults );
577
+		$args   = wp_parse_args($args, $defaults);
578 578
 		$output = '';
579 579
 		$label = '';
580 580
 
@@ -582,21 +582,21 @@  discard block
 block discarded – undo
582 582
 		$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
583 583
 
584 584
 		// floating labels don't work with wysiwyg so set it as top
585
-		if ( $args['label_type'] == 'floating' && ! empty( $args['wysiwyg'] ) ) {
585
+		if ($args['label_type'] == 'floating' && !empty($args['wysiwyg'])) {
586 586
 			$args['label_type'] = 'top';
587 587
 		}
588 588
 
589 589
 		$label_after = $args['label_after'];
590 590
 
591 591
 		// floating labels need label after
592
-		if ( $args['label_type'] == 'floating' && empty( $args['wysiwyg'] ) ) {
592
+		if ($args['label_type'] == 'floating' && empty($args['wysiwyg'])) {
593 593
 			$label_after         = true;
594 594
 			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
595 595
 		}
596 596
 
597 597
 		// label
598
-		if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
599
-		} elseif ( ! empty( $args['label'] ) && ! $label_after ) {
598
+		if (!empty($args['label']) && is_array($args['label'])) {
599
+		} elseif (!empty($args['label']) && !$label_after) {
600 600
 			$label_args = array(
601 601
 				'title'      => $args['label'],
602 602
 				'for'        => $args['id'],
@@ -604,34 +604,34 @@  discard block
 block discarded – undo
604 604
 				'label_type' => $args['label_type'],
605 605
 				'label_col'  => $args['label_col']
606 606
 			);
607
-			$label .= self::label( $label_args );
607
+			$label .= self::label($label_args);
608 608
 		}
609 609
 
610 610
 		// maybe horizontal label
611
-		if ( $args['label_type'] == 'horizontal' ) {
612
-			$input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
611
+		if ($args['label_type'] == 'horizontal') {
612
+			$input_col = AUI_Component_Helper::get_column_class($args['label_col'], 'input');
613 613
 			$label .= '<div class="' . $input_col . '">';
614 614
 		}
615 615
 
616
-		if ( ! empty( $args['wysiwyg'] ) ) {
616
+		if (!empty($args['wysiwyg'])) {
617 617
 			ob_start();
618 618
 			$content   = $args['value'];
619
-			$editor_id = ! empty( $args['id'] ) ? sanitize_html_class( $args['id'] ) : 'wp_editor';
619
+			$editor_id = !empty($args['id']) ? sanitize_html_class($args['id']) : 'wp_editor';
620 620
 			$settings  = array(
621
-				'textarea_rows' => ! empty( absint( $args['rows'] ) ) ? absint( $args['rows'] ) : 4,
621
+				'textarea_rows' => !empty(absint($args['rows'])) ? absint($args['rows']) : 4,
622 622
 				'quicktags'     => false,
623 623
 				'media_buttons' => false,
624 624
 				'editor_class'  => 'form-control',
625
-				'textarea_name' => ! empty( $args['name'] ) ? sanitize_html_class( $args['name'] ) : sanitize_html_class( $args['id'] ),
625
+				'textarea_name' => !empty($args['name']) ? sanitize_html_class($args['name']) : sanitize_html_class($args['id']),
626 626
 				'teeny'         => true,
627 627
 			);
628 628
 
629 629
 			// maybe set settings if array
630
-			if ( is_array( $args['wysiwyg'] ) ) {
631
-				$settings = wp_parse_args( $args['wysiwyg'], $settings );
630
+			if (is_array($args['wysiwyg'])) {
631
+				$settings = wp_parse_args($args['wysiwyg'], $settings);
632 632
 			}
633 633
 
634
-			wp_editor( $content, $editor_id, $settings );
634
+			wp_editor($content, $editor_id, $settings);
635 635
 			$output .= ob_get_clean();
636 636
 		} else {
637 637
 
@@ -639,65 +639,65 @@  discard block
 block discarded – undo
639 639
 			$output .= '<textarea ';
640 640
 
641 641
 			// name
642
-			if ( ! empty( $args['name'] ) ) {
643
-				$output .= ' name="' . esc_attr( $args['name'] ) . '" ';
642
+			if (!empty($args['name'])) {
643
+				$output .= ' name="' . esc_attr($args['name']) . '" ';
644 644
 			}
645 645
 
646 646
 			// id
647
-			if ( ! empty( $args['id'] ) ) {
648
-				$output .= ' id="' . sanitize_html_class( $args['id'] ) . '" ';
647
+			if (!empty($args['id'])) {
648
+				$output .= ' id="' . sanitize_html_class($args['id']) . '" ';
649 649
 			}
650 650
 
651 651
 			// placeholder
652
-			if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) {
653
-				$output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" ';
652
+			if (isset($args['placeholder']) && '' != $args['placeholder']) {
653
+				$output .= ' placeholder="' . esc_attr($args['placeholder']) . '" ';
654 654
 			}
655 655
 
656 656
 			// title
657
-			if ( ! empty( $args['title'] ) ) {
658
-				$output .= ' title="' . esc_attr( $args['title'] ) . '" ';
657
+			if (!empty($args['title'])) {
658
+				$output .= ' title="' . esc_attr($args['title']) . '" ';
659 659
 			}
660 660
 
661 661
 			// validation text
662
-			if ( ! empty( $args['validation_text'] ) ) {
663
-				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr( addslashes( $args['validation_text'] ) ) . '\')" ';
662
+			if (!empty($args['validation_text'])) {
663
+				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr(addslashes($args['validation_text'])) . '\')" ';
664 664
 				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
665 665
 			}
666 666
 
667 667
 			// validation_pattern
668
-			if ( ! empty( $args['validation_pattern'] ) ) {
669
-				$output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" ';
668
+			if (!empty($args['validation_pattern'])) {
669
+				$output .= ' pattern="' . esc_attr($args['validation_pattern']) . '" ';
670 670
 			}
671 671
 
672 672
 			// required
673
-			if ( ! empty( $args['required'] ) ) {
673
+			if (!empty($args['required'])) {
674 674
 				$output .= ' required ';
675 675
 			}
676 676
 
677 677
 			// rows
678
-			if ( ! empty( $args['rows'] ) ) {
679
-				$output .= ' rows="' . absint( $args['rows'] ) . '" ';
678
+			if (!empty($args['rows'])) {
679
+				$output .= ' rows="' . absint($args['rows']) . '" ';
680 680
 			}
681 681
 
682 682
 
683 683
 			// class
684
-			$class = ! empty( $args['class'] ) ? $args['class'] : '';
684
+			$class = !empty($args['class']) ? $args['class'] : '';
685 685
 			$output .= ' class="form-control ' . $class . '" ';
686 686
 
687 687
 			// extra attributes
688
-			if ( ! empty( $args['extra_attributes'] ) ) {
689
-				$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
688
+			if (!empty($args['extra_attributes'])) {
689
+				$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
690 690
 			}
691 691
 
692 692
 			// close tag
693 693
 			$output .= ' >';
694 694
 
695 695
 			// value
696
-			if ( ! empty( $args['value'] ) ) {
697
-				if ( ! empty( $args['allow_tags'] ) ) {
698
-					$output .= AUI_Component_Helper::sanitize_html_field( $args['value'], $args ); // Sanitize HTML.
696
+			if (!empty($args['value'])) {
697
+				if (!empty($args['allow_tags'])) {
698
+					$output .= AUI_Component_Helper::sanitize_html_field($args['value'], $args); // Sanitize HTML.
699 699
 				} else {
700
-					$output .= AUI_Component_Helper::sanitize_textarea_field( $args['value'] );
700
+					$output .= AUI_Component_Helper::sanitize_textarea_field($args['value']);
701 701
 				}
702 702
 			}
703 703
 
@@ -706,23 +706,23 @@  discard block
 block discarded – undo
706 706
 
707 707
 
708 708
 			// input group wraps
709
-			if ( $args['input_group_left'] || $args['input_group_right'] ) {
710
-				$w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
711
-				if ( $args['input_group_left'] ) {
712
-					$output = self::wrap( array(
709
+			if ($args['input_group_left'] || $args['input_group_right']) {
710
+				$w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : '';
711
+				if ($args['input_group_left']) {
712
+					$output = self::wrap(array(
713 713
 						'content'                 => $output,
714 714
 						'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
715 715
 						'input_group_left'        => $args['input_group_left'],
716 716
 						'input_group_left_inside' => $args['input_group_left_inside']
717
-					) );
717
+					));
718 718
 				}
719
-				if ( $args['input_group_right'] ) {
720
-					$output = self::wrap( array(
719
+				if ($args['input_group_right']) {
720
+					$output = self::wrap(array(
721 721
 						'content'                  => $output,
722 722
 						'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
723 723
 						'input_group_right'        => $args['input_group_right'],
724 724
 						'input_group_right_inside' => $args['input_group_right_inside']
725
-					) );
725
+					));
726 726
 				}
727 727
 
728 728
 			}
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 
731 731
 		}
732 732
 
733
-		if ( ! empty( $args['label'] ) && $label_after ) {
733
+		if (!empty($args['label']) && $label_after) {
734 734
 			$label_args = array(
735 735
 				'title'      => $args['label'],
736 736
 				'for'        => $args['id'],
@@ -738,41 +738,41 @@  discard block
 block discarded – undo
738 738
 				'label_type' => $args['label_type'],
739 739
 				'label_col'  => $args['label_col']
740 740
 			);
741
-			$output .= self::label( $label_args );
741
+			$output .= self::label($label_args);
742 742
 		}
743 743
 
744 744
 		// help text
745
-		if ( ! empty( $args['help_text'] ) ) {
746
-			$output .= AUI_Component_Helper::help_text( $args['help_text'] );
745
+		if (!empty($args['help_text'])) {
746
+			$output .= AUI_Component_Helper::help_text($args['help_text']);
747 747
 		}
748 748
 
749
-		if ( ! $label_after ) {
749
+		if (!$label_after) {
750 750
 			$output = $label . $output;
751 751
 		}
752 752
 
753 753
 		// maybe horizontal label
754
-		if ( $args['label_type'] == 'horizontal' ) {
754
+		if ($args['label_type'] == 'horizontal') {
755 755
 			$output .= '</div>';
756 756
 		}
757 757
 
758 758
 
759 759
 		// wrap
760
-		if ( ! $args['no_wrap'] ) {
761
-			if ( ! empty( $args['form_group_class'] ) ) {
762
-				$fg_class = esc_attr( $args['form_group_class'] );
763
-			}else{
760
+		if (!$args['no_wrap']) {
761
+			if (!empty($args['form_group_class'])) {
762
+				$fg_class = esc_attr($args['form_group_class']);
763
+			} else {
764 764
 				$fg_class = $aui_bs5 ? 'mb-3' : 'form-group';
765 765
 			}
766 766
 			$form_group_class = $args['label_type'] == 'floating' ? 'form-label-group' : $fg_class;
767 767
 			$wrap_class       = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
768
-			$wrap_class       = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
769
-			$output           = self::wrap( array(
768
+			$wrap_class       = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
769
+			$output           = self::wrap(array(
770 770
 				'content'         => $output,
771 771
 				'class'           => $wrap_class,
772 772
 				'element_require' => $args['element_require'],
773 773
 				'argument_id'     => $args['id'],
774 774
 				'wrap_attributes' => $args['wrap_attributes'],
775
-			) );
775
+			));
776 776
 		}
777 777
 
778 778
 
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 	 *
787 787
 	 * @return string The rendered component.
788 788
 	 */
789
-	public static function select( $args = array() ) {
789
+	public static function select($args = array()) {
790 790
 		global $aui_bs5, $aui_has_select2, $aui_select2_enqueued;
791 791
 
792 792
 		$defaults = array(
@@ -826,11 +826,11 @@  discard block
 block discarded – undo
826 826
 		/**
827 827
 		 * Parse incoming $args into an array and merge it with $defaults
828 828
 		 */
829
-		$args   = wp_parse_args( $args, $defaults );
829
+		$args   = wp_parse_args($args, $defaults);
830 830
 		$output = '';
831 831
 
832 832
 		// for now lets hide floating labels
833
-		if ( $args['label_type'] == 'floating' ) {
833
+		if ($args['label_type'] == 'floating') {
834 834
 			$args['label_type'] = 'hidden';
835 835
 		}
836 836
 
@@ -841,26 +841,26 @@  discard block
 block discarded – undo
841 841
 		$label_after = $args['label_after'];
842 842
 
843 843
 		// floating labels need label after
844
-		if ( $args['label_type'] == 'floating' ) {
844
+		if ($args['label_type'] == 'floating') {
845 845
 			$label_after         = true;
846 846
 			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
847 847
 		}
848 848
 
849 849
 		// Maybe setup select2
850 850
 		$is_select2 = false;
851
-		if ( ! empty( $args['select2'] ) ) {
851
+		if (!empty($args['select2'])) {
852 852
 			$args['class'] .= ' aui-select2';
853 853
 			$is_select2 = true;
854
-		} elseif ( strpos( $args['class'], 'aui-select2' ) !== false ) {
854
+		} elseif (strpos($args['class'], 'aui-select2') !== false) {
855 855
 			$is_select2 = true;
856 856
 		}
857 857
 
858
-		if ( $is_select2 && ! $aui_has_select2 ) {
858
+		if ($is_select2 && !$aui_has_select2) {
859 859
 			$aui_has_select2 = true;
860
-			$conditional_select2 = apply_filters( 'aui_is_conditional_select2', true );
860
+			$conditional_select2 = apply_filters('aui_is_conditional_select2', true);
861 861
 
862 862
 			// Enqueue the script,
863
-			if ( empty( $aui_select2_enqueued ) && $conditional_select2 === true ) {
863
+			if (empty($aui_select2_enqueued) && $conditional_select2 === true) {
864 864
 				$aui_select2_enqueued = true;
865 865
 
866 866
 				$aui_settings = AyeCode_UI_Settings::instance();
@@ -869,75 +869,75 @@  discard block
 block discarded – undo
869 869
 		}
870 870
 
871 871
 		// select2 tags
872
-		if ( ! empty( $args['select2'] ) && $args['select2'] === 'tags' ) { // triple equals needed here for some reason
872
+		if (!empty($args['select2']) && $args['select2'] === 'tags') { // triple equals needed here for some reason
873 873
 			$args['data-tags']             = 'true';
874 874
 			$args['data-token-separators'] = "[',']";
875 875
 			$args['multiple']              = true;
876 876
 		}
877 877
 
878 878
 		// select2 placeholder
879
-		if ( $is_select2 && isset( $args['placeholder'] ) && '' != $args['placeholder'] && empty( $args['data-placeholder'] ) ) {
880
-			$args['data-placeholder'] = esc_attr( $args['placeholder'] );
881
-			$args['data-allow-clear'] = isset( $args['data-allow-clear'] ) ? (bool) $args['data-allow-clear'] : true;
879
+		if ($is_select2 && isset($args['placeholder']) && '' != $args['placeholder'] && empty($args['data-placeholder'])) {
880
+			$args['data-placeholder'] = esc_attr($args['placeholder']);
881
+			$args['data-allow-clear'] = isset($args['data-allow-clear']) ? (bool) $args['data-allow-clear'] : true;
882 882
 		}
883 883
 
884 884
 		// Set hidden input to save empty value for multiselect.
885
-		if ( ! empty( $args['multiple'] ) && ! empty( $args['name'] ) ) {
886
-			$output .= '<input type="hidden" ' . AUI_Component_Helper::name( $args['name'] ) . ' value="" data-ignore-rule/>';
885
+		if (!empty($args['multiple']) && !empty($args['name'])) {
886
+			$output .= '<input type="hidden" ' . AUI_Component_Helper::name($args['name']) . ' value="" data-ignore-rule/>';
887 887
 		}
888 888
 
889 889
 		// open/type
890 890
 		$output .= '<select ';
891 891
 
892 892
 		// style
893
-		if ( $is_select2 && !($args['input_group_left'] || $args['input_group_right'])) {
893
+		if ($is_select2 && !($args['input_group_left'] || $args['input_group_right'])) {
894 894
 			$output .= " style='width:100%;' ";
895 895
 		}
896 896
 
897 897
 		// element require
898
-		if ( ! empty( $args['element_require'] ) ) {
899
-			$output .= AUI_Component_Helper::element_require( $args['element_require'] );
898
+		if (!empty($args['element_require'])) {
899
+			$output .= AUI_Component_Helper::element_require($args['element_require']);
900 900
 			$args['class'] .= " aui-conditional-field";
901 901
 		}
902 902
 
903 903
 		// class
904
-		$class = ! empty( $args['class'] ) ? $args['class'] : '';
904
+		$class = !empty($args['class']) ? $args['class'] : '';
905 905
 		$select_class = $aui_bs5 ? 'form-select ' : 'custom-select ';
906
-		$output .= AUI_Component_Helper::class_attr( $select_class . $class );
906
+		$output .= AUI_Component_Helper::class_attr($select_class . $class);
907 907
 
908 908
 		// name
909
-		if ( ! empty( $args['name'] ) ) {
910
-			$output .= AUI_Component_Helper::name( $args['name'], $args['multiple'] );
909
+		if (!empty($args['name'])) {
910
+			$output .= AUI_Component_Helper::name($args['name'], $args['multiple']);
911 911
 		}
912 912
 
913 913
 		// id
914
-		if ( ! empty( $args['id'] ) ) {
915
-			$output .= AUI_Component_Helper::id( $args['id'] );
914
+		if (!empty($args['id'])) {
915
+			$output .= AUI_Component_Helper::id($args['id']);
916 916
 		}
917 917
 
918 918
 		// title
919
-		if ( ! empty( $args['title'] ) ) {
920
-			$output .= AUI_Component_Helper::title( $args['title'] );
919
+		if (!empty($args['title'])) {
920
+			$output .= AUI_Component_Helper::title($args['title']);
921 921
 		}
922 922
 
923 923
 		// data-attributes
924
-		$output .= AUI_Component_Helper::data_attributes( $args );
924
+		$output .= AUI_Component_Helper::data_attributes($args);
925 925
 
926 926
 		// aria-attributes
927
-		$output .= AUI_Component_Helper::aria_attributes( $args );
927
+		$output .= AUI_Component_Helper::aria_attributes($args);
928 928
 
929 929
 		// extra attributes
930
-		if ( ! empty( $args['extra_attributes'] ) ) {
931
-			$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
930
+		if (!empty($args['extra_attributes'])) {
931
+			$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
932 932
 		}
933 933
 
934 934
 		// required
935
-		if ( ! empty( $args['required'] ) ) {
935
+		if (!empty($args['required'])) {
936 936
 			$output .= ' required ';
937 937
 		}
938 938
 
939 939
 		// multiple
940
-		if ( ! empty( $args['multiple'] ) ) {
940
+		if (!empty($args['multiple'])) {
941 941
 			$output .= ' multiple ';
942 942
 		}
943 943
 
@@ -945,50 +945,50 @@  discard block
 block discarded – undo
945 945
 		$output .= ' >';
946 946
 
947 947
 		// placeholder
948
-		if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] && ! $is_select2 ) {
949
-			$output .= '<option value="" disabled selected hidden>' . esc_attr( $args['placeholder'] ) . '</option>';
950
-		} elseif ( $is_select2 && ! empty( $args['placeholder'] ) ) {
948
+		if (isset($args['placeholder']) && '' != $args['placeholder'] && !$is_select2) {
949
+			$output .= '<option value="" disabled selected hidden>' . esc_attr($args['placeholder']) . '</option>';
950
+		} elseif ($is_select2 && !empty($args['placeholder'])) {
951 951
 			$output .= "<option></option>"; // select2 needs an empty select to fill the placeholder
952 952
 		}
953 953
 
954 954
 		// Options
955
-		if ( ! empty( $args['options'] ) ) {
955
+		if (!empty($args['options'])) {
956 956
 
957
-			if ( ! is_array( $args['options'] ) ) {
957
+			if (!is_array($args['options'])) {
958 958
 				$output .= $args['options']; // not the preferred way but an option
959 959
 			} else {
960
-				foreach ( $args['options'] as $val => $name ) {
960
+				foreach ($args['options'] as $val => $name) {
961 961
 					$selected = '';
962
-					if ( is_array( $name ) ) {
963
-						if ( isset( $name['optgroup'] ) && ( $name['optgroup'] == 'start' || $name['optgroup'] == 'end' ) ) {
964
-							$option_label = isset( $name['label'] ) ? $name['label'] : '';
962
+					if (is_array($name)) {
963
+						if (isset($name['optgroup']) && ($name['optgroup'] == 'start' || $name['optgroup'] == 'end')) {
964
+							$option_label = isset($name['label']) ? $name['label'] : '';
965 965
 
966
-							$output .= $name['optgroup'] == 'start' ? '<optgroup label="' . esc_attr( $option_label ) . '">' : '</optgroup>';
966
+							$output .= $name['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
967 967
 						} else {
968
-							$option_label = isset( $name['label'] ) ? $name['label'] : '';
969
-							$option_value = isset( $name['value'] ) ? $name['value'] : '';
970
-							$extra_attributes = !empty($name['extra_attributes']) ? AUI_Component_Helper::extra_attributes( $name['extra_attributes'] ) : '';
971
-							if ( ! empty( $args['multiple'] ) && ! empty( $args['value'] ) && is_array( $args['value'] ) ) {
972
-								$selected = in_array( $option_value, stripslashes_deep( $args['value'] ) ) ? "selected" : "";
973
-							} elseif ( ! empty( $args['value'] ) ) {
974
-								$selected = selected( $option_value, stripslashes_deep( $args['value'] ), false );
975
-							} elseif ( empty( $args['value'] ) && $args['value'] === $option_value ) {
976
-								$selected = selected( $option_value, $args['value'], false );
968
+							$option_label = isset($name['label']) ? $name['label'] : '';
969
+							$option_value = isset($name['value']) ? $name['value'] : '';
970
+							$extra_attributes = !empty($name['extra_attributes']) ? AUI_Component_Helper::extra_attributes($name['extra_attributes']) : '';
971
+							if (!empty($args['multiple']) && !empty($args['value']) && is_array($args['value'])) {
972
+								$selected = in_array($option_value, stripslashes_deep($args['value'])) ? "selected" : "";
973
+							} elseif (!empty($args['value'])) {
974
+								$selected = selected($option_value, stripslashes_deep($args['value']), false);
975
+							} elseif (empty($args['value']) && $args['value'] === $option_value) {
976
+								$selected = selected($option_value, $args['value'], false);
977 977
 							}
978 978
 
979
-							$output .= '<option value="' . esc_attr( $option_value ) . '" ' . $selected . ' '.$extra_attributes .'>' . $option_label . '</option>';
979
+							$output .= '<option value="' . esc_attr($option_value) . '" ' . $selected . ' ' . $extra_attributes . '>' . $option_label . '</option>';
980 980
 						}
981 981
 					} else {
982
-						if ( ! empty( $args['value'] ) ) {
983
-							if ( is_array( $args['value'] ) ) {
984
-								$selected = in_array( $val, $args['value'] ) ? 'selected="selected"' : '';
985
-							} elseif ( ! empty( $args['value'] ) ) {
986
-								$selected = selected( $args['value'], $val, false );
982
+						if (!empty($args['value'])) {
983
+							if (is_array($args['value'])) {
984
+								$selected = in_array($val, $args['value']) ? 'selected="selected"' : '';
985
+							} elseif (!empty($args['value'])) {
986
+								$selected = selected($args['value'], $val, false);
987 987
 							}
988
-						} elseif ( $args['value'] === $val ) {
989
-							$selected = selected( $args['value'], $val, false );
988
+						} elseif ($args['value'] === $val) {
989
+							$selected = selected($args['value'], $val, false);
990 990
 						}
991
-						$output .= '<option value="' . esc_attr( $val ) . '" ' . $selected . '>' . esc_attr( $name ) . '</option>';
991
+						$output .= '<option value="' . esc_attr($val) . '" ' . $selected . '>' . esc_attr($name) . '</option>';
992 992
 					}
993 993
 				}
994 994
 			}
@@ -1001,8 +1001,8 @@  discard block
 block discarded – undo
1001 1001
 		$label = '';
1002 1002
 		$help_text = '';
1003 1003
 		// label
1004
-		if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
1005
-		} elseif ( ! empty( $args['label'] ) && ! $label_after ) {
1004
+		if (!empty($args['label']) && is_array($args['label'])) {
1005
+		} elseif (!empty($args['label']) && !$label_after) {
1006 1006
 			$label_args = array(
1007 1007
 				'title'      => $args['label'],
1008 1008
 				'for'        => $args['id'],
@@ -1010,49 +1010,49 @@  discard block
 block discarded – undo
1010 1010
 				'label_type' => $args['label_type'],
1011 1011
 				'label_col'  => $args['label_col']
1012 1012
 			);
1013
-			$label = self::label( $label_args );
1013
+			$label = self::label($label_args);
1014 1014
 		}
1015 1015
 
1016 1016
 		// help text
1017
-		if ( ! empty( $args['help_text'] ) ) {
1018
-			$help_text = AUI_Component_Helper::help_text( $args['help_text'] );
1017
+		if (!empty($args['help_text'])) {
1018
+			$help_text = AUI_Component_Helper::help_text($args['help_text']);
1019 1019
 		}
1020 1020
 
1021 1021
 		// input group wraps
1022
-		if ( $args['input_group_left'] || $args['input_group_right'] ) {
1023
-			$w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
1024
-			if ( $args['input_group_left'] ) {
1025
-				$output = self::wrap( array(
1022
+		if ($args['input_group_left'] || $args['input_group_right']) {
1023
+			$w100 = strpos($args['class'], 'w-100') !== false ? ' w-100' : '';
1024
+			if ($args['input_group_left']) {
1025
+				$output = self::wrap(array(
1026 1026
 					'content'                 => $output,
1027 1027
 					'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
1028 1028
 					'input_group_left'        => $args['input_group_left'],
1029 1029
 					'input_group_left_inside' => $args['input_group_left_inside']
1030
-				) );
1030
+				));
1031 1031
 			}
1032
-			if ( $args['input_group_right'] ) {
1033
-				$output = self::wrap( array(
1032
+			if ($args['input_group_right']) {
1033
+				$output = self::wrap(array(
1034 1034
 					'content'                  => $output,
1035 1035
 					'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
1036 1036
 					'input_group_right'        => $args['input_group_right'],
1037 1037
 					'input_group_right_inside' => $args['input_group_right_inside']
1038
-				) );
1038
+				));
1039 1039
 			}
1040 1040
 
1041 1041
 		}
1042 1042
 
1043
-		if ( ! $label_after ) {
1043
+		if (!$label_after) {
1044 1044
 			$output .= $help_text;
1045 1045
 		}
1046 1046
 
1047 1047
 
1048
-		if ( $args['label_type'] == 'horizontal' ) {
1049
-			$output = self::wrap( array(
1048
+		if ($args['label_type'] == 'horizontal') {
1049
+			$output = self::wrap(array(
1050 1050
 				'content' => $output,
1051
-				'class'   => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' )
1052
-			) );
1051
+				'class'   => AUI_Component_Helper::get_column_class($args['label_col'], 'input')
1052
+			));
1053 1053
 		}
1054 1054
 
1055
-		if ( ! $label_after ) {
1055
+		if (!$label_after) {
1056 1056
 			$output = $label . $output;
1057 1057
 		}
1058 1058
 
@@ -1063,21 +1063,21 @@  discard block
 block discarded – undo
1063 1063
 
1064 1064
 
1065 1065
 		// wrap
1066
-		if ( ! $args['no_wrap'] ) {
1067
-			if ( ! empty( $args['form_group_class'] ) ) {
1068
-				$fg_class = esc_attr( $args['form_group_class'] );
1069
-			}else{
1066
+		if (!$args['no_wrap']) {
1067
+			if (!empty($args['form_group_class'])) {
1068
+				$fg_class = esc_attr($args['form_group_class']);
1069
+			} else {
1070 1070
 				$fg_class = $aui_bs5 ? 'mb-3' : 'form-group';
1071 1071
 			}
1072 1072
 			$wrap_class = $args['label_type'] == 'horizontal' ? $fg_class . ' row' : $fg_class;
1073
-			$wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
1074
-			$output     = self::wrap( array(
1073
+			$wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
1074
+			$output     = self::wrap(array(
1075 1075
 				'content'         => $output,
1076 1076
 				'class'           => $wrap_class,
1077 1077
 				'element_require' => $args['element_require'],
1078 1078
 				'argument_id'     => $args['id'],
1079 1079
 				'wrap_attributes' => $args['wrap_attributes'],
1080
-			) );
1080
+			));
1081 1081
 		}
1082 1082
 
1083 1083
 
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 	 *
1092 1092
 	 * @return string The rendered component.
1093 1093
 	 */
1094
-	public static function radio( $args = array() ) {
1094
+	public static function radio($args = array()) {
1095 1095
 		global $aui_bs5;
1096 1096
 
1097 1097
 		$defaults = array(
@@ -1123,10 +1123,10 @@  discard block
 block discarded – undo
1123 1123
 		/**
1124 1124
 		 * Parse incoming $args into an array and merge it with $defaults
1125 1125
 		 */
1126
-		$args = wp_parse_args( $args, $defaults );
1126
+		$args = wp_parse_args($args, $defaults);
1127 1127
 
1128 1128
 		// for now lets use horizontal for floating
1129
-		if ( $args['label_type'] == 'floating' ) {
1129
+		if ($args['label_type'] == 'floating') {
1130 1130
 			$args['label_type'] = 'horizontal';
1131 1131
 		}
1132 1132
 
@@ -1137,10 +1137,10 @@  discard block
 block discarded – undo
1137 1137
 			'label_col'  => $args['label_col']
1138 1138
 		);
1139 1139
 
1140
-		if ( $args['label_type'] == 'top' || $args['label_type'] == 'hidden' ) {
1140
+		if ($args['label_type'] == 'top' || $args['label_type'] == 'hidden') {
1141 1141
 			$label_args['class'] .= 'd-block ';
1142 1142
 
1143
-			if ( $args['label_type'] == 'hidden' ) {
1143
+			if ($args['label_type'] == 'hidden') {
1144 1144
 				$label_args['class'] .= 'sr-only ';
1145 1145
 			}
1146 1146
 		}
@@ -1148,48 +1148,48 @@  discard block
 block discarded – undo
1148 1148
 		$output = '';
1149 1149
 
1150 1150
 		// label before
1151
-		if ( ! empty( $args['label'] ) ) {
1152
-			$output .= self::label( $label_args, 'radio' );
1151
+		if (!empty($args['label'])) {
1152
+			$output .= self::label($label_args, 'radio');
1153 1153
 		}
1154 1154
 
1155 1155
 		// maybe horizontal label
1156
-		if ( $args['label_type'] == 'horizontal' ) {
1157
-			$input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
1156
+		if ($args['label_type'] == 'horizontal') {
1157
+			$input_col = AUI_Component_Helper::get_column_class($args['label_col'], 'input');
1158 1158
 			$output .= '<div class="' . $input_col . '">';
1159 1159
 		}
1160 1160
 
1161
-		if ( ! empty( $args['options'] ) ) {
1161
+		if (!empty($args['options'])) {
1162 1162
 			$count = 0;
1163
-			foreach ( $args['options'] as $value => $label ) {
1163
+			foreach ($args['options'] as $value => $label) {
1164 1164
 				$option_args            = $args;
1165 1165
 				$option_args['value']   = $value;
1166 1166
 				$option_args['label']   = $label;
1167 1167
 				$option_args['checked'] = $value == $args['value'] ? true : false;
1168
-				$output .= self::radio_option( $option_args, $count );
1169
-				$count ++;
1168
+				$output .= self::radio_option($option_args, $count);
1169
+				$count++;
1170 1170
 			}
1171 1171
 		}
1172 1172
 
1173 1173
 		// help text
1174
-		$help_text = ! empty( $args['help_text'] ) ? AUI_Component_Helper::help_text( $args['help_text'] ) : '';
1174
+		$help_text = !empty($args['help_text']) ? AUI_Component_Helper::help_text($args['help_text']) : '';
1175 1175
 		$output .= $help_text;
1176 1176
 
1177 1177
 		// maybe horizontal label
1178
-		if ( $args['label_type'] == 'horizontal' ) {
1178
+		if ($args['label_type'] == 'horizontal') {
1179 1179
 			$output .= '</div>';
1180 1180
 		}
1181 1181
 
1182 1182
 		// wrap
1183 1183
 		$fg_class = $aui_bs5 ? 'mb-3' : 'form-group';
1184 1184
 		$wrap_class = $args['label_type'] == 'horizontal' ? $fg_class . ' row' : $fg_class;
1185
-		$wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
1186
-		$output     = self::wrap( array(
1185
+		$wrap_class = !empty($args['wrap_class']) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
1186
+		$output     = self::wrap(array(
1187 1187
 			'content'         => $output,
1188 1188
 			'class'           => $wrap_class,
1189 1189
 			'element_require' => $args['element_require'],
1190 1190
 			'argument_id'     => $args['id'],
1191 1191
 			'wrap_attributes' => $args['wrap_attributes'],
1192
-		) );
1192
+		));
1193 1193
 
1194 1194
 
1195 1195
 		return $output;
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
 	 *
1203 1203
 	 * @return string The rendered component.
1204 1204
 	 */
1205
-	public static function radio_option( $args = array(), $count = '' ) {
1205
+	public static function radio_option($args = array(), $count = '') {
1206 1206
 		$defaults = array(
1207 1207
 			'class'            => '',
1208 1208
 			'id'               => '',
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
 		/**
1221 1221
 		 * Parse incoming $args into an array and merge it with $defaults
1222 1222
 		 */
1223
-		$args = wp_parse_args( $args, $defaults );
1223
+		$args = wp_parse_args($args, $defaults);
1224 1224
 
1225 1225
 		$output = '';
1226 1226
 
@@ -1231,43 +1231,43 @@  discard block
 block discarded – undo
1231 1231
 		$output .= ' class="form-check-input" ';
1232 1232
 
1233 1233
 		// name
1234
-		if ( ! empty( $args['name'] ) ) {
1235
-			$output .= AUI_Component_Helper::name( $args['name'] );
1234
+		if (!empty($args['name'])) {
1235
+			$output .= AUI_Component_Helper::name($args['name']);
1236 1236
 		}
1237 1237
 
1238 1238
 		// id
1239
-		if ( ! empty( $args['id'] ) ) {
1240
-			$output .= AUI_Component_Helper::id( $args['id'] . $count );
1239
+		if (!empty($args['id'])) {
1240
+			$output .= AUI_Component_Helper::id($args['id'] . $count);
1241 1241
 		}
1242 1242
 
1243 1243
 		// title
1244
-		if ( ! empty( $args['title'] ) ) {
1245
-			$output .= AUI_Component_Helper::title( $args['title'] );
1244
+		if (!empty($args['title'])) {
1245
+			$output .= AUI_Component_Helper::title($args['title']);
1246 1246
 		}
1247 1247
 
1248 1248
 		// value
1249
-		if ( isset( $args['value'] ) ) {
1250
-			$output .= AUI_Component_Helper::value( $args['value'] );
1249
+		if (isset($args['value'])) {
1250
+			$output .= AUI_Component_Helper::value($args['value']);
1251 1251
 		}
1252 1252
 
1253 1253
 		// checked, for radio and checkboxes
1254
-		if ( $args['checked'] ) {
1254
+		if ($args['checked']) {
1255 1255
 			$output .= ' checked ';
1256 1256
 		}
1257 1257
 
1258 1258
 		// data-attributes
1259
-		$output .= AUI_Component_Helper::data_attributes( $args );
1259
+		$output .= AUI_Component_Helper::data_attributes($args);
1260 1260
 
1261 1261
 		// aria-attributes
1262
-		$output .= AUI_Component_Helper::aria_attributes( $args );
1262
+		$output .= AUI_Component_Helper::aria_attributes($args);
1263 1263
 
1264 1264
 		// extra attributes
1265
-		if ( ! empty( $args['extra_attributes'] ) ) {
1266
-			$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
1265
+		if (!empty($args['extra_attributes'])) {
1266
+			$output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']);
1267 1267
 		}
1268 1268
 
1269 1269
 		// required
1270
-		if ( ! empty( $args['required'] ) ) {
1270
+		if (!empty($args['required'])) {
1271 1271
 			$output .= ' required ';
1272 1272
 		}
1273 1273
 
@@ -1275,38 +1275,38 @@  discard block
 block discarded – undo
1275 1275
 		$output .= ' >';
1276 1276
 
1277 1277
 		// label
1278
-		if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
1279
-		} elseif ( ! empty( $args['label'] ) ) {
1280
-			$output .= self::label( array(
1278
+		if (!empty($args['label']) && is_array($args['label'])) {
1279
+		} elseif (!empty($args['label'])) {
1280
+			$output .= self::label(array(
1281 1281
 				'title' => $args['label'],
1282 1282
 				'for'   => $args['id'] . $count,
1283 1283
 				'class' => 'form-check-label'
1284
-			), 'radio' );
1284
+			), 'radio');
1285 1285
 		}
1286 1286
 
1287 1287
 		// wrap
1288
-		if ( ! $args['no_wrap'] ) {
1288
+		if (!$args['no_wrap']) {
1289 1289
 			$wrap_class = $args['inline'] ? 'form-check form-check-inline' : 'form-check';
1290 1290
 
1291 1291
 			// Unique wrap class
1292 1292
 			$uniq_class = 'fwrap';
1293
-			if ( ! empty( $args['name'] ) ) {
1293
+			if (!empty($args['name'])) {
1294 1294
 				$uniq_class .= '-' . $args['name'];
1295
-			} else if ( ! empty( $args['id'] ) ) {
1295
+			} else if (!empty($args['id'])) {
1296 1296
 				$uniq_class .= '-' . $args['id'];
1297 1297
 			}
1298 1298
 
1299
-			if ( isset( $args['value'] ) || $args['value'] !== "" ) {
1299
+			if (isset($args['value']) || $args['value'] !== "") {
1300 1300
 				$uniq_class .= '-' . $args['value'];
1301 1301
 			} else {
1302 1302
 				$uniq_class .= '-' . $count;
1303 1303
 			}
1304
-			$wrap_class .= ' ' . sanitize_html_class( $uniq_class );
1304
+			$wrap_class .= ' ' . sanitize_html_class($uniq_class);
1305 1305
 
1306
-			$output = self::wrap( array(
1306
+			$output = self::wrap(array(
1307 1307
 				'content' => $output,
1308 1308
 				'class'   => $wrap_class
1309
-			) );
1309
+			));
1310 1310
 		}
1311 1311
 
1312 1312
 		return $output;
Please login to merge, or discard this patch.
includes/admin/class-getpaid-admin.php 1 patch
Spacing   +278 added lines, -278 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * The main admin class.
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function __construct() {
41 41
 
42
-        $this->admin_path  = plugin_dir_path( __FILE__ );
43
-		$this->admin_url   = plugins_url( '/', __FILE__ );
42
+        $this->admin_path = plugin_dir_path(__FILE__);
43
+		$this->admin_url   = plugins_url('/', __FILE__);
44 44
 		$this->reports     = new GetPaid_Reports();
45 45
 
46
-        if ( is_admin() ) {
46
+        if (is_admin()) {
47 47
 			$this->init_admin_hooks();
48 48
         }
49 49
 
@@ -54,36 +54,36 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 */
56 56
 	private function init_admin_hooks() {
57
-        add_action( 'admin_enqueue_scripts', array( $this, 'enqeue_scripts' ), 9 );
58
-        add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
59
-        add_action( 'admin_init', array( $this, 'init_ayecode_connect_helper' ) );
60
-        add_action( 'admin_init', array( $this, 'activation_redirect' ) );
61
-        add_action( 'admin_init', array( $this, 'maybe_do_admin_action' ) );
62
-		add_action( 'admin_notices', array( $this, 'show_notices' ) );
63
-		add_action( 'getpaid_authenticated_admin_action_rate_plugin', array( $this, 'redirect_to_wordpress_rating_page' ) );
64
-		add_action( 'getpaid_authenticated_admin_action_duplicate_form', array( $this, 'duplicate_payment_form' ) );
65
-		add_action( 'getpaid_authenticated_admin_action_reset_form_stats', array( $this, 'reset_form_stats' ) );
66
-		add_action( 'getpaid_authenticated_admin_action_duplicate_invoice', array( $this, 'duplicate_invoice' ) );
67
-		add_action( 'getpaid_authenticated_admin_action_refund_invoice', array( $this, 'refund_invoice' ) );
68
-		add_action( 'getpaid_authenticated_admin_action_send_invoice', array( $this, 'send_customer_invoice' ) );
69
-		add_action( 'getpaid_authenticated_admin_action_send_invoice_reminder', array( $this, 'send_customer_payment_reminder' ) );
70
-        add_action( 'getpaid_authenticated_admin_action_reset_tax_rates', array( $this, 'admin_reset_tax_rates' ) );
71
-		add_action( 'getpaid_authenticated_admin_action_create_missing_pages', array( $this, 'admin_create_missing_pages' ) );
72
-		add_action( 'getpaid_authenticated_admin_action_refresh_permalinks', array( $this, 'admin_refresh_permalinks' ) );
73
-		add_action( 'getpaid_authenticated_admin_action_create_missing_tables', array( $this, 'admin_create_missing_tables' ) );
74
-		add_action( 'getpaid_authenticated_admin_action_migrate_old_invoices', array( $this, 'admin_migrate_old_invoices' ) );
75
-		add_action( 'getpaid_authenticated_admin_action_download_customers', array( $this, 'admin_download_customers' ) );
76
-		add_action( 'getpaid_authenticated_admin_action_recalculate_discounts', array( $this, 'admin_recalculate_discounts' ) );
77
-		add_action( 'getpaid_authenticated_admin_action_install_plugin', array( $this, 'admin_install_plugin' ) );
78
-		add_action( 'getpaid_authenticated_admin_action_connect_gateway', array( $this, 'admin_connect_gateway' ) );
79
-		add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) );
80
-		do_action( 'getpaid_init_admin_hooks', $this );
57
+        add_action('admin_enqueue_scripts', array($this, 'enqeue_scripts'), 9);
58
+        add_filter('admin_body_class', array($this, 'admin_body_class'));
59
+        add_action('admin_init', array($this, 'init_ayecode_connect_helper'));
60
+        add_action('admin_init', array($this, 'activation_redirect'));
61
+        add_action('admin_init', array($this, 'maybe_do_admin_action'));
62
+		add_action('admin_notices', array($this, 'show_notices'));
63
+		add_action('getpaid_authenticated_admin_action_rate_plugin', array($this, 'redirect_to_wordpress_rating_page'));
64
+		add_action('getpaid_authenticated_admin_action_duplicate_form', array($this, 'duplicate_payment_form'));
65
+		add_action('getpaid_authenticated_admin_action_reset_form_stats', array($this, 'reset_form_stats'));
66
+		add_action('getpaid_authenticated_admin_action_duplicate_invoice', array($this, 'duplicate_invoice'));
67
+		add_action('getpaid_authenticated_admin_action_refund_invoice', array($this, 'refund_invoice'));
68
+		add_action('getpaid_authenticated_admin_action_send_invoice', array($this, 'send_customer_invoice'));
69
+		add_action('getpaid_authenticated_admin_action_send_invoice_reminder', array($this, 'send_customer_payment_reminder'));
70
+        add_action('getpaid_authenticated_admin_action_reset_tax_rates', array($this, 'admin_reset_tax_rates'));
71
+		add_action('getpaid_authenticated_admin_action_create_missing_pages', array($this, 'admin_create_missing_pages'));
72
+		add_action('getpaid_authenticated_admin_action_refresh_permalinks', array($this, 'admin_refresh_permalinks'));
73
+		add_action('getpaid_authenticated_admin_action_create_missing_tables', array($this, 'admin_create_missing_tables'));
74
+		add_action('getpaid_authenticated_admin_action_migrate_old_invoices', array($this, 'admin_migrate_old_invoices'));
75
+		add_action('getpaid_authenticated_admin_action_download_customers', array($this, 'admin_download_customers'));
76
+		add_action('getpaid_authenticated_admin_action_recalculate_discounts', array($this, 'admin_recalculate_discounts'));
77
+		add_action('getpaid_authenticated_admin_action_install_plugin', array($this, 'admin_install_plugin'));
78
+		add_action('getpaid_authenticated_admin_action_connect_gateway', array($this, 'admin_connect_gateway'));
79
+		add_filter('admin_footer_text', array($this, 'admin_footer_text'));
80
+		do_action('getpaid_init_admin_hooks', $this);
81 81
 
82 82
 		// Setup/welcome
83
-		if ( ! empty( $_GET['page'] ) ) {
84
-			switch ( sanitize_text_field( $_GET['page'] ) ) {
83
+		if (!empty($_GET['page'])) {
84
+			switch (sanitize_text_field($_GET['page'])) {
85 85
 				case 'gp-setup':
86
-					include_once dirname( __FILE__ ) . '/class-getpaid-admin-setup-wizard.php';
86
+					include_once dirname(__FILE__) . '/class-getpaid-admin-setup-wizard.php';
87 87
 					break;
88 88
 			}
89 89
 		}
@@ -97,37 +97,37 @@  discard block
 block discarded – undo
97 97
 	public function enqeue_scripts() {
98 98
         global $current_screen, $pagenow;
99 99
 
100
-		$page    = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
100
+		$page    = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
101 101
 		$editing = $pagenow == 'post.php' || $pagenow == 'post-new.php';
102 102
 
103
-        if ( ! empty( $current_screen->post_type ) ) {
103
+        if (!empty($current_screen->post_type)) {
104 104
 			$page = $current_screen->post_type;
105 105
         }
106 106
 
107 107
         // General styles.
108
-        if ( false !== stripos( $page, 'wpi' ) || false !== stripos( $page, 'getpaid' ) || 'gp-setup' == $page || false !== stripos( $page, 'geodir-tickets' ) ) {
108
+        if (false !== stripos($page, 'wpi') || false !== stripos($page, 'getpaid') || 'gp-setup' == $page || false !== stripos($page, 'geodir-tickets')) {
109 109
 
110 110
             // Styles.
111
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/admin.css' );
112
-            wp_enqueue_style( 'wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array( 'wp-color-picker' ), $version );
113
-            wp_enqueue_style( 'select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all' );
111
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/admin.css');
112
+            wp_enqueue_style('wpinv_admin_style', WPINV_PLUGIN_URL . 'assets/css/admin.css', array('wp-color-picker'), $version);
113
+            wp_enqueue_style('select2', WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), '4.0.13', 'all');
114 114
 
115 115
             // Scripts.
116
-            wp_enqueue_script( 'select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array( 'jquery' ), WPINV_VERSION );
116
+            wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full.min.js', array('jquery'), WPINV_VERSION);
117 117
 
118
-            $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/admin.js' );
119
-            wp_enqueue_script( 'wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array( 'jquery', 'wp-color-picker', 'jquery-ui-tooltip' ), $version );
120
-            wp_localize_script( 'wpinv-admin-script', 'WPInv_Admin', apply_filters( 'wpinv_admin_js_localize', $this->get_admin_i18() ) );
118
+            $version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/admin.js');
119
+            wp_enqueue_script('wpinv-admin-script', WPINV_PLUGIN_URL . 'assets/js/admin.js', array('jquery', 'wp-color-picker', 'jquery-ui-tooltip'), $version);
120
+            wp_localize_script('wpinv-admin-script', 'WPInv_Admin', apply_filters('wpinv_admin_js_localize', $this->get_admin_i18()));
121 121
 
122 122
         }
123 123
 
124 124
         // Payment form scripts.
125
-		if ( 'wpi_payment_form' == $page && $editing ) {
125
+		if ('wpi_payment_form' == $page && $editing) {
126 126
             $this->load_payment_form_scripts();
127 127
         }
128 128
 
129
-		if ( $page == 'wpinv-subscriptions' ) {
130
-			wp_enqueue_script( 'postbox' );
129
+		if ($page == 'wpinv-subscriptions') {
130
+			wp_enqueue_script('postbox');
131 131
 		}
132 132
 
133 133
     }
@@ -140,31 +140,31 @@  discard block
 block discarded – undo
140 140
         global $post;
141 141
 
142 142
 		$date_range = array(
143
-			'period' => isset( $_GET['date_range'] ) ? sanitize_text_field( $_GET['date_range'] ) : '7_days',
143
+			'period' => isset($_GET['date_range']) ? sanitize_text_field($_GET['date_range']) : '7_days',
144 144
 		);
145 145
 
146
-		if ( $date_range['period'] == 'custom' ) {
146
+		if ($date_range['period'] == 'custom') {
147 147
 
148
-			if ( isset( $_GET['from'] ) ) {
149
-				$date_range['after'] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['from'] ), current_time( 'timestamp' ) ) - DAY_IN_SECONDS );
148
+			if (isset($_GET['from'])) {
149
+				$date_range['after'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['from']), current_time('timestamp')) - DAY_IN_SECONDS);
150 150
 			}
151 151
 
152
-			if ( isset( $_GET['to'] ) ) {
153
-				$date_range['before'] = date( 'Y-m-d', strtotime( sanitize_text_field( $_GET['to'] ), current_time( 'timestamp' ) ) + DAY_IN_SECONDS );
152
+			if (isset($_GET['to'])) {
153
+				$date_range['before'] = date('Y-m-d', strtotime(sanitize_text_field($_GET['to']), current_time('timestamp')) + DAY_IN_SECONDS);
154 154
 			}
155 155
 }
156 156
 
157 157
         $i18n = array(
158
-            'ajax_url'                  => admin_url( 'admin-ajax.php' ),
159
-            'post_ID'                   => isset( $post->ID ) ? $post->ID : '',
160
-			'wpinv_nonce'               => wp_create_nonce( 'wpinv-nonce' ),
161
-			'rest_nonce'                => wp_create_nonce( 'wp_rest' ),
162
-			'rest_root'                 => esc_url_raw( rest_url() ),
158
+            'ajax_url'                  => admin_url('admin-ajax.php'),
159
+            'post_ID'                   => isset($post->ID) ? $post->ID : '',
160
+			'wpinv_nonce'               => wp_create_nonce('wpinv-nonce'),
161
+			'rest_nonce'                => wp_create_nonce('wp_rest'),
162
+			'rest_root'                 => esc_url_raw(rest_url()),
163 163
 			'date_range'                => $date_range,
164
-            'add_invoice_note_nonce'    => wp_create_nonce( 'add-invoice-note' ),
165
-            'delete_invoice_note_nonce' => wp_create_nonce( 'delete-invoice-note' ),
166
-            'invoice_item_nonce'        => wp_create_nonce( 'invoice-item' ),
167
-            'billing_details_nonce'     => wp_create_nonce( 'get-billing-details' ),
164
+            'add_invoice_note_nonce'    => wp_create_nonce('add-invoice-note'),
165
+            'delete_invoice_note_nonce' => wp_create_nonce('delete-invoice-note'),
166
+            'invoice_item_nonce'        => wp_create_nonce('invoice-item'),
167
+            'billing_details_nonce'     => wp_create_nonce('get-billing-details'),
168 168
             'tax'                       => wpinv_tax_amount(),
169 169
             'discount'                  => 0,
170 170
 			'currency_symbol'           => wpinv_currency_symbol(),
@@ -173,39 +173,39 @@  discard block
 block discarded – undo
173 173
             'thousand_sep'              => wpinv_thousands_separator(),
174 174
             'decimal_sep'               => wpinv_decimal_separator(),
175 175
             'decimals'                  => wpinv_decimals(),
176
-            'save_invoice'              => __( 'Save Invoice', 'invoicing' ),
177
-            'status_publish'            => wpinv_status_nicename( 'publish' ),
178
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
179
-            'delete_tax_rate'           => __( 'Are you sure you wish to delete this tax rate?', 'invoicing' ),
180
-            'status_pending'            => wpinv_status_nicename( 'wpi-pending' ),
181
-            'FillBillingDetails'        => __( 'Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing' ),
182
-            'confirmCalcTotals'         => __( 'Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing' ),
183
-            'AreYouSure'                => __( 'Are you sure?', 'invoicing' ),
184
-            'errDeleteItem'             => __( 'This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing' ),
185
-            'delete_subscription'       => __( 'Are you sure you want to delete this subscription?', 'invoicing' ),
186
-            'action_edit'               => __( 'Edit', 'invoicing' ),
187
-            'action_cancel'             => __( 'Cancel', 'invoicing' ),
188
-            'item_description'          => __( 'Item Description', 'invoicing' ),
189
-            'invoice_description'       => __( 'Invoice Description', 'invoicing' ),
190
-            'discount_description'      => __( 'Discount Description', 'invoicing' ),
191
-			'searching'                 => __( 'Searching', 'invoicing' ),
192
-			'loading'                   => __( 'Loading...', 'invoicing' ),
193
-			'search_customers'          => __( 'Enter customer name or email', 'invoicing' ),
194
-			'search_items'              => __( 'Enter item name', 'invoicing' ),
195
-			'graphs'                    => array_merge( array( 'refunded_fees', 'refunded_items', 'refunded_subtotal', 'refunded_tax' ), array_keys( wpinv_get_report_graphs() ) ),
176
+            'save_invoice'              => __('Save Invoice', 'invoicing'),
177
+            'status_publish'            => wpinv_status_nicename('publish'),
178
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
179
+            'delete_tax_rate'           => __('Are you sure you wish to delete this tax rate?', 'invoicing'),
180
+            'status_pending'            => wpinv_status_nicename('wpi-pending'),
181
+            'FillBillingDetails'        => __('Fill the user\'s billing information? This will remove any currently entered billing information', 'invoicing'),
182
+            'confirmCalcTotals'         => __('Recalculate totals? This will recalculate totals based on the user billing country. If no billing country is set it will use the base country.', 'invoicing'),
183
+            'AreYouSure'                => __('Are you sure?', 'invoicing'),
184
+            'errDeleteItem'             => __('This item is in use! Before delete this item, you need to delete all the invoice(s) using this item.', 'invoicing'),
185
+            'delete_subscription'       => __('Are you sure you want to delete this subscription?', 'invoicing'),
186
+            'action_edit'               => __('Edit', 'invoicing'),
187
+            'action_cancel'             => __('Cancel', 'invoicing'),
188
+            'item_description'          => __('Item Description', 'invoicing'),
189
+            'invoice_description'       => __('Invoice Description', 'invoicing'),
190
+            'discount_description'      => __('Discount Description', 'invoicing'),
191
+			'searching'                 => __('Searching', 'invoicing'),
192
+			'loading'                   => __('Loading...', 'invoicing'),
193
+			'search_customers'          => __('Enter customer name or email', 'invoicing'),
194
+			'search_items'              => __('Enter item name', 'invoicing'),
195
+			'graphs'                    => array_merge(array('refunded_fees', 'refunded_items', 'refunded_subtotal', 'refunded_tax'), array_keys(wpinv_get_report_graphs())),
196 196
         );
197 197
 
198
-		if ( ! empty( $post ) && getpaid_is_invoice_post_type( $post->post_type ) ) {
198
+		if (!empty($post) && getpaid_is_invoice_post_type($post->post_type)) {
199 199
 
200
-			$invoice              = new WPInv_Invoice( $post );
200
+			$invoice              = new WPInv_Invoice($post);
201 201
 			$i18n['save_invoice'] = sprintf(
202
-				__( 'Save %s', 'invoicing' ),
203
-				ucfirst( $invoice->get_invoice_quote_type() )
202
+				__('Save %s', 'invoicing'),
203
+				ucfirst($invoice->get_invoice_quote_type())
204 204
 			);
205 205
 
206 206
 			$i18n['invoice_description'] = sprintf(
207
-				__( '%s Description', 'invoicing' ),
208
-				ucfirst( $invoice->get_invoice_quote_type() )
207
+				__('%s Description', 'invoicing'),
208
+				ucfirst($invoice->get_invoice_quote_type())
209 209
 			);
210 210
 
211 211
 		}
@@ -219,24 +219,24 @@  discard block
 block discarded – undo
219 219
 	 * @param  string $footer_text
220 220
 	 * @return string
221 221
 	 */
222
-	public function admin_footer_text( $footer_text ) {
222
+	public function admin_footer_text($footer_text) {
223 223
 		global $current_screen;
224 224
 
225
-		$page    = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
225
+		$page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
226 226
 
227
-        if ( ! empty( $current_screen->post_type ) ) {
227
+        if (!empty($current_screen->post_type)) {
228 228
 			$page = $current_screen->post_type;
229 229
         }
230 230
 
231 231
         // General styles.
232
-        if ( apply_filters( 'getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing() ) && false !== stripos( $page, 'wpi' ) ) {
232
+        if (apply_filters('getpaid_display_admin_footer_text', wpinv_current_user_can_manage_invoicing()) && false !== stripos($page, 'wpi')) {
233 233
 
234 234
 			// Change the footer text
235
-			if ( ! get_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', true ) ) {
235
+			if (!get_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', true)) {
236 236
 
237
-				$rating_url  = esc_url(
237
+				$rating_url = esc_url(
238 238
 					wp_nonce_url(
239
-						admin_url( 'admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin' ),
239
+						admin_url('admin.php?page=wpinv-reports&getpaid-admin-action=rate_plugin'),
240 240
 						'getpaid-nonce',
241 241
 						'getpaid-nonce'
242 242
                     )
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
 				$footer_text = sprintf(
246 246
 					/* translators: %s: five stars */
247
-					__( 'If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing' ),
247
+					__('If you like <strong>GetPaid</strong>, please leave us a %s rating. A huge thanks in advance!', 'invoicing'),
248 248
 					"<a href='$rating_url'>&#9733;&#9733;&#9733;&#9733;&#9733;</a>"
249 249
 				);
250 250
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
 				$footer_text = sprintf(
254 254
 					/* translators: %s: GetPaid */
255
-					__( 'Thank you for using %s!', 'invoicing' ),
255
+					__('Thank you for using %s!', 'invoicing'),
256 256
 					"<a href='https://wpgetpaid.com/' target='_blank'><strong>GetPaid</strong></a>"
257 257
 				);
258 258
 
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
 	 * @since  2.0.0
269 269
 	 */
270 270
 	public function redirect_to_wordpress_rating_page() {
271
-		update_user_meta( get_current_user_id(), 'getpaid_admin_footer_text_rated', 1 );
272
-		wp_redirect( 'https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post' );
271
+		update_user_meta(get_current_user_id(), 'getpaid_admin_footer_text_rated', 1);
272
+		wp_redirect('https://wordpress.org/support/plugin/invoicing/reviews?rate=5#new-post');
273 273
 		exit;
274 274
 	}
275 275
 
@@ -280,29 +280,29 @@  discard block
 block discarded – undo
280 280
 	protected function load_payment_form_scripts() {
281 281
         global $post;
282 282
 
283
-        wp_enqueue_script( 'vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.min.js', array(), WPINV_VERSION );
284
-		wp_enqueue_script( 'sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION );
285
-		wp_enqueue_script( 'vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array( 'sortable', 'vue' ), WPINV_VERSION );
283
+        wp_enqueue_script('vue', WPINV_PLUGIN_URL . 'assets/js/vue/vue.min.js', array(), WPINV_VERSION);
284
+		wp_enqueue_script('sortable', WPINV_PLUGIN_URL . 'assets/js/sortable.min.js', array(), WPINV_VERSION);
285
+		wp_enqueue_script('vue_draggable', WPINV_PLUGIN_URL . 'assets/js/vue/vuedraggable.min.js', array('sortable', 'vue'), WPINV_VERSION);
286 286
 
287
-		wp_register_script( 'wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.min.js', array( 'wpinv-admin-script', 'vue_draggable', 'wp-hooks' ), WPINV_VERSION );
287
+		wp_register_script('wpinv-admin-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/admin-payment-forms.min.js', array('wpinv-admin-script', 'vue_draggable', 'wp-hooks'), WPINV_VERSION);
288 288
 
289 289
 		wp_localize_script(
290 290
             'wpinv-admin-payment-form-script',
291 291
             'wpinvPaymentFormAdmin',
292 292
             array(
293
-				'elements'      => wpinv_get_data( 'payment-form-elements' ),
294
-				'form_elements' => getpaid_get_payment_form_elements( $post->ID ),
293
+				'elements'      => wpinv_get_data('payment-form-elements'),
294
+				'form_elements' => getpaid_get_payment_form_elements($post->ID),
295 295
 				'currency'      => wpinv_currency_symbol(),
296 296
 				'position'      => wpinv_currency_position(),
297 297
 				'decimals'      => (int) wpinv_decimals(),
298 298
 				'thousands_sep' => wpinv_thousands_separator(),
299 299
 				'decimals_sep'  => wpinv_decimal_separator(),
300
-				'form_items'    => gepaid_get_form_items( $post->ID ),
300
+				'form_items'    => gepaid_get_form_items($post->ID),
301 301
 				'is_default'    => $post->ID == wpinv_get_default_payment_form(),
302 302
             )
303 303
         );
304 304
 
305
-        wp_enqueue_script( 'wpinv-admin-payment-form-script' );
305
+        wp_enqueue_script('wpinv-admin-payment-form-script');
306 306
 
307 307
     }
308 308
 
@@ -313,24 +313,24 @@  discard block
 block discarded – undo
313 313
      * @return string
314 314
 	 *
315 315
 	 */
316
-    public function admin_body_class( $classes ) {
316
+    public function admin_body_class($classes) {
317 317
 		global $pagenow, $post, $current_screen;
318 318
 
319
-        $page = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
319
+        $page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
320 320
 
321
-        if ( ! empty( $current_screen->post_type ) ) {
321
+        if (!empty($current_screen->post_type)) {
322 322
 			$page = $current_screen->post_type;
323 323
         }
324 324
 
325
-        if ( false !== stripos( $page, 'wpi' ) ) {
326
-            $classes .= ' wpi-' . sanitize_key( $page );
325
+        if (false !== stripos($page, 'wpi')) {
326
+            $classes .= ' wpi-' . sanitize_key($page);
327 327
         }
328 328
 
329
-        if ( in_array( $page, wpinv_parse_list( 'wpi_invoice wpi_payment_form wpi_quote' ) ) ) {
329
+        if (in_array($page, wpinv_parse_list('wpi_invoice wpi_payment_form wpi_quote'))) {
330 330
             $classes .= ' wpinv-cpt wpinv';
331 331
 		}
332 332
 
333
-		if ( getpaid_is_invoice_post_type( $page ) ) {
333
+		if (getpaid_is_invoice_post_type($page)) {
334 334
             $classes .= ' getpaid-is-invoice-cpt';
335 335
         }
336 336
 
@@ -349,21 +349,21 @@  discard block
 block discarded – undo
349 349
 				'version'           => WPINV_VERSION,
350 350
 				'support_url'       => 'https://wpgetpaid.com/support/',
351 351
 				'documentation_url' => 'https://docs.wpgetpaid.com/',
352
-				'activated'         => (int) get_option( 'gepaid_installed_on' ),
352
+				'activated'         => (int) get_option('gepaid_installed_on'),
353 353
             )
354 354
         );
355 355
 
356 356
         new AyeCode_Connect_Helper(
357 357
             array(
358
-				'connect_title'     => __( 'WP Invoicing - an AyeCode product!', 'invoicing' ),
359
-				'connect_external'  => __( 'Please confirm you wish to connect your site?', 'invoicing' ),
360
-				'connect'           => sprintf( __( '<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %1$slearn more%2$s', 'invoicing' ), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", '</a>' ),
361
-				'connect_button'    => __( 'Connect Site', 'invoicing' ),
362
-				'connecting_button' => __( 'Connecting...', 'invoicing' ),
363
-				'error_localhost'   => __( 'This service will only work with a live domain, not a localhost.', 'invoicing' ),
364
-				'error'             => __( 'Something went wrong, please refresh and try again.', 'invoicing' ),
358
+				'connect_title'     => __('WP Invoicing - an AyeCode product!', 'invoicing'),
359
+				'connect_external'  => __('Please confirm you wish to connect your site?', 'invoicing'),
360
+				'connect'           => sprintf(__('<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %1$slearn more%2$s', 'invoicing'), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", '</a>'),
361
+				'connect_button'    => __('Connect Site', 'invoicing'),
362
+				'connecting_button' => __('Connecting...', 'invoicing'),
363
+				'error_localhost'   => __('This service will only work with a live domain, not a localhost.', 'invoicing'),
364
+				'error'             => __('Something went wrong, please refresh and try again.', 'invoicing'),
365 365
             ),
366
-            array( 'wpi-addons' )
366
+            array('wpi-addons')
367 367
         );
368 368
 
369 369
     }
@@ -375,20 +375,20 @@  discard block
 block discarded – undo
375 375
 	 */
376 376
 	public function activation_redirect() {
377 377
 
378
-		$redirected = get_option( 'wpinv_redirected_to_settings' );
378
+		$redirected = get_option('wpinv_redirected_to_settings');
379 379
 
380
-		if ( ! empty( $redirected ) || wp_doing_ajax() || ! current_user_can( 'manage_options' ) ) {
380
+		if (!empty($redirected) || wp_doing_ajax() || !current_user_can('manage_options')) {
381 381
 			return;
382 382
 		}
383 383
 
384 384
 		// Bail if activating from network, or bulk
385
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
385
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
386 386
 			return;
387 387
 		}
388 388
 
389
-	    update_option( 'wpinv_redirected_to_settings', 1 );
389
+	    update_option('wpinv_redirected_to_settings', 1);
390 390
 
391
-        wp_safe_redirect( admin_url( 'index.php?page=gp-setup' ) );
391
+        wp_safe_redirect(admin_url('index.php?page=gp-setup'));
392 392
         exit;
393 393
 
394 394
 	}
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
      * Fires an admin action after verifying that a user can fire them.
398 398
      */
399 399
     public function maybe_do_admin_action() {
400
-        if ( isset( $_REQUEST['getpaid-admin-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) && wpinv_current_user_can( sanitize_text_field( $_REQUEST['getpaid-admin-action'] ), $_REQUEST ) ) {
401
-            $key = sanitize_key( $_REQUEST['getpaid-admin-action'] );
400
+        if (isset($_REQUEST['getpaid-admin-action']) && isset($_REQUEST['getpaid-nonce']) && wp_verify_nonce($_REQUEST['getpaid-nonce'], 'getpaid-nonce') && wpinv_current_user_can(sanitize_text_field($_REQUEST['getpaid-admin-action']), $_REQUEST)) {
401
+            $key = sanitize_key($_REQUEST['getpaid-admin-action']);
402 402
 
403
-            do_action( "getpaid_authenticated_admin_action_$key", $_REQUEST );
403
+            do_action("getpaid_authenticated_admin_action_$key", $_REQUEST);
404 404
         }
405 405
     }
406 406
 
@@ -409,24 +409,24 @@  discard block
 block discarded – undo
409 409
 	 *
410 410
 	 * @param array $args
411 411
      */
412
-    public function duplicate_invoice( $args ) {
412
+    public function duplicate_invoice($args) {
413 413
 
414
-		if ( empty( $args['invoice_id'] ) ) {
414
+		if (empty($args['invoice_id'])) {
415 415
 			return;
416 416
 		}
417 417
 
418
-		$invoice = new WPInv_Invoice( (int) $args['invoice_id'] );
418
+		$invoice = new WPInv_Invoice((int) $args['invoice_id']);
419 419
 
420
-		if ( ! $invoice->exists() ) {
420
+		if (!$invoice->exists()) {
421 421
 			return;
422 422
 		}
423 423
 
424
-		$new_invoice = getpaid_duplicate_invoice( $invoice );
424
+		$new_invoice = getpaid_duplicate_invoice($invoice);
425 425
 		$new_invoice->save();
426 426
 
427
-		if ( $new_invoice->exists() ) {
427
+		if ($new_invoice->exists()) {
428 428
 
429
-			getpaid_admin()->show_success( __( 'Invoice duplicated successfully.', 'invoicing' ) );
429
+			getpaid_admin()->show_success(__('Invoice duplicated successfully.', 'invoicing'));
430 430
 
431 431
 			wp_safe_redirect(
432 432
 				add_query_arg(
@@ -434,14 +434,14 @@  discard block
 block discarded – undo
434 434
 						'action' => 'edit',
435 435
 						'post'   => $new_invoice->get_id(),
436 436
 					),
437
-					admin_url( 'post.php' )
437
+					admin_url('post.php')
438 438
 				)
439 439
 			);
440 440
 			exit;
441 441
 
442 442
 		}
443 443
 
444
-		getpaid_admin()->show_error( __( 'There was an error duplicating this invoice. Please try again.', 'invoicing' ) );
444
+		getpaid_admin()->show_error(__('There was an error duplicating this invoice. Please try again.', 'invoicing'));
445 445
 
446 446
 	}
447 447
 
@@ -450,40 +450,40 @@  discard block
 block discarded – undo
450 450
 	 *
451 451
 	 * @param array $args
452 452
      */
453
-    public function refund_invoice( $args ) {
453
+    public function refund_invoice($args) {
454 454
 
455
-		if ( empty( $args['invoice_id'] ) ) {
455
+		if (empty($args['invoice_id'])) {
456 456
 			return;
457 457
 		}
458 458
 
459
-		$invoice = new WPInv_Invoice( (int) $args['invoice_id'] );
459
+		$invoice = new WPInv_Invoice((int) $args['invoice_id']);
460 460
 
461
-		if ( ! $invoice->exists() || $invoice->is_refunded() ) {
461
+		if (!$invoice->exists() || $invoice->is_refunded()) {
462 462
 			return;
463 463
 		}
464 464
 
465 465
 		$invoice->refund();
466 466
 
467 467
 		// Refund remotely.
468
-		if ( getpaid_payment_gateway_supports( $invoice->get_gateway(), 'refunds' ) && ! empty( $args['getpaid_refund_remote'] ) ) {
469
-			do_action( 'getpaid_refund_invoice_remotely', $invoice );
468
+		if (getpaid_payment_gateway_supports($invoice->get_gateway(), 'refunds') && !empty($args['getpaid_refund_remote'])) {
469
+			do_action('getpaid_refund_invoice_remotely', $invoice);
470 470
 		}
471 471
 
472 472
 		// Cancel subscriptions.
473
-		if ( ! empty( $args['getpaid_cancel_subscription'] ) ) {
474
-			$subscriptions = getpaid_get_invoice_subscriptions( $invoice );
473
+		if (!empty($args['getpaid_cancel_subscription'])) {
474
+			$subscriptions = getpaid_get_invoice_subscriptions($invoice);
475 475
 
476
-			if ( ! empty( $subscriptions ) ) {
477
-				if ( ! is_array( $subscriptions ) ) {
478
-					$subscriptions = array( $subscriptions );
476
+			if (!empty($subscriptions)) {
477
+				if (!is_array($subscriptions)) {
478
+					$subscriptions = array($subscriptions);
479 479
 				}
480 480
 
481
-				foreach ( $subscriptions as $subscription ) {
481
+				foreach ($subscriptions as $subscription) {
482 482
 					$subscription->cancel();
483 483
 					$invoice->add_system_note(
484 484
 						sprintf(
485 485
 							// translators: %s: subscription ID.
486
-							__( 'Subscription #%s cancelled', 'invoicing' ),
486
+							__('Subscription #%s cancelled', 'invoicing'),
487 487
 							$subscription->get_id()
488 488
 						)
489 489
 					);
@@ -492,11 +492,11 @@  discard block
 block discarded – undo
492 492
 		}
493 493
 
494 494
 		// Add notice.
495
-		$this->show_success( __( 'Invoice refunded successfully.', 'invoicing' ) );
495
+		$this->show_success(__('Invoice refunded successfully.', 'invoicing'));
496 496
 
497 497
 		// Redirect.
498 498
 		wp_safe_redirect(
499
-			remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id', 'getpaid_cancel_subscription', 'getpaid_refund_remote' ) )
499
+			remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id', 'getpaid_cancel_subscription', 'getpaid_refund_remote'))
500 500
 		);
501 501
 	}
502 502
 
@@ -505,34 +505,34 @@  discard block
 block discarded – undo
505 505
 	 *
506 506
 	 * @param array $args
507 507
      */
508
-    public function duplicate_payment_form( $args ) {
508
+    public function duplicate_payment_form($args) {
509 509
 
510
-		if ( empty( $args['form_id'] ) ) {
510
+		if (empty($args['form_id'])) {
511 511
 			return;
512 512
 		}
513 513
 
514
-		$form = new GetPaid_Payment_Form( (int) $args['form_id'] );
514
+		$form = new GetPaid_Payment_Form((int) $args['form_id']);
515 515
 
516
-		if ( ! $form->exists() ) {
516
+		if (!$form->exists()) {
517 517
 			return;
518 518
 		}
519 519
 
520 520
 		$new_form = new GetPaid_Payment_Form();
521
-		$new_form->set_author( $form->get_author( 'edit' ) );
522
-		$new_form->set_name( $form->get_name( 'edit' ) . __( '(copy)', 'invoicing' ) );
523
-		$new_form->set_elements( $form->get_elements( 'edit' ) );
524
-		$new_form->set_items( $form->get_items( 'edit' ) );
521
+		$new_form->set_author($form->get_author('edit'));
522
+		$new_form->set_name($form->get_name('edit') . __('(copy)', 'invoicing'));
523
+		$new_form->set_elements($form->get_elements('edit'));
524
+		$new_form->set_items($form->get_items('edit'));
525 525
 		$new_form->save();
526 526
 
527
-		if ( $new_form->exists() ) {
528
-			$this->show_success( __( 'Form duplicated successfully', 'invoicing' ) );
529
-			$url = get_edit_post_link( $new_form->get_id(), 'edit' );
527
+		if ($new_form->exists()) {
528
+			$this->show_success(__('Form duplicated successfully', 'invoicing'));
529
+			$url = get_edit_post_link($new_form->get_id(), 'edit');
530 530
 		} else {
531
-			$this->show_error( __( 'Unable to duplicate form', 'invoicing' ) );
532
-			$url = remove_query_arg( array( 'getpaid-admin-action', 'form_id', 'getpaid-nonce' ) );
531
+			$this->show_error(__('Unable to duplicate form', 'invoicing'));
532
+			$url = remove_query_arg(array('getpaid-admin-action', 'form_id', 'getpaid-nonce'));
533 533
 		}
534 534
 
535
-		wp_redirect( $url );
535
+		wp_redirect($url);
536 536
 		exit;
537 537
 	}
538 538
 
@@ -541,27 +541,27 @@  discard block
 block discarded – undo
541 541
 	 *
542 542
 	 * @param array $args
543 543
      */
544
-    public function reset_form_stats( $args ) {
544
+    public function reset_form_stats($args) {
545 545
 
546
-		if ( empty( $args['form_id'] ) ) {
546
+		if (empty($args['form_id'])) {
547 547
 			return;
548 548
 		}
549 549
 
550
-		$form = new GetPaid_Payment_Form( (int) $args['form_id'] );
550
+		$form = new GetPaid_Payment_Form((int) $args['form_id']);
551 551
 
552
-		if ( ! $form->exists() ) {
552
+		if (!$form->exists()) {
553 553
 			return;
554 554
 		}
555 555
 
556
-		$form->set_earned( 0 );
557
-		$form->set_refunded( 0 );
558
-		$form->set_cancelled( 0 );
559
-		$form->set_failed( 0 );
556
+		$form->set_earned(0);
557
+		$form->set_refunded(0);
558
+		$form->set_cancelled(0);
559
+		$form->set_failed(0);
560 560
 		$form->save();
561 561
 
562
-		$this->show_success( __( 'Form stats reset successfully', 'invoicing' ) );
562
+		$this->show_success(__('Form stats reset successfully', 'invoicing'));
563 563
 
564
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'form_id', 'getpaid-nonce' ) ) );
564
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'form_id', 'getpaid-nonce')));
565 565
 		exit;
566 566
 	}
567 567
 
@@ -570,9 +570,9 @@  discard block
 block discarded – undo
570 570
 	 *
571 571
 	 * @param array $args
572 572
      */
573
-    public function send_customer_invoice( $args ) {
574
-		getpaid()->get( 'invoice_emails' )->user_invoice( new WPInv_Invoice( $args['invoice_id'] ), true );
575
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
573
+    public function send_customer_invoice($args) {
574
+		getpaid()->get('invoice_emails')->user_invoice(new WPInv_Invoice($args['invoice_id']), true);
575
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
576 576
 		exit;
577 577
 	}
578 578
 
@@ -581,16 +581,16 @@  discard block
 block discarded – undo
581 581
 	 *
582 582
 	 * @param array $args
583 583
      */
584
-    public function send_customer_payment_reminder( $args ) {
585
-		$sent = getpaid()->get( 'invoice_emails' )->force_send_overdue_notice( new WPInv_Invoice( $args['invoice_id'] ) );
584
+    public function send_customer_payment_reminder($args) {
585
+		$sent = getpaid()->get('invoice_emails')->force_send_overdue_notice(new WPInv_Invoice($args['invoice_id']));
586 586
 
587
-		if ( $sent ) {
588
-			$this->show_success( __( 'Payment reminder was successfully sent to the customer', 'invoicing' ) );
587
+		if ($sent) {
588
+			$this->show_success(__('Payment reminder was successfully sent to the customer', 'invoicing'));
589 589
 		} else {
590
-			$this->show_error( __( 'Could not sent payment reminder to the customer', 'invoicing' ) );
590
+			$this->show_error(__('Could not sent payment reminder to the customer', 'invoicing'));
591 591
 		}
592 592
 
593
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce', 'invoice_id' ) ) );
593
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce', 'invoice_id')));
594 594
 		exit;
595 595
 	}
596 596
 
@@ -600,8 +600,8 @@  discard block
 block discarded – undo
600 600
      */
601 601
     public function admin_reset_tax_rates() {
602 602
 
603
-		update_option( 'wpinv_tax_rates', wpinv_get_data( 'tax-rates' ) );
604
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
603
+		update_option('wpinv_tax_rates', wpinv_get_data('tax-rates'));
604
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
605 605
 		exit;
606 606
 
607 607
 	}
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
     public function admin_create_missing_pages() {
614 614
 		$installer = new GetPaid_Installer();
615 615
 		$installer->create_pages();
616
-		$this->show_success( __( 'GetPaid pages updated.', 'invoicing' ) );
617
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
616
+		$this->show_success(__('GetPaid pages updated.', 'invoicing'));
617
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
618 618
 		exit;
619 619
 	}
620 620
 
@@ -623,8 +623,8 @@  discard block
 block discarded – undo
623 623
 	 */
624 624
 	public function admin_refresh_permalinks() {
625 625
 		flush_rewrite_rules();
626
-		$this->show_success( __( 'Permalinks refreshed.', 'invoicing' ) );
627
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
626
+		$this->show_success(__('Permalinks refreshed.', 'invoicing'));
627
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
628 628
 		exit;
629 629
 	}
630 630
 
@@ -638,13 +638,13 @@  discard block
 block discarded – undo
638 638
 		GetPaid_Installer::create_db_tables();
639 639
 		GetPaid_Installer::migrate_old_customers();
640 640
 
641
-		if ( '' !== $wpdb->last_error ) {
642
-			$this->show_error( __( 'Your GetPaid tables have been updated:', 'invoicing' ) . ' ' . $wpdb->last_error );
641
+		if ('' !== $wpdb->last_error) {
642
+			$this->show_error(__('Your GetPaid tables have been updated:', 'invoicing') . ' ' . $wpdb->last_error);
643 643
 		} else {
644
-			$this->show_success( __( 'Your GetPaid tables have been updated.', 'invoicing' ) );
644
+			$this->show_success(__('Your GetPaid tables have been updated.', 'invoicing'));
645 645
 		}
646 646
 
647
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
647
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
648 648
 		exit;
649 649
 	}
650 650
 
@@ -659,10 +659,10 @@  discard block
 block discarded – undo
659 659
 		$installer->migrate_old_invoices();
660 660
 
661 661
 		// Show an admin message.
662
-		$this->show_success( __( 'Your invoices have been migrated.', 'invoicing' ) );
662
+		$this->show_success(__('Your invoices have been migrated.', 'invoicing'));
663 663
 
664 664
 		// Redirect the admin.
665
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
665
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
666 666
 		exit;
667 667
 
668 668
 	}
@@ -673,35 +673,35 @@  discard block
 block discarded – undo
673 673
      */
674 674
     public function admin_download_customers() {
675 675
 
676
-		$output = fopen( 'php://output', 'w' );
676
+		$output = fopen('php://output', 'w');
677 677
 
678
-		if ( false === $output ) {
679
-			wp_die( esc_html__( 'Unsupported server', 'invoicing' ), 500 );
678
+		if (false === $output) {
679
+			wp_die(esc_html__('Unsupported server', 'invoicing'), 500);
680 680
 		}
681 681
 
682
-		header( 'Content-Type:text/csv' );
683
-		header( 'Content-Disposition:attachment;filename=customers.csv' );
682
+		header('Content-Type:text/csv');
683
+		header('Content-Disposition:attachment;filename=customers.csv');
684 684
 
685 685
 		/** @var GetPaid_Customer[] $customers */
686
-		$customers = getpaid_get_customers( array( 'number' => -1 ) );
687
-		$columns   = array_keys( GetPaid_Customer_Data_Store::get_database_fields() );
686
+		$customers = getpaid_get_customers(array('number' => -1));
687
+		$columns   = array_keys(GetPaid_Customer_Data_Store::get_database_fields());
688 688
 
689 689
 		// Output the csv column headers.
690
-		fputcsv( $output, $columns );
690
+		fputcsv($output, $columns);
691 691
 
692 692
 		// Loop through
693
-		foreach ( $customers as $customer ) {
693
+		foreach ($customers as $customer) {
694 694
 
695
-			$row  = array();
695
+			$row = array();
696 696
 
697
-			foreach ( $columns as $column ) {
698
-				$row[]  = (string) maybe_serialize( $customer->get( $column, 'edit' ) );
697
+			foreach ($columns as $column) {
698
+				$row[] = (string) maybe_serialize($customer->get($column, 'edit'));
699 699
 			}
700 700
 
701
-			fputcsv( $output, $row );
701
+			fputcsv($output, $row);
702 702
 		}
703 703
 
704
-		fclose( $output );
704
+		fclose($output);
705 705
 		exit;
706 706
 
707 707
 	}
@@ -711,27 +711,27 @@  discard block
 block discarded – undo
711 711
 	 *
712 712
 	 * @param array $data
713 713
      */
714
-    public function admin_install_plugin( $data ) {
714
+    public function admin_install_plugin($data) {
715 715
 
716
-		if ( ! empty( $data['plugins'] ) ) {
716
+		if (!empty($data['plugins'])) {
717 717
 			include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
718 718
 			wp_cache_flush();
719 719
 
720
-			foreach ( $data['plugins'] as $slug => $file ) {
721
-				$plugin_zip = esc_url( 'https://downloads.wordpress.org/plugin/' . $slug . '.latest-stable.zip' );
722
-				$upgrader   = new Plugin_Upgrader( new Automatic_Upgrader_Skin() );
723
-				$installed  = $upgrader->install( $plugin_zip );
720
+			foreach ($data['plugins'] as $slug => $file) {
721
+				$plugin_zip = esc_url('https://downloads.wordpress.org/plugin/' . $slug . '.latest-stable.zip');
722
+				$upgrader   = new Plugin_Upgrader(new Automatic_Upgrader_Skin());
723
+				$installed  = $upgrader->install($plugin_zip);
724 724
 
725
-				if ( ! is_wp_error( $installed ) && $installed ) {
726
-					activate_plugin( $file, '', false, true );
725
+				if (!is_wp_error($installed) && $installed) {
726
+					activate_plugin($file, '', false, true);
727 727
 				} else {
728
-					wpinv_error_log( $upgrader->skin->get_upgrade_messages(), false );
728
+					wpinv_error_log($upgrader->skin->get_upgrade_messages(), false);
729 729
 				}
730 730
 }
731 731
 }
732 732
 
733
-		$redirect = isset( $data['redirect'] ) ? esc_url_raw( $data['redirect'] ) : admin_url( 'plugins.php' );
734
-		wp_safe_redirect( $redirect );
733
+		$redirect = isset($data['redirect']) ? esc_url_raw($data['redirect']) : admin_url('plugins.php');
734
+		wp_safe_redirect($redirect);
735 735
 		exit;
736 736
 
737 737
 	}
@@ -741,41 +741,41 @@  discard block
 block discarded – undo
741 741
 	 *
742 742
 	 * @param array $data
743 743
      */
744
-    public function admin_connect_gateway( $data ) {
744
+    public function admin_connect_gateway($data) {
745 745
 
746
-		if ( ! empty( $data['plugin'] ) ) {
746
+		if (!empty($data['plugin'])) {
747 747
 
748
-			$gateway     = sanitize_key( $data['plugin'] );
749
-			$connect_url = apply_filters( "getpaid_get_{$gateway}_connect_url", false, $data );
748
+			$gateway     = sanitize_key($data['plugin']);
749
+			$connect_url = apply_filters("getpaid_get_{$gateway}_connect_url", false, $data);
750 750
 
751
-			if ( ! empty( $connect_url ) ) {
752
-				wp_redirect( $connect_url );
751
+			if (!empty($connect_url)) {
752
+				wp_redirect($connect_url);
753 753
 				exit;
754 754
 			}
755 755
 
756
-			if ( 'stripe' == $data['plugin'] ) {
756
+			if ('stripe' == $data['plugin']) {
757 757
 				require_once ABSPATH . 'wp-admin/includes/plugin.php';
758 758
 				include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
759 759
 				wp_cache_flush();
760 760
 
761
-				if ( ! array_key_exists( 'getpaid-stripe-payments/getpaid-stripe-payments.php', get_plugins() ) ) {
762
-					$plugin_zip = esc_url( 'https://downloads.wordpress.org/plugin/getpaid-stripe-payments.latest-stable.zip' );
763
-					$upgrader   = new Plugin_Upgrader( new Automatic_Upgrader_Skin() );
764
-					$upgrader->install( $plugin_zip );
761
+				if (!array_key_exists('getpaid-stripe-payments/getpaid-stripe-payments.php', get_plugins())) {
762
+					$plugin_zip = esc_url('https://downloads.wordpress.org/plugin/getpaid-stripe-payments.latest-stable.zip');
763
+					$upgrader   = new Plugin_Upgrader(new Automatic_Upgrader_Skin());
764
+					$upgrader->install($plugin_zip);
765 765
 				}
766 766
 
767
-				activate_plugin( 'getpaid-stripe-payments/getpaid-stripe-payments.php', '', false, true );
767
+				activate_plugin('getpaid-stripe-payments/getpaid-stripe-payments.php', '', false, true);
768 768
 			}
769 769
 
770
-			$connect_url = apply_filters( "getpaid_get_{$gateway}_connect_url", false, $data );
771
-			if ( ! empty( $connect_url ) ) {
772
-				wp_redirect( $connect_url );
770
+			$connect_url = apply_filters("getpaid_get_{$gateway}_connect_url", false, $data);
771
+			if (!empty($connect_url)) {
772
+				wp_redirect($connect_url);
773 773
 				exit;
774 774
 			}
775 775
 }
776 776
 
777
-		$redirect = isset( $data['redirect'] ) ? esc_url_raw( urldecode( $data['redirect'] ) ) : admin_url( 'admin.php?page=wpinv-settings&tab=gateways' );
778
-		wp_safe_redirect( $redirect );
777
+		$redirect = isset($data['redirect']) ? esc_url_raw(urldecode($data['redirect'])) : admin_url('admin.php?page=wpinv-settings&tab=gateways');
778
+		wp_safe_redirect($redirect);
779 779
 		exit;
780 780
 
781 781
 	}
@@ -789,35 +789,35 @@  discard block
 block discarded – undo
789 789
 
790 790
 		// Fetch all invoices that have discount codes.
791 791
 		$table    = $wpdb->prefix . 'getpaid_invoices';
792
-		$invoices = $wpdb->get_col( "SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''" );
792
+		$invoices = $wpdb->get_col("SELECT `post_id` FROM `$table` WHERE `discount` = 0 && `discount_code` <> ''");
793 793
 
794
-		foreach ( $invoices as $invoice ) {
794
+		foreach ($invoices as $invoice) {
795 795
 
796
-			$invoice = new WPInv_Invoice( $invoice );
796
+			$invoice = new WPInv_Invoice($invoice);
797 797
 
798
-			if ( ! $invoice->exists() ) {
798
+			if (!$invoice->exists()) {
799 799
 				continue;
800 800
 			}
801 801
 
802 802
 			// Abort if the discount does not exist or does not apply here.
803
-			$discount = new WPInv_Discount( $invoice->get_discount_code() );
804
-			if ( ! $discount->exists() ) {
803
+			$discount = new WPInv_Discount($invoice->get_discount_code());
804
+			if (!$discount->exists()) {
805 805
 				continue;
806 806
 			}
807 807
 
808
-			$invoice->add_discount( getpaid_calculate_invoice_discount( $invoice, $discount ) );
808
+			$invoice->add_discount(getpaid_calculate_invoice_discount($invoice, $discount));
809 809
 			$invoice->recalculate_total();
810 810
 
811
-			if ( $invoice->get_total_discount() > 0 ) {
811
+			if ($invoice->get_total_discount() > 0) {
812 812
 				$invoice->save();
813 813
 			}
814 814
 }
815 815
 
816 816
 		// Show an admin message.
817
-		$this->show_success( __( 'Discounts have been recalculated.', 'invoicing' ) );
817
+		$this->show_success(__('Discounts have been recalculated.', 'invoicing'));
818 818
 
819 819
 		// Redirect the admin.
820
-		wp_safe_redirect( remove_query_arg( array( 'getpaid-admin-action', 'getpaid-nonce' ) ) );
820
+		wp_safe_redirect(remove_query_arg(array('getpaid-admin-action', 'getpaid-nonce')));
821 821
 		exit;
822 822
 
823 823
 	}
@@ -829,8 +829,8 @@  discard block
 block discarded – undo
829 829
      * @return array
830 830
 	 */
831 831
 	public function get_notices() {
832
-		$notices = get_option( 'wpinv_admin_notices' );
833
-        return is_array( $notices ) ? $notices : array();
832
+		$notices = get_option('wpinv_admin_notices');
833
+        return is_array($notices) ? $notices : array();
834 834
 	}
835 835
 
836 836
 	/**
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
      * @return array
841 841
 	 */
842 842
 	public function has_notices() {
843
-		return count( $this->get_notices() ) > 0;
843
+		return count($this->get_notices()) > 0;
844 844
 	}
845 845
 
846 846
 	/**
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
 	 * @since       1.0.19
851 851
 	 */
852 852
 	public function clear_notices() {
853
-		delete_option( 'wpinv_admin_notices' );
853
+		delete_option('wpinv_admin_notices');
854 854
 	}
855 855
 
856 856
 	/**
@@ -859,16 +859,16 @@  discard block
 block discarded – undo
859 859
 	 * @access      public
860 860
 	 * @since       1.0.19
861 861
 	 */
862
-	public function save_notice( $type, $message ) {
862
+	public function save_notice($type, $message) {
863 863
 		$notices = $this->get_notices();
864 864
 
865
-		if ( empty( $notices[ $type ] ) || ! is_array( $notices[ $type ] ) ) {
866
-			$notices[ $type ] = array();
865
+		if (empty($notices[$type]) || !is_array($notices[$type])) {
866
+			$notices[$type] = array();
867 867
 		}
868 868
 
869
-		$notices[ $type ][] = $message;
869
+		$notices[$type][] = $message;
870 870
 
871
-		update_option( 'wpinv_admin_notices', $notices );
871
+		update_option('wpinv_admin_notices', $notices);
872 872
 	}
873 873
 
874 874
 	/**
@@ -878,8 +878,8 @@  discard block
 block discarded – undo
878 878
 	 * @access      public
879 879
 	 * @since       1.0.19
880 880
 	 */
881
-	public function show_success( $msg ) {
882
-		$this->save_notice( 'success', $msg );
881
+	public function show_success($msg) {
882
+		$this->save_notice('success', $msg);
883 883
 	}
884 884
 
885 885
 	/**
@@ -889,8 +889,8 @@  discard block
 block discarded – undo
889 889
 	 * @param       string $msg The message to qeue.
890 890
 	 * @since       1.0.19
891 891
 	 */
892
-	public function show_error( $msg ) {
893
-		$this->save_notice( 'error', $msg );
892
+	public function show_error($msg) {
893
+		$this->save_notice('error', $msg);
894 894
 	}
895 895
 
896 896
 	/**
@@ -900,8 +900,8 @@  discard block
 block discarded – undo
900 900
 	 * @param       string $msg The message to qeue.
901 901
 	 * @since       1.0.19
902 902
 	 */
903
-	public function show_warning( $msg ) {
904
-		$this->save_notice( 'warning', $msg );
903
+	public function show_warning($msg) {
904
+		$this->save_notice('warning', $msg);
905 905
 	}
906 906
 
907 907
 	/**
@@ -911,8 +911,8 @@  discard block
 block discarded – undo
911 911
 	 * @param       string $msg The message to qeue.
912 912
 	 * @since       1.0.19
913 913
 	 */
914
-	public function show_info( $msg ) {
915
-		$this->save_notice( 'info', $msg );
914
+	public function show_info($msg) {
915
+		$this->save_notice('info', $msg);
916 916
 	}
917 917
 
918 918
 	/**
@@ -926,29 +926,29 @@  discard block
 block discarded – undo
926 926
         $notices = $this->get_notices();
927 927
         $this->clear_notices();
928 928
 
929
-		foreach ( $notices as $type => $messages ) {
929
+		foreach ($notices as $type => $messages) {
930 930
 
931
-			if ( ! is_array( $messages ) ) {
931
+			if (!is_array($messages)) {
932 932
 				continue;
933 933
 			}
934 934
 
935
-            $type  = esc_attr( $type );
936
-			foreach ( $messages as $message ) {
937
-				echo wp_kses_post( "<div class='notice notice-$type is-dismissible'><p>$message</p></div>" );
935
+            $type = esc_attr($type);
936
+			foreach ($messages as $message) {
937
+				echo wp_kses_post("<div class='notice notice-$type is-dismissible'><p>$message</p></div>");
938 938
             }
939 939
 }
940 940
 
941
-		foreach ( array( 'checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page' ) as $page ) {
941
+		foreach (array('checkout_page', 'invoice_history_page', 'success_page', 'failure_page', 'invoice_subscription_page') as $page) {
942 942
 
943
-			if ( ! is_numeric( wpinv_get_option( $page, false ) ) ) {
944
-				$url     = wp_nonce_url(
945
-					add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
943
+			if (!is_numeric(wpinv_get_option($page, false))) {
944
+				$url = wp_nonce_url(
945
+					add_query_arg('getpaid-admin-action', 'create_missing_pages'),
946 946
 					'getpaid-nonce',
947 947
 					'getpaid-nonce'
948 948
 				);
949
-				$message  = __( 'Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing' );
950
-				$message2 = __( 'Generate Pages', 'invoicing' );
951
-				echo wp_kses_post( "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>" );
949
+				$message  = __('Some GetPaid pages are missing. To use GetPaid without any issues, click the button below to generate the missing pages.', 'invoicing');
950
+				$message2 = __('Generate Pages', 'invoicing');
951
+				echo wp_kses_post("<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>");
952 952
 				break;
953 953
 			}
954 954
 }
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/includes/class-super-duper-bricks-element.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 
4
-if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
+if (!defined('ABSPATH')) exit; // Exit if accessed directly
5 5
 
6 6
 
7 7
 class Super_Duper_Bricks_Element extends \Bricks\Element {
8 8
 
9 9
 	public $widget;
10 10
 
11
-	public function __construct( $element = null ) {
11
+	public function __construct($element = null) {
12 12
 
13 13
 
14 14
 		$block_icon = !empty($this->widget->options['block-icon']) ? $this->widget->options['block-icon'] : '';
15 15
 
16 16
 
17
-		$this->category = !empty($this->widget->options['textdomain']) ? esc_attr( $this->widget->options['textdomain'] ) : 'Super Duper';
17
+		$this->category = !empty($this->widget->options['textdomain']) ? esc_attr($this->widget->options['textdomain']) : 'Super Duper';
18 18
 		$this->name     = $this->widget->id_base;
19 19
 		$this->icon     = (strpos($block_icon, 'fa') === 0) ? esc_attr($this->widget->options['block-icon']) : 'fas fa-globe-americas';
20 20
 
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 	 * @return array|string|string[]|null
28 28
 	 */
29 29
 	public function get_label() {
30
-		$escaped_text = esc_attr( $this->widget->name );
31
-		return str_replace( ' &gt; ', ' > ', $escaped_text ); // keep our > but have it safe
30
+		$escaped_text = esc_attr($this->widget->name);
31
+		return str_replace(' &gt; ', ' > ', $escaped_text); // keep our > but have it safe
32 32
 	}
33 33
 
34 34
 	/**
@@ -54,19 +54,19 @@  discard block
 block discarded – undo
54 54
 		$args = $this->sd_get_arguments();
55 55
 
56 56
 		$groups = array();
57
-		if(!empty($args)) {
57
+		if (!empty($args)) {
58 58
 			foreach ($args as $k => $v) {
59
-				$g_slug = !empty($v['group']) ? sanitize_title( $v['group'] ) : '';
60
-				if($g_slug && empty($groups[$g_slug])) {
59
+				$g_slug = !empty($v['group']) ? sanitize_title($v['group']) : '';
60
+				if ($g_slug && empty($groups[$g_slug])) {
61 61
 					$groups[$g_slug] = array(
62
-						'title' => esc_html( $v['group'] ),
62
+						'title' => esc_html($v['group']),
63 63
 						'tab' => 'content',
64 64
 					);
65 65
 				}
66 66
 			}
67 67
 		}
68 68
 
69
-		if(!empty($groups)) {
69
+		if (!empty($groups)) {
70 70
 			$this->control_groups = $this->control_groups + $groups;
71 71
 		}
72 72
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 		$args = $this->widget->set_arguments();
82 82
 		$arg_keys_subtract = $this->sd_remove_arguments();
83 83
 
84
-		if ( ! empty( $arg_keys_subtract ) ) {
85
-			foreach($arg_keys_subtract as $key ){
84
+		if (!empty($arg_keys_subtract)) {
85
+			foreach ($arg_keys_subtract as $key) {
86 86
 				unset($args[$key]);
87 87
 			}
88 88
 		}
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 	 * @return void
98 98
 	 */
99 99
 	public function render() {
100
-		$settings   = $this->sd_maybe_convert_values( $this->settings );
100
+		$settings = $this->sd_maybe_convert_values($this->settings);
101 101
 
102 102
 
103 103
 		// set the AyeCode UI calss on the wrapper
104
-		$this->set_attribute( '_root', 'class', 'bsui' );
104
+		$this->set_attribute('_root', 'class', 'bsui');
105 105
 
106 106
 		// we might need to add a placeholder here for previews.
107 107
 
108 108
 		// add the bricks attributes to wrapper
109
-		echo "<div {$this->render_attributes( '_root' )}>";
109
+		echo "<div {$this->render_attributes('_root')}>";
110 110
 		echo $this->widget->output($settings);
111 111
 		echo '</div>';
112 112
 	}
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
 	 * @param $settings
118 118
 	 * @return mixed
119 119
 	 */
120
-	public function sd_maybe_convert_values( $settings ) {
120
+	public function sd_maybe_convert_values($settings) {
121 121
 
122 122
 
123 123
 		if (!empty($settings)) {
124
-			foreach( $settings as $k => $v ) {
125
-				if(is_array($v)) {
124
+			foreach ($settings as $k => $v) {
125
+				if (is_array($v)) {
126 126
 					$value = '';
127 127
 					// is color
128 128
 					if (isset($v['hex'])) {
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 				$arg['hasDynamicData'] = false;
169 169
 
170 170
 				if (!empty($arg['group'])) {
171
-					$arg['group'] =  sanitize_title($arg['group']);
171
+					$arg['group'] = sanitize_title($arg['group']);
172 172
 				}
173 173
 
174 174
 				$arg['rerender'] = true;
175 175
 
176 176
 				// required
177
-				if(!empty($arg['element_require'])) {
177
+				if (!empty($arg['element_require'])) {
178 178
 					$arg['required'] = $this->sd_convert_required($arg['element_require']);
179 179
 					unset($arg['element_require']);
180 180
 				}
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 /**
254 254
  * This implements the desktop, tablet and mobile breakpoints views with our fields that are hidden on these types and adda the icon after the label to show which it applies to.
255 255
  */
256
-add_action( 'wp_enqueue_scripts', function() {
256
+add_action('wp_enqueue_scripts', function() {
257 257
 
258 258
 	// Check if we're in the Bricks Editor
259
-	if ( isset( $_GET['bricks'] ) && $_GET['bricks'] && bricks_is_builder_main() ) {
259
+	if (isset($_GET['bricks']) && $_GET['bricks'] && bricks_is_builder_main()) {
260 260
 		// Add inline script to the 'bricks-builder' script
261 261
 		wp_add_inline_script(
262 262
 			'bricks-builder',
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.7
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.
includes/class-wpinv-privacy-exporters.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Personal data exporters.
4 4
  */
5 5
 
6
-defined( 'ABSPATH' ) || exit;
6
+defined('ABSPATH') || exit;
7 7
 
8 8
 /**
9 9
  * WPInv_Privacy_Exporters Class.
@@ -17,39 +17,39 @@  discard block
 block discarded – undo
17 17
      * @param int    $page  Page.
18 18
      * @return array An array of invoice data in name value pairs
19 19
      */
20
-    public static function customer_invoice_data_exporter( $email_address, $page ) {
20
+    public static function customer_invoice_data_exporter($email_address, $page) {
21 21
         $done           = false;
22 22
         $page           = (int) $page;
23 23
         $data_to_export = array();
24 24
 
25
-        $user           = get_user_by( 'email', $email_address );
26
-        if ( ! $user instanceof WP_User ) {
25
+        $user           = get_user_by('email', $email_address);
26
+        if (!$user instanceof WP_User) {
27 27
             return array(
28 28
                 'data' => $data_to_export,
29 29
                 'done' => true,
30 30
             );
31 31
         }
32 32
 
33
-        $args    = array(
34
-            'limit'    => get_option( 'posts_per_page' ),
33
+        $args = array(
34
+            'limit'    => get_option('posts_per_page'),
35 35
             'page'     => $page,
36 36
             'user'     => $user->ID,
37 37
             'paginate' => false,
38 38
         );
39 39
 
40
-        $invoices = wpinv_get_invoices( $args );
40
+        $invoices = wpinv_get_invoices($args);
41 41
 
42
-        if ( 0 < count( $invoices ) ) {
43
-            foreach ( $invoices as $invoice ) {
42
+        if (0 < count($invoices)) {
43
+            foreach ($invoices as $invoice) {
44 44
                 $data_to_export[] = array(
45 45
                     'group_id'          => 'customer_invoices',
46
-                    'group_label'       => __( 'GetPaid: Invoices', 'invoicing' ),
47
-                    'group_description' => __( 'Customer invoices.', 'invoicing' ),
46
+                    'group_label'       => __('GetPaid: Invoices', 'invoicing'),
47
+                    'group_description' => __('Customer invoices.', 'invoicing'),
48 48
                     'item_id'           => "wpinv-{$invoice->get_id()}",
49
-                    'data'              => self::get_customer_invoice_data( $invoice ),
49
+                    'data'              => self::get_customer_invoice_data($invoice),
50 50
                 );
51 51
             }
52
-            $done = get_option( 'posts_per_page' ) > count( $invoices );
52
+            $done = get_option('posts_per_page') > count($invoices);
53 53
         } else {
54 54
             $done = true;
55 55
         }
@@ -67,122 +67,122 @@  discard block
 block discarded – undo
67 67
      * @param WPInv_Invoice $invoice invoice object.
68 68
      * @return array
69 69
      */
70
-    public static function get_customer_invoice_data( $invoice ) {
70
+    public static function get_customer_invoice_data($invoice) {
71 71
 
72 72
         // Prepare basic properties.
73 73
         $props_to_export = array(
74 74
             'number'       => array(
75
-                'name'  => __( 'Invoice Number', 'invoicing' ),
75
+                'name'  => __('Invoice Number', 'invoicing'),
76 76
                 'value' => $invoice->get_number(),
77 77
             ),
78 78
             'created_date' => array(
79
-                'name'  => __( 'Created Date', 'invoicing' ),
79
+                'name'  => __('Created Date', 'invoicing'),
80 80
                 'value' => $invoice->get_date_created(),
81 81
             ),
82 82
             'due_date'     => array(
83
-                'name'  => __( 'Due Date', 'invoicing' ),
83
+                'name'  => __('Due Date', 'invoicing'),
84 84
                 'value' => $invoice->get_due_date(),
85 85
             ),
86 86
             'items'        => array(
87
-                'name'  => __( 'Invoice Items', 'invoicing' ),
88
-                'value' => self::process_invoice_items( $invoice ),
87
+                'name'  => __('Invoice Items', 'invoicing'),
88
+                'value' => self::process_invoice_items($invoice),
89 89
             ),
90 90
             'discount'     => array(
91
-                'name'  => __( 'Invoice Discount', 'invoicing' ),
92
-                'value' => wpinv_price( $invoice->get_total_discount(), $invoice->get_currency() ),
91
+                'name'  => __('Invoice Discount', 'invoicing'),
92
+                'value' => wpinv_price($invoice->get_total_discount(), $invoice->get_currency()),
93 93
             ),
94 94
             'total'        => array(
95
-                'name'  => __( 'Invoice Total', 'invoicing' ),
96
-                'value' => wpinv_price( $invoice->get_total(), $invoice->get_currency() ),
95
+                'name'  => __('Invoice Total', 'invoicing'),
96
+                'value' => wpinv_price($invoice->get_total(), $invoice->get_currency()),
97 97
             ),
98 98
             'status'       => array(
99
-                'name'  => __( 'Invoice Status', 'invoicing' ),
99
+                'name'  => __('Invoice Status', 'invoicing'),
100 100
                 'value' => $invoice->get_status_nicename(),
101 101
             ),
102 102
             'first_name'   => array(
103
-                'name'  => __( 'First Name', 'invoicing' ),
103
+                'name'  => __('First Name', 'invoicing'),
104 104
                 'value' => $invoice->get_first_name(),
105 105
             ),
106 106
             'last_name'    => array(
107
-                'name'  => __( 'Last Name', 'invoicing' ),
107
+                'name'  => __('Last Name', 'invoicing'),
108 108
                 'value' => $invoice->get_last_name(),
109 109
             ),
110 110
             'email'        => array(
111
-                'name'  => __( 'Email Address', 'invoicing' ),
111
+                'name'  => __('Email Address', 'invoicing'),
112 112
                 'value' => $invoice->get_email(),
113 113
             ),
114 114
             'company'      => array(
115
-                'name'  => __( 'Company', 'invoicing' ),
115
+                'name'  => __('Company', 'invoicing'),
116 116
                 'value' => $invoice->get_company(),
117 117
             ),
118 118
             'phone'        => array(
119
-                'name'  => __( 'Phone Number', 'invoicing' ),
119
+                'name'  => __('Phone Number', 'invoicing'),
120 120
                 'value' => $invoice->get_phone(),
121 121
             ),
122 122
             'address'      => array(
123
-                'name'  => __( 'Address', 'invoicing' ),
123
+                'name'  => __('Address', 'invoicing'),
124 124
                 'value' => $invoice->get_address(),
125 125
             ),
126 126
             'city'         => array(
127
-                'name'  => __( 'City', 'invoicing' ),
127
+                'name'  => __('City', 'invoicing'),
128 128
                 'value' => $invoice->get_city(),
129 129
             ),
130 130
             'state'        => array(
131
-                'name'  => __( 'State', 'invoicing' ),
131
+                'name'  => __('State', 'invoicing'),
132 132
                 'value' => $invoice->get_state(),
133 133
             ),
134 134
             'zip'          => array(
135
-                'name'  => __( 'Zip', 'invoicing' ),
135
+                'name'  => __('Zip', 'invoicing'),
136 136
                 'value' => $invoice->get_zip(),
137 137
             ),
138 138
             'vat_number'   => array(
139
-                'name'  => __( 'VAT Number', 'invoicing' ),
139
+                'name'  => __('VAT Number', 'invoicing'),
140 140
                 'value' => $invoice->get_vat_number(),
141 141
             ),
142 142
             'description'  => array(
143
-                'name'  => __( 'Description', 'invoicing' ),
143
+                'name'  => __('Description', 'invoicing'),
144 144
                 'value' => $invoice->get_description(),
145 145
             ),
146 146
         );
147 147
 
148 148
         // In case the invoice is paid, add the payment date and gateway.
149
-        if ( $invoice->is_paid() ) {
149
+        if ($invoice->is_paid()) {
150 150
 
151 151
             $props_to_export['completed_date'] = array(
152
-                'name'  => __( 'Completed Date', 'invoicing' ),
152
+                'name'  => __('Completed Date', 'invoicing'),
153 153
                 'value' => $invoice->get_completed_date(),
154 154
             );
155 155
 
156 156
             $props_to_export['gateway'] = array(
157
-                'name'  => __( 'Paid Via', 'invoicing' ),
157
+                'name'  => __('Paid Via', 'invoicing'),
158 158
                 'value' => $invoice->get_gateway(),
159 159
             );
160 160
 
161 161
         }
162 162
 
163 163
         // Maybe add subscription details.
164
-        $props_to_export = self::process_subscription( $invoice, $props_to_export );
164
+        $props_to_export = self::process_subscription($invoice, $props_to_export);
165 165
 
166 166
         // Add the ip address.
167 167
         $props_to_export['ip'] = array(
168
-            'name'  => __( 'IP Address', 'invoicing' ),
168
+            'name'  => __('IP Address', 'invoicing'),
169 169
             'value' => $invoice->get_ip(),
170 170
         );
171 171
 
172 172
         // Add the invoice url.
173 173
         $props_to_export['view_url'] = array(
174
-            'name'  => __( 'Invoice URL', 'invoicing' ),
174
+            'name'  => __('Invoice URL', 'invoicing'),
175 175
             'value' => $invoice->get_view_url(),
176 176
         );
177 177
 
178 178
         // Return the values.
179
-        $items = apply_filters( 'getpaid_privacy_export_invoice_personal_data', array_values( $props_to_export ), $invoice );
179
+        $items = apply_filters('getpaid_privacy_export_invoice_personal_data', array_values($props_to_export), $invoice);
180 180
 
181 181
         $data = array();
182 182
 
183 183
         // Unset null values to prevent PHP deprecated notice.
184
-        foreach ( $items as $item ) {
185
-            if ( isset( $item['value'] ) && ! is_null( $item['value'] ) ) {
184
+        foreach ($items as $item) {
185
+            if (isset($item['value']) && !is_null($item['value'])) {
186 186
                 $data[] = $item;
187 187
             }
188 188
         }
@@ -198,40 +198,40 @@  discard block
 block discarded – undo
198 198
      * @param array $props invoice props.
199 199
      * @return array
200 200
      */
201
-    public static function process_subscription( $invoice, $props ) {
201
+    public static function process_subscription($invoice, $props) {
202 202
 
203
-        $subscription = wpinv_get_subscription( $invoice );
204
-        if ( ! empty( $subscription ) ) {
203
+        $subscription = wpinv_get_subscription($invoice);
204
+        if (!empty($subscription)) {
205 205
 
206
-            $frequency    = getpaid_get_subscription_period_label( $subscription->get_period(), $subscription->get_frequency() );
207
-            $period       = wpinv_price( $subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency() ) . ' / ' . $frequency;
208
-            $initial_amt  = wpinv_price( $subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency() );
209
-            $bill_times   = $subscription->get_times_billed() . ' / ' . ( ( $subscription->get_bill_times() == 0 ) ? __( 'Until Cancelled', 'invoicing' ) : $subscription->get_bill_times() );
210
-            $renewal_date = getpaid_format_date_value( $subscription->get_expiration() );
206
+            $frequency    = getpaid_get_subscription_period_label($subscription->get_period(), $subscription->get_frequency());
207
+            $period       = wpinv_price($subscription->get_recurring_amount(), $subscription->get_parent_payment()->get_currency()) . ' / ' . $frequency;
208
+            $initial_amt  = wpinv_price($subscription->get_initial_amount(), $subscription->get_parent_payment()->get_currency());
209
+            $bill_times   = $subscription->get_times_billed() . ' / ' . (($subscription->get_bill_times() == 0) ? __('Until Cancelled', 'invoicing') : $subscription->get_bill_times());
210
+            $renewal_date = getpaid_format_date_value($subscription->get_expiration());
211 211
 
212 212
             // Billing cycle.
213 213
             $props['period'] = array(
214
-                'name'  => __( 'Billing Cycle', 'invoicing' ),
214
+                'name'  => __('Billing Cycle', 'invoicing'),
215 215
                 'value' => $period,
216 216
             );
217 217
 
218 218
             // Initial amount.
219 219
             $props['initial_amount'] = array(
220
-                'name'  => __( 'Initial Amount', 'invoicing' ),
220
+                'name'  => __('Initial Amount', 'invoicing'),
221 221
                 'value' => $initial_amt,
222 222
             );
223 223
 
224 224
             // Bill times.
225 225
             $props['bill_times'] = array(
226
-                'name'  => __( 'Times Billed', 'invoicing' ),
226
+                'name'  => __('Times Billed', 'invoicing'),
227 227
                 'value' => $bill_times,
228 228
             );
229 229
 
230 230
             // Add expiry date.
231
-            if ( $subscription->is_active() ) {
231
+            if ($subscription->is_active()) {
232 232
 
233 233
                 $props['renewal_date'] = array(
234
-                    'name'  => __( 'Expires', 'invoicing' ),
234
+                    'name'  => __('Expires', 'invoicing'),
235 235
                     'value' => $renewal_date,
236 236
                 );
237 237
 
@@ -249,19 +249,19 @@  discard block
 block discarded – undo
249 249
      * @param WPInv_Invoice $invoice invoice object.
250 250
      * @return array
251 251
      */
252
-    public static function process_invoice_items( $invoice ) {
252
+    public static function process_invoice_items($invoice) {
253 253
 
254 254
         $item_names = array();
255
-        foreach ( $invoice->get_items() as $cart_item ) {
255
+        foreach ($invoice->get_items() as $cart_item) {
256 256
             $item_names[] = sprintf(
257 257
                 '%s x %s - %s',
258 258
                 $cart_item->get_name(),
259 259
                 $cart_item->get_quantity(),
260
-                wpinv_price( $invoice->is_renewal() ? $cart_item->get_recurring_sub_total() : $cart_item->get_sub_total(), $invoice->get_currency() )
260
+                wpinv_price($invoice->is_renewal() ? $cart_item->get_recurring_sub_total() : $cart_item->get_sub_total(), $invoice->get_currency())
261 261
             );
262 262
         }
263 263
 
264
-        return implode( ', ', $item_names );
264
+        return implode(', ', $item_names);
265 265
 
266 266
     }
267 267
 
Please login to merge, or discard this patch.
includes/class-wpinv-privacy.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Privacy/GDPR related functionality which ties into WordPress functionality.
4 4
  */
5 5
 
6
-defined( 'ABSPATH' ) || exit;
6
+defined('ABSPATH') || exit;
7 7
 
8 8
 /**
9 9
  * WPInv_Privacy Class.
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         $this->init();
27 27
 
28 28
         // Initialize data exporters and erasers.
29
-        add_action( 'init', array( $this, 'register_erasers_exporters' ) );
29
+        add_action('init', array($this, 'register_erasers_exporters'));
30 30
     }
31 31
 
32 32
    /**
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
      * Due to the use of translation functions, this should run only after plugins loaded.
36 36
      */
37 37
     public function register_erasers_exporters() {
38
-        $this->name = __( 'GetPaid', 'invoicing' );
38
+        $this->name = __('GetPaid', 'invoicing');
39 39
 
40 40
         // This hook registers Invoicing data exporters.
41
-        $this->add_exporter( 'wpinv-customer-invoices', __( 'Customer Invoices', 'invoicing' ), array( 'WPInv_Privacy_Exporters', 'customer_invoice_data_exporter' ) );
41
+        $this->add_exporter('wpinv-customer-invoices', __('Customer Invoices', 'invoicing'), array('WPInv_Privacy_Exporters', 'customer_invoice_data_exporter'));
42 42
     }
43 43
 
44 44
     /**
@@ -49,27 +49,27 @@  discard block
 block discarded – undo
49 49
     public function get_privacy_message() {
50 50
 
51 51
         $content = '<div class="wp-suggested-text">' .
52
-                   '<h2>' . __( 'Invoices and checkout', 'invoicing' ) . '</h2>' .
53
-                   '<p class="privacy-policy-tutorial">' . __( 'Example privacy texts.', 'invoicing' ) . '</p>' .
54
-                   '<p>' . __( 'We collect information about you during the checkout process on our site. This information may include, but is not limited to, your name, email address, phone number, address, IP and any other details that might be requested from you for the purpose of processing your payment and retaining your invoice details for legal reasons.', 'invoicing' ) . '</p>' .
55
-                   '<p>' . __( 'Handling this data also allows us to:', 'invoicing' ) . '</p>' .
52
+                   '<h2>' . __('Invoices and checkout', 'invoicing') . '</h2>' .
53
+                   '<p class="privacy-policy-tutorial">' . __('Example privacy texts.', 'invoicing') . '</p>' .
54
+                   '<p>' . __('We collect information about you during the checkout process on our site. This information may include, but is not limited to, your name, email address, phone number, address, IP and any other details that might be requested from you for the purpose of processing your payment and retaining your invoice details for legal reasons.', 'invoicing') . '</p>' .
55
+                   '<p>' . __('Handling this data also allows us to:', 'invoicing') . '</p>' .
56 56
                    '<ul>' .
57
-                   '<li>' . __( '- Send you important account/invoice/service information.', 'invoicing' ) . '</li>' .
58
-                   '<li>' . __( '- Estimate taxes based on your location.', 'invoicing' ) . '</li>' .
59
-                   '<li>' . __( '- Respond to your queries or complaints.', 'invoicing' ) . '</li>' .
60
-                   '<li>' . __( '- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' .
61
-                   '<li>' . __( '- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing' ) . '</li>' .
62
-                   '<li>' . __( '- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'invoicing' ) . '</li>' .
57
+                   '<li>' . __('- Send you important account/invoice/service information.', 'invoicing') . '</li>' .
58
+                   '<li>' . __('- Estimate taxes based on your location.', 'invoicing') . '</li>' .
59
+                   '<li>' . __('- Respond to your queries or complaints.', 'invoicing') . '</li>' .
60
+                   '<li>' . __('- Process payments and to prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', 'invoicing') . '</li>' .
61
+                   '<li>' . __('- Retain historical payment and invoice history. We do this on the basis of legal obligations.', 'invoicing') . '</li>' .
62
+                   '<li>' . __('- Set up and administer your account, provide technical and/or customer support, and to verify your identity. We do this on the basis of our legitimate business interests.', 'invoicing') . '</li>' .
63 63
                    '</ul>' .
64
-                   '<p>' . __( 'In addition to collecting information at checkout we may also use and store your contact details when manually creating invoices for require payments relating to prior contractual agreements or agreed terms.', 'invoicing' ) . '</p>' .
65
-                   '<h2>' . __( 'What we share with others', 'invoicing' ) . '</h2>' .
66
-                   '<p>' . __( 'We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing' ) . '</p>' .
67
-                   '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should list which third party payment processors you’re using to take payments since these may handle customer data. We’ve included PayPal as an example, but you should remove this if you’re not using PayPal.', 'invoicing' ) . '</p>' .
68
-                   '<p>' . __( 'We accept payments through PayPal. When processing payments, some of your data will be passed to PayPal, including information required to process or support the payment, such as the purchase total and billing information.', 'invoicing' ) . '</p>' .
69
-                   '<p>' . __( 'Please see the <a href="https://www.paypal.com/us/webapps/mpp/ua/privacy-full">PayPal Privacy Policy</a> for more details.', 'invoicing' ) . '</p>' .
64
+                   '<p>' . __('In addition to collecting information at checkout we may also use and store your contact details when manually creating invoices for require payments relating to prior contractual agreements or agreed terms.', 'invoicing') . '</p>' .
65
+                   '<h2>' . __('What we share with others', 'invoicing') . '</h2>' .
66
+                   '<p>' . __('We share information with third parties who help us provide our payment and invoicing services to you; for example --', 'invoicing') . '</p>' .
67
+                   '<p class="privacy-policy-tutorial">' . __('In this subsection you should list which third party payment processors you’re using to take payments since these may handle customer data. We’ve included PayPal as an example, but you should remove this if you’re not using PayPal.', 'invoicing') . '</p>' .
68
+                   '<p>' . __('We accept payments through PayPal. When processing payments, some of your data will be passed to PayPal, including information required to process or support the payment, such as the purchase total and billing information.', 'invoicing') . '</p>' .
69
+                   '<p>' . __('Please see the <a href="https://www.paypal.com/us/webapps/mpp/ua/privacy-full">PayPal Privacy Policy</a> for more details.', 'invoicing') . '</p>' .
70 70
                    '</div>';
71 71
 
72
-        return apply_filters( 'wpinv_privacy_policy_content', $content );
72
+        return apply_filters('wpinv_privacy_policy_content', $content);
73 73
     }
74 74
 
75 75
 }
Please login to merge, or discard this patch.