Passed
Push — master ( dd5891...4a2524 )
by Brian
04:39
created
includes/gateways/class-getpaid-paypal-gateway-ipn-handler.php 1 patch
Indentation   +391 added lines, -391 removed lines patch added patch discarded remove patch
@@ -12,473 +12,473 @@
 block discarded – undo
12 12
  */
13 13
 class GetPaid_Paypal_Gateway_IPN_Handler {
14 14
 
15
-	/**
16
-	 * Payment method id.
17
-	 *
18
-	 * @var string
19
-	 */
20
-	protected $id = 'paypal';
21
-
22
-	/**
23
-	 * Payment method object.
24
-	 *
25
-	 * @var GetPaid_Paypal_Gateway
26
-	 */
27
-	protected $gateway;
28
-
29
-	/**
30
-	 * Class constructor.
31
-	 *
32
-	 * @param GetPaid_Paypal_Gateway $gateway
33
-	 */
34
-	public function __construct( $gateway ) {
35
-		$this->gateway = $gateway;
36
-		$this->verify_ipn();
37
-	}
38
-
39
-	/**
40
-	 * Processes ipns and marks payments as complete.
41
-	 *
42
-	 * @return void
43
-	 */
44
-	public function verify_ipn() {
45
-
46
-		wpinv_error_log( 'GetPaid PayPal IPN Handler', false );
47
-
48
-		// Validate the IPN.
49
-		if ( empty( $_POST ) || ! $this->validate_ipn() ) {
50
-			wp_die( 'PayPal IPN Request Failure', 500 );
51
-		}
52
-
53
-		// Process the IPN.
54
-		$posted  = wp_unslash( $_POST );
55
-		$invoice = $this->get_ipn_invoice( $posted );
56
-
57
-		// Abort if it was not paid by our gateway.
58
-		if ( $this->id != $invoice->get_gateway() ) {
59
-			wpinv_error_log( 'Aborting, Invoice was not paid via PayPal', false );
60
-			wp_die( 'Invoice not paid via PayPal', 200 );
61
-		}
62
-
63
-		$posted['payment_status'] = isset( $posted['payment_status'] ) ? sanitize_key( strtolower( $posted['payment_status'] ) ) : '';
64
-		$posted['txn_type']       = sanitize_key( strtolower( $posted['txn_type'] ) );
65
-
66
-		wpinv_error_log( 'Payment status:' . $posted['payment_status'], false );
67
-		wpinv_error_log( 'IPN Type:' . $posted['txn_type'], false );
68
-
69
-		if ( method_exists( $this, 'ipn_txn_' . $posted['txn_type'] ) ) {
70
-			call_user_func( array( $this, 'ipn_txn_' . $posted['txn_type'] ), $invoice, $posted );
71
-			wpinv_error_log( 'Done processing IPN', false );
72
-			wp_die( 'Processed', 200 );
73
-		}
74
-
75
-		wpinv_error_log( 'Aborting, Unsupported IPN type:' . $posted['txn_type'], false );
76
-		wp_die( 'Unsupported IPN type', 200 );
77
-
78
-	}
79
-
80
-	/**
81
-	 * Retrieves IPN Invoice.
82
-	 *
83
-	 * @param array $posted
84
-	 * @return WPInv_Invoice
85
-	 */
86
-	protected function get_ipn_invoice( $posted ) {
87
-
88
-		wpinv_error_log( 'Retrieving PayPal IPN Response Invoice', false );
89
-
90
-		if ( ! empty( $posted['custom'] ) ) {
91
-			$invoice = new WPInv_Invoice( $posted['custom'] );
92
-
93
-			if ( $invoice->exists() ) {
94
-				wpinv_error_log( 'Found invoice #' . $invoice->get_number(), false );
95
-				return $invoice;
96
-			}
97
-		}
98
-
99
-		wpinv_error_log( 'Could not retrieve the associated invoice.', false );
100
-		wp_die( 'Could not retrieve the associated invoice.', 200 );
101
-	}
102
-
103
-	/**
104
-	 * Check PayPal IPN validity.
105
-	 */
106
-	protected function validate_ipn() {
107
-
108
-		wpinv_error_log( 'Validating PayPal IPN response', false );
109
-
110
-		// Retrieve the associated invoice.
111
-		$posted  = wp_unslash( $_POST );
112
-		$invoice = $this->get_ipn_invoice( $posted );
113
-
114
-		if ( $this->gateway->is_sandbox( $invoice ) ) {
115
-			wpinv_error_log( $posted, 'Invoice was processed in sandbox hence logging the posted data', false );
116
-		}
117
-
118
-		// Validate the IPN.
119
-		$posted['cmd'] = '_notify-validate';
120
-
121
-		// Send back post vars to paypal.
122
-		$params = array(
123
-			'body'        => $posted,
124
-			'timeout'     => 60,
125
-			'httpversion' => '1.1',
126
-			'compress'    => false,
127
-			'decompress'  => false,
128
-			'user-agent'  => 'GetPaid/' . WPINV_VERSION,
129
-		);
130
-
131
-		// Post back to get a response.
132
-		$response = wp_safe_remote_post( $this->gateway->is_sandbox( $invoice ) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr', $params );
133
-
134
-		// Check to see if the request was valid.
135
-		if ( ! is_wp_error( $response ) && $response['response']['code'] < 300 && strstr( $response['body'], 'VERIFIED' ) ) {
136
-			wpinv_error_log( 'Received valid response from PayPal IPN: ' . $response['body'], false );
137
-			return true;
138
-		}
139
-
140
-		if ( is_wp_error( $response ) ) {
141
-			wpinv_error_log( $response->get_error_message(), 'Received invalid response from PayPal IPN' );
142
-			return false;
143
-		}
144
-
145
-		wpinv_error_log( $response['body'], 'Received invalid response from PayPal IPN' );
146
-		return false;
147
-
148
-	}
149
-
150
-	/**
151
-	 * Check currency from IPN matches the invoice.
152
-	 *
153
-	 * @param WPInv_Invoice $invoice          Invoice object.
154
-	 * @param string   $currency currency to validate.
155
-	 */
156
-	protected function validate_ipn_currency( $invoice, $currency ) {
15
+    /**
16
+     * Payment method id.
17
+     *
18
+     * @var string
19
+     */
20
+    protected $id = 'paypal';
21
+
22
+    /**
23
+     * Payment method object.
24
+     *
25
+     * @var GetPaid_Paypal_Gateway
26
+     */
27
+    protected $gateway;
28
+
29
+    /**
30
+     * Class constructor.
31
+     *
32
+     * @param GetPaid_Paypal_Gateway $gateway
33
+     */
34
+    public function __construct( $gateway ) {
35
+        $this->gateway = $gateway;
36
+        $this->verify_ipn();
37
+    }
38
+
39
+    /**
40
+     * Processes ipns and marks payments as complete.
41
+     *
42
+     * @return void
43
+     */
44
+    public function verify_ipn() {
45
+
46
+        wpinv_error_log( 'GetPaid PayPal IPN Handler', false );
47
+
48
+        // Validate the IPN.
49
+        if ( empty( $_POST ) || ! $this->validate_ipn() ) {
50
+            wp_die( 'PayPal IPN Request Failure', 500 );
51
+        }
52
+
53
+        // Process the IPN.
54
+        $posted  = wp_unslash( $_POST );
55
+        $invoice = $this->get_ipn_invoice( $posted );
56
+
57
+        // Abort if it was not paid by our gateway.
58
+        if ( $this->id != $invoice->get_gateway() ) {
59
+            wpinv_error_log( 'Aborting, Invoice was not paid via PayPal', false );
60
+            wp_die( 'Invoice not paid via PayPal', 200 );
61
+        }
62
+
63
+        $posted['payment_status'] = isset( $posted['payment_status'] ) ? sanitize_key( strtolower( $posted['payment_status'] ) ) : '';
64
+        $posted['txn_type']       = sanitize_key( strtolower( $posted['txn_type'] ) );
65
+
66
+        wpinv_error_log( 'Payment status:' . $posted['payment_status'], false );
67
+        wpinv_error_log( 'IPN Type:' . $posted['txn_type'], false );
68
+
69
+        if ( method_exists( $this, 'ipn_txn_' . $posted['txn_type'] ) ) {
70
+            call_user_func( array( $this, 'ipn_txn_' . $posted['txn_type'] ), $invoice, $posted );
71
+            wpinv_error_log( 'Done processing IPN', false );
72
+            wp_die( 'Processed', 200 );
73
+        }
74
+
75
+        wpinv_error_log( 'Aborting, Unsupported IPN type:' . $posted['txn_type'], false );
76
+        wp_die( 'Unsupported IPN type', 200 );
77
+
78
+    }
79
+
80
+    /**
81
+     * Retrieves IPN Invoice.
82
+     *
83
+     * @param array $posted
84
+     * @return WPInv_Invoice
85
+     */
86
+    protected function get_ipn_invoice( $posted ) {
87
+
88
+        wpinv_error_log( 'Retrieving PayPal IPN Response Invoice', false );
89
+
90
+        if ( ! empty( $posted['custom'] ) ) {
91
+            $invoice = new WPInv_Invoice( $posted['custom'] );
92
+
93
+            if ( $invoice->exists() ) {
94
+                wpinv_error_log( 'Found invoice #' . $invoice->get_number(), false );
95
+                return $invoice;
96
+            }
97
+        }
98
+
99
+        wpinv_error_log( 'Could not retrieve the associated invoice.', false );
100
+        wp_die( 'Could not retrieve the associated invoice.', 200 );
101
+    }
102
+
103
+    /**
104
+     * Check PayPal IPN validity.
105
+     */
106
+    protected function validate_ipn() {
107
+
108
+        wpinv_error_log( 'Validating PayPal IPN response', false );
109
+
110
+        // Retrieve the associated invoice.
111
+        $posted  = wp_unslash( $_POST );
112
+        $invoice = $this->get_ipn_invoice( $posted );
113
+
114
+        if ( $this->gateway->is_sandbox( $invoice ) ) {
115
+            wpinv_error_log( $posted, 'Invoice was processed in sandbox hence logging the posted data', false );
116
+        }
117
+
118
+        // Validate the IPN.
119
+        $posted['cmd'] = '_notify-validate';
120
+
121
+        // Send back post vars to paypal.
122
+        $params = array(
123
+            'body'        => $posted,
124
+            'timeout'     => 60,
125
+            'httpversion' => '1.1',
126
+            'compress'    => false,
127
+            'decompress'  => false,
128
+            'user-agent'  => 'GetPaid/' . WPINV_VERSION,
129
+        );
130
+
131
+        // Post back to get a response.
132
+        $response = wp_safe_remote_post( $this->gateway->is_sandbox( $invoice ) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr', $params );
133
+
134
+        // Check to see if the request was valid.
135
+        if ( ! is_wp_error( $response ) && $response['response']['code'] < 300 && strstr( $response['body'], 'VERIFIED' ) ) {
136
+            wpinv_error_log( 'Received valid response from PayPal IPN: ' . $response['body'], false );
137
+            return true;
138
+        }
139
+
140
+        if ( is_wp_error( $response ) ) {
141
+            wpinv_error_log( $response->get_error_message(), 'Received invalid response from PayPal IPN' );
142
+            return false;
143
+        }
144
+
145
+        wpinv_error_log( $response['body'], 'Received invalid response from PayPal IPN' );
146
+        return false;
147
+
148
+    }
149
+
150
+    /**
151
+     * Check currency from IPN matches the invoice.
152
+     *
153
+     * @param WPInv_Invoice $invoice          Invoice object.
154
+     * @param string   $currency currency to validate.
155
+     */
156
+    protected function validate_ipn_currency( $invoice, $currency ) {
157 157
 
158
-		if ( strtolower( $invoice->get_currency() ) !== strtolower( $currency ) ) {
158
+        if ( strtolower( $invoice->get_currency() ) !== strtolower( $currency ) ) {
159 159
 
160
-			/* translators: %s: currency code. */
161
-			$invoice->update_status( 'wpi-processing', sprintf( __( 'Validation error: PayPal currencies do not match (code %s).', 'invoicing' ), $currency ) );
160
+            /* translators: %s: currency code. */
161
+            $invoice->update_status( 'wpi-processing', sprintf( __( 'Validation error: PayPal currencies do not match (code %s).', 'invoicing' ), $currency ) );
162 162
 
163
-			wpinv_error_log( "Currencies do not match: {$currency} instead of {$invoice->get_currency()}", 'IPN Error', __FILE__, __LINE__, true );
164
-		}
163
+            wpinv_error_log( "Currencies do not match: {$currency} instead of {$invoice->get_currency()}", 'IPN Error', __FILE__, __LINE__, true );
164
+        }
165 165
 
166
-		wpinv_error_log( $currency, 'Validated IPN Currency', false );
167
-	}
166
+        wpinv_error_log( $currency, 'Validated IPN Currency', false );
167
+    }
168 168
 
169
-	/**
170
-	 * Check payment amount from IPN matches the invoice.
171
-	 *
172
-	 * @param WPInv_Invoice $invoice          Invoice object.
173
-	 * @param float   $amount amount to validate.
174
-	 */
175
-	protected function validate_ipn_amount( $invoice, $amount ) {
176
-		if ( number_format( $invoice->get_total(), 2, '.', '' ) !== number_format( $amount, 2, '.', '' ) ) {
169
+    /**
170
+     * Check payment amount from IPN matches the invoice.
171
+     *
172
+     * @param WPInv_Invoice $invoice          Invoice object.
173
+     * @param float   $amount amount to validate.
174
+     */
175
+    protected function validate_ipn_amount( $invoice, $amount ) {
176
+        if ( number_format( $invoice->get_total(), 2, '.', '' ) !== number_format( $amount, 2, '.', '' ) ) {
177 177
 
178
-			/* translators: %s: Amount. */
179
-			$invoice->update_status( 'wpi-processing', sprintf( __( 'Validation error: PayPal amounts do not match (gross %s).', 'invoicing' ), $amount ) );
178
+            /* translators: %s: Amount. */
179
+            $invoice->update_status( 'wpi-processing', sprintf( __( 'Validation error: PayPal amounts do not match (gross %s).', 'invoicing' ), $amount ) );
180 180
 
181
-			wpinv_error_log( "Amounts do not match: {$amount} instead of {$invoice->get_total()}", 'IPN Error', __FILE__, __LINE__, true );
182
-		}
181
+            wpinv_error_log( "Amounts do not match: {$amount} instead of {$invoice->get_total()}", 'IPN Error', __FILE__, __LINE__, true );
182
+        }
183 183
 
184
-		wpinv_error_log( $amount, 'Validated IPN Amount', false );
185
-	}
184
+        wpinv_error_log( $amount, 'Validated IPN Amount', false );
185
+    }
186 186
 
187
-	/**
188
-	 * Verify receiver email from PayPal.
189
-	 *
190
-	 * @param WPInv_Invoice $invoice          Invoice object.
191
-	 * @param string   $receiver_email Email to validate.
192
-	 */
193
-	protected function validate_ipn_receiver_email( $invoice, $receiver_email ) {
194
-		$paypal_email = wpinv_get_option( 'paypal_email' );
187
+    /**
188
+     * Verify receiver email from PayPal.
189
+     *
190
+     * @param WPInv_Invoice $invoice          Invoice object.
191
+     * @param string   $receiver_email Email to validate.
192
+     */
193
+    protected function validate_ipn_receiver_email( $invoice, $receiver_email ) {
194
+        $paypal_email = wpinv_get_option( 'paypal_email' );
195 195
 
196
-		if ( $receiver_email && strcasecmp( trim( $receiver_email ), trim( $paypal_email ) ) !== 0 ) {
197
-			wpinv_record_gateway_error( 'IPN Error', "IPN Response is for another account: {$receiver_email}. Your email is {$paypal_email}" );
196
+        if ( $receiver_email && strcasecmp( trim( $receiver_email ), trim( $paypal_email ) ) !== 0 ) {
197
+            wpinv_record_gateway_error( 'IPN Error', "IPN Response is for another account: {$receiver_email}. Your email is {$paypal_email}" );
198 198
 
199
-			/* translators: %s: email address . */
200
-			$invoice->update_status( 'wpi-processing', sprintf( __( 'Validation error: PayPal IPN response from a different email address (%s).', 'invoicing' ), $receiver_email ) );
199
+            /* translators: %s: email address . */
200
+            $invoice->update_status( 'wpi-processing', sprintf( __( 'Validation error: PayPal IPN response from a different email address (%s).', 'invoicing' ), $receiver_email ) );
201 201
 
202
-			return wpinv_error_log( "IPN Response is for another account: {$receiver_email}. Your email is {$paypal_email}", 'IPN Error', __FILE__, __LINE__, true );
203
-		}
202
+            return wpinv_error_log( "IPN Response is for another account: {$receiver_email}. Your email is {$paypal_email}", 'IPN Error', __FILE__, __LINE__, true );
203
+        }
204 204
 
205
-		wpinv_error_log( 'Validated PayPal Email', false );
206
-	}
205
+        wpinv_error_log( 'Validated PayPal Email', false );
206
+    }
207 207
 
208
-	/**
209
-	 * Handles one time payments.
210
-	 *
211
-	 * @param WPInv_Invoice $invoice  Invoice object.
212
-	 * @param array    $posted Posted data.
213
-	 */
214
-	protected function ipn_txn_web_accept( $invoice, $posted ) {
208
+    /**
209
+     * Handles one time payments.
210
+     *
211
+     * @param WPInv_Invoice $invoice  Invoice object.
212
+     * @param array    $posted Posted data.
213
+     */
214
+    protected function ipn_txn_web_accept( $invoice, $posted ) {
215 215
 
216
-		// Collect payment details
217
-		$payment_status = strtolower( $posted['payment_status'] );
218
-		$business_email = isset( $posted['business'] ) && is_email( $posted['business'] ) ? trim( $posted['business'] ) : trim( $posted['receiver_email'] );
216
+        // Collect payment details
217
+        $payment_status = strtolower( $posted['payment_status'] );
218
+        $business_email = isset( $posted['business'] ) && is_email( $posted['business'] ) ? trim( $posted['business'] ) : trim( $posted['receiver_email'] );
219 219
 
220
-		$this->validate_ipn_receiver_email( $invoice, $business_email );
221
-		$this->validate_ipn_currency( $invoice, $posted['mc_currency'] );
220
+        $this->validate_ipn_receiver_email( $invoice, $business_email );
221
+        $this->validate_ipn_currency( $invoice, $posted['mc_currency'] );
222 222
 
223
-		// Update the transaction id.
224
-		if ( ! empty( $posted['txn_id'] ) ) {
225
-			$invoice->set_transaction_id( wpinv_clean( $posted['txn_id'] ) );
226
-			$invoice->save();
227
-		}
223
+        // Update the transaction id.
224
+        if ( ! empty( $posted['txn_id'] ) ) {
225
+            $invoice->set_transaction_id( wpinv_clean( $posted['txn_id'] ) );
226
+            $invoice->save();
227
+        }
228 228
 
229
-		$invoice->add_system_note( __( 'Processing invoice IPN', 'invoicing' ) );
229
+        $invoice->add_system_note( __( 'Processing invoice IPN', 'invoicing' ) );
230 230
 
231
-		// Process a refund.
232
-		if ( 'refunded' === $payment_status || 'reversed' === $payment_status ) {
231
+        // Process a refund.
232
+        if ( 'refunded' === $payment_status || 'reversed' === $payment_status ) {
233 233
 
234
-			update_post_meta( $invoice->get_id(), 'refunded_remotely', 1 );
234
+            update_post_meta( $invoice->get_id(), 'refunded_remotely', 1 );
235 235
 
236
-			if ( ! $invoice->is_refunded() ) {
237
-				$invoice->update_status( 'wpi-refunded', $posted['reason_code'] );
238
-			}
236
+            if ( ! $invoice->is_refunded() ) {
237
+                $invoice->update_status( 'wpi-refunded', $posted['reason_code'] );
238
+            }
239 239
 
240
-			return wpinv_error_log( $posted['reason_code'], false );
241
-		}
240
+            return wpinv_error_log( $posted['reason_code'], false );
241
+        }
242 242
 
243
-		// Process payments.
244
-		if ( 'completed' === $payment_status ) {
243
+        // Process payments.
244
+        if ( 'completed' === $payment_status ) {
245 245
 
246
-			if ( $invoice->is_paid() && 'wpi_processing' != $invoice->get_status() ) {
247
-				return wpinv_error_log( 'Aborting, Invoice #' . $invoice->get_number() . ' is already paid.', false );
248
-			}
246
+            if ( $invoice->is_paid() && 'wpi_processing' != $invoice->get_status() ) {
247
+                return wpinv_error_log( 'Aborting, Invoice #' . $invoice->get_number() . ' is already paid.', false );
248
+            }
249 249
 
250
-			$this->validate_ipn_amount( $invoice, $posted['mc_gross'] );
250
+            $this->validate_ipn_amount( $invoice, $posted['mc_gross'] );
251 251
 
252
-			$note = '';
252
+            $note = '';
253 253
 
254
-			if ( ! empty( $posted['mc_fee'] ) ) {
255
-				$note = sprintf( __( 'PayPal Transaction Fee %s.', 'invoicing' ), sanitize_text_field( $posted['mc_fee'] ) );
256
-			}
254
+            if ( ! empty( $posted['mc_fee'] ) ) {
255
+                $note = sprintf( __( 'PayPal Transaction Fee %s.', 'invoicing' ), sanitize_text_field( $posted['mc_fee'] ) );
256
+            }
257 257
 
258
-			if ( ! empty( $posted['payer_status'] ) ) {
259
-				$note = ' ' . sprintf( __( 'Buyer status %s.', 'invoicing' ), sanitize_text_field( $posted['payer_status'] ) );
260
-			}
258
+            if ( ! empty( $posted['payer_status'] ) ) {
259
+                $note = ' ' . sprintf( __( 'Buyer status %s.', 'invoicing' ), sanitize_text_field( $posted['payer_status'] ) );
260
+            }
261 261
 
262
-			$invoice->mark_paid( ( ! empty( $posted['txn_id'] ) ? sanitize_text_field( $posted['txn_id'] ) : '' ), trim( $note ) );
263
-			return wpinv_error_log( 'Invoice marked as paid.', false );
262
+            $invoice->mark_paid( ( ! empty( $posted['txn_id'] ) ? sanitize_text_field( $posted['txn_id'] ) : '' ), trim( $note ) );
263
+            return wpinv_error_log( 'Invoice marked as paid.', false );
264 264
 
265
-		}
265
+        }
266 266
 
267
-		// Pending payments.
268
-		if ( 'pending' === $payment_status ) {
267
+        // Pending payments.
268
+        if ( 'pending' === $payment_status ) {
269 269
 
270
-			/* translators: %s: pending reason. */
271
-			$invoice->update_status( 'wpi-onhold', sprintf( __( 'Payment pending (%s).', 'invoicing' ), $posted['pending_reason'] ) );
270
+            /* translators: %s: pending reason. */
271
+            $invoice->update_status( 'wpi-onhold', sprintf( __( 'Payment pending (%s).', 'invoicing' ), $posted['pending_reason'] ) );
272 272
 
273
-			return wpinv_error_log( 'Invoice marked as "payment held".', false );
274
-		}
273
+            return wpinv_error_log( 'Invoice marked as "payment held".', false );
274
+        }
275 275
 
276
-		/* translators: %s: payment status. */
277
-		$invoice->update_status( 'wpi-failed', sprintf( __( 'Payment %s via IPN.', 'invoicing' ), sanitize_text_field( $posted['payment_status'] ) ) );
276
+        /* translators: %s: payment status. */
277
+        $invoice->update_status( 'wpi-failed', sprintf( __( 'Payment %s via IPN.', 'invoicing' ), sanitize_text_field( $posted['payment_status'] ) ) );
278 278
 
279
-	}
279
+    }
280 280
 
281
-	/**
282
-	 * Handles one time payments.
283
-	 *
284
-	 * @param WPInv_Invoice $invoice  Invoice object.
285
-	 * @param array    $posted Posted data.
286
-	 */
287
-	protected function ipn_txn_cart( $invoice, $posted ) {
288
-		$this->ipn_txn_web_accept( $invoice, $posted );
289
-	}
281
+    /**
282
+     * Handles one time payments.
283
+     *
284
+     * @param WPInv_Invoice $invoice  Invoice object.
285
+     * @param array    $posted Posted data.
286
+     */
287
+    protected function ipn_txn_cart( $invoice, $posted ) {
288
+        $this->ipn_txn_web_accept( $invoice, $posted );
289
+    }
290 290
 
291
-	/**
292
-	 * Handles subscription sign ups.
293
-	 *
294
-	 * @param WPInv_Invoice $invoice  Invoice object.
295
-	 * @param array    $posted Posted data.
296
-	 */
297
-	protected function ipn_txn_subscr_signup( $invoice, $posted ) {
291
+    /**
292
+     * Handles subscription sign ups.
293
+     *
294
+     * @param WPInv_Invoice $invoice  Invoice object.
295
+     * @param array    $posted Posted data.
296
+     */
297
+    protected function ipn_txn_subscr_signup( $invoice, $posted ) {
298 298
 
299
-		wpinv_error_log( 'Processing subscription signup', false );
299
+        wpinv_error_log( 'Processing subscription signup', false );
300 300
 
301
-		// Make sure the invoice has a subscription.
302
-		$subscription = getpaid_get_invoice_subscription( $invoice );
301
+        // Make sure the invoice has a subscription.
302
+        $subscription = getpaid_get_invoice_subscription( $invoice );
303 303
 
304
-		if ( empty( $subscription ) ) {
305
-			return wpinv_error_log( 'Aborting, Subscription for the invoice ' . $invoice->get_id() . ' not found', false );
306
-		}
304
+        if ( empty( $subscription ) ) {
305
+            return wpinv_error_log( 'Aborting, Subscription for the invoice ' . $invoice->get_id() . ' not found', false );
306
+        }
307 307
 
308
-		wpinv_error_log( 'Found subscription #' . $subscription->get_id(), false );
308
+        wpinv_error_log( 'Found subscription #' . $subscription->get_id(), false );
309 309
 
310
-		// Validate the IPN.
311
-		$business_email = isset( $posted['business'] ) && is_email( $posted['business'] ) ? trim( $posted['business'] ) : trim( $posted['receiver_email'] );
312
-		$this->validate_ipn_receiver_email( $invoice, $business_email );
313
-		$this->validate_ipn_currency( $invoice, $posted['mc_currency'] );
310
+        // Validate the IPN.
311
+        $business_email = isset( $posted['business'] ) && is_email( $posted['business'] ) ? trim( $posted['business'] ) : trim( $posted['receiver_email'] );
312
+        $this->validate_ipn_receiver_email( $invoice, $business_email );
313
+        $this->validate_ipn_currency( $invoice, $posted['mc_currency'] );
314 314
 
315
-		// Activate the subscription.
316
-		$duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() );
317
-		$subscription->set_date_created( current_time( 'mysql' ) );
318
-		$subscription->set_expiration( date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) ) );
319
-		$subscription->set_profile_id( sanitize_text_field( $posted['subscr_id'] ) );
320
-		$subscription->activate();
315
+        // Activate the subscription.
316
+        $duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() );
317
+        $subscription->set_date_created( current_time( 'mysql' ) );
318
+        $subscription->set_expiration( date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) ) );
319
+        $subscription->set_profile_id( sanitize_text_field( $posted['subscr_id'] ) );
320
+        $subscription->activate();
321 321
 
322
-		// Set the transaction id.
323
-		if ( ! empty( $posted['txn_id'] ) ) {
324
-			$invoice->add_note( sprintf( __( 'PayPal Transaction ID: %s', 'invoicing' ), $posted['txn_id'] ), false, false, true );
325
-			$invoice->set_transaction_id( $posted['txn_id'] );
326
-		}
322
+        // Set the transaction id.
323
+        if ( ! empty( $posted['txn_id'] ) ) {
324
+            $invoice->add_note( sprintf( __( 'PayPal Transaction ID: %s', 'invoicing' ), $posted['txn_id'] ), false, false, true );
325
+            $invoice->set_transaction_id( $posted['txn_id'] );
326
+        }
327 327
 
328
-		// Update the payment status.
329
-		$invoice->mark_paid();
328
+        // Update the payment status.
329
+        $invoice->mark_paid();
330 330
 
331
-		$invoice->add_note( sprintf( __( 'PayPal Subscription ID: %s', 'invoicing' ), $posted['subscr_id'] ), false, false, true );
331
+        $invoice->add_note( sprintf( __( 'PayPal Subscription ID: %s', 'invoicing' ), $posted['subscr_id'] ), false, false, true );
332 332
 
333
-		wpinv_error_log( 'Subscription started.', false );
334
-	}
333
+        wpinv_error_log( 'Subscription started.', false );
334
+    }
335 335
 
336
-	/**
337
-	 * Handles subscription renewals.
338
-	 *
339
-	 * @param WPInv_Invoice $invoice  Invoice object.
340
-	 * @param array    $posted Posted data.
341
-	 */
342
-	protected function ipn_txn_subscr_payment( $invoice, $posted ) {
336
+    /**
337
+     * Handles subscription renewals.
338
+     *
339
+     * @param WPInv_Invoice $invoice  Invoice object.
340
+     * @param array    $posted Posted data.
341
+     */
342
+    protected function ipn_txn_subscr_payment( $invoice, $posted ) {
343 343
 
344
-		// Make sure the invoice has a subscription.
345
-		$subscription = getpaid_subscriptions()->get_invoice_subscription( $invoice );
344
+        // Make sure the invoice has a subscription.
345
+        $subscription = getpaid_subscriptions()->get_invoice_subscription( $invoice );
346 346
 
347
-		if ( empty( $subscription ) ) {
348
-			return wpinv_error_log( 'Aborting, Subscription for the invoice ' . $invoice->get_id() . ' not found', false );
349
-		}
347
+        if ( empty( $subscription ) ) {
348
+            return wpinv_error_log( 'Aborting, Subscription for the invoice ' . $invoice->get_id() . ' not found', false );
349
+        }
350 350
 
351
-		wpinv_error_log( 'Found subscription #' . $subscription->get_id(), false );
351
+        wpinv_error_log( 'Found subscription #' . $subscription->get_id(), false );
352 352
 
353
-		// PayPal sends a subscr_payment for the first payment too.
354
-		$date_completed = getpaid_format_date( $invoice->get_date_completed() );
355
-		$date_created   = getpaid_format_date( $invoice->get_date_created() );
356
-		$today_date     = getpaid_format_date( current_time( 'mysql' ) );
357
-		$payment_date   = getpaid_format_date( $posted['payment_date'] );
358
-		$subscribe_date = getpaid_format_date( $subscription->get_date_created() );
359
-		$dates          = array_filter( compact( 'date_completed', 'date_created', 'subscribe_date' ) );
353
+        // PayPal sends a subscr_payment for the first payment too.
354
+        $date_completed = getpaid_format_date( $invoice->get_date_completed() );
355
+        $date_created   = getpaid_format_date( $invoice->get_date_created() );
356
+        $today_date     = getpaid_format_date( current_time( 'mysql' ) );
357
+        $payment_date   = getpaid_format_date( $posted['payment_date'] );
358
+        $subscribe_date = getpaid_format_date( $subscription->get_date_created() );
359
+        $dates          = array_filter( compact( 'date_completed', 'date_created', 'subscribe_date' ) );
360 360
 
361
-		foreach ( $dates as $date ) {
361
+        foreach ( $dates as $date ) {
362 362
 
363
-			if ( $date !== $today_date && $date !== $payment_date ) {
364
-				continue;
365
-			}
363
+            if ( $date !== $today_date && $date !== $payment_date ) {
364
+                continue;
365
+            }
366 366
 
367
-			if ( ! empty( $posted['txn_id'] ) ) {
368
-				$invoice->set_transaction_id( sanitize_text_field( $posted['txn_id'] ) );
369
-				$invoice->add_note( wp_sprintf( __( 'PayPal Transaction ID: %s', 'invoicing' ), sanitize_text_field( $posted['txn_id'] ) ), false, false, true );
370
-			}
367
+            if ( ! empty( $posted['txn_id'] ) ) {
368
+                $invoice->set_transaction_id( sanitize_text_field( $posted['txn_id'] ) );
369
+                $invoice->add_note( wp_sprintf( __( 'PayPal Transaction ID: %s', 'invoicing' ), sanitize_text_field( $posted['txn_id'] ) ), false, false, true );
370
+            }
371 371
 
372
-			return $invoice->mark_paid();
373
-
374
-		}
372
+            return $invoice->mark_paid();
373
+
374
+        }
375 375
 
376
-		wpinv_error_log( 'Processing subscription renewal payment for the invoice ' . $invoice->get_id(), false );
377
-
378
-		// Abort if the payment is already recorded.
379
-		if ( wpinv_get_id_by_transaction_id( $posted['txn_id'] ) ) {
380
-			return wpinv_error_log( 'Aborting, Transaction ' . $posted['txn_id'] . ' has already been processed', false );
381
-		}
382
-
383
-		$args = array(
384
-			'transaction_id' => $posted['txn_id'],
385
-			'gateway'        => $this->id,
386
-		);
387
-
388
-		$invoice = wpinv_get_invoice( $subscription->add_payment( $args ) );
376
+        wpinv_error_log( 'Processing subscription renewal payment for the invoice ' . $invoice->get_id(), false );
377
+
378
+        // Abort if the payment is already recorded.
379
+        if ( wpinv_get_id_by_transaction_id( $posted['txn_id'] ) ) {
380
+            return wpinv_error_log( 'Aborting, Transaction ' . $posted['txn_id'] . ' has already been processed', false );
381
+        }
382
+
383
+        $args = array(
384
+            'transaction_id' => $posted['txn_id'],
385
+            'gateway'        => $this->id,
386
+        );
387
+
388
+        $invoice = wpinv_get_invoice( $subscription->add_payment( $args ) );
389 389
 
390
-		if ( empty( $invoice ) ) {
391
-			return;
392
-		}
390
+        if ( empty( $invoice ) ) {
391
+            return;
392
+        }
393 393
 
394
-		$invoice->add_note( wp_sprintf( __( 'PayPal Transaction ID: %s', 'invoicing' ), $posted['txn_id'] ), false, false, true );
395
-		$invoice->add_note( wp_sprintf( __( 'PayPal Subscription ID: %s', 'invoicing' ), $posted['subscr_id'] ), false, false, true );
394
+        $invoice->add_note( wp_sprintf( __( 'PayPal Transaction ID: %s', 'invoicing' ), $posted['txn_id'] ), false, false, true );
395
+        $invoice->add_note( wp_sprintf( __( 'PayPal Subscription ID: %s', 'invoicing' ), $posted['subscr_id'] ), false, false, true );
396 396
 
397
-		$subscription->renew();
398
-		wpinv_error_log( 'Subscription renewed.', false );
397
+        $subscription->renew();
398
+        wpinv_error_log( 'Subscription renewed.', false );
399 399
 
400
-	}
400
+    }
401 401
 
402
-	/**
403
-	 * Handles subscription cancelations.
404
-	 *
405
-	 * @param WPInv_Invoice $invoice  Invoice object.
406
-	 */
407
-	protected function ipn_txn_subscr_cancel( $invoice ) {
402
+    /**
403
+     * Handles subscription cancelations.
404
+     *
405
+     * @param WPInv_Invoice $invoice  Invoice object.
406
+     */
407
+    protected function ipn_txn_subscr_cancel( $invoice ) {
408 408
 
409
-		// Make sure the invoice has a subscription.
410
-		$subscription = getpaid_subscriptions()->get_invoice_subscription( $invoice );
411
-
412
-		if ( empty( $subscription ) ) {
413
-			return wpinv_error_log( 'Aborting, Subscription for the invoice ' . $invoice->get_id() . ' not found', false );
414
-		}
415
-
416
-		wpinv_error_log( 'Processing subscription cancellation for the invoice ' . $invoice->get_id(), false );
417
-		$subscription->cancel();
418
-		wpinv_error_log( 'Subscription cancelled.', false );
409
+        // Make sure the invoice has a subscription.
410
+        $subscription = getpaid_subscriptions()->get_invoice_subscription( $invoice );
411
+
412
+        if ( empty( $subscription ) ) {
413
+            return wpinv_error_log( 'Aborting, Subscription for the invoice ' . $invoice->get_id() . ' not found', false );
414
+        }
415
+
416
+        wpinv_error_log( 'Processing subscription cancellation for the invoice ' . $invoice->get_id(), false );
417
+        $subscription->cancel();
418
+        wpinv_error_log( 'Subscription cancelled.', false );
419 419
 
420
-	}
420
+    }
421 421
 
422
-	/**
423
-	 * Handles subscription completions.
424
-	 *
425
-	 * @param WPInv_Invoice $invoice  Invoice object.
426
-	 * @param array    $posted Posted data.
427
-	 */
428
-	protected function ipn_txn_subscr_eot( $invoice ) {
422
+    /**
423
+     * Handles subscription completions.
424
+     *
425
+     * @param WPInv_Invoice $invoice  Invoice object.
426
+     * @param array    $posted Posted data.
427
+     */
428
+    protected function ipn_txn_subscr_eot( $invoice ) {
429 429
 
430
-		// Make sure the invoice has a subscription.
431
-		$subscription = getpaid_subscriptions()->get_invoice_subscription( $invoice );
430
+        // Make sure the invoice has a subscription.
431
+        $subscription = getpaid_subscriptions()->get_invoice_subscription( $invoice );
432 432
 
433
-		if ( empty( $subscription ) ) {
434
-			return wpinv_error_log( 'Aborting, Subscription for the invoice ' . $invoice->get_id() . ' not found', false );
435
-		}
433
+        if ( empty( $subscription ) ) {
434
+            return wpinv_error_log( 'Aborting, Subscription for the invoice ' . $invoice->get_id() . ' not found', false );
435
+        }
436 436
 
437
-		wpinv_error_log( 'Processing subscription end of life for the invoice ' . $invoice->get_id(), false );
438
-		$subscription->complete();
439
-		wpinv_error_log( 'Subscription completed.', false );
437
+        wpinv_error_log( 'Processing subscription end of life for the invoice ' . $invoice->get_id(), false );
438
+        $subscription->complete();
439
+        wpinv_error_log( 'Subscription completed.', false );
440 440
 
441
-	}
441
+    }
442 442
 
443
-	/**
444
-	 * Handles subscription fails.
445
-	 *
446
-	 * @param WPInv_Invoice $invoice  Invoice object.
447
-	 * @param array    $posted Posted data.
448
-	 */
449
-	protected function ipn_txn_subscr_failed( $invoice ) {
443
+    /**
444
+     * Handles subscription fails.
445
+     *
446
+     * @param WPInv_Invoice $invoice  Invoice object.
447
+     * @param array    $posted Posted data.
448
+     */
449
+    protected function ipn_txn_subscr_failed( $invoice ) {
450 450
 
451
-		// Make sure the invoice has a subscription.
452
-		$subscription = getpaid_subscriptions()->get_invoice_subscription( $invoice );
451
+        // Make sure the invoice has a subscription.
452
+        $subscription = getpaid_subscriptions()->get_invoice_subscription( $invoice );
453 453
 
454
-		if ( empty( $subscription ) ) {
455
-			return wpinv_error_log( 'Aborting, Subscription for the invoice ' . $invoice->get_id() . ' not found', false );
456
-		}
454
+        if ( empty( $subscription ) ) {
455
+            return wpinv_error_log( 'Aborting, Subscription for the invoice ' . $invoice->get_id() . ' not found', false );
456
+        }
457 457
 
458
-		wpinv_error_log( 'Processing subscription payment failure for the invoice ' . $invoice->get_id(), false );
459
-		$subscription->failing();
460
-		wpinv_error_log( 'Subscription marked as failing.', false );
458
+        wpinv_error_log( 'Processing subscription payment failure for the invoice ' . $invoice->get_id(), false );
459
+        $subscription->failing();
460
+        wpinv_error_log( 'Subscription marked as failing.', false );
461 461
 
462
-	}
462
+    }
463 463
 
464
-	/**
465
-	 * Handles subscription suspensions.
466
-	 *
467
-	 * @param WPInv_Invoice $invoice  Invoice object.
468
-	 * @param array    $posted Posted data.
469
-	 */
470
-	protected function ipn_txn_recurring_payment_suspended_due_to_max_failed_payment( $invoice ) {
464
+    /**
465
+     * Handles subscription suspensions.
466
+     *
467
+     * @param WPInv_Invoice $invoice  Invoice object.
468
+     * @param array    $posted Posted data.
469
+     */
470
+    protected function ipn_txn_recurring_payment_suspended_due_to_max_failed_payment( $invoice ) {
471 471
 
472
-		// Make sure the invoice has a subscription.
473
-		$subscription = getpaid_subscriptions()->get_invoice_subscription( $invoice );
472
+        // Make sure the invoice has a subscription.
473
+        $subscription = getpaid_subscriptions()->get_invoice_subscription( $invoice );
474 474
 
475
-		if ( empty( $subscription ) ) {
476
-			return wpinv_error_log( 'Aborting, Subscription for the invoice ' . $invoice->get_id() . ' not found', false );
477
-		}
478
-
479
-		wpinv_error_log( 'Processing subscription cancellation due to max failed payment for the invoice ' . $invoice->get_id(), false );
480
-		$subscription->cancel();
481
-		wpinv_error_log( 'Subscription cancelled.', false );
482
-	}
475
+        if ( empty( $subscription ) ) {
476
+            return wpinv_error_log( 'Aborting, Subscription for the invoice ' . $invoice->get_id() . ' not found', false );
477
+        }
478
+
479
+        wpinv_error_log( 'Processing subscription cancellation due to max failed payment for the invoice ' . $invoice->get_id(), false );
480
+        $subscription->cancel();
481
+        wpinv_error_log( 'Subscription cancelled.', false );
482
+    }
483 483
 
484 484
 }
Please login to merge, or discard this patch.
includes/gateways/class-getpaid-payment-gateway.php 1 patch
Indentation   +615 added lines, -615 removed lines patch added patch discarded remove patch
@@ -13,464 +13,464 @@  discard block
 block discarded – undo
13 13
  */
14 14
 abstract class GetPaid_Payment_Gateway {
15 15
 
16
-	/**
17
-	 * Set if the place checkout button should be renamed on selection.
18
-	 *
19
-	 * @var string
20
-	 */
21
-	public $checkout_button_text;
22
-
23
-	/**
24
-	 * Boolean whether the method is enabled.
25
-	 *
26
-	 * @var bool
27
-	 */
28
-	public $enabled = true;
29
-
30
-	/**
31
-	 * Payment method id.
32
-	 *
33
-	 * @var string
34
-	 */
35
-	public $id;
36
-
37
-	/**
38
-	 * Payment method order.
39
-	 *
40
-	 * @var int
41
-	 */
42
-	public $order = 10;
43
-
44
-	/**
45
-	 * Payment method title for the frontend.
46
-	 *
47
-	 * @var string
48
-	 */
49
-	public $title;
50
-
51
-	/**
52
-	 * Payment method description for the frontend.
53
-	 *
54
-	 * @var string
55
-	 */
56
-	public $description;
57
-
58
-	/**
59
-	 * Gateway title.
60
-	 *
61
-	 * @var string
62
-	 */
63
-	public $method_title = '';
64
-
65
-	/**
66
-	 * Gateway description.
67
-	 *
68
-	 * @var string
69
-	 */
70
-	public $method_description = '';
71
-
72
-	/**
73
-	 * Countries this gateway is allowed for.
74
-	 *
75
-	 * @var array
76
-	 */
77
-	public $countries;
78
-
79
-	/**
80
-	 * Currencies this gateway is allowed for.
81
-	 *
82
-	 * @var array
83
-	 */
84
-	public $currencies;
85
-
86
-	/**
87
-	 * Currencies this gateway is not allowed for.
88
-	 *
89
-	 * @var array
90
-	 */
91
-	public $exclude_currencies;
92
-
93
-	/**
94
-	 * Maximum transaction amount, zero does not define a maximum.
95
-	 *
96
-	 * @var int
97
-	 */
98
-	public $max_amount = 0;
99
-
100
-	/**
101
-	 * Optional URL to view a transaction.
102
-	 *
103
-	 * @var string
104
-	 */
105
-	public $view_transaction_url = '';
106
-
107
-	/**
108
-	 * Optional URL to view a subscription.
109
-	 *
110
-	 * @var string
111
-	 */
112
-	public $view_subscription_url = '';
113
-
114
-	/**
115
-	 * Optional label to show for "new payment method" in the payment
116
-	 * method/token selection radio selection.
117
-	 *
118
-	 * @var string
119
-	 */
120
-	public $new_method_label = '';
121
-
122
-	/**
123
-	 * Contains a user's saved tokens for this gateway.
124
-	 *
125
-	 * @var array
126
-	 */
127
-	protected $tokens = array();
128
-
129
-	/**
130
-	 * An array of features that this gateway supports.
131
-	 *
132
-	 * @var array
133
-	 */
134
-	protected $supports = array();
135
-
136
-	/**
137
-	 * Class constructor.
138
-	 */
139
-	public function __construct() {
140
-
141
-		do_action( 'getpaid_before_init_payment_gateway_' . $this->id, $this );
142
-
143
-		// Register gateway.
144
-		add_filter( 'wpinv_payment_gateways', array( $this, 'register_gateway' ) );
145
-
146
-		$this->enabled = wpinv_is_gateway_active( $this->id );
147
-
148
-		// Add support for various features.
149
-		foreach ( $this->supports as $feature ) {
150
-			add_filter( "wpinv_{$this->id}_support_{$feature}", '__return_true' );
151
-			add_filter( "getpaid_{$this->id}_support_{$feature}", '__return_true' );
152
-			add_filter( "getpaid_{$this->id}_supports_{$feature}", '__return_true' );
153
-		}
154
-
155
-		// Invoice addons.
156
-		if ( $this->supports( 'addons' ) ) {
157
-			add_action( "getpaid_process_{$this->id}_invoice_addons", array( $this, 'process_addons' ), 10, 2 );
158
-		}
159
-
160
-		// Gateway settings.
161
-		add_filter( "wpinv_gateway_settings_{$this->id}", array( $this, 'admin_settings' ) );
162
-
163
-		// Gateway checkout fiellds.
164
-		add_action( "wpinv_{$this->id}_cc_form", array( $this, 'payment_fields' ), 10, 2 );
165
-
166
-		// Process payment.
167
-		add_action( "getpaid_gateway_{$this->id}", array( $this, 'process_payment' ), 10, 3 );
168
-
169
-		// Change the checkout button text.
170
-		if ( ! empty( $this->checkout_button_text ) ) {
171
-			add_filter( "getpaid_gateway_{$this->id}_checkout_button_label", array( $this, 'rename_checkout_button' ) );
172
-		}
173
-
174
-		// Check if a gateway is valid for a given currency.
175
-		add_filter( "getpaid_gateway_{$this->id}_is_valid_for_currency", array( $this, 'validate_currency' ), 10, 2 );
176
-
177
-		// Generate the transaction url.
178
-		add_filter( "getpaid_gateway_{$this->id}_transaction_url", array( $this, 'filter_transaction_url' ), 10, 2 );
179
-
180
-		// Generate the subscription url.
181
-		add_filter( 'getpaid_remote_subscription_profile_url', array( $this, 'generate_subscription_url' ), 10, 2 );
182
-
183
-		// Confirm payments.
184
-		add_filter( "wpinv_payment_confirm_{$this->id}", array( $this, 'confirm_payment' ), 10, 2 );
185
-
186
-		// Verify IPNs.
187
-		add_action( "wpinv_verify_{$this->id}_ipn", array( $this, 'verify_ipn' ) );
188
-
189
-	}
190
-
191
-	/**
192
-	 * Checks if this gateway is a given gateway.
193
-	 *
194
-	 * @since 1.0.19
195
-	 * @return bool
196
-	 */
197
-	public function is( $gateway ) {
198
-		return $gateway == $this->id;
199
-	}
200
-
201
-	/**
202
-	 * Returns a users saved tokens for this gateway.
203
-	 *
204
-	 * @since 1.0.19
205
-	 * @return array
206
-	 */
207
-	public function get_tokens( $sandbox = null ) {
208
-
209
-		if ( is_user_logged_in() && $this->supports( 'tokens' ) && 0 == count( $this->tokens ) ) {
210
-			$tokens = get_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", true );
211
-
212
-			if ( is_array( $tokens ) ) {
213
-				$this->tokens = $tokens;
214
-			}
16
+    /**
17
+     * Set if the place checkout button should be renamed on selection.
18
+     *
19
+     * @var string
20
+     */
21
+    public $checkout_button_text;
22
+
23
+    /**
24
+     * Boolean whether the method is enabled.
25
+     *
26
+     * @var bool
27
+     */
28
+    public $enabled = true;
29
+
30
+    /**
31
+     * Payment method id.
32
+     *
33
+     * @var string
34
+     */
35
+    public $id;
36
+
37
+    /**
38
+     * Payment method order.
39
+     *
40
+     * @var int
41
+     */
42
+    public $order = 10;
43
+
44
+    /**
45
+     * Payment method title for the frontend.
46
+     *
47
+     * @var string
48
+     */
49
+    public $title;
50
+
51
+    /**
52
+     * Payment method description for the frontend.
53
+     *
54
+     * @var string
55
+     */
56
+    public $description;
57
+
58
+    /**
59
+     * Gateway title.
60
+     *
61
+     * @var string
62
+     */
63
+    public $method_title = '';
64
+
65
+    /**
66
+     * Gateway description.
67
+     *
68
+     * @var string
69
+     */
70
+    public $method_description = '';
71
+
72
+    /**
73
+     * Countries this gateway is allowed for.
74
+     *
75
+     * @var array
76
+     */
77
+    public $countries;
78
+
79
+    /**
80
+     * Currencies this gateway is allowed for.
81
+     *
82
+     * @var array
83
+     */
84
+    public $currencies;
85
+
86
+    /**
87
+     * Currencies this gateway is not allowed for.
88
+     *
89
+     * @var array
90
+     */
91
+    public $exclude_currencies;
92
+
93
+    /**
94
+     * Maximum transaction amount, zero does not define a maximum.
95
+     *
96
+     * @var int
97
+     */
98
+    public $max_amount = 0;
99
+
100
+    /**
101
+     * Optional URL to view a transaction.
102
+     *
103
+     * @var string
104
+     */
105
+    public $view_transaction_url = '';
106
+
107
+    /**
108
+     * Optional URL to view a subscription.
109
+     *
110
+     * @var string
111
+     */
112
+    public $view_subscription_url = '';
113
+
114
+    /**
115
+     * Optional label to show for "new payment method" in the payment
116
+     * method/token selection radio selection.
117
+     *
118
+     * @var string
119
+     */
120
+    public $new_method_label = '';
121
+
122
+    /**
123
+     * Contains a user's saved tokens for this gateway.
124
+     *
125
+     * @var array
126
+     */
127
+    protected $tokens = array();
128
+
129
+    /**
130
+     * An array of features that this gateway supports.
131
+     *
132
+     * @var array
133
+     */
134
+    protected $supports = array();
135
+
136
+    /**
137
+     * Class constructor.
138
+     */
139
+    public function __construct() {
140
+
141
+        do_action( 'getpaid_before_init_payment_gateway_' . $this->id, $this );
142
+
143
+        // Register gateway.
144
+        add_filter( 'wpinv_payment_gateways', array( $this, 'register_gateway' ) );
145
+
146
+        $this->enabled = wpinv_is_gateway_active( $this->id );
147
+
148
+        // Add support for various features.
149
+        foreach ( $this->supports as $feature ) {
150
+            add_filter( "wpinv_{$this->id}_support_{$feature}", '__return_true' );
151
+            add_filter( "getpaid_{$this->id}_support_{$feature}", '__return_true' );
152
+            add_filter( "getpaid_{$this->id}_supports_{$feature}", '__return_true' );
153
+        }
154
+
155
+        // Invoice addons.
156
+        if ( $this->supports( 'addons' ) ) {
157
+            add_action( "getpaid_process_{$this->id}_invoice_addons", array( $this, 'process_addons' ), 10, 2 );
158
+        }
159
+
160
+        // Gateway settings.
161
+        add_filter( "wpinv_gateway_settings_{$this->id}", array( $this, 'admin_settings' ) );
162
+
163
+        // Gateway checkout fiellds.
164
+        add_action( "wpinv_{$this->id}_cc_form", array( $this, 'payment_fields' ), 10, 2 );
165
+
166
+        // Process payment.
167
+        add_action( "getpaid_gateway_{$this->id}", array( $this, 'process_payment' ), 10, 3 );
168
+
169
+        // Change the checkout button text.
170
+        if ( ! empty( $this->checkout_button_text ) ) {
171
+            add_filter( "getpaid_gateway_{$this->id}_checkout_button_label", array( $this, 'rename_checkout_button' ) );
172
+        }
173
+
174
+        // Check if a gateway is valid for a given currency.
175
+        add_filter( "getpaid_gateway_{$this->id}_is_valid_for_currency", array( $this, 'validate_currency' ), 10, 2 );
176
+
177
+        // Generate the transaction url.
178
+        add_filter( "getpaid_gateway_{$this->id}_transaction_url", array( $this, 'filter_transaction_url' ), 10, 2 );
179
+
180
+        // Generate the subscription url.
181
+        add_filter( 'getpaid_remote_subscription_profile_url', array( $this, 'generate_subscription_url' ), 10, 2 );
182
+
183
+        // Confirm payments.
184
+        add_filter( "wpinv_payment_confirm_{$this->id}", array( $this, 'confirm_payment' ), 10, 2 );
185
+
186
+        // Verify IPNs.
187
+        add_action( "wpinv_verify_{$this->id}_ipn", array( $this, 'verify_ipn' ) );
188
+
189
+    }
190
+
191
+    /**
192
+     * Checks if this gateway is a given gateway.
193
+     *
194
+     * @since 1.0.19
195
+     * @return bool
196
+     */
197
+    public function is( $gateway ) {
198
+        return $gateway == $this->id;
199
+    }
200
+
201
+    /**
202
+     * Returns a users saved tokens for this gateway.
203
+     *
204
+     * @since 1.0.19
205
+     * @return array
206
+     */
207
+    public function get_tokens( $sandbox = null ) {
208
+
209
+        if ( is_user_logged_in() && $this->supports( 'tokens' ) && 0 == count( $this->tokens ) ) {
210
+            $tokens = get_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", true );
211
+
212
+            if ( is_array( $tokens ) ) {
213
+                $this->tokens = $tokens;
214
+            }
215 215
 }
216 216
 
217
-		if ( ! is_bool( $sandbox ) ) {
218
-			return $this->tokens;
219
-		}
220
-
221
-		// Filter tokens.
222
-		$args = array( 'type' => $sandbox ? 'sandbox' : 'live' );
223
-		return wp_list_filter( $this->tokens, $args );
224
-
225
-	}
226
-
227
-	/**
228
-	 * Saves a token for this gateway.
229
-	 *
230
-	 * @since 1.0.19
231
-	 */
232
-	public function save_token( $token ) {
233
-
234
-		$tokens   = $this->get_tokens();
235
-		$tokens[] = $token;
236
-
237
-		update_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", $tokens );
238
-
239
-		$this->tokens = $tokens;
240
-
241
-	}
242
-
243
-	/**
244
-	 * Return the title for admin screens.
245
-	 *
246
-	 * @return string
247
-	 */
248
-	public function get_method_title() {
249
-		return apply_filters( 'getpaid_gateway_method_title', $this->method_title, $this );
250
-	}
251
-
252
-	/**
253
-	 * Return the description for admin screens.
254
-	 *
255
-	 * @return string
256
-	 */
257
-	public function get_method_description() {
258
-		return apply_filters( 'getpaid_gateway_method_description', $this->method_description, $this );
259
-	}
260
-
261
-	/**
262
-	 * Get the success url.
263
-	 *
264
-	 * @param WPInv_Invoice $invoice Invoice object.
265
-	 * @return string
266
-	 */
267
-	public function get_return_url( $invoice ) {
268
-
269
-		// Payment success url
270
-		$return_url = add_query_arg(
271
-			array(
272
-				'payment-confirm' => $this->id,
273
-				'invoice_key'     => $invoice->get_key(),
274
-				'utm_nooverride'  => 1,
275
-			),
276
-			wpinv_get_success_page_uri()
277
-		);
278
-
279
-		return apply_filters( 'getpaid_gateway_success_url', $return_url, $invoice, $this );
280
-	}
281
-
282
-	/**
283
-	 * Confirms payments when rendering the success page.
284
-	 *
285
-	 * @param string $content Success page content.
286
-	 * @return string
287
-	 */
288
-	public function confirm_payment( $content ) {
289
-
290
-		// Retrieve the invoice.
291
-		$invoice_id = getpaid_get_current_invoice_id();
292
-		$invoice    = wpinv_get_invoice( $invoice_id );
293
-
294
-		// Ensure that it exists and that it is pending payment.
295
-		if ( empty( $invoice_id ) || ! $invoice->needs_payment() ) {
296
-			return $content;
297
-		}
298
-
299
-		// Can the user view this invoice??
300
-		if ( ! wpinv_user_can_view_invoice( $invoice ) ) {
301
-			return $content;
302
-		}
303
-
304
-		// Show payment processing indicator.
305
-		return wpinv_get_template_html( 'wpinv-payment-processing.php', compact( 'invoice' ) );
306
-	}
307
-
308
-	/**
309
-	 * Processes ipns and marks payments as complete.
310
-	 *
311
-	 * @return void
312
-	 */
313
-	public function verify_ipn() {}
314
-
315
-	/**
316
-	 * Processes invoice addons.
317
-	 *
318
-	 * @param WPInv_Invoice $invoice
319
-	 * @param GetPaid_Form_Item[] $items
320
-	 * @return WPInv_Invoice
321
-	 */
322
-	public function process_addons( $invoice, $items ) {
323
-
324
-	}
325
-
326
-	/**
327
-	 * Get a link to the transaction on the 3rd party gateway site (if applicable).
328
-	 *
329
-	 * @param string $transaction_url transaction url.
330
-	 * @param WPInv_Invoice $invoice Invoice object.
331
-	 * @return string transaction URL, or empty string.
332
-	 */
333
-	public function filter_transaction_url( $transaction_url, $invoice ) {
334
-
335
-		$transaction_id  = $invoice->get_transaction_id();
336
-
337
-		if ( ! empty( $this->view_transaction_url ) && ! empty( $transaction_id ) ) {
338
-			$transaction_url = sprintf( $this->view_transaction_url, $transaction_id );
339
-			$replace         = $this->is_sandbox( $invoice ) ? 'sandbox' : '';
340
-			$transaction_url = str_replace( '{sandbox}', $replace, $transaction_url );
341
-		}
342
-
343
-		return $transaction_url;
344
-	}
345
-
346
-	/**
347
-	 * Get a link to the subscription on the 3rd party gateway site (if applicable).
348
-	 *
349
-	 * @param string $subscription_url transaction url.
350
-	 * @param WPInv_Subscription $subscription Subscription objectt.
351
-	 * @return string subscription URL, or empty string.
352
-	 */
353
-	public function generate_subscription_url( $subscription_url, $subscription ) {
354
-
355
-		$profile_id      = $subscription->get_profile_id();
356
-
357
-		if ( $this->id == $subscription->get_gateway() && ! empty( $this->view_subscription_url ) && ! empty( $profile_id ) ) {
358
-
359
-			$subscription_url = sprintf( $this->view_subscription_url, $profile_id );
360
-			$replace          = $this->is_sandbox( $subscription->get_parent_invoice() ) ? 'sandbox' : '';
361
-			$subscription_url = str_replace( '{sandbox}', $replace, $subscription_url );
362
-
363
-		}
364
-
365
-		return $subscription_url;
366
-	}
367
-
368
-	/**
369
-	 * Check if the gateway is available for use.
370
-	 *
371
-	 * @return bool
372
-	 */
373
-	public function is_available() {
374
-		return ! empty( $this->enabled );
375
-	}
376
-
377
-	/**
378
-	 * Return the gateway's title.
379
-	 *
380
-	 * @return string
381
-	 */
382
-	public function get_title() {
383
-		return apply_filters( 'getpaid_gateway_title', $this->title, $this );
384
-	}
385
-
386
-	/**
387
-	 * Return the gateway's description.
388
-	 *
389
-	 * @return string
390
-	 */
391
-	public function get_description() {
392
-		return apply_filters( 'getpaid_gateway_description', $this->description, $this );
393
-	}
394
-
395
-	/**
396
-	 * Process Payment.
397
-	 *
398
-	 *
399
-	 * @param WPInv_Invoice $invoice Invoice.
400
-	 * @param array $submission_data Posted checkout fields.
401
-	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
402
-	 * @return void
403
-	 */
404
-	public function process_payment( $invoice, $submission_data, $submission ) {
405
-		// Process the payment then either redirect to the success page or the gateway.
406
-		do_action( 'getpaid_process_invoice_payment_' . $this->id, $invoice, $submission_data, $submission );
407
-	}
408
-
409
-	/**
410
-	 * Process refund.
411
-	 *
412
-	 * If the gateway declares 'refunds' support, this will allow it to refund.
413
-	 * a passed in amount.
414
-	 *
415
-	 * @param WPInv_Invoice $invoice Invoice.
416
-	 * @param  float  $amount Refund amount.
417
-	 * @param  string $reason Refund reason.
418
-	 * @return WP_Error|bool True or false based on success, or a WP_Error object.
419
-	 */
420
-	public function process_refund( $invoice, $amount = null, $reason = '' ) {
421
-		return apply_filters( 'getpaid_process_invoice_refund_' . $this->id, false, $invoice, $amount, $reason );
422
-	}
423
-
424
-	/**
425
-	 * Displays the payment fields, credit cards etc.
426
-	 *
427
-	 * @param int $invoice_id 0 or invoice id.
428
-	 * @param GetPaid_Payment_Form $form Current payment form.
429
-	 */
430
-	public function payment_fields( $invoice_id, $form ) {
431
-		do_action( 'getpaid_getpaid_gateway_payment_fields_' . $this->id, $invoice_id, $form );
432
-	}
433
-
434
-	/**
435
-	 * Filters the gateway settings.
436
-	 *
437
-	 * @param array $admin_settings
438
-	 */
439
-	public function admin_settings( $admin_settings ) {
440
-		return $admin_settings;
441
-	}
442
-
443
-	/**
444
-	 * Retrieves the value of a gateway setting.
445
-	 *
446
-	 * @param string $option
447
-	 */
448
-	public function get_option( $option, $default = false ) {
449
-		return wpinv_get_option( $this->id . '_' . $option, $default );
450
-	}
451
-
452
-	/**
453
-	 * Check if a gateway supports a given feature.
454
-	 *
455
-	 * Gateways should override this to declare support (or lack of support) for a feature.
456
-	 * For backward compatibility, gateways support 'products' by default, but nothing else.
457
-	 *
458
-	 * @param string $feature string The name of a feature to test support for.
459
-	 * @return bool True if the gateway supports the feature, false otherwise.
460
-	 * @since 1.0.19
461
-	 */
462
-	public function supports( $feature ) {
463
-		return getpaid_payment_gateway_supports( $this->id, $feature );
464
-	}
465
-
466
-	/**
467
-	 * Returns the credit card form html.
468
-	 *
469
-	 * @param bool $save whether or not to display the save button.
470
-	 */
217
+        if ( ! is_bool( $sandbox ) ) {
218
+            return $this->tokens;
219
+        }
220
+
221
+        // Filter tokens.
222
+        $args = array( 'type' => $sandbox ? 'sandbox' : 'live' );
223
+        return wp_list_filter( $this->tokens, $args );
224
+
225
+    }
226
+
227
+    /**
228
+     * Saves a token for this gateway.
229
+     *
230
+     * @since 1.0.19
231
+     */
232
+    public function save_token( $token ) {
233
+
234
+        $tokens   = $this->get_tokens();
235
+        $tokens[] = $token;
236
+
237
+        update_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", $tokens );
238
+
239
+        $this->tokens = $tokens;
240
+
241
+    }
242
+
243
+    /**
244
+     * Return the title for admin screens.
245
+     *
246
+     * @return string
247
+     */
248
+    public function get_method_title() {
249
+        return apply_filters( 'getpaid_gateway_method_title', $this->method_title, $this );
250
+    }
251
+
252
+    /**
253
+     * Return the description for admin screens.
254
+     *
255
+     * @return string
256
+     */
257
+    public function get_method_description() {
258
+        return apply_filters( 'getpaid_gateway_method_description', $this->method_description, $this );
259
+    }
260
+
261
+    /**
262
+     * Get the success url.
263
+     *
264
+     * @param WPInv_Invoice $invoice Invoice object.
265
+     * @return string
266
+     */
267
+    public function get_return_url( $invoice ) {
268
+
269
+        // Payment success url
270
+        $return_url = add_query_arg(
271
+            array(
272
+                'payment-confirm' => $this->id,
273
+                'invoice_key'     => $invoice->get_key(),
274
+                'utm_nooverride'  => 1,
275
+            ),
276
+            wpinv_get_success_page_uri()
277
+        );
278
+
279
+        return apply_filters( 'getpaid_gateway_success_url', $return_url, $invoice, $this );
280
+    }
281
+
282
+    /**
283
+     * Confirms payments when rendering the success page.
284
+     *
285
+     * @param string $content Success page content.
286
+     * @return string
287
+     */
288
+    public function confirm_payment( $content ) {
289
+
290
+        // Retrieve the invoice.
291
+        $invoice_id = getpaid_get_current_invoice_id();
292
+        $invoice    = wpinv_get_invoice( $invoice_id );
293
+
294
+        // Ensure that it exists and that it is pending payment.
295
+        if ( empty( $invoice_id ) || ! $invoice->needs_payment() ) {
296
+            return $content;
297
+        }
298
+
299
+        // Can the user view this invoice??
300
+        if ( ! wpinv_user_can_view_invoice( $invoice ) ) {
301
+            return $content;
302
+        }
303
+
304
+        // Show payment processing indicator.
305
+        return wpinv_get_template_html( 'wpinv-payment-processing.php', compact( 'invoice' ) );
306
+    }
307
+
308
+    /**
309
+     * Processes ipns and marks payments as complete.
310
+     *
311
+     * @return void
312
+     */
313
+    public function verify_ipn() {}
314
+
315
+    /**
316
+     * Processes invoice addons.
317
+     *
318
+     * @param WPInv_Invoice $invoice
319
+     * @param GetPaid_Form_Item[] $items
320
+     * @return WPInv_Invoice
321
+     */
322
+    public function process_addons( $invoice, $items ) {
323
+
324
+    }
325
+
326
+    /**
327
+     * Get a link to the transaction on the 3rd party gateway site (if applicable).
328
+     *
329
+     * @param string $transaction_url transaction url.
330
+     * @param WPInv_Invoice $invoice Invoice object.
331
+     * @return string transaction URL, or empty string.
332
+     */
333
+    public function filter_transaction_url( $transaction_url, $invoice ) {
334
+
335
+        $transaction_id  = $invoice->get_transaction_id();
336
+
337
+        if ( ! empty( $this->view_transaction_url ) && ! empty( $transaction_id ) ) {
338
+            $transaction_url = sprintf( $this->view_transaction_url, $transaction_id );
339
+            $replace         = $this->is_sandbox( $invoice ) ? 'sandbox' : '';
340
+            $transaction_url = str_replace( '{sandbox}', $replace, $transaction_url );
341
+        }
342
+
343
+        return $transaction_url;
344
+    }
345
+
346
+    /**
347
+     * Get a link to the subscription on the 3rd party gateway site (if applicable).
348
+     *
349
+     * @param string $subscription_url transaction url.
350
+     * @param WPInv_Subscription $subscription Subscription objectt.
351
+     * @return string subscription URL, or empty string.
352
+     */
353
+    public function generate_subscription_url( $subscription_url, $subscription ) {
354
+
355
+        $profile_id      = $subscription->get_profile_id();
356
+
357
+        if ( $this->id == $subscription->get_gateway() && ! empty( $this->view_subscription_url ) && ! empty( $profile_id ) ) {
358
+
359
+            $subscription_url = sprintf( $this->view_subscription_url, $profile_id );
360
+            $replace          = $this->is_sandbox( $subscription->get_parent_invoice() ) ? 'sandbox' : '';
361
+            $subscription_url = str_replace( '{sandbox}', $replace, $subscription_url );
362
+
363
+        }
364
+
365
+        return $subscription_url;
366
+    }
367
+
368
+    /**
369
+     * Check if the gateway is available for use.
370
+     *
371
+     * @return bool
372
+     */
373
+    public function is_available() {
374
+        return ! empty( $this->enabled );
375
+    }
376
+
377
+    /**
378
+     * Return the gateway's title.
379
+     *
380
+     * @return string
381
+     */
382
+    public function get_title() {
383
+        return apply_filters( 'getpaid_gateway_title', $this->title, $this );
384
+    }
385
+
386
+    /**
387
+     * Return the gateway's description.
388
+     *
389
+     * @return string
390
+     */
391
+    public function get_description() {
392
+        return apply_filters( 'getpaid_gateway_description', $this->description, $this );
393
+    }
394
+
395
+    /**
396
+     * Process Payment.
397
+     *
398
+     *
399
+     * @param WPInv_Invoice $invoice Invoice.
400
+     * @param array $submission_data Posted checkout fields.
401
+     * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
402
+     * @return void
403
+     */
404
+    public function process_payment( $invoice, $submission_data, $submission ) {
405
+        // Process the payment then either redirect to the success page or the gateway.
406
+        do_action( 'getpaid_process_invoice_payment_' . $this->id, $invoice, $submission_data, $submission );
407
+    }
408
+
409
+    /**
410
+     * Process refund.
411
+     *
412
+     * If the gateway declares 'refunds' support, this will allow it to refund.
413
+     * a passed in amount.
414
+     *
415
+     * @param WPInv_Invoice $invoice Invoice.
416
+     * @param  float  $amount Refund amount.
417
+     * @param  string $reason Refund reason.
418
+     * @return WP_Error|bool True or false based on success, or a WP_Error object.
419
+     */
420
+    public function process_refund( $invoice, $amount = null, $reason = '' ) {
421
+        return apply_filters( 'getpaid_process_invoice_refund_' . $this->id, false, $invoice, $amount, $reason );
422
+    }
423
+
424
+    /**
425
+     * Displays the payment fields, credit cards etc.
426
+     *
427
+     * @param int $invoice_id 0 or invoice id.
428
+     * @param GetPaid_Payment_Form $form Current payment form.
429
+     */
430
+    public function payment_fields( $invoice_id, $form ) {
431
+        do_action( 'getpaid_getpaid_gateway_payment_fields_' . $this->id, $invoice_id, $form );
432
+    }
433
+
434
+    /**
435
+     * Filters the gateway settings.
436
+     *
437
+     * @param array $admin_settings
438
+     */
439
+    public function admin_settings( $admin_settings ) {
440
+        return $admin_settings;
441
+    }
442
+
443
+    /**
444
+     * Retrieves the value of a gateway setting.
445
+     *
446
+     * @param string $option
447
+     */
448
+    public function get_option( $option, $default = false ) {
449
+        return wpinv_get_option( $this->id . '_' . $option, $default );
450
+    }
451
+
452
+    /**
453
+     * Check if a gateway supports a given feature.
454
+     *
455
+     * Gateways should override this to declare support (or lack of support) for a feature.
456
+     * For backward compatibility, gateways support 'products' by default, but nothing else.
457
+     *
458
+     * @param string $feature string The name of a feature to test support for.
459
+     * @return bool True if the gateway supports the feature, false otherwise.
460
+     * @since 1.0.19
461
+     */
462
+    public function supports( $feature ) {
463
+        return getpaid_payment_gateway_supports( $this->id, $feature );
464
+    }
465
+
466
+    /**
467
+     * Returns the credit card form html.
468
+     *
469
+     * @param bool $save whether or not to display the save button.
470
+     */
471 471
     public function get_cc_form( $save = false ) {
472 472
 
473
-		ob_start();
473
+        ob_start();
474 474
 
475 475
         $id_prefix = esc_attr( uniqid( $this->id ) );
476 476
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
             '11' => __( 'November', 'invoicing' ),
489 489
             '12' => __( 'December', 'invoicing' ),
490 490
         );
491
-		$months = apply_filters( 'getpaid_cc_months', $months, $this );
491
+        $months = apply_filters( 'getpaid_cc_months', $months, $this );
492 492
 
493 493
         $year  = (int) current_time( 'Y' );
494 494
         $years = array();
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
             $years[ $year + $i ] = $year + $i;
498 498
         }
499 499
 
500
-		$years = apply_filters( 'getpaid_cc_years', $years, $this );
500
+        $years = apply_filters( 'getpaid_cc_years', $years, $this );
501 501
 
502 502
         ?>
503 503
             <div class="<?php echo esc_attr( $this->id ); ?>-cc-form getpaid-cc-form mt-1">
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
                                             <?php
541 541
                                                 foreach ( $months as $key => $month ) {
542
-												echo "<option value='" . esc_attr( $key ) . "'>" . esc_html( $month ) . '</option>';
542
+                                                echo "<option value='" . esc_attr( $key ) . "'>" . esc_html( $month ) . '</option>';
543 543
                                                 }
544 544
                                             ?>
545 545
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 
553 553
                                             <?php
554 554
                                                 foreach ( $years as $key => $year ) {
555
-												echo "<option value='" . esc_attr( $key ) . "'>" . esc_html( $year ) . '</option>';
555
+                                                echo "<option value='" . esc_attr( $key ) . "'>" . esc_html( $year ) . '</option>';
556 556
                                                 }
557 557
                                             ?>
558 558
 
@@ -570,13 +570,13 @@  discard block
 block discarded – undo
570 570
                                         'name'             => $this->id . '[cc_cvv2]',
571 571
                                         'id'               => "$id_prefix-cc-cvv2",
572 572
                                         'label'            => __( 'CCV', 'invoicing' ),
573
-										'label_type'       => 'vertical',
574
-										'class'            => 'form-control-sm',
575
-										'extra_attributes' => array(
576
-											'autocomplete' => 'cc-csc',
577
-										),
573
+                                        'label_type'       => 'vertical',
574
+                                        'class'            => 'form-control-sm',
575
+                                        'extra_attributes' => array(
576
+                                            'autocomplete' => 'cc-csc',
577
+                                        ),
578 578
                                     ),
579
-									true
579
+                                    true
580 580
                                 );
581 581
                             ?>
582 582
                         </div>
@@ -585,192 +585,192 @@  discard block
 block discarded – undo
585 585
 
586 586
 					<?php
587 587
 
588
-						if ( $save ) {
589
-							$this->save_payment_method_checkbox();
590
-						}
588
+                        if ( $save ) {
589
+                            $this->save_payment_method_checkbox();
590
+                        }
591 591
 
592
-					?>
592
+                    ?>
593 593
                 </div>
594 594
 
595 595
             </div>
596 596
 		<?php
597 597
 
598
-		return ob_get_clean();
598
+        return ob_get_clean();
599
+
600
+    }
601
+
602
+    /**
603
+     * Displays a new payment method entry form.
604
+     *
605
+     * @since 1.0.19
606
+     */
607
+    public function new_payment_method_entry( $form ) {
608
+        echo "<div class='getpaid-new-payment-method-form' style='display:none;'> " . wp_kses( $form, getpaid_allowed_html() ) . '</div>';
609
+    }
610
+
611
+    /**
612
+     * Grab and display our saved payment methods.
613
+     *
614
+     * @since 1.0.19
615
+     */
616
+    public function saved_payment_methods() {
617
+        echo '<ul class="getpaid-saved-payment-methods list-unstyled m-0 mt-2" data-count="' . esc_attr( count( $this->get_tokens( $this->is_sandbox() ) ) ) . '">';
618
+
619
+        foreach ( $this->get_tokens( $this->is_sandbox() ) as $token ) {
620
+            $this->get_saved_payment_method_option_html( $token );
621
+        }
622
+
623
+        $this->get_new_payment_method_option_html();
624
+        echo '</ul>';
599 625
 
600 626
     }
601 627
 
602
-	/**
603
-	 * Displays a new payment method entry form.
604
-	 *
605
-	 * @since 1.0.19
606
-	 */
607
-	public function new_payment_method_entry( $form ) {
608
-		echo "<div class='getpaid-new-payment-method-form' style='display:none;'> " . wp_kses( $form, getpaid_allowed_html() ) . '</div>';
609
-	}
610
-
611
-	/**
612
-	 * Grab and display our saved payment methods.
613
-	 *
614
-	 * @since 1.0.19
615
-	 */
616
-	public function saved_payment_methods() {
617
-		echo '<ul class="getpaid-saved-payment-methods list-unstyled m-0 mt-2" data-count="' . esc_attr( count( $this->get_tokens( $this->is_sandbox() ) ) ) . '">';
618
-
619
-		foreach ( $this->get_tokens( $this->is_sandbox() ) as $token ) {
620
-			$this->get_saved_payment_method_option_html( $token );
621
-		}
622
-
623
-		$this->get_new_payment_method_option_html();
624
-		echo '</ul>';
625
-
626
-	}
627
-
628
-	/**
629
-	 * Gets saved payment method HTML from a token.
630
-	 *
631
-	 * @since 1.0.19
632
-	 * @param  array $token Payment Token.
633
-	 * @return string Generated payment method HTML
634
-	 */
635
-	public function get_saved_payment_method_option_html( $token ) {
636
-
637
-		printf(
638
-			'<li class="getpaid-payment-method form-group mb-3">
628
+    /**
629
+     * Gets saved payment method HTML from a token.
630
+     *
631
+     * @since 1.0.19
632
+     * @param  array $token Payment Token.
633
+     * @return string Generated payment method HTML
634
+     */
635
+    public function get_saved_payment_method_option_html( $token ) {
636
+
637
+        printf(
638
+            '<li class="getpaid-payment-method form-group mb-3">
639 639
 				<label>
640 640
 					<input name="getpaid-%1$s-payment-method" type="radio" value="%2$s" data-currency="%5$s" style="width:auto;" class="getpaid-saved-payment-method-token-input" %4$s />
641 641
 					<span>%3$s</span>
642 642
 				</label>
643 643
 			</li>',
644
-			esc_attr( $this->id ),
645
-			esc_attr( $token['id'] ),
646
-			esc_html( $token['name'] ),
647
-			checked( empty( $token['default'] ), false, false ),
648
-			empty( $token['currency'] ) ? 'none' : esc_attr( $token['currency'] )
649
-		);
650
-
651
-	}
652
-
653
-	/**
654
-	 * Displays a radio button for entering a new payment method (new CC details) instead of using a saved method.
655
-	 *
656
-	 * @since 1.0.19
657
-	 */
658
-	public function get_new_payment_method_option_html() {
659
-
660
-		$label = apply_filters( 'getpaid_new_payment_method_label', $this->new_method_label ? $this->new_method_label : __( 'Use a new payment method', 'invoicing' ), $this );
661
-
662
-		printf(
663
-			'<li class="getpaid-new-payment-method">
644
+            esc_attr( $this->id ),
645
+            esc_attr( $token['id'] ),
646
+            esc_html( $token['name'] ),
647
+            checked( empty( $token['default'] ), false, false ),
648
+            empty( $token['currency'] ) ? 'none' : esc_attr( $token['currency'] )
649
+        );
650
+
651
+    }
652
+
653
+    /**
654
+     * Displays a radio button for entering a new payment method (new CC details) instead of using a saved method.
655
+     *
656
+     * @since 1.0.19
657
+     */
658
+    public function get_new_payment_method_option_html() {
659
+
660
+        $label = apply_filters( 'getpaid_new_payment_method_label', $this->new_method_label ? $this->new_method_label : __( 'Use a new payment method', 'invoicing' ), $this );
661
+
662
+        printf(
663
+            '<li class="getpaid-new-payment-method">
664 664
 				<label>
665 665
 					<input name="getpaid-%1$s-payment-method" type="radio" data-currency="none" value="new" style="width:auto;" />
666 666
 					<span>%2$s</span>
667 667
 				</label>
668 668
 			</li>',
669
-			esc_attr( $this->id ),
670
-			esc_html( $label )
671
-		);
672
-
673
-	}
674
-
675
-	/**
676
-	 * Outputs a checkbox for saving a new payment method to the database.
677
-	 *
678
-	 * @since 1.0.19
679
-	 */
680
-	public function save_payment_method_checkbox() {
681
-
682
-		aui()->input(
683
-			array(
684
-				'type'       => 'checkbox',
685
-				'name'       => esc_attr( "getpaid-$this->id-new-payment-method" ),
686
-				'id'         => esc_attr( uniqid( $this->id ) ),
687
-				'required'   => false,
688
-				'label'      => esc_html__( 'Save payment method', 'invoicing' ),
689
-				'value'      => 'true',
690
-				'checked'    => true,
691
-				'wrap_class' => 'getpaid-save-payment-method pt-1 pb-1',
692
-			),
693
-			true
694
-		);
695
-
696
-	}
697
-
698
-	/**
699
-	 * Registers the gateway.
700
-	 *
701
-	 * @return array
702
-	 */
703
-	public function register_gateway( $gateways ) {
704
-
705
-		$gateways[ $this->id ] = array(
706
-
707
-			'admin_label'    => $this->method_title,
669
+            esc_attr( $this->id ),
670
+            esc_html( $label )
671
+        );
672
+
673
+    }
674
+
675
+    /**
676
+     * Outputs a checkbox for saving a new payment method to the database.
677
+     *
678
+     * @since 1.0.19
679
+     */
680
+    public function save_payment_method_checkbox() {
681
+
682
+        aui()->input(
683
+            array(
684
+                'type'       => 'checkbox',
685
+                'name'       => esc_attr( "getpaid-$this->id-new-payment-method" ),
686
+                'id'         => esc_attr( uniqid( $this->id ) ),
687
+                'required'   => false,
688
+                'label'      => esc_html__( 'Save payment method', 'invoicing' ),
689
+                'value'      => 'true',
690
+                'checked'    => true,
691
+                'wrap_class' => 'getpaid-save-payment-method pt-1 pb-1',
692
+            ),
693
+            true
694
+        );
695
+
696
+    }
697
+
698
+    /**
699
+     * Registers the gateway.
700
+     *
701
+     * @return array
702
+     */
703
+    public function register_gateway( $gateways ) {
704
+
705
+        $gateways[ $this->id ] = array(
706
+
707
+            'admin_label'    => $this->method_title,
708 708
             'checkout_label' => $this->title,
709
-			'ordering'       => $this->order,
709
+            'ordering'       => $this->order,
710 710
 
711
-		);
711
+        );
712 712
 
713
-		return $gateways;
713
+        return $gateways;
714 714
 
715
-	}
715
+    }
716 716
 
717
-	/**
718
-	 * Checks whether or not this is a sandbox request.
719
-	 *
720
-	 * @param  WPInv_Invoice|null $invoice Invoice object or null.
721
-	 * @return bool
722
-	 */
723
-	public function is_sandbox( $invoice = null ) {
717
+    /**
718
+     * Checks whether or not this is a sandbox request.
719
+     *
720
+     * @param  WPInv_Invoice|null $invoice Invoice object or null.
721
+     * @return bool
722
+     */
723
+    public function is_sandbox( $invoice = null ) {
724 724
 
725
-		if ( is_a( $invoice, 'WPInv_Invoice' ) && ! $invoice->needs_payment() ) {
726
-			return $invoice->get_mode() === 'test';
727
-		}
725
+        if ( is_a( $invoice, 'WPInv_Invoice' ) && ! $invoice->needs_payment() ) {
726
+            return $invoice->get_mode() === 'test';
727
+        }
728 728
 
729
-		return wpinv_is_test_mode( $this->id );
729
+        return wpinv_is_test_mode( $this->id );
730 730
 
731
-	}
731
+    }
732 732
 
733
-	/**
734
-	 * Renames the checkout button
735
-	 *
736
-	 * @return string
737
-	 */
738
-	public function rename_checkout_button() {
739
-		return $this->checkout_button_text;
740
-	}
733
+    /**
734
+     * Renames the checkout button
735
+     *
736
+     * @return string
737
+     */
738
+    public function rename_checkout_button() {
739
+        return $this->checkout_button_text;
740
+    }
741 741
 
742
-	/**
743
-	 * Validate gateway currency
744
-	 *
745
-	 * @return bool
746
-	 */
747
-	public function validate_currency( $validation, $currency ) {
742
+    /**
743
+     * Validate gateway currency
744
+     *
745
+     * @return bool
746
+     */
747
+    public function validate_currency( $validation, $currency ) {
748 748
 
749
-		// Required currencies.
750
-		if ( ! empty( $this->currencies ) && ! in_array( $currency, $this->currencies ) ) {
751
-			return false;
752
-		}
749
+        // Required currencies.
750
+        if ( ! empty( $this->currencies ) && ! in_array( $currency, $this->currencies ) ) {
751
+            return false;
752
+        }
753 753
 
754
-		// Excluded currencies.
755
-		if ( ! empty( $this->exclude_currencies ) && in_array( $currency, $this->exclude_currencies ) ) {
756
-			return false;
757
-		}
754
+        // Excluded currencies.
755
+        if ( ! empty( $this->exclude_currencies ) && in_array( $currency, $this->exclude_currencies ) ) {
756
+            return false;
757
+        }
758 758
 
759
-		return $validation;
760
-	}
759
+        return $validation;
760
+    }
761 761
 
762
-	/**
763
-	 * Displays an error
764
-	 *
765
-	 */
766
-	public function show_error( $code, $message, $type ) {
762
+    /**
763
+     * Displays an error
764
+     *
765
+     */
766
+    public function show_error( $code, $message, $type ) {
767 767
 
768
-		if ( is_admin() ) {
769
-			getpaid_admin()->{"show_$type"}( $message );
770
-		}
768
+        if ( is_admin() ) {
769
+            getpaid_admin()->{"show_$type"}( $message );
770
+        }
771 771
 
772
-		wpinv_set_error( $code, $message, $type );
772
+        wpinv_set_error( $code, $message, $type );
773 773
 
774
-	}
774
+    }
775 775
 
776 776
 }
Please login to merge, or discard this patch.
includes/admin/register-settings.php 1 patch
Indentation   +320 added lines, -320 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
                     $defaults[ $key ] = $setting['std'];
26 26
                 }
27 27
             }
28
-		}
29
-	}
28
+        }
29
+    }
30 30
 
31 31
     return $defaults;
32 32
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
  *
145 145
  */
146 146
 function wpinv_register_settings() {
147
-	do_action( 'getpaid_before_register_settings' );
147
+    do_action( 'getpaid_before_register_settings' );
148 148
 
149 149
     // Loop through all tabs.
150 150
     foreach ( wpinv_get_registered_settings() as $tab => $sections ) {
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
                 $settings = $sections;
160 160
             }
161 161
 
162
-			do_action( "getpaid_register_{$tab}_{$section}" );
162
+            do_action( "getpaid_register_{$tab}_{$section}" );
163 163
 
164 164
             // Register the setting section.
165 165
             add_settings_section(
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     // Creates our settings in the options table.
181 181
     register_setting( 'wpinv_settings', 'wpinv_settings', 'wpinv_settings_sanitize' );
182 182
 
183
-	do_action( 'getpaid_after_register_settings' );
183
+    do_action( 'getpaid_after_register_settings' );
184 184
 }
185 185
 add_action( 'admin_init', 'wpinv_register_settings' );
186 186
 
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
     $name       = isset( $option['name'] ) ? $option['name'] : '';
198 198
     $cb         = "wpinv_{$option['type']}_callback";
199 199
     $section    = "wpinv_settings_{$tab}_$section";
200
-	$is_wizzard = is_admin() && isset( $_GET['page'] ) && 'gp-setup' == $_GET['page'];
200
+    $is_wizzard = is_admin() && isset( $_GET['page'] ) && 'gp-setup' == $_GET['page'];
201 201
 
202
-	if ( isset( $option['desc'] ) && ( ! $is_wizzard && ! empty( $option['help-tip'] ) ) ) {
203
-		$tip   = wpinv_clean( $option['desc'] );
204
-		$name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
205
-		unset( $option['desc'] );
206
-	}
202
+    if ( isset( $option['desc'] ) && ( ! $is_wizzard && ! empty( $option['help-tip'] ) ) ) {
203
+        $tip   = wpinv_clean( $option['desc'] );
204
+        $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
205
+        unset( $option['desc'] );
206
+    }
207 207
 
208 208
     // Loop through all tabs.
209 209
     add_settings_field(
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
             'faux'            => isset( $option['faux'] ) ? $option['faux'] : false,
231 231
             'onchange'        => isset( $option['onchange'] ) ? $option['onchange'] : '',
232 232
             'custom'          => isset( $option['custom'] ) ? $option['custom'] : '',
233
-			'default_content' => isset( $option['default_content'] ) ? $option['default_content'] : '',
234
-			'class'           => isset( $option['class'] ) ? $option['class'] : '',
235
-			'style'           => isset( $option['style'] ) ? $option['style'] : '',
233
+            'default_content' => isset( $option['default_content'] ) ? $option['default_content'] : '',
234
+            'class'           => isset( $option['class'] ) ? $option['class'] : '',
235
+            'style'           => isset( $option['style'] ) ? $option['style'] : '',
236 236
             'cols'            => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
237 237
             'rows'            => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
238 238
         )
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
  * @return array
247 247
  */
248 248
 function wpinv_get_registered_settings() {
249
-	return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
249
+    return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
250 250
 }
251 251
 
252 252
 /**
@@ -265,18 +265,18 @@  discard block
 block discarded – undo
265 265
  */
266 266
 function wpinv_settings_sanitize( $input = array() ) {
267 267
 
268
-	$wpinv_options = wpinv_get_options();
269
-	$raw_referrer  = wp_get_raw_referer();
268
+    $wpinv_options = wpinv_get_options();
269
+    $raw_referrer  = wp_get_raw_referer();
270 270
 
271 271
     if ( empty( $raw_referrer ) ) {
272
-		return array_merge( $wpinv_options, $input );
272
+        return array_merge( $wpinv_options, $input );
273 273
     }
274 274
 
275 275
     wp_parse_str( $raw_referrer, $referrer );
276 276
 
277
-	if ( in_array( 'gp-setup', $referrer ) ) {
278
-		return array_merge( $wpinv_options, $input );
279
-	}
277
+    if ( in_array( 'gp-setup', $referrer ) ) {
278
+        return array_merge( $wpinv_options, $input );
279
+    }
280 280
 
281 281
     $settings = wpinv_get_registered_settings();
282 282
     $tab      = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
         }
299 299
 
300 300
         // General filter
301
-		$input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
301
+        $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
302 302
 
303
-		// Key specific filter.
304
-		$input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
303
+        // Key specific filter.
304
+        $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
305 305
     }
306 306
 
307 307
     // Loop through the whitelist and unset any that are empty for the tab being saved
@@ -344,14 +344,14 @@  discard block
 block discarded – undo
344 344
 
345 345
     foreach ( $new_rates as $rate ) {
346 346
 
347
-		$rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
348
-		$rate['name']    = sanitize_text_field( $rate['name'] );
349
-		$rate['state']   = sanitize_text_field( $rate['state'] );
350
-		$rate['country'] = sanitize_text_field( $rate['country'] );
351
-		$rate['global']  = empty( $rate['state'] );
352
-		$tax_rates[]     = $rate;
347
+        $rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
348
+        $rate['name']    = sanitize_text_field( $rate['name'] );
349
+        $rate['state']   = sanitize_text_field( $rate['state'] );
350
+        $rate['country'] = sanitize_text_field( $rate['country'] );
351
+        $rate['global']  = empty( $rate['state'] );
352
+        $tax_rates[]     = $rate;
353 353
 
354
-	}
354
+    }
355 355
 
356 356
     update_option( 'wpinv_tax_rates', $tax_rates );
357 357
 
@@ -364,21 +364,21 @@  discard block
 block discarded – undo
364 364
         return $input;
365 365
     }
366 366
 
367
-	if ( empty( $_POST['wpinv_tax_rules_nonce'] ) || ! wp_verify_nonce( $_POST['wpinv_tax_rules_nonce'], 'wpinv_tax_rules' ) ) {
368
-		return $input;
369
-	}
367
+    if ( empty( $_POST['wpinv_tax_rules_nonce'] ) || ! wp_verify_nonce( $_POST['wpinv_tax_rules_nonce'], 'wpinv_tax_rules' ) ) {
368
+        return $input;
369
+    }
370 370
 
371 371
     $new_rules = ! empty( $_POST['tax_rules'] ) ? wp_kses_post_deep( array_values( $_POST['tax_rules'] ) ) : array();
372 372
     $tax_rules = array();
373 373
 
374 374
     foreach ( $new_rules as $rule ) {
375 375
 
376
-		$rule['key']      = sanitize_title_with_dashes( $rule['key'] );
377
-		$rule['label']    = sanitize_text_field( $rule['label'] );
378
-		$rule['tax_base'] = sanitize_text_field( $rule['tax_base'] );
379
-		$tax_rules[]      = $rule;
376
+        $rule['key']      = sanitize_title_with_dashes( $rule['key'] );
377
+        $rule['label']    = sanitize_text_field( $rule['label'] );
378
+        $rule['tax_base'] = sanitize_text_field( $rule['tax_base'] );
379
+        $tax_rules[]      = $rule;
380 380
 
381
-	}
381
+    }
382 382
 
383 383
     update_option( 'wpinv_tax_rules', $tax_rules );
384 384
 
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
     $tabs['general']  = __( 'General', 'invoicing' );
392 392
     $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
393 393
     $tabs['taxes']    = __( 'Taxes', 'invoicing' );
394
-	$tabs['emails']   = __( 'Emails', 'invoicing' );
394
+    $tabs['emails']   = __( 'Emails', 'invoicing' );
395 395
 
396
-	if ( count( getpaid_get_integration_settings() ) > 0 ) {
397
-		$tabs['integrations'] = __( 'Integrations', 'invoicing' );
398
-	}
396
+    if ( count( getpaid_get_integration_settings() ) > 0 ) {
397
+        $tabs['integrations'] = __( 'Integrations', 'invoicing' );
398
+    }
399 399
 
400 400
     $tabs['privacy']  = __( 'Privacy', 'invoicing' );
401 401
     $tabs['misc']     = __( 'Misc', 'invoicing' );
@@ -426,53 +426,53 @@  discard block
 block discarded – undo
426 426
         'general'      => apply_filters(
427 427
             'wpinv_settings_sections_general',
428 428
             array(
429
-				'main'             => __( 'General Settings', 'invoicing' ),
430
-				'page_section'     => __( 'Page Settings', 'invoicing' ),
431
-				'currency_section' => __( 'Currency Settings', 'invoicing' ),
432
-				'labels'           => __( 'Label Texts', 'invoicing' ),
429
+                'main'             => __( 'General Settings', 'invoicing' ),
430
+                'page_section'     => __( 'Page Settings', 'invoicing' ),
431
+                'currency_section' => __( 'Currency Settings', 'invoicing' ),
432
+                'labels'           => __( 'Label Texts', 'invoicing' ),
433 433
             )
434 434
         ),
435 435
         'gateways'     => apply_filters(
436 436
             'wpinv_settings_sections_gateways',
437 437
             array(
438
-				'main' => __( 'Gateway Settings', 'invoicing' ),
438
+                'main' => __( 'Gateway Settings', 'invoicing' ),
439 439
             )
440 440
         ),
441 441
         'taxes'        => apply_filters(
442 442
             'wpinv_settings_sections_taxes',
443 443
             array(
444
-				'main'  => __( 'Tax Settings', 'invoicing' ),
445
-				'rules' => __( 'Tax Rules', 'invoicing' ),
446
-				'rates' => __( 'Tax Rates', 'invoicing' ),
447
-				'vat'   => __( 'EU VAT Settings', 'invoicing' ),
444
+                'main'  => __( 'Tax Settings', 'invoicing' ),
445
+                'rules' => __( 'Tax Rules', 'invoicing' ),
446
+                'rates' => __( 'Tax Rates', 'invoicing' ),
447
+                'vat'   => __( 'EU VAT Settings', 'invoicing' ),
448 448
             )
449 449
         ),
450 450
         'emails'       => apply_filters(
451 451
             'wpinv_settings_sections_emails',
452 452
             array(
453
-				'main' => __( 'Email Settings', 'invoicing' ),
453
+                'main' => __( 'Email Settings', 'invoicing' ),
454 454
             )
455 455
         ),
456 456
 
457
-		'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
457
+        'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
458 458
 
459 459
         'privacy'      => apply_filters(
460 460
             'wpinv_settings_sections_privacy',
461 461
             array(
462
-				'main' => __( 'Privacy policy', 'invoicing' ),
462
+                'main' => __( 'Privacy policy', 'invoicing' ),
463 463
             )
464 464
         ),
465 465
         'misc'         => apply_filters(
466 466
             'wpinv_settings_sections_misc',
467 467
             array(
468
-				'main'       => __( 'Miscellaneous', 'invoicing' ),
469
-				'custom-css' => __( 'Custom CSS', 'invoicing' ),
468
+                'main'       => __( 'Miscellaneous', 'invoicing' ),
469
+                'custom-css' => __( 'Custom CSS', 'invoicing' ),
470 470
             )
471 471
         ),
472 472
         'tools'        => apply_filters(
473 473
             'wpinv_settings_sections_tools',
474 474
             array(
475
-				'main' => __( 'Diagnostic Tools', 'invoicing' ),
475
+                'main' => __( 'Diagnostic Tools', 'invoicing' ),
476 476
             )
477 477
         ),
478 478
     );
@@ -483,46 +483,46 @@  discard block
 block discarded – undo
483 483
 }
484 484
 
485 485
 function wpinv_get_pages( $with_slug = false, $default_label = null ) {
486
-	$pages_options = array();
486
+    $pages_options = array();
487 487
 
488
-	if ( $default_label !== null && $default_label !== false ) {
489
-		$pages_options = array( '' => $default_label ); // Blank option
490
-	}
488
+    if ( $default_label !== null && $default_label !== false ) {
489
+        $pages_options = array( '' => $default_label ); // Blank option
490
+    }
491 491
 
492
-	$pages = get_pages();
493
-	if ( $pages ) {
494
-		foreach ( $pages as $page ) {
495
-			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
492
+    $pages = get_pages();
493
+    if ( $pages ) {
494
+        foreach ( $pages as $page ) {
495
+            $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
496 496
             $pages_options[ $page->ID ] = $title;
497
-		}
498
-	}
497
+        }
498
+    }
499 499
 
500
-	return $pages_options;
500
+    return $pages_options;
501 501
 }
502 502
 
503 503
 function wpinv_header_callback( $args ) {
504
-	if ( ! empty( $args['desc'] ) ) {
504
+    if ( ! empty( $args['desc'] ) ) {
505 505
         echo wp_kses_post( $args['desc'] );
506 506
     }
507 507
 }
508 508
 
509 509
 function wpinv_hidden_callback( $args ) {
510 510
 
511
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
512
-	$value   = wpinv_get_option( $args['id'], $std );
511
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
512
+    $value   = wpinv_get_option( $args['id'], $std );
513 513
 
514
-	if ( isset( $args['set_value'] ) ) {
515
-		$value = $args['set_value'];
516
-	}
514
+    if ( isset( $args['set_value'] ) ) {
515
+        $value = $args['set_value'];
516
+    }
517 517
 
518
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
519
-		$args['readonly'] = true;
520
-		$name  = '';
521
-	} else {
522
-		$name = 'wpinv_settings[' . esc_attr( $args['id'] ) . ']';
523
-	}
518
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
519
+        $args['readonly'] = true;
520
+        $name  = '';
521
+    } else {
522
+        $name = 'wpinv_settings[' . esc_attr( $args['id'] ) . ']';
523
+    }
524 524
 
525
-	echo '<input type="hidden" id="wpinv_settings[' . esc_attr( $args['id'] ) . ']" name="' . esc_attr( $name ) . '" value="' . esc_attr( stripslashes( $value ) ) . '" />';
525
+    echo '<input type="hidden" id="wpinv_settings[' . esc_attr( $args['id'] ) . ']" name="' . esc_attr( $name ) . '" value="' . esc_attr( stripslashes( $value ) ) . '" />';
526 526
 
527 527
 }
528 528
 
@@ -531,12 +531,12 @@  discard block
 block discarded – undo
531 531
  */
532 532
 function wpinv_checkbox_callback( $args ) {
533 533
 
534
-	$std = isset( $args['std'] ) ? $args['std'] : '';
535
-	$std = wpinv_get_option( $args['id'], $std );
536
-	$id  = esc_attr( $args['id'] );
534
+    $std = isset( $args['std'] ) ? $args['std'] : '';
535
+    $std = wpinv_get_option( $args['id'], $std );
536
+    $id  = esc_attr( $args['id'] );
537 537
 
538
-	getpaid_hidden_field( "wpinv_settings[$id]", '0' );
539
-	?>
538
+    getpaid_hidden_field( "wpinv_settings[$id]", '0' );
539
+    ?>
540 540
 		<label>
541 541
 			<input id="wpinv-settings-<?php echo esc_attr( $id ); ?>" name="wpinv_settings[<?php echo esc_attr( $id ); ?>]" <?php checked( empty( $std ), false ); ?> value="1" type="checkbox" />
542 542
 			<?php echo wp_kses_post( $args['desc'] ); ?>
@@ -546,75 +546,75 @@  discard block
 block discarded – undo
546 546
 
547 547
 function wpinv_multicheck_callback( $args ) {
548 548
 
549
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
550
-	$class = ! empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
549
+    $sanitize_id = wpinv_sanitize_key( $args['id'] );
550
+    $class = ! empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
551 551
 
552
-	if ( ! empty( $args['options'] ) ) {
552
+    if ( ! empty( $args['options'] ) ) {
553 553
 
554
-		$std     = isset( $args['std'] ) ? $args['std'] : array();
555
-		$value   = wpinv_get_option( $args['id'], $std );
554
+        $std     = isset( $args['std'] ) ? $args['std'] : array();
555
+        $value   = wpinv_get_option( $args['id'], $std );
556 556
 
557
-		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . esc_attr( $sanitize_id . $class ) . '">';
557
+        echo '<div class="wpi-mcheck-rows wpi-mcheck-' . esc_attr( $sanitize_id . $class ) . '">';
558 558
         foreach ( $args['options'] as $key => $option ) :
559
-			$sanitize_key = esc_attr( wpinv_sanitize_key( $key ) );
560
-			if ( in_array( $sanitize_key, $value ) ) {
561
-				$enabled = $sanitize_key;
562
-			} else {
563
-				$enabled = null;
564
-			}
565
-			echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" id="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
566
-			echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']">' . wp_kses_post( $option ) . '</label></div>';
567
-		endforeach;
568
-		echo '</div>';
569
-		echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
570
-	}
559
+            $sanitize_key = esc_attr( wpinv_sanitize_key( $key ) );
560
+            if ( in_array( $sanitize_key, $value ) ) {
561
+                $enabled = $sanitize_key;
562
+            } else {
563
+                $enabled = null;
564
+            }
565
+            echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" id="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/>&nbsp;';
566
+            echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']">' . wp_kses_post( $option ) . '</label></div>';
567
+        endforeach;
568
+        echo '</div>';
569
+        echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
570
+    }
571 571
 }
572 572
 
573 573
 function wpinv_payment_icons_callback( $args ) {
574 574
 
575 575
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
576
-	$value   = wpinv_get_option( $args['id'], false );
576
+    $value   = wpinv_get_option( $args['id'], false );
577 577
 
578
-	if ( ! empty( $args['options'] ) ) {
579
-		foreach ( $args['options'] as $key => $option ) {
578
+    if ( ! empty( $args['options'] ) ) {
579
+        foreach ( $args['options'] as $key => $option ) {
580 580
             $sanitize_key = wpinv_sanitize_key( $key );
581 581
 
582
-			if ( empty( $value ) ) {
583
-				$enabled = $option;
584
-			} else {
585
-				$enabled = null;
586
-			}
587
-
588
-			echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
589
-
590
-				echo '<input name="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" id="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
591
-
592
-				if ( wpinv_string_is_image_url( $key ) ) {
593
-				echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
594
-				} else {
595
-				$card = strtolower( str_replace( ' ', '', $option ) );
596
-
597
-				if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
598
-					$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
599
-					} else {
600
-					$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
601
-					$content_dir = WP_CONTENT_DIR;
602
-
603
-					if ( function_exists( 'wp_normalize_path' ) ) {
604
-						// Replaces backslashes with forward slashes for Windows systems
605
-						$image = wp_normalize_path( $image );
606
-						$content_dir = wp_normalize_path( $content_dir );
607
-						}
608
-
609
-					$image = str_replace( $content_dir, content_url(), $image );
610
-					}
611
-
612
-				echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
613
-				}
614
-			echo wp_kses_post( $option ) . '</label>';
615
-		}
616
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
617
-	}
582
+            if ( empty( $value ) ) {
583
+                $enabled = $option;
584
+            } else {
585
+                $enabled = null;
586
+            }
587
+
588
+            echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">';
589
+
590
+                echo '<input name="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" id="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/>&nbsp;';
591
+
592
+                if ( wpinv_string_is_image_url( $key ) ) {
593
+                echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
594
+                } else {
595
+                $card = strtolower( str_replace( ' ', '', $option ) );
596
+
597
+                if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
598
+                    $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
599
+                    } else {
600
+                    $image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
601
+                    $content_dir = WP_CONTENT_DIR;
602
+
603
+                    if ( function_exists( 'wp_normalize_path' ) ) {
604
+                        // Replaces backslashes with forward slashes for Windows systems
605
+                        $image = wp_normalize_path( $image );
606
+                        $content_dir = wp_normalize_path( $content_dir );
607
+                        }
608
+
609
+                    $image = str_replace( $content_dir, content_url(), $image );
610
+                    }
611
+
612
+                echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
613
+                }
614
+            echo wp_kses_post( $option ) . '</label>';
615
+        }
616
+        echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
617
+    }
618 618
 }
619 619
 
620 620
 /**
@@ -622,9 +622,9 @@  discard block
 block discarded – undo
622 622
  */
623 623
 function wpinv_radio_callback( $args ) {
624 624
 
625
-	$std = isset( $args['std'] ) ? $args['std'] : '';
626
-	$std = wpinv_get_option( $args['id'], $std );
627
-	?>
625
+    $std = isset( $args['std'] ) ? $args['std'] : '';
626
+    $std = wpinv_get_option( $args['id'], $std );
627
+    ?>
628 628
 		<fieldset>
629 629
 			<ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;">
630 630
 				<?php foreach ( $args['options'] as $key => $option ) : ?>
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 			</ul>
639 639
 		</fieldset>
640 640
 	<?php
641
-	getpaid_settings_description_callback( $args );
641
+    getpaid_settings_description_callback( $args );
642 642
 }
643 643
 
644 644
 /**
@@ -646,10 +646,10 @@  discard block
 block discarded – undo
646 646
  */
647 647
 function getpaid_settings_description_callback( $args ) {
648 648
 
649
-	if ( ! empty( $args['desc'] ) ) {
650
-		$description = $args['desc'];
651
-		echo wp_kses_post( "<p class='description'>$description</p>" );
652
-	}
649
+    if ( ! empty( $args['desc'] ) ) {
650
+        $description = $args['desc'];
651
+        echo wp_kses_post( "<p class='description'>$description</p>" );
652
+    }
653 653
 
654 654
 }
655 655
 
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
  */
659 659
 function wpinv_gateways_callback() {
660 660
 
661
-	?>
661
+    ?>
662 662
 		</td>
663 663
 	</tr>
664 664
 	<tr class="bsui">
@@ -672,26 +672,26 @@  discard block
 block discarded – undo
672 672
 
673 673
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
674 674
     $class = ! empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
675
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
676
-	$value   = wpinv_get_option( $args['id'], $std );
675
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
676
+    $value   = wpinv_get_option( $args['id'], $std );
677 677
 
678
-	echo '<select name="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" class="' . esc_attr( $class ) . '" >';
678
+    echo '<select name="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" class="' . esc_attr( $class ) . '" >';
679 679
 
680
-	foreach ( $args['options'] as $key => $option ) :
680
+    foreach ( $args['options'] as $key => $option ) :
681 681
 
682
-		echo '<option value="' . esc_attr( $key ) . '" ';
682
+        echo '<option value="' . esc_attr( $key ) . '" ';
683 683
 
684
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
684
+        if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
685 685
             selected( $key, $args['selected'] );
686 686
         } else {
687 687
             selected( $key, $value );
688 688
         }
689 689
 
690
-		echo '>' . esc_html( $option['admin_label'] ) . '</option>';
691
-	endforeach;
690
+        echo '>' . esc_html( $option['admin_label'] ) . '</option>';
691
+    endforeach;
692 692
 
693
-	echo '</select>';
694
-	echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
693
+    echo '</select>';
694
+    echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
695 695
 }
696 696
 
697 697
 /**
@@ -702,38 +702,38 @@  discard block
 block discarded – undo
702 702
  */
703 703
 function wpinv_settings_attrs_helper( $args ) {
704 704
 
705
-	$value = isset( $args['std'] ) ? $args['std'] : '';
706
-	$id    = esc_attr( $args['id'] );
707
-	$value = is_scalar( $value ) ? $value : '';
708
-
709
-	$attrs = array(
710
-		'name'     => ! empty( $args['faux'] ) ? false : "wpinv_settings[$id]",
711
-		'readonly' => ! empty( $args['faux'] ),
712
-		'value'    => ! empty( $args['faux'] ) ? $value : wpinv_get_option( $args['id'], $value ),
713
-		'id'       => 'wpinv-settings-' . $args['id'],
714
-		'style'    => $args['style'],
715
-		'class'    => $args['class'],
716
-		'placeholder' => $args['placeholder'],
717
-		'data-placeholder' => $args['placeholder'],
718
-	);
705
+    $value = isset( $args['std'] ) ? $args['std'] : '';
706
+    $id    = esc_attr( $args['id'] );
707
+    $value = is_scalar( $value ) ? $value : '';
708
+
709
+    $attrs = array(
710
+        'name'     => ! empty( $args['faux'] ) ? false : "wpinv_settings[$id]",
711
+        'readonly' => ! empty( $args['faux'] ),
712
+        'value'    => ! empty( $args['faux'] ) ? $value : wpinv_get_option( $args['id'], $value ),
713
+        'id'       => 'wpinv-settings-' . $args['id'],
714
+        'style'    => $args['style'],
715
+        'class'    => $args['class'],
716
+        'placeholder' => $args['placeholder'],
717
+        'data-placeholder' => $args['placeholder'],
718
+    );
719 719
 
720
-	if ( ! empty( $args['onchange'] ) ) {
721
-		$attrs['onchange'] = $args['onchange'];
722
-	}
720
+    if ( ! empty( $args['onchange'] ) ) {
721
+        $attrs['onchange'] = $args['onchange'];
722
+    }
723 723
 
724
-	foreach ( $attrs as $key => $value ) {
724
+    foreach ( $attrs as $key => $value ) {
725 725
 
726
-		if ( false === $value ) {
727
-			continue;
728
-		}
726
+        if ( false === $value ) {
727
+            continue;
728
+        }
729 729
 
730
-		if ( true === $value ) {
731
-			echo ' ' . esc_attr( $key );
732
-		} else {
733
-			echo ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
734
-		}
730
+        if ( true === $value ) {
731
+            echo ' ' . esc_attr( $key );
732
+        } else {
733
+            echo ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
734
+        }
735 735
 
736
-	}
736
+    }
737 737
 
738 738
 }
739 739
 
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
  */
743 743
 function wpinv_text_callback( $args ) {
744 744
 
745
-	?>
745
+    ?>
746 746
 		<label style="width: 100%;">
747 747
 			<input type="text" <?php wpinv_settings_attrs_helper( $args ); ?>>
748 748
 			<?php getpaid_settings_description_callback( $args ); ?>
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
  */
757 757
 function wpinv_number_callback( $args ) {
758 758
 
759
-	?>
759
+    ?>
760 760
 		<label style="width: 100%;">
761 761
 			<input type="number" step="<?php echo esc_attr( $args['step'] ); ?>" max="<?php echo intval( $args['max'] ); ?>" min="<?php echo intval( $args['min'] ); ?>" <?php wpinv_settings_attrs_helper( $args ); ?>>
762 762
 			<?php getpaid_settings_description_callback( $args ); ?>
@@ -768,34 +768,34 @@  discard block
 block discarded – undo
768 768
 function wpinv_textarea_callback( $args ) {
769 769
 
770 770
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
771
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
772
-	$value   = wpinv_get_option( $args['id'], $std );
771
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
772
+    $value   = wpinv_get_option( $args['id'], $std );
773 773
 
774 774
     $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
775 775
     $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
776 776
 
777
-	echo '<textarea class="' . esc_attr( $class ) . ' txtarea-' . esc_attr( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . esc_attr( $args['cols'] ) . '" rows="' . esc_attr( $args['rows'] ) . '" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
778
-	echo '<br /><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
777
+    echo '<textarea class="' . esc_attr( $class ) . ' txtarea-' . esc_attr( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . esc_attr( $args['cols'] ) . '" rows="' . esc_attr( $args['rows'] ) . '" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
778
+    echo '<br /><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
779 779
 
780 780
 }
781 781
 
782 782
 function wpinv_password_callback( $args ) {
783 783
 
784 784
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
785
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
786
-	$value   = wpinv_get_option( $args['id'], $std );
785
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
786
+    $value   = wpinv_get_option( $args['id'], $std );
787 787
 
788
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
789
-	echo '<input type="password" class="' . esc_attr( $size ) . '-text" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
790
-	echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
788
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
789
+    echo '<input type="password" class="' . esc_attr( $size ) . '-text" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>';
790
+    echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
791 791
 
792 792
 }
793 793
 
794 794
 function wpinv_missing_callback( $args ) {
795
-	printf(
796
-		esc_html__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
797
-		'<strong>' . esc_html( $args['id'] ) . '</strong>'
798
-	);
795
+    printf(
796
+        esc_html__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
797
+        '<strong>' . esc_html( $args['id'] ) . '</strong>'
798
+    );
799 799
 }
800 800
 
801 801
 /**
@@ -803,13 +803,13 @@  discard block
 block discarded – undo
803 803
  */
804 804
 function wpinv_select_callback( $args ) {
805 805
 
806
-	$desc   = wp_kses_post( $args['desc'] );
807
-	$desc   = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
808
-	$value  = isset( $args['std'] ) ? $args['std'] : '';
809
-	$value  = wpinv_get_option( $args['id'], $value );
810
-	$rand   = uniqid( 'random_id' );
806
+    $desc   = wp_kses_post( $args['desc'] );
807
+    $desc   = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
808
+    $value  = isset( $args['std'] ) ? $args['std'] : '';
809
+    $value  = wpinv_get_option( $args['id'], $value );
810
+    $rand   = uniqid( 'random_id' );
811 811
 
812
-	?>
812
+    ?>
813 813
 		<label style="width: 100%;">
814 814
 			<select <?php wpinv_settings_attrs_helper( $args ); ?> data-allow-clear="true">
815 815
 				<?php foreach ( $args['options'] as $option => $name ) : ?>
@@ -842,50 +842,50 @@  discard block
 block discarded – undo
842 842
 function wpinv_color_select_callback( $args ) {
843 843
 
844 844
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
845
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
846
-	$value   = wpinv_get_option( $args['id'], $std );
845
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
846
+    $value   = wpinv_get_option( $args['id'], $std );
847 847
 
848
-	echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
848
+    echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
849 849
 
850
-	foreach ( $args['options'] as $option => $color ) {
851
-		echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $color['label'] ) . '</option>';
852
-	}
850
+    foreach ( $args['options'] as $option => $color ) {
851
+        echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $color['label'] ) . '</option>';
852
+    }
853 853
 
854
-	echo '</select>';
855
-	echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
854
+    echo '</select>';
855
+    echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
856 856
 
857 857
 }
858 858
 
859 859
 function wpinv_rich_editor_callback( $args ) {
860
-	global $wp_version;
860
+    global $wp_version;
861 861
 
862 862
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
863 863
 
864
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
865
-	$value   = wpinv_get_option( $args['id'], $std );
864
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
865
+    $value   = wpinv_get_option( $args['id'], $std );
866 866
 
867
-	if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) {
868
-		$value = $std;
869
-	}
867
+    if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) {
868
+        $value = $std;
869
+    }
870 870
 
871
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
871
+    $rows = isset( $args['size'] ) ? $args['size'] : 20;
872 872
 
873
-	echo '<div class="getpaid-settings-editor-input">';
874
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
875
-		wp_editor(
873
+    echo '<div class="getpaid-settings-editor-input">';
874
+    if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
875
+        wp_editor(
876 876
             stripslashes( $value ),
877 877
             'wpinv_settings_' . esc_attr( $args['id'] ),
878 878
             array(
879
-				'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']',
880
-				'textarea_rows' => absint( $rows ),
881
-				'media_buttons' => false,
879
+                'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']',
880
+                'textarea_rows' => absint( $rows ),
881
+                'media_buttons' => false,
882 882
             )
883 883
         );
884
-	} else {
885
-		echo '<textarea class="large-text" rows="10" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
886
-	}
884
+    } else {
885
+        echo '<textarea class="large-text" rows="10" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>';
886
+    }
887 887
 
888
-	echo '</div><br/><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
888
+    echo '</div><br/><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
889 889
 
890 890
 }
891 891
 
@@ -893,51 +893,51 @@  discard block
 block discarded – undo
893 893
 
894 894
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
895 895
 
896
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
897
-	$value   = wpinv_get_option( $args['id'], $std );
896
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
897
+    $value   = wpinv_get_option( $args['id'], $std );
898 898
 
899
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
900
-	echo '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
901
-	echo '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . esc_attr__( 'Upload File', 'invoicing' ) . '"/></span>';
902
-	echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
899
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
900
+    echo '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>';
901
+    echo '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . esc_attr__( 'Upload File', 'invoicing' ) . '"/></span>';
902
+    echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
903 903
 
904 904
 }
905 905
 
906 906
 function wpinv_color_callback( $args ) {
907 907
 
908
-	$std         = isset( $args['std'] ) ? $args['std'] : '';
909
-	$value       = wpinv_get_option( $args['id'], $std );
908
+    $std         = isset( $args['std'] ) ? $args['std'] : '';
909
+    $value       = wpinv_get_option( $args['id'], $std );
910 910
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
911 911
 
912
-	echo '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />';
913
-	echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
912
+    echo '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $std ) . '" />';
913
+    echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
914 914
 
915 915
 }
916 916
 
917 917
 function wpinv_country_states_callback( $args ) {
918 918
 
919
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
920
-	$value   = wpinv_get_option( $args['id'], $std );
919
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
920
+    $value   = wpinv_get_option( $args['id'], $std );
921 921
 
922 922
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
923 923
 
924
-	if ( isset( $args['placeholder'] ) ) {
925
-		$placeholder = $args['placeholder'];
926
-	} else {
927
-		$placeholder = '';
928
-	}
924
+    if ( isset( $args['placeholder'] ) ) {
925
+        $placeholder = $args['placeholder'];
926
+    } else {
927
+        $placeholder = '';
928
+    }
929 929
 
930
-	$states = wpinv_get_country_states();
930
+    $states = wpinv_get_country_states();
931 931
 
932
-	$class = empty( $states ) ? 'wpinv-no-states' : 'wpi_select2';
933
-	echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="' . esc_attr( $class ) . '" data-placeholder="' . esc_html( $placeholder ) . '"/>';
932
+    $class = empty( $states ) ? 'wpinv-no-states' : 'wpi_select2';
933
+    echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="' . esc_attr( $class ) . '" data-placeholder="' . esc_html( $placeholder ) . '"/>';
934 934
 
935
-	foreach ( $states as $option => $name ) {
936
-		echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $name ) . '</option>';
937
-	}
935
+    foreach ( $states as $option => $name ) {
936
+        echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $name ) . '</option>';
937
+    }
938 938
 
939
-	echo '</select>';
940
-	echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
939
+    echo '</select>';
940
+    echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
941 941
 
942 942
 }
943 943
 
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
  */
947 947
 function wpinv_tax_rates_callback() {
948 948
 
949
-	?>
949
+    ?>
950 950
 		</td>
951 951
 	</tr>
952 952
 	<tr class="bsui">
@@ -962,9 +962,9 @@  discard block
 block discarded – undo
962 962
  */
963 963
 function wpinv_tax_rate_callback( $tax_rate, $key ) {
964 964
 
965
-	$key                      = sanitize_key( $key );
966
-	$tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
967
-	include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
965
+    $key                      = sanitize_key( $key );
966
+    $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
967
+    include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
968 968
 
969 969
 }
970 970
 
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
  */
974 974
 function wpinv_tax_rules_callback() {
975 975
 
976
-	?>
976
+    ?>
977 977
 		</td>
978 978
 	</tr>
979 979
 	<tr class="bsui">
@@ -1011,14 +1011,14 @@  discard block
 block discarded – undo
1011 1011
                 <td>
1012 1012
 					<a href="
1013 1013
                     <?php
1014
-						echo esc_url(
1015
-							wp_nonce_url(
1016
-								add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
1017
-								'getpaid-nonce',
1018
-								'getpaid-nonce'
1019
-							)
1020
-						);
1021
-					?>
1014
+                        echo esc_url(
1015
+                            wp_nonce_url(
1016
+                                add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
1017
+                                'getpaid-nonce',
1018
+                                'getpaid-nonce'
1019
+                            )
1020
+                        );
1021
+                    ?>
1022 1022
                     " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a>
1023 1023
                 </td>
1024 1024
             </tr>
@@ -1030,14 +1030,14 @@  discard block
 block discarded – undo
1030 1030
                 <td>
1031 1031
 					<a href="
1032 1032
                     <?php
1033
-						echo esc_url(
1034
-							wp_nonce_url(
1035
-								add_query_arg( 'getpaid-admin-action', 'refresh_permalinks' ),
1036
-								'getpaid-nonce',
1037
-								'getpaid-nonce'
1038
-							)
1039
-						);
1040
-					?>
1033
+                        echo esc_url(
1034
+                            wp_nonce_url(
1035
+                                add_query_arg( 'getpaid-admin-action', 'refresh_permalinks' ),
1036
+                                'getpaid-nonce',
1037
+                                'getpaid-nonce'
1038
+                            )
1039
+                        );
1040
+                    ?>
1041 1041
                     " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a>
1042 1042
                 </td>
1043 1043
             </tr>
@@ -1049,14 +1049,14 @@  discard block
 block discarded – undo
1049 1049
                 <td>
1050 1050
 					<a href="
1051 1051
                     <?php
1052
-						echo esc_url(
1053
-							wp_nonce_url(
1054
-								add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
1055
-								'getpaid-nonce',
1056
-								'getpaid-nonce'
1057
-							)
1058
-						);
1059
-					?>
1052
+                        echo esc_url(
1053
+                            wp_nonce_url(
1054
+                                add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
1055
+                                'getpaid-nonce',
1056
+                                'getpaid-nonce'
1057
+                            )
1058
+                        );
1059
+                    ?>
1060 1060
                     " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a>
1061 1061
                 </td>
1062 1062
             </tr>
@@ -1068,14 +1068,14 @@  discard block
 block discarded – undo
1068 1068
                 <td>
1069 1069
 					<a href="
1070 1070
                     <?php
1071
-						echo esc_url(
1072
-							wp_nonce_url(
1073
-								add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ),
1074
-								'getpaid-nonce',
1075
-								'getpaid-nonce'
1076
-							)
1077
-						);
1078
-					?>
1071
+                        echo esc_url(
1072
+                            wp_nonce_url(
1073
+                                add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ),
1074
+                                'getpaid-nonce',
1075
+                                'getpaid-nonce'
1076
+                            )
1077
+                        );
1078
+                    ?>
1079 1079
                     " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a>
1080 1080
                 </td>
1081 1081
             </tr>
@@ -1088,14 +1088,14 @@  discard block
 block discarded – undo
1088 1088
                 <td>
1089 1089
 					<a href="
1090 1090
                     <?php
1091
-						echo esc_url(
1092
-							wp_nonce_url(
1093
-								add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ),
1094
-								'getpaid-nonce',
1095
-								'getpaid-nonce'
1096
-							)
1097
-						);
1098
-					?>
1091
+                        echo esc_url(
1092
+                            wp_nonce_url(
1093
+                                add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ),
1094
+                                'getpaid-nonce',
1095
+                                'getpaid-nonce'
1096
+                            )
1097
+                        );
1098
+                    ?>
1099 1099
                     " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a>
1100 1100
                 </td>
1101 1101
             </tr>
@@ -1108,8 +1108,8 @@  discard block
 block discarded – undo
1108 1108
                 <td>
1109 1109
 					<a href="
1110 1110
                     <?php
1111
-						echo esc_url( admin_url( 'index.php?page=gp-setup' ) );
1112
-					?>
1111
+                        echo esc_url( admin_url( 'index.php?page=gp-setup' ) );
1112
+                    ?>
1113 1113
                     " class="button button-primary"><?php esc_html_e( 'Launch', 'invoicing' ); ?></a>
1114 1114
                 </td>
1115 1115
             </tr>
@@ -1123,19 +1123,19 @@  discard block
 block discarded – undo
1123 1123
 
1124 1124
 
1125 1125
 function wpinv_descriptive_text_callback( $args ) {
1126
-	echo wp_kses_post( $args['desc'] );
1126
+    echo wp_kses_post( $args['desc'] );
1127 1127
 }
1128 1128
 
1129 1129
 function wpinv_raw_html_callback( $args ) {
1130
-	echo wp_kses( $args['desc'], getpaid_allowed_html() );
1130
+    echo wp_kses( $args['desc'], getpaid_allowed_html() );
1131 1131
 }
1132 1132
 
1133 1133
 function wpinv_hook_callback( $args ) {
1134
-	do_action( 'wpinv_' . $args['id'], $args );
1134
+    do_action( 'wpinv_' . $args['id'], $args );
1135 1135
 }
1136 1136
 
1137 1137
 function wpinv_set_settings_cap() {
1138
-	return wpinv_get_capability();
1138
+    return wpinv_get_capability();
1139 1139
 }
1140 1140
 add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1141 1141
 
@@ -1159,15 +1159,15 @@  discard block
 block discarded – undo
1159 1159
  */
1160 1160
 function wpinv_get_merge_tags_help_text( $subscription = false ) {
1161 1161
 
1162
-	$url  = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f';
1163
-	$link = sprintf(
1164
-		'<strong><a href="%s" target="_blank">%s</a></strong>',
1165
-		$url,
1166
-		esc_html__( 'View available merge tags.', 'invoicing' )
1167
-	);
1162
+    $url  = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f';
1163
+    $link = sprintf(
1164
+        '<strong><a href="%s" target="_blank">%s</a></strong>',
1165
+        $url,
1166
+        esc_html__( 'View available merge tags.', 'invoicing' )
1167
+    );
1168 1168
 
1169
-	$description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' );
1169
+    $description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' );
1170 1170
 
1171
-	return "$description $link";
1171
+    return "$description $link";
1172 1172
 
1173 1173
 }
Please login to merge, or discard this patch.
includes/class-wpinv.php 1 patch
Indentation   +605 added lines, -605 removed lines patch added patch discarded remove patch
@@ -14,650 +14,650 @@
 block discarded – undo
14 14
  */
15 15
 class WPInv_Plugin {
16 16
 
17
-	/**
18
-	 * GetPaid version.
19
-	 *
20
-	 * @var string
21
-	 */
22
-	public $version;
23
-
24
-	/**
25
-	 * Data container.
26
-	 *
27
-	 * @var array
28
-	 */
29
-	protected $data = array();
30
-
31
-	/**
32
-	 * Form elements instance.
33
-	 *
34
-	 * @var WPInv_Payment_Form_Elements
35
-	 */
36
-	public $form_elements;
37
-
38
-	/**
39
-	 * @var array An array of payment gateways.
40
-	 */
41
-	public $gateways;
42
-
43
-	/**
44
-	 * Class constructor.
45
-	 */
46
-	public function __construct() {
47
-		$this->define_constants();
48
-		$this->includes();
49
-		$this->init_hooks();
50
-		$this->set_properties();
51
-	}
52
-
53
-	/**
54
-	 * Sets a custom data property.
55
-	 *
56
-	 * @param string $prop The prop to set.
57
-	 * @param mixed $value The value to retrieve.
58
-	 */
59
-	public function set( $prop, $value ) {
60
-		$this->data[ $prop ] = $value;
61
-	}
62
-
63
-	/**
64
-	 * Gets a custom data property.
65
-	 *
66
-	 * @param string $prop The prop to set.
67
-	 * @return mixed The value.
68
-	 */
69
-	public function get( $prop ) {
70
-
71
-		if ( isset( $this->data[ $prop ] ) ) {
72
-			return $this->data[ $prop ];
73
-		}
74
-
75
-		return null;
76
-	}
77
-
78
-	/**
79
-	 * Define class properties.
80
-	 */
81
-	public function set_properties() {
82
-
83
-		// Sessions.
84
-		$this->set( 'session', new WPInv_Session_Handler() );
85
-		$GLOBALS['wpi_session'] = $this->get( 'session' ); // Backwards compatibility.
86
-		$GLOBALS['wpinv_euvat'] = new WPInv_EUVat(); // Backwards compatibility.
87
-
88
-		// Init other objects.
89
-		$this->set( 'notes', new WPInv_Notes() );
90
-		$this->set( 'api', new WPInv_API() );
91
-		$this->set( 'post_types', new GetPaid_Post_Types() );
92
-		$this->set( 'template', new GetPaid_Template() );
93
-		$this->set( 'admin', new GetPaid_Admin() );
94
-		$this->set( 'subscriptions', new WPInv_Subscriptions() );
95
-		$this->set( 'invoice_emails', new GetPaid_Invoice_Notification_Emails() );
96
-		$this->set( 'subscription_emails', new GetPaid_Subscription_Notification_Emails() );
97
-		$this->set( 'daily_maintenace', new GetPaid_Daily_Maintenance() );
98
-		$this->set( 'payment_forms', new GetPaid_Payment_Forms() );
99
-		$this->set( 'maxmind', new GetPaid_MaxMind_Geolocation() );
100
-
101
-	}
102
-
103
-	 /**
104
-	 * Define plugin constants.
105
-	 */
106
-	public function define_constants() {
107
-		define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) );
108
-		define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) );
109
-		$this->version = WPINV_VERSION;
110
-	}
111
-
112
-	/**
113
-	 * Hook into actions and filters.
114
-	 *
115
-	 * @since 1.0.19
116
-	 */
117
-	protected function init_hooks() {
118
-		/* Internationalize the text strings used. */
119
-		add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) );
120
-
121
-		// Init the plugin after WordPress inits.
122
-		add_action( 'init', array( $this, 'init' ), 1 );
123
-		add_action( 'init', array( $this, 'maybe_process_ipn' ), 10 );
124
-		add_action( 'init', array( $this, 'wpinv_actions' ) );
125
-		add_action( 'init', array( $this, 'maybe_do_authenticated_action' ), 100 );
126
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 11 );
127
-		add_action( 'wp_footer', array( $this, 'wp_footer' ) );
128
-		add_action( 'wp_head', array( $this, 'wp_head' ) );
129
-		add_action( 'widgets_init', array( $this, 'register_widgets' ) );
130
-		add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) );
131
-		add_filter( 'the_seo_framework_sitemap_supported_post_types', array( $this, 'exclude_invoicing_post_types' ) );
132
-		add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
133
-
134
-		add_filter( 'query_vars', array( $this, 'custom_query_vars' ) );
17
+    /**
18
+     * GetPaid version.
19
+     *
20
+     * @var string
21
+     */
22
+    public $version;
23
+
24
+    /**
25
+     * Data container.
26
+     *
27
+     * @var array
28
+     */
29
+    protected $data = array();
30
+
31
+    /**
32
+     * Form elements instance.
33
+     *
34
+     * @var WPInv_Payment_Form_Elements
35
+     */
36
+    public $form_elements;
37
+
38
+    /**
39
+     * @var array An array of payment gateways.
40
+     */
41
+    public $gateways;
42
+
43
+    /**
44
+     * Class constructor.
45
+     */
46
+    public function __construct() {
47
+        $this->define_constants();
48
+        $this->includes();
49
+        $this->init_hooks();
50
+        $this->set_properties();
51
+    }
52
+
53
+    /**
54
+     * Sets a custom data property.
55
+     *
56
+     * @param string $prop The prop to set.
57
+     * @param mixed $value The value to retrieve.
58
+     */
59
+    public function set( $prop, $value ) {
60
+        $this->data[ $prop ] = $value;
61
+    }
62
+
63
+    /**
64
+     * Gets a custom data property.
65
+     *
66
+     * @param string $prop The prop to set.
67
+     * @return mixed The value.
68
+     */
69
+    public function get( $prop ) {
70
+
71
+        if ( isset( $this->data[ $prop ] ) ) {
72
+            return $this->data[ $prop ];
73
+        }
74
+
75
+        return null;
76
+    }
77
+
78
+    /**
79
+     * Define class properties.
80
+     */
81
+    public function set_properties() {
82
+
83
+        // Sessions.
84
+        $this->set( 'session', new WPInv_Session_Handler() );
85
+        $GLOBALS['wpi_session'] = $this->get( 'session' ); // Backwards compatibility.
86
+        $GLOBALS['wpinv_euvat'] = new WPInv_EUVat(); // Backwards compatibility.
87
+
88
+        // Init other objects.
89
+        $this->set( 'notes', new WPInv_Notes() );
90
+        $this->set( 'api', new WPInv_API() );
91
+        $this->set( 'post_types', new GetPaid_Post_Types() );
92
+        $this->set( 'template', new GetPaid_Template() );
93
+        $this->set( 'admin', new GetPaid_Admin() );
94
+        $this->set( 'subscriptions', new WPInv_Subscriptions() );
95
+        $this->set( 'invoice_emails', new GetPaid_Invoice_Notification_Emails() );
96
+        $this->set( 'subscription_emails', new GetPaid_Subscription_Notification_Emails() );
97
+        $this->set( 'daily_maintenace', new GetPaid_Daily_Maintenance() );
98
+        $this->set( 'payment_forms', new GetPaid_Payment_Forms() );
99
+        $this->set( 'maxmind', new GetPaid_MaxMind_Geolocation() );
100
+
101
+    }
102
+
103
+        /**
104
+         * Define plugin constants.
105
+         */
106
+    public function define_constants() {
107
+        define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) );
108
+        define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) );
109
+        $this->version = WPINV_VERSION;
110
+    }
111
+
112
+    /**
113
+     * Hook into actions and filters.
114
+     *
115
+     * @since 1.0.19
116
+     */
117
+    protected function init_hooks() {
118
+        /* Internationalize the text strings used. */
119
+        add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) );
120
+
121
+        // Init the plugin after WordPress inits.
122
+        add_action( 'init', array( $this, 'init' ), 1 );
123
+        add_action( 'init', array( $this, 'maybe_process_ipn' ), 10 );
124
+        add_action( 'init', array( $this, 'wpinv_actions' ) );
125
+        add_action( 'init', array( $this, 'maybe_do_authenticated_action' ), 100 );
126
+        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 11 );
127
+        add_action( 'wp_footer', array( $this, 'wp_footer' ) );
128
+        add_action( 'wp_head', array( $this, 'wp_head' ) );
129
+        add_action( 'widgets_init', array( $this, 'register_widgets' ) );
130
+        add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) );
131
+        add_filter( 'the_seo_framework_sitemap_supported_post_types', array( $this, 'exclude_invoicing_post_types' ) );
132
+        add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
133
+
134
+        add_filter( 'query_vars', array( $this, 'custom_query_vars' ) );
135 135
         add_action( 'init', array( $this, 'add_rewrite_rule' ), 10, 0 );
136
-		add_action( 'pre_get_posts', array( $this, 'maybe_process_new_ipn' ), 1 );
137
-
138
-		// Fires after registering actions.
139
-		do_action( 'wpinv_actions', $this );
140
-		do_action( 'getpaid_actions', $this );
141
-
142
-	}
143
-
144
-	public function plugins_loaded() {
145
-		/* Internationalize the text strings used. */
146
-		$this->load_textdomain();
147
-
148
-		do_action( 'wpinv_loaded' );
149
-
150
-		// Fix oxygen page builder conflict
151
-		if ( function_exists( 'ct_css_output' ) ) {
152
-			wpinv_oxygen_fix_conflict();
153
-		}
154
-	}
155
-
156
-	/**
157
-	 * Load Localisation files.
158
-	 *
159
-	 * Note: the first-loaded translation file overrides any following ones if the same translation is present.
160
-	 *
161
-	 * Locales found in:
162
-	 *      - WP_LANG_DIR/plugins/invoicing-LOCALE.mo
163
-	 *      - WP_PLUGIN_DIR/invoicing/languages/invoicing-LOCALE.mo
164
-	 *
165
-	 * @since 1.0.0
166
-	 */
167
-	public function load_textdomain() {
168
-
169
-		load_plugin_textdomain(
170
-			'invoicing',
171
-			false,
172
-			plugin_basename( dirname( WPINV_PLUGIN_FILE ) ) . '/languages/'
173
-		);
174
-
175
-	}
176
-
177
-	/**
178
-	 * Include required core files used in admin and on the frontend.
179
-	 */
180
-	public function includes() {
181
-
182
-		// Start with the settings.
183
-		require_once WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php';
184
-
185
-		// Packages/libraries.
186
-		require_once WPINV_PLUGIN_DIR . 'vendor/autoload.php';
187
-		require_once WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php';
188
-
189
-		// Load functions.
190
-		require_once WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php';
191
-		require_once WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php';
192
-		require_once WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php';
193
-		require_once WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php';
194
-		require_once WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php';
195
-		require_once WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php';
196
-		require_once WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php';
197
-		require_once WPINV_PLUGIN_DIR . 'includes/invoice-functions.php';
198
-		require_once WPINV_PLUGIN_DIR . 'includes/subscription-functions.php';
199
-		require_once WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php';
200
-		require_once WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php';
201
-		require_once WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php';
202
-		require_once WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php';
203
-		require_once WPINV_PLUGIN_DIR . 'includes/user-functions.php';
204
-		require_once WPINV_PLUGIN_DIR . 'includes/error-functions.php';
205
-
206
-		// Register autoloader.
207
-		try {
208
-			spl_autoload_register( array( $this, 'autoload' ), true );
209
-		} catch ( Exception $e ) {
210
-			wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true );
211
-		}
212
-
213
-		require_once WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php';
214
-		require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php';
215
-		require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php';
216
-		require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php';
217
-		require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php';
218
-		require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php';
219
-		require_once WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php';
220
-		require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php';
221
-		require_once WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php';
222
-		require_once WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php';
223
-		require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php';
224
-		require_once WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php';
225
-		require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php';
226
-		require_once WPINV_PLUGIN_DIR . 'widgets/checkout.php';
227
-		require_once WPINV_PLUGIN_DIR . 'widgets/invoice-history.php';
228
-		require_once WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php';
229
-		require_once WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php';
230
-		require_once WPINV_PLUGIN_DIR . 'widgets/subscriptions.php';
231
-		require_once WPINV_PLUGIN_DIR . 'widgets/buy-item.php';
232
-		require_once WPINV_PLUGIN_DIR . 'widgets/getpaid.php';
233
-		require_once WPINV_PLUGIN_DIR . 'widgets/invoice.php';
234
-		require_once WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php';
235
-
236
-		if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
237
-			GetPaid_Post_Types_Admin::init();
238
-
239
-			require_once WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php';
240
-			require_once WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php';
241
-			require_once WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php';
242
-			require_once WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php';
243
-			require_once WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php';
244
-			require_once WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php';
245
-			// load the user class only on the users.php page
246
-			global $pagenow;
247
-			if ( $pagenow == 'users.php' ) {
248
-				new WPInv_Admin_Users();
249
-			}
250
-		}
251
-
252
-		// Register cli commands
253
-		if ( defined( 'WP_CLI' ) && WP_CLI ) {
254
-			require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php';
255
-			WP_CLI::add_command( 'invoicing', 'WPInv_CLI' );
256
-		}
257
-
258
-	}
259
-
260
-	/**
261
-	 * Class autoloader
262
-	 *
263
-	 * @param       string $class_name The name of the class to load.
264
-	 * @access      public
265
-	 * @since       1.0.19
266
-	 * @return      void
267
-	 */
268
-	public function autoload( $class_name ) {
269
-
270
-		// Normalize the class name...
271
-		$class_name  = strtolower( $class_name );
272
-
273
-		// ... and make sure it is our class.
274
-		if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) {
275
-			return;
276
-		}
277
-
278
-		// Next, prepare the file name from the class.
279
-		$file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php';
280
-
281
-		// Base path of the classes.
282
-		$plugin_path = untrailingslashit( WPINV_PLUGIN_DIR );
283
-
284
-		// And an array of possible locations in order of importance.
285
-		$locations = array(
286
-			"$plugin_path/includes",
287
-			"$plugin_path/includes/data-stores",
288
-			"$plugin_path/includes/gateways",
289
-			"$plugin_path/includes/payments",
290
-			"$plugin_path/includes/geolocation",
291
-			"$plugin_path/includes/reports",
292
-			"$plugin_path/includes/api",
293
-			"$plugin_path/includes/admin",
294
-			"$plugin_path/includes/admin/meta-boxes",
295
-		);
296
-
297
-		foreach ( apply_filters( 'getpaid_autoload_locations', $locations ) as $location ) {
298
-
299
-			if ( file_exists( trailingslashit( $location ) . $file_name ) ) {
300
-				include trailingslashit( $location ) . $file_name;
301
-				break;
302
-			}
136
+        add_action( 'pre_get_posts', array( $this, 'maybe_process_new_ipn' ), 1 );
137
+
138
+        // Fires after registering actions.
139
+        do_action( 'wpinv_actions', $this );
140
+        do_action( 'getpaid_actions', $this );
141
+
142
+    }
143
+
144
+    public function plugins_loaded() {
145
+        /* Internationalize the text strings used. */
146
+        $this->load_textdomain();
147
+
148
+        do_action( 'wpinv_loaded' );
149
+
150
+        // Fix oxygen page builder conflict
151
+        if ( function_exists( 'ct_css_output' ) ) {
152
+            wpinv_oxygen_fix_conflict();
153
+        }
154
+    }
155
+
156
+    /**
157
+     * Load Localisation files.
158
+     *
159
+     * Note: the first-loaded translation file overrides any following ones if the same translation is present.
160
+     *
161
+     * Locales found in:
162
+     *      - WP_LANG_DIR/plugins/invoicing-LOCALE.mo
163
+     *      - WP_PLUGIN_DIR/invoicing/languages/invoicing-LOCALE.mo
164
+     *
165
+     * @since 1.0.0
166
+     */
167
+    public function load_textdomain() {
168
+
169
+        load_plugin_textdomain(
170
+            'invoicing',
171
+            false,
172
+            plugin_basename( dirname( WPINV_PLUGIN_FILE ) ) . '/languages/'
173
+        );
174
+
175
+    }
176
+
177
+    /**
178
+     * Include required core files used in admin and on the frontend.
179
+     */
180
+    public function includes() {
181
+
182
+        // Start with the settings.
183
+        require_once WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php';
184
+
185
+        // Packages/libraries.
186
+        require_once WPINV_PLUGIN_DIR . 'vendor/autoload.php';
187
+        require_once WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php';
188
+
189
+        // Load functions.
190
+        require_once WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php';
191
+        require_once WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php';
192
+        require_once WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php';
193
+        require_once WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php';
194
+        require_once WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php';
195
+        require_once WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php';
196
+        require_once WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php';
197
+        require_once WPINV_PLUGIN_DIR . 'includes/invoice-functions.php';
198
+        require_once WPINV_PLUGIN_DIR . 'includes/subscription-functions.php';
199
+        require_once WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php';
200
+        require_once WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php';
201
+        require_once WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php';
202
+        require_once WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php';
203
+        require_once WPINV_PLUGIN_DIR . 'includes/user-functions.php';
204
+        require_once WPINV_PLUGIN_DIR . 'includes/error-functions.php';
205
+
206
+        // Register autoloader.
207
+        try {
208
+            spl_autoload_register( array( $this, 'autoload' ), true );
209
+        } catch ( Exception $e ) {
210
+            wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true );
211
+        }
212
+
213
+        require_once WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php';
214
+        require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php';
215
+        require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php';
216
+        require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php';
217
+        require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php';
218
+        require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php';
219
+        require_once WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php';
220
+        require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php';
221
+        require_once WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php';
222
+        require_once WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php';
223
+        require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php';
224
+        require_once WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php';
225
+        require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php';
226
+        require_once WPINV_PLUGIN_DIR . 'widgets/checkout.php';
227
+        require_once WPINV_PLUGIN_DIR . 'widgets/invoice-history.php';
228
+        require_once WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php';
229
+        require_once WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php';
230
+        require_once WPINV_PLUGIN_DIR . 'widgets/subscriptions.php';
231
+        require_once WPINV_PLUGIN_DIR . 'widgets/buy-item.php';
232
+        require_once WPINV_PLUGIN_DIR . 'widgets/getpaid.php';
233
+        require_once WPINV_PLUGIN_DIR . 'widgets/invoice.php';
234
+        require_once WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php';
235
+
236
+        if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
237
+            GetPaid_Post_Types_Admin::init();
238
+
239
+            require_once WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php';
240
+            require_once WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php';
241
+            require_once WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php';
242
+            require_once WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php';
243
+            require_once WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php';
244
+            require_once WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php';
245
+            // load the user class only on the users.php page
246
+            global $pagenow;
247
+            if ( $pagenow == 'users.php' ) {
248
+                new WPInv_Admin_Users();
249
+            }
250
+        }
251
+
252
+        // Register cli commands
253
+        if ( defined( 'WP_CLI' ) && WP_CLI ) {
254
+            require_once WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php';
255
+            WP_CLI::add_command( 'invoicing', 'WPInv_CLI' );
256
+        }
257
+
258
+    }
259
+
260
+    /**
261
+     * Class autoloader
262
+     *
263
+     * @param       string $class_name The name of the class to load.
264
+     * @access      public
265
+     * @since       1.0.19
266
+     * @return      void
267
+     */
268
+    public function autoload( $class_name ) {
269
+
270
+        // Normalize the class name...
271
+        $class_name  = strtolower( $class_name );
272
+
273
+        // ... and make sure it is our class.
274
+        if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) {
275
+            return;
276
+        }
277
+
278
+        // Next, prepare the file name from the class.
279
+        $file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php';
280
+
281
+        // Base path of the classes.
282
+        $plugin_path = untrailingslashit( WPINV_PLUGIN_DIR );
283
+
284
+        // And an array of possible locations in order of importance.
285
+        $locations = array(
286
+            "$plugin_path/includes",
287
+            "$plugin_path/includes/data-stores",
288
+            "$plugin_path/includes/gateways",
289
+            "$plugin_path/includes/payments",
290
+            "$plugin_path/includes/geolocation",
291
+            "$plugin_path/includes/reports",
292
+            "$plugin_path/includes/api",
293
+            "$plugin_path/includes/admin",
294
+            "$plugin_path/includes/admin/meta-boxes",
295
+        );
296
+
297
+        foreach ( apply_filters( 'getpaid_autoload_locations', $locations ) as $location ) {
298
+
299
+            if ( file_exists( trailingslashit( $location ) . $file_name ) ) {
300
+                include trailingslashit( $location ) . $file_name;
301
+                break;
302
+            }
303 303
 }
304 304
 
305
-	}
306
-
307
-	/**
308
-	 * Inits hooks etc.
309
-	 */
310
-	public function init() {
311
-
312
-		// Fires before getpaid inits.
313
-		do_action( 'before_getpaid_init', $this );
314
-
315
-		// Maybe upgrade.
316
-		$this->maybe_upgrade_database();
317
-
318
-		// Load default gateways.
319
-		$gateways = apply_filters(
320
-			'getpaid_default_gateways',
321
-			array(
322
-				'manual'        => 'GetPaid_Manual_Gateway',
323
-				'paypal'        => 'GetPaid_Paypal_Gateway',
324
-				'worldpay'      => 'GetPaid_Worldpay_Gateway',
325
-				'bank_transfer' => 'GetPaid_Bank_Transfer_Gateway',
326
-				'authorizenet'  => 'GetPaid_Authorize_Net_Gateway',
327
-			)
328
-		);
329
-
330
-		foreach ( $gateways as $id => $class ) {
331
-			$this->gateways[ $id ] = new $class();
332
-		}
333
-
334
-		if ( 'yes' != get_option( 'wpinv_renamed_gateways' ) ) {
335
-			GetPaid_Installer::rename_gateways_label();
336
-			update_option( 'wpinv_renamed_gateways', 'yes' );
337
-		}
338
-
339
-		// Fires after getpaid inits.
340
-		do_action( 'getpaid_init', $this );
341
-
342
-	}
343
-
344
-	/**
345
-	 * Checks if this is an IPN request and processes it.
346
-	 */
347
-	public function maybe_process_ipn() {
348
-
349
-		// Ensure that this is an IPN request.
350
-		if ( empty( $_GET['wpi-listener'] ) || 'IPN' !== $_GET['wpi-listener'] || empty( $_GET['wpi-gateway'] ) ) {
351
-			return;
352
-		}
353
-
354
-		$gateway = sanitize_text_field( $_GET['wpi-gateway'] );
355
-
356
-		do_action( 'wpinv_verify_payment_ipn', $gateway );
357
-		do_action( "wpinv_verify_{$gateway}_ipn" );
358
-		exit;
359
-
360
-	}
361
-
362
-	public function enqueue_scripts() {
363
-
364
-		// Fires before adding scripts.
365
-		do_action( 'getpaid_enqueue_scripts' );
366
-
367
-		$localize                         = array();
368
-		$localize['ajax_url']             = admin_url( 'admin-ajax.php' );
369
-		$localize['thousands']            = wpinv_thousands_separator();
370
-		$localize['decimals']             = wpinv_decimal_separator();
371
-		$localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
372
-		$localize['txtComplete']          = __( 'Continue', 'invoicing' );
373
-		$localize['UseTaxes']             = wpinv_use_taxes();
374
-		$localize['formNonce']            = wp_create_nonce( 'getpaid_form_nonce' );
375
-		$localize['loading']              = __( 'Loading...', 'invoicing' );
376
-		$localize['connectionError']      = __( 'Could not establish a connection to the server.', 'invoicing' );
377
-		$localize['recaptchaSettings']    = getpaid_get_recaptcha_settings();
378
-
379
-		$localize = apply_filters( 'wpinv_front_js_localize', $localize );
380
-
381
-		// reCaptcha.
382
-		if ( getpaid_is_recaptcha_enabled() ) {
383
-			$url = apply_filters(
384
-				'getpaid_recaptcha_api_url',
385
-				add_query_arg(
386
-					array(
387
-						'render' => 'v2' === getpaid_get_recaptcha_version() ? 'explicit' : getpaid_get_recaptcha_site_key(),
388
-					),
389
-					'https://www.google.com/recaptcha/api.js'
390
-				)
391
-			);
392
-			wp_enqueue_script( 'recaptcha', $url, array(), null, true ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
393
-		}
394
-
395
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' );
396
-		wp_enqueue_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'jquery' ), $version, true );
397
-		wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
398
-	}
399
-
400
-	public function wpinv_actions() {
401
-		if ( isset( $_REQUEST['wpi_action'] ) ) {
402
-			do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
403
-		}
404
-
405
-		if ( defined( 'WP_ALL_IMPORT_ROOT_DIR' ) ) {
406
-			include plugin_dir_path( __FILE__ ) . 'libraries/wp-all-import/class-getpaid-wp-all-import.php';
407
-		}
408
-	}
409
-
410
-	/**
305
+    }
306
+
307
+    /**
308
+     * Inits hooks etc.
309
+     */
310
+    public function init() {
311
+
312
+        // Fires before getpaid inits.
313
+        do_action( 'before_getpaid_init', $this );
314
+
315
+        // Maybe upgrade.
316
+        $this->maybe_upgrade_database();
317
+
318
+        // Load default gateways.
319
+        $gateways = apply_filters(
320
+            'getpaid_default_gateways',
321
+            array(
322
+                'manual'        => 'GetPaid_Manual_Gateway',
323
+                'paypal'        => 'GetPaid_Paypal_Gateway',
324
+                'worldpay'      => 'GetPaid_Worldpay_Gateway',
325
+                'bank_transfer' => 'GetPaid_Bank_Transfer_Gateway',
326
+                'authorizenet'  => 'GetPaid_Authorize_Net_Gateway',
327
+            )
328
+        );
329
+
330
+        foreach ( $gateways as $id => $class ) {
331
+            $this->gateways[ $id ] = new $class();
332
+        }
333
+
334
+        if ( 'yes' != get_option( 'wpinv_renamed_gateways' ) ) {
335
+            GetPaid_Installer::rename_gateways_label();
336
+            update_option( 'wpinv_renamed_gateways', 'yes' );
337
+        }
338
+
339
+        // Fires after getpaid inits.
340
+        do_action( 'getpaid_init', $this );
341
+
342
+    }
343
+
344
+    /**
345
+     * Checks if this is an IPN request and processes it.
346
+     */
347
+    public function maybe_process_ipn() {
348
+
349
+        // Ensure that this is an IPN request.
350
+        if ( empty( $_GET['wpi-listener'] ) || 'IPN' !== $_GET['wpi-listener'] || empty( $_GET['wpi-gateway'] ) ) {
351
+            return;
352
+        }
353
+
354
+        $gateway = sanitize_text_field( $_GET['wpi-gateway'] );
355
+
356
+        do_action( 'wpinv_verify_payment_ipn', $gateway );
357
+        do_action( "wpinv_verify_{$gateway}_ipn" );
358
+        exit;
359
+
360
+    }
361
+
362
+    public function enqueue_scripts() {
363
+
364
+        // Fires before adding scripts.
365
+        do_action( 'getpaid_enqueue_scripts' );
366
+
367
+        $localize                         = array();
368
+        $localize['ajax_url']             = admin_url( 'admin-ajax.php' );
369
+        $localize['thousands']            = wpinv_thousands_separator();
370
+        $localize['decimals']             = wpinv_decimal_separator();
371
+        $localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
372
+        $localize['txtComplete']          = __( 'Continue', 'invoicing' );
373
+        $localize['UseTaxes']             = wpinv_use_taxes();
374
+        $localize['formNonce']            = wp_create_nonce( 'getpaid_form_nonce' );
375
+        $localize['loading']              = __( 'Loading...', 'invoicing' );
376
+        $localize['connectionError']      = __( 'Could not establish a connection to the server.', 'invoicing' );
377
+        $localize['recaptchaSettings']    = getpaid_get_recaptcha_settings();
378
+
379
+        $localize = apply_filters( 'wpinv_front_js_localize', $localize );
380
+
381
+        // reCaptcha.
382
+        if ( getpaid_is_recaptcha_enabled() ) {
383
+            $url = apply_filters(
384
+                'getpaid_recaptcha_api_url',
385
+                add_query_arg(
386
+                    array(
387
+                        'render' => 'v2' === getpaid_get_recaptcha_version() ? 'explicit' : getpaid_get_recaptcha_site_key(),
388
+                    ),
389
+                    'https://www.google.com/recaptcha/api.js'
390
+                )
391
+            );
392
+            wp_enqueue_script( 'recaptcha', $url, array(), null, true ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
393
+        }
394
+
395
+        $version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' );
396
+        wp_enqueue_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'jquery' ), $version, true );
397
+        wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
398
+    }
399
+
400
+    public function wpinv_actions() {
401
+        if ( isset( $_REQUEST['wpi_action'] ) ) {
402
+            do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
403
+        }
404
+
405
+        if ( defined( 'WP_ALL_IMPORT_ROOT_DIR' ) ) {
406
+            include plugin_dir_path( __FILE__ ) . 'libraries/wp-all-import/class-getpaid-wp-all-import.php';
407
+        }
408
+    }
409
+
410
+    /**
411 411
      * Fires an action after verifying that a user can fire them.
412
-	 *
413
-	 * Note: If the action is on an invoice, subscription etc, esure that the
414
-	 * current user owns the invoice/subscription.
412
+     *
413
+     * Note: If the action is on an invoice, subscription etc, esure that the
414
+     * current user owns the invoice/subscription.
415 415
      */
416 416
     public function maybe_do_authenticated_action() {
417 417
 
418
-		if ( isset( $_REQUEST['getpaid-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) {
418
+        if ( isset( $_REQUEST['getpaid-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) {
419 419
 
420
-			$key  = sanitize_key( $_REQUEST['getpaid-action'] );
421
-			$data = wp_unslash( $_REQUEST );
422
-			if ( is_user_logged_in() ) {
423
-				do_action( "getpaid_authenticated_action_$key", $data );
424
-			}
420
+            $key  = sanitize_key( $_REQUEST['getpaid-action'] );
421
+            $data = wp_unslash( $_REQUEST );
422
+            if ( is_user_logged_in() ) {
423
+                do_action( "getpaid_authenticated_action_$key", $data );
424
+            }
425 425
 
426
-			do_action( "getpaid_unauthenticated_action_$key", $data );
426
+            do_action( "getpaid_unauthenticated_action_$key", $data );
427 427
 
428
-		}
428
+        }
429 429
 
430 430
     }
431 431
 
432
-	public function pre_get_posts( $wp_query ) {
433
-
434
-		if ( ! is_admin() && ! empty( $wp_query->query_vars['post_type'] ) && getpaid_is_invoice_post_type( $wp_query->query_vars['post_type'] ) && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) {
435
-			$wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses( false, false, $wp_query->query_vars['post_type'] ) );
436
-		}
437
-
438
-		return $wp_query;
439
-	}
440
-
441
-	/**
442
-	 * Register widgets
443
-	 *
444
-	 */
445
-	public function register_widgets() {
446
-		global $pagenow;
447
-
448
-		// Currently, UX Builder does not work particulaly well with SuperDuper.
449
-		// So we disable our widgets when editing a page with UX Builder.
450
-		if ( function_exists( 'ux_builder_is_active' ) && ux_builder_is_active() ) {
451
-			return;
452
-		}
453
-
454
-		$block_widget_init_screens = function_exists( 'sd_pagenow_exclude' ) ? sd_pagenow_exclude() : array();
455
-
456
-		if ( is_admin() && $pagenow && in_array( $pagenow, $block_widget_init_screens ) ) {
457
-			// don't initiate in these conditions.
458
-		} else {
459
-
460
-			// Only load allowed widgets.
461
-			$exclude = function_exists( 'sd_widget_exclude' ) ? sd_widget_exclude() : array();
462
-			$widgets = apply_filters(
463
-				'getpaid_widget_classes',
464
-				array(
465
-					'WPInv_Checkout_Widget',
466
-					'WPInv_History_Widget',
467
-					'WPInv_Receipt_Widget',
468
-					'WPInv_Subscriptions_Widget',
469
-					'WPInv_Buy_Item_Widget',
470
-					'WPInv_Messages_Widget',
471
-					'WPInv_GetPaid_Widget',
472
-					'WPInv_Invoice_Widget',
473
-				)
474
-			);
475
-
476
-			// For each widget...
477
-			foreach ( $widgets as $widget ) {
478
-
479
-				// Abort early if it is excluded for this page.
480
-				if ( in_array( $widget, $exclude ) ) {
481
-					continue;
482
-				}
483
-
484
-				// SD V1 used to extend the widget class. V2 does not, so we cannot call register widget on it.
485
-				if ( is_subclass_of( $widget, 'WP_Widget' ) ) {
486
-					register_widget( $widget );
487
-				} else {
488
-					new $widget();
489
-				}
432
+    public function pre_get_posts( $wp_query ) {
433
+
434
+        if ( ! is_admin() && ! empty( $wp_query->query_vars['post_type'] ) && getpaid_is_invoice_post_type( $wp_query->query_vars['post_type'] ) && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) {
435
+            $wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses( false, false, $wp_query->query_vars['post_type'] ) );
436
+        }
437
+
438
+        return $wp_query;
439
+    }
440
+
441
+    /**
442
+     * Register widgets
443
+     *
444
+     */
445
+    public function register_widgets() {
446
+        global $pagenow;
447
+
448
+        // Currently, UX Builder does not work particulaly well with SuperDuper.
449
+        // So we disable our widgets when editing a page with UX Builder.
450
+        if ( function_exists( 'ux_builder_is_active' ) && ux_builder_is_active() ) {
451
+            return;
452
+        }
453
+
454
+        $block_widget_init_screens = function_exists( 'sd_pagenow_exclude' ) ? sd_pagenow_exclude() : array();
455
+
456
+        if ( is_admin() && $pagenow && in_array( $pagenow, $block_widget_init_screens ) ) {
457
+            // don't initiate in these conditions.
458
+        } else {
459
+
460
+            // Only load allowed widgets.
461
+            $exclude = function_exists( 'sd_widget_exclude' ) ? sd_widget_exclude() : array();
462
+            $widgets = apply_filters(
463
+                'getpaid_widget_classes',
464
+                array(
465
+                    'WPInv_Checkout_Widget',
466
+                    'WPInv_History_Widget',
467
+                    'WPInv_Receipt_Widget',
468
+                    'WPInv_Subscriptions_Widget',
469
+                    'WPInv_Buy_Item_Widget',
470
+                    'WPInv_Messages_Widget',
471
+                    'WPInv_GetPaid_Widget',
472
+                    'WPInv_Invoice_Widget',
473
+                )
474
+            );
475
+
476
+            // For each widget...
477
+            foreach ( $widgets as $widget ) {
478
+
479
+                // Abort early if it is excluded for this page.
480
+                if ( in_array( $widget, $exclude ) ) {
481
+                    continue;
482
+                }
483
+
484
+                // SD V1 used to extend the widget class. V2 does not, so we cannot call register widget on it.
485
+                if ( is_subclass_of( $widget, 'WP_Widget' ) ) {
486
+                    register_widget( $widget );
487
+                } else {
488
+                    new $widget();
489
+                }
490 490
 }
491 491
 }
492 492
 
493
-	}
493
+    }
494
+
495
+    /**
496
+     * Upgrades the database.
497
+     *
498
+     * @since 2.0.2
499
+     */
500
+    public function maybe_upgrade_database() {
501
+
502
+        $wpi_version = get_option( 'wpinv_version', 0 );
503
+
504
+        if ( $wpi_version == WPINV_VERSION ) {
505
+            return;
506
+        }
507
+
508
+        $installer = new GetPaid_Installer();
509
+
510
+        if ( empty( $wpi_version ) ) {
511
+            return $installer->upgrade_db( 0 );
512
+        }
513
+
514
+        $upgrades  = array(
515
+            '0.0.5'  => '004',
516
+            '1.0.3'  => '102',
517
+            '2.0.0'  => '118',
518
+            '2.0.8'  => '207',
519
+            '2.6.16' => '2615',
520
+        );
521
+
522
+        foreach ( $upgrades as $key => $method ) {
523
+
524
+            if ( version_compare( $wpi_version, $key, '<' ) ) {
525
+                return $installer->upgrade_db( $method );
526
+            }
527
+        }
528
+
529
+    }
530
+
531
+    /**
532
+     * Flushes the permalinks if needed.
533
+     *
534
+     * @since 2.0.8
535
+     */
536
+    public function maybe_flush_permalinks() {
537
+
538
+        $flush = get_option( 'wpinv_flush_permalinks', 0 );
539
+
540
+        if ( ! empty( $flush ) ) {
541
+            flush_rewrite_rules();
542
+            delete_option( 'wpinv_flush_permalinks' );
543
+        }
544
+
545
+    }
546
+
547
+    /**
548
+     * Remove our pages from yoast sitemaps.
549
+     *
550
+     * @since 1.0.19
551
+     * @param int[] $excluded_posts_ids
552
+     */
553
+    public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ) {
554
+
555
+        // Ensure that we have an array.
556
+        if ( ! is_array( $excluded_posts_ids ) ) {
557
+            $excluded_posts_ids = array();
558
+        }
559
+
560
+        // Prepare our pages.
561
+        $our_pages = array();
562
+
563
+        // Checkout page.
564
+        $our_pages[] = wpinv_get_option( 'checkout_page', false );
565
+
566
+        // Success page.
567
+        $our_pages[] = wpinv_get_option( 'success_page', false );
568
+
569
+        // Failure page.
570
+        $our_pages[] = wpinv_get_option( 'failure_page', false );
571
+
572
+        // History page.
573
+        $our_pages[] = wpinv_get_option( 'invoice_history_page', false );
494 574
 
495
-	/**
496
-	 * Upgrades the database.
497
-	 *
498
-	 * @since 2.0.2
499
-	 */
500
-	public function maybe_upgrade_database() {
575
+        // Subscriptions page.
576
+        $our_pages[] = wpinv_get_option( 'invoice_subscription_page', false );
501 577
 
502
-		$wpi_version = get_option( 'wpinv_version', 0 );
578
+        $our_pages   = array_map( 'intval', array_filter( $our_pages ) );
503 579
 
504
-		if ( $wpi_version == WPINV_VERSION ) {
505
-			return;
506
-		}
580
+        $excluded_posts_ids = $excluded_posts_ids + $our_pages;
581
+        return array_unique( $excluded_posts_ids );
507 582
 
508
-		$installer = new GetPaid_Installer();
583
+    }
584
+
585
+    /**
586
+     * Remove our pages from yoast sitemaps.
587
+     *
588
+     * @since 1.0.19
589
+     * @param string[] $post_types
590
+     */
591
+    public function exclude_invoicing_post_types( $post_types ) {
592
+
593
+        // Ensure that we have an array.
594
+        if ( ! is_array( $post_types ) ) {
595
+            $post_types = array();
596
+        }
597
+
598
+        // Remove our post types.
599
+        return array_diff( $post_types, array_keys( getpaid_get_invoice_post_types() ) );
600
+    }
601
+
602
+    /**
603
+     * Displays additional footer code.
604
+     *
605
+     * @since 2.0.0
606
+     */
607
+    public function wp_footer() {
608
+        wpinv_get_template( 'frontend-footer.php' );
609
+    }
509 610
 
510
-		if ( empty( $wpi_version ) ) {
511
-			return $installer->upgrade_db( 0 );
512
-		}
611
+    /**
612
+     * Displays additional header code.
613
+     *
614
+     * @since 2.0.0
615
+     */
616
+    public function wp_head() {
617
+        wpinv_get_template( 'frontend-head.php' );
618
+    }
513 619
 
514
-		$upgrades  = array(
515
-			'0.0.5'  => '004',
516
-			'1.0.3'  => '102',
517
-			'2.0.0'  => '118',
518
-			'2.0.8'  => '207',
519
-			'2.6.16' => '2615',
520
-		);
521
-
522
-		foreach ( $upgrades as $key => $method ) {
523
-
524
-			if ( version_compare( $wpi_version, $key, '<' ) ) {
525
-				return $installer->upgrade_db( $method );
526
-			}
527
-		}
528
-
529
-	}
530
-
531
-	/**
532
-	 * Flushes the permalinks if needed.
533
-	 *
534
-	 * @since 2.0.8
535
-	 */
536
-	public function maybe_flush_permalinks() {
537
-
538
-		$flush = get_option( 'wpinv_flush_permalinks', 0 );
539
-
540
-		if ( ! empty( $flush ) ) {
541
-			flush_rewrite_rules();
542
-			delete_option( 'wpinv_flush_permalinks' );
543
-		}
544
-
545
-	}
546
-
547
-	/**
548
-	 * Remove our pages from yoast sitemaps.
549
-	 *
550
-	 * @since 1.0.19
551
-	 * @param int[] $excluded_posts_ids
552
-	 */
553
-	public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ) {
554
-
555
-		// Ensure that we have an array.
556
-		if ( ! is_array( $excluded_posts_ids ) ) {
557
-			$excluded_posts_ids = array();
558
-		}
559
-
560
-		// Prepare our pages.
561
-		$our_pages = array();
562
-
563
-		// Checkout page.
564
-		$our_pages[] = wpinv_get_option( 'checkout_page', false );
565
-
566
-		// Success page.
567
-		$our_pages[] = wpinv_get_option( 'success_page', false );
568
-
569
-		// Failure page.
570
-		$our_pages[] = wpinv_get_option( 'failure_page', false );
571
-
572
-		// History page.
573
-		$our_pages[] = wpinv_get_option( 'invoice_history_page', false );
574
-
575
-		// Subscriptions page.
576
-		$our_pages[] = wpinv_get_option( 'invoice_subscription_page', false );
577
-
578
-		$our_pages   = array_map( 'intval', array_filter( $our_pages ) );
579
-
580
-		$excluded_posts_ids = $excluded_posts_ids + $our_pages;
581
-		return array_unique( $excluded_posts_ids );
582
-
583
-	}
584
-
585
-	/**
586
-	 * Remove our pages from yoast sitemaps.
587
-	 *
588
-	 * @since 1.0.19
589
-	 * @param string[] $post_types
590
-	 */
591
-	public function exclude_invoicing_post_types( $post_types ) {
592
-
593
-		// Ensure that we have an array.
594
-		if ( ! is_array( $post_types ) ) {
595
-			$post_types = array();
596
-		}
597
-
598
-		// Remove our post types.
599
-		return array_diff( $post_types, array_keys( getpaid_get_invoice_post_types() ) );
600
-	}
601
-
602
-	/**
603
-	 * Displays additional footer code.
604
-	 *
605
-	 * @since 2.0.0
606
-	 */
607
-	public function wp_footer() {
608
-		wpinv_get_template( 'frontend-footer.php' );
609
-	}
610
-
611
-	/**
612
-	 * Displays additional header code.
613
-	 *
614
-	 * @since 2.0.0
615
-	 */
616
-	public function wp_head() {
617
-		wpinv_get_template( 'frontend-head.php' );
618
-	}
619
-
620
-	/**
621
-	 * Custom query vars.
622
-	 *
623
-	 */
624
-	public function custom_query_vars( $vars ) {
620
+    /**
621
+     * Custom query vars.
622
+     *
623
+     */
624
+    public function custom_query_vars( $vars ) {
625 625
         $vars[] = 'getpaid-ipn';
626 626
         return $vars;
627
-	}
627
+    }
628 628
 
629
-	/**
630
-	 * Add rewrite tags and rules.
631
-	 *
632
-	 */
633
-	public function add_rewrite_rule() {
629
+    /**
630
+     * Add rewrite tags and rules.
631
+     *
632
+     */
633
+    public function add_rewrite_rule() {
634 634
         $tag = 'getpaid-ipn';
635 635
         add_rewrite_tag( "%$tag%", '([^&]+)' );
636 636
         add_rewrite_rule( "^$tag/([^/]*)/?", "index.php?$tag=\$matches[1]", 'top' );
637
-	}
637
+    }
638 638
 
639
-	/**
640
-	 * Processes non-query string ipns.
641
-	 *
642
-	 */
643
-	public function maybe_process_new_ipn( $query ) {
639
+    /**
640
+     * Processes non-query string ipns.
641
+     *
642
+     */
643
+    public function maybe_process_new_ipn( $query ) {
644 644
 
645 645
         if ( is_admin() || ! $query->is_main_query() ) {
646 646
             return;
647 647
         }
648 648
 
649
-		$gateway = get_query_var( 'getpaid-ipn' );
649
+        $gateway = get_query_var( 'getpaid-ipn' );
650 650
 
651 651
         if ( ! empty( $gateway ) ) {
652 652
 
653
-			$gateway = sanitize_text_field( $gateway );
654
-			nocache_headers();
655
-			do_action( 'wpinv_verify_payment_ipn', $gateway );
656
-			do_action( "wpinv_verify_{$gateway}_ipn" );
657
-			exit;
653
+            $gateway = sanitize_text_field( $gateway );
654
+            nocache_headers();
655
+            do_action( 'wpinv_verify_payment_ipn', $gateway );
656
+            do_action( "wpinv_verify_{$gateway}_ipn" );
657
+            exit;
658 658
 
659 659
         }
660 660
 
661
-	}
661
+    }
662 662
 
663 663
 }
Please login to merge, or discard this patch.
includes/wpinv-payment-functions.php 1 patch
Indentation   +272 added lines, -272 removed lines patch added patch discarded remove patch
@@ -1,196 +1,196 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 function wpinv_is_subscription_payment( $invoice = '' ) {
3
-	if ( empty( $invoice ) ) {
4
-		return false;
5
-	}
3
+    if ( empty( $invoice ) ) {
4
+        return false;
5
+    }
6 6
 
7
-	if ( ! is_object( $invoice ) && is_scalar( $invoice ) ) {
8
-		$invoice = wpinv_get_invoice( $invoice );
9
-	}
7
+    if ( ! is_object( $invoice ) && is_scalar( $invoice ) ) {
8
+        $invoice = wpinv_get_invoice( $invoice );
9
+    }
10 10
 
11
-	if ( empty( $invoice ) ) {
12
-		return false;
13
-	}
11
+    if ( empty( $invoice ) ) {
12
+        return false;
13
+    }
14 14
 
15
-	if ( $invoice->is_renewal() ) {
16
-		return true;
17
-	}
15
+    if ( $invoice->is_renewal() ) {
16
+        return true;
17
+    }
18 18
 
19
-	return false;
19
+    return false;
20 20
 }
21 21
 
22 22
 function wpinv_payment_link_transaction_id( $invoice = '' ) {
23
-	if ( empty( $invoice ) ) {
24
-		return false;
25
-	}
23
+    if ( empty( $invoice ) ) {
24
+        return false;
25
+    }
26 26
 
27
-	if ( ! is_object( $invoice ) && is_scalar( $invoice ) ) {
28
-		$invoice = wpinv_get_invoice( $invoice );
29
-	}
27
+    if ( ! is_object( $invoice ) && is_scalar( $invoice ) ) {
28
+        $invoice = wpinv_get_invoice( $invoice );
29
+    }
30 30
 
31
-	if ( empty( $invoice ) ) {
32
-		return false;
33
-	}
31
+    if ( empty( $invoice ) ) {
32
+        return false;
33
+    }
34 34
 
35
-	return apply_filters( 'wpinv_payment_details_transaction_id-' . $invoice->gateway, $invoice->get_transaction_id(), $invoice->ID, $invoice );
35
+    return apply_filters( 'wpinv_payment_details_transaction_id-' . $invoice->gateway, $invoice->get_transaction_id(), $invoice->ID, $invoice );
36 36
 }
37 37
 
38 38
 function wpinv_subscription_initial_payment_desc( $amount, $period, $interval, $trial_period = '', $trial_interval = 0 ) {
39
-	$interval   = (int)$interval > 0 ? (int)$interval : 1;
40
-
41
-	if ( $trial_interval > 0 && ! empty( $trial_period ) ) {
42
-		$amount = __( 'Free', 'invoicing' );
43
-		$interval = $trial_interval;
44
-		$period = $trial_period;
45
-	}
46
-
47
-	$description = '';
48
-	switch ( $period ) {
49
-		case 'D':
50
-		case 'day':
51
-			$description = wp_sprintf( _n( '%s for the first day.', '%1$s for the first %2$d days.', $interval, 'invoicing' ), $amount, $interval );
52
-			break;
53
-		case 'W':
54
-		case 'week':
55
-			$description = wp_sprintf( _n( '%s for the first week.', '%1$s for the first %2$d weeks.', $interval, 'invoicing' ), $amount, $interval );
56
-			break;
57
-		case 'M':
58
-		case 'month':
59
-			$description = wp_sprintf( _n( '%s for the first month.', '%1$s for the first %2$d months.', $interval, 'invoicing' ), $amount, $interval );
60
-			break;
61
-		case 'Y':
62
-		case 'year':
63
-			$description = wp_sprintf( _n( '%s for the first year.', '%1$s for the first %2$d years.', $interval, 'invoicing' ), $amount, $interval );
64
-			break;
65
-	}
66
-
67
-	return apply_filters( 'wpinv_subscription_initial_payment_desc', $description, $amount, $period, $interval, $trial_period, $trial_interval );
39
+    $interval   = (int)$interval > 0 ? (int)$interval : 1;
40
+
41
+    if ( $trial_interval > 0 && ! empty( $trial_period ) ) {
42
+        $amount = __( 'Free', 'invoicing' );
43
+        $interval = $trial_interval;
44
+        $period = $trial_period;
45
+    }
46
+
47
+    $description = '';
48
+    switch ( $period ) {
49
+        case 'D':
50
+        case 'day':
51
+            $description = wp_sprintf( _n( '%s for the first day.', '%1$s for the first %2$d days.', $interval, 'invoicing' ), $amount, $interval );
52
+            break;
53
+        case 'W':
54
+        case 'week':
55
+            $description = wp_sprintf( _n( '%s for the first week.', '%1$s for the first %2$d weeks.', $interval, 'invoicing' ), $amount, $interval );
56
+            break;
57
+        case 'M':
58
+        case 'month':
59
+            $description = wp_sprintf( _n( '%s for the first month.', '%1$s for the first %2$d months.', $interval, 'invoicing' ), $amount, $interval );
60
+            break;
61
+        case 'Y':
62
+        case 'year':
63
+            $description = wp_sprintf( _n( '%s for the first year.', '%1$s for the first %2$d years.', $interval, 'invoicing' ), $amount, $interval );
64
+            break;
65
+    }
66
+
67
+    return apply_filters( 'wpinv_subscription_initial_payment_desc', $description, $amount, $period, $interval, $trial_period, $trial_interval );
68 68
 }
69 69
 
70 70
 function wpinv_subscription_recurring_payment_desc( $amount, $period, $interval, $bill_times = 0, $trial_period = '', $trial_interval = 0 ) {
71
-	$interval   = (int)$interval > 0 ? (int)$interval : 1;
72
-	$bill_times = (int)$bill_times > 0 ? (int)$bill_times : 0;
73
-
74
-	$description = '';
75
-	switch ( $period ) {
76
-		case 'D':
77
-		case 'day':
78
-			if ( (int)$bill_times > 0 ) {
79
-				if ( $interval > 1 ) {
80
-					if ( $bill_times > 1 ) {
81
-						$description = wp_sprintf( __( '%1$s for each %2$d days, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times );
82
-					} else {
83
-						$description = wp_sprintf( __( '%1$s for %2$d days.', 'invoicing' ), $amount, $interval );
84
-					}
85
-				} else {
86
-					$description = wp_sprintf( _n( '%s for one day.', '%1$s for each day, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times );
87
-				}
88
-			} else {
89
-				$description = wp_sprintf( _n( '%s for each day.', '%1$s for each %2$d days.', $interval, 'invoicing' ), $amount, $interval );
90
-			}
91
-			break;
92
-		case 'W':
93
-		case 'week':
94
-			if ( (int)$bill_times > 0 ) {
95
-				if ( $interval > 1 ) {
96
-					if ( $bill_times > 1 ) {
97
-						$description = wp_sprintf( __( '%1$s for each %2$d weeks, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times );
98
-					} else {
99
-						$description = wp_sprintf( __( '%1$s for %2$d weeks.', 'invoicing' ), $amount, $interval );
100
-					}
101
-				} else {
102
-					$description = wp_sprintf( _n( '%s for one week.', '%1$s for each week, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times );
103
-				}
104
-			} else {
105
-				$description = wp_sprintf( _n( '%s for each week.', '%1$s for each %2$d weeks.', $interval, 'invoicing' ), $amount, $interval );
106
-			}
107
-			break;
108
-		case 'M':
109
-		case 'month':
110
-			if ( (int)$bill_times > 0 ) {
111
-				if ( $interval > 1 ) {
112
-					if ( $bill_times > 1 ) {
113
-						$description = wp_sprintf( __( '%1$s for each %2$d months, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times );
114
-					} else {
115
-						$description = wp_sprintf( __( '%1$s for %2$d months.', 'invoicing' ), $amount, $interval );
116
-					}
117
-				} else {
118
-					$description = wp_sprintf( _n( '%s for one month.', '%1$s for each month, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times );
119
-				}
120
-			} else {
121
-				$description = wp_sprintf( _n( '%s for each month.', '%1$s for each %2$d months.', $interval, 'invoicing' ), $amount, $interval );
122
-			}
123
-			break;
124
-		case 'Y':
125
-		case 'year':
126
-			if ( (int)$bill_times > 0 ) {
127
-				if ( $interval > 1 ) {
128
-					if ( $bill_times > 1 ) {
129
-						$description = wp_sprintf( __( '%1$s for each %2$d years, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times );
130
-					} else {
131
-						$description = wp_sprintf( __( '%1$s for %2$d years.', 'invoicing' ), $amount, $interval );
132
-					}
133
-				} else {
134
-					$description = wp_sprintf( _n( '%s for one year.', '%1$s for each year, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times );
135
-				}
136
-			} else {
137
-				$description = wp_sprintf( _n( '%s for each year.', '%1$s for each %2$d years.', $interval, 'invoicing' ), $amount, $interval );
138
-			}
139
-			break;
140
-	}
141
-
142
-	return apply_filters( 'wpinv_subscription_recurring_payment_desc', $description, $amount, $period, $interval, $bill_times, $trial_period, $trial_interval );
71
+    $interval   = (int)$interval > 0 ? (int)$interval : 1;
72
+    $bill_times = (int)$bill_times > 0 ? (int)$bill_times : 0;
73
+
74
+    $description = '';
75
+    switch ( $period ) {
76
+        case 'D':
77
+        case 'day':
78
+            if ( (int)$bill_times > 0 ) {
79
+                if ( $interval > 1 ) {
80
+                    if ( $bill_times > 1 ) {
81
+                        $description = wp_sprintf( __( '%1$s for each %2$d days, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times );
82
+                    } else {
83
+                        $description = wp_sprintf( __( '%1$s for %2$d days.', 'invoicing' ), $amount, $interval );
84
+                    }
85
+                } else {
86
+                    $description = wp_sprintf( _n( '%s for one day.', '%1$s for each day, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times );
87
+                }
88
+            } else {
89
+                $description = wp_sprintf( _n( '%s for each day.', '%1$s for each %2$d days.', $interval, 'invoicing' ), $amount, $interval );
90
+            }
91
+            break;
92
+        case 'W':
93
+        case 'week':
94
+            if ( (int)$bill_times > 0 ) {
95
+                if ( $interval > 1 ) {
96
+                    if ( $bill_times > 1 ) {
97
+                        $description = wp_sprintf( __( '%1$s for each %2$d weeks, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times );
98
+                    } else {
99
+                        $description = wp_sprintf( __( '%1$s for %2$d weeks.', 'invoicing' ), $amount, $interval );
100
+                    }
101
+                } else {
102
+                    $description = wp_sprintf( _n( '%s for one week.', '%1$s for each week, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times );
103
+                }
104
+            } else {
105
+                $description = wp_sprintf( _n( '%s for each week.', '%1$s for each %2$d weeks.', $interval, 'invoicing' ), $amount, $interval );
106
+            }
107
+            break;
108
+        case 'M':
109
+        case 'month':
110
+            if ( (int)$bill_times > 0 ) {
111
+                if ( $interval > 1 ) {
112
+                    if ( $bill_times > 1 ) {
113
+                        $description = wp_sprintf( __( '%1$s for each %2$d months, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times );
114
+                    } else {
115
+                        $description = wp_sprintf( __( '%1$s for %2$d months.', 'invoicing' ), $amount, $interval );
116
+                    }
117
+                } else {
118
+                    $description = wp_sprintf( _n( '%s for one month.', '%1$s for each month, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times );
119
+                }
120
+            } else {
121
+                $description = wp_sprintf( _n( '%s for each month.', '%1$s for each %2$d months.', $interval, 'invoicing' ), $amount, $interval );
122
+            }
123
+            break;
124
+        case 'Y':
125
+        case 'year':
126
+            if ( (int)$bill_times > 0 ) {
127
+                if ( $interval > 1 ) {
128
+                    if ( $bill_times > 1 ) {
129
+                        $description = wp_sprintf( __( '%1$s for each %2$d years, for %3$d installments.', 'invoicing' ), $amount, $interval, $bill_times );
130
+                    } else {
131
+                        $description = wp_sprintf( __( '%1$s for %2$d years.', 'invoicing' ), $amount, $interval );
132
+                    }
133
+                } else {
134
+                    $description = wp_sprintf( _n( '%s for one year.', '%1$s for each year, for %2$d installments.', $bill_times, 'invoicing' ), $amount, $bill_times );
135
+                }
136
+            } else {
137
+                $description = wp_sprintf( _n( '%s for each year.', '%1$s for each %2$d years.', $interval, 'invoicing' ), $amount, $interval );
138
+            }
139
+            break;
140
+    }
141
+
142
+    return apply_filters( 'wpinv_subscription_recurring_payment_desc', $description, $amount, $period, $interval, $bill_times, $trial_period, $trial_interval );
143 143
 }
144 144
 
145 145
 function wpinv_subscription_payment_desc( $invoice ) {
146
-	if ( empty( $invoice ) ) {
147
-		return null;
148
-	}
149
-
150
-	$description = '';
151
-	if ( $invoice->is_parent() && $item = $invoice->get_recurring( true ) ) {
152
-		if ( $item->has_free_trial() ) {
153
-			$trial_period = $item->get_trial_period();
154
-			$trial_interval = $item->get_trial_interval();
155
-		} else {
156
-			$trial_period = '';
157
-			$trial_interval = 0;
158
-		}
159
-
160
-		$description = wpinv_get_billing_cycle( $invoice->get_total(), $invoice->get_recurring_details( 'total' ), $item->get_recurring_period(), $item->get_recurring_interval(), $item->get_recurring_limit(), $trial_period, $trial_interval, $invoice->get_currency() );
161
-	}
162
-
163
-	return apply_filters( 'wpinv_subscription_payment_desc', $description, $invoice );
146
+    if ( empty( $invoice ) ) {
147
+        return null;
148
+    }
149
+
150
+    $description = '';
151
+    if ( $invoice->is_parent() && $item = $invoice->get_recurring( true ) ) {
152
+        if ( $item->has_free_trial() ) {
153
+            $trial_period = $item->get_trial_period();
154
+            $trial_interval = $item->get_trial_interval();
155
+        } else {
156
+            $trial_period = '';
157
+            $trial_interval = 0;
158
+        }
159
+
160
+        $description = wpinv_get_billing_cycle( $invoice->get_total(), $invoice->get_recurring_details( 'total' ), $item->get_recurring_period(), $item->get_recurring_interval(), $item->get_recurring_limit(), $trial_period, $trial_interval, $invoice->get_currency() );
161
+    }
162
+
163
+    return apply_filters( 'wpinv_subscription_payment_desc', $description, $invoice );
164 164
 }
165 165
 
166 166
 function wpinv_get_billing_cycle( $initial, $recurring, $period, $interval, $bill_times, $trial_period = '', $trial_interval = 0, $currency = '' ) {
167
-	$initial_total      = wpinv_round_amount( $initial );
168
-	$recurring_total    = wpinv_round_amount( $recurring );
167
+    $initial_total      = wpinv_round_amount( $initial );
168
+    $recurring_total    = wpinv_round_amount( $recurring );
169 169
 
170
-	if ( $trial_interval > 0 && ! empty( $trial_period ) ) {
171
-		// Free trial
172
-	} else {
173
-		if ( $bill_times == 1 ) {
174
-			$recurring_total = $initial_total;
175
-		} elseif ( $bill_times > 1 && $initial_total != $recurring_total ) {
176
-			$bill_times--;
177
-		}
178
-	}
170
+    if ( $trial_interval > 0 && ! empty( $trial_period ) ) {
171
+        // Free trial
172
+    } else {
173
+        if ( $bill_times == 1 ) {
174
+            $recurring_total = $initial_total;
175
+        } elseif ( $bill_times > 1 && $initial_total != $recurring_total ) {
176
+            $bill_times--;
177
+        }
178
+    }
179 179
 
180
-	$initial_amount     = wpinv_price( $initial_total, $currency );
181
-	$recurring_amount   = wpinv_price( $recurring_total, $currency );
180
+    $initial_amount     = wpinv_price( $initial_total, $currency );
181
+    $recurring_amount   = wpinv_price( $recurring_total, $currency );
182 182
 
183
-	$recurring          = wpinv_subscription_recurring_payment_desc( $recurring_amount, $period, $interval, $bill_times, $trial_period, $trial_interval );
183
+    $recurring          = wpinv_subscription_recurring_payment_desc( $recurring_amount, $period, $interval, $bill_times, $trial_period, $trial_interval );
184 184
 
185
-	if ( $initial_total != $recurring_total ) {
186
-		$initial        = wpinv_subscription_initial_payment_desc( $initial_amount, $period, $interval, $trial_period, $trial_interval );
185
+    if ( $initial_total != $recurring_total ) {
186
+        $initial        = wpinv_subscription_initial_payment_desc( $initial_amount, $period, $interval, $trial_period, $trial_interval );
187 187
 
188
-		$description    = wp_sprintf( __( '%1$s Then %2$s', 'invoicing' ), $initial, $recurring );
189
-	} else {
190
-		$description    = $recurring;
191
-	}
188
+        $description    = wp_sprintf( __( '%1$s Then %2$s', 'invoicing' ), $initial, $recurring );
189
+    } else {
190
+        $description    = $recurring;
191
+    }
192 192
 
193
-	return apply_filters( 'wpinv_get_billing_cycle', $description, $initial, $recurring, $period, $interval, $bill_times, $trial_period, $trial_interval, $currency );
193
+    return apply_filters( 'wpinv_get_billing_cycle', $description, $initial, $recurring, $period, $interval, $bill_times, $trial_period, $trial_interval, $currency );
194 194
 }
195 195
 
196 196
 /**
@@ -202,25 +202,25 @@  discard block
 block discarded – undo
202 202
  */
203 203
 function getpaid_get_card_name( $card_number ) {
204 204
 
205
-	// Known regexes.
206
-	$regexes = array(
207
-		'/^4/'                     => __( 'Visa', 'invoicing' ),
208
-		'/^5[1-5]/'                => __( 'Mastercard', 'invoicing' ),
209
-		'/^3[47]/'                 => __( 'Amex', 'invoicing' ),
210
-		'/^3(?:0[0-5]|[68])/'      => __( 'Diners Club', 'invoicing' ),
211
-		'/^6(?:011|5)/'            => __( 'Discover', 'invoicing' ),
212
-		'/^(?:2131|1800|35\d{3})/' => __( 'JCB', 'invoicing' ),
213
-	);
214
-
215
-	// Confirm if one matches.
216
-	foreach ( $regexes as $regex => $card ) {
217
-		if ( preg_match( $regex, $card_number ) >= 1 ) {
218
-			return $card;
219
-		}
220
-	}
221
-
222
-	// None matched.
223
-	return __( 'Card', 'invoicing' );
205
+    // Known regexes.
206
+    $regexes = array(
207
+        '/^4/'                     => __( 'Visa', 'invoicing' ),
208
+        '/^5[1-5]/'                => __( 'Mastercard', 'invoicing' ),
209
+        '/^3[47]/'                 => __( 'Amex', 'invoicing' ),
210
+        '/^3(?:0[0-5]|[68])/'      => __( 'Diners Club', 'invoicing' ),
211
+        '/^6(?:011|5)/'            => __( 'Discover', 'invoicing' ),
212
+        '/^(?:2131|1800|35\d{3})/' => __( 'JCB', 'invoicing' ),
213
+    );
214
+
215
+    // Confirm if one matches.
216
+    foreach ( $regexes as $regex => $card ) {
217
+        if ( preg_match( $regex, $card_number ) >= 1 ) {
218
+            return $card;
219
+        }
220
+    }
221
+
222
+    // None matched.
223
+    return __( 'Card', 'invoicing' );
224 224
 
225 225
 }
226 226
 
@@ -230,24 +230,24 @@  discard block
 block discarded – undo
230 230
  * @param WPInv_Invoice|int|null $invoice
231 231
  */
232 232
 function wpinv_send_back_to_checkout( $invoice = null ) {
233
-	$response = array( 'success' => false );
234
-	$invoice  = wpinv_get_invoice( $invoice );
235
-
236
-	// Was an invoice created?
237
-	if ( ! empty( $invoice ) ) {
238
-		$invoice             = is_scalar( $invoice ) ? new WPInv_Invoice( $invoice ) : $invoice;
239
-		$response['invoice'] = $invoice->get_id();
240
-		do_action( 'getpaid_checkout_invoice_exception', $invoice );
241
-	}
242
-
243
-	// Do we have any errors?
244
-	if ( wpinv_get_errors() ) {
245
-		$response['data'] = getpaid_get_errors_html( true, false );
246
-	} else {
247
-		$response['data'] = __( 'An error occured while processing your payment. Please try again.', 'invoicing' );
248
-	}
249
-
250
-	wp_send_json( $response );
233
+    $response = array( 'success' => false );
234
+    $invoice  = wpinv_get_invoice( $invoice );
235
+
236
+    // Was an invoice created?
237
+    if ( ! empty( $invoice ) ) {
238
+        $invoice             = is_scalar( $invoice ) ? new WPInv_Invoice( $invoice ) : $invoice;
239
+        $response['invoice'] = $invoice->get_id();
240
+        do_action( 'getpaid_checkout_invoice_exception', $invoice );
241
+    }
242
+
243
+    // Do we have any errors?
244
+    if ( wpinv_get_errors() ) {
245
+        $response['data'] = getpaid_get_errors_html( true, false );
246
+    } else {
247
+        $response['data'] = __( 'An error occured while processing your payment. Please try again.', 'invoicing' );
248
+    }
249
+
250
+    wp_send_json( $response );
251 251
 }
252 252
 
253 253
 /**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
  * @return string
257 257
  */
258 258
 function getpaid_get_recaptcha_site_key() {
259
-	return apply_filters( 'getpaid_recaptcha_site_key', wpinv_get_option( 'recaptcha_site_key', '' ) );
259
+    return apply_filters( 'getpaid_recaptcha_site_key', wpinv_get_option( 'recaptcha_site_key', '' ) );
260 260
 }
261 261
 
262 262
 /**
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
  * @return string
266 266
  */
267 267
 function getpaid_get_recaptcha_secret_key() {
268
-	return apply_filters( 'getpaid_recaptcha_secret_key', wpinv_get_option( 'recaptcha_secret_key', '' ) );
268
+    return apply_filters( 'getpaid_recaptcha_secret_key', wpinv_get_option( 'recaptcha_secret_key', '' ) );
269 269
 }
270 270
 
271 271
 /**
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
  * @return bool
275 275
  */
276 276
 function getpaid_is_recaptcha_enabled() {
277
-	return wpinv_get_option( 'enable_recaptcha', false ) && getpaid_get_recaptcha_site_key() && getpaid_get_recaptcha_secret_key();
277
+    return wpinv_get_option( 'enable_recaptcha', false ) && getpaid_get_recaptcha_site_key() && getpaid_get_recaptcha_secret_key();
278 278
 }
279 279
 
280 280
 /**
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
  * @return string
284 284
  */
285 285
 function getpaid_get_recaptcha_version() {
286
-	return apply_filters( 'getpaid_recaptcha_version', wpinv_get_option( 'recaptcha_version', 'v2' ) );
286
+    return apply_filters( 'getpaid_recaptcha_version', wpinv_get_option( 'recaptcha_version', 'v2' ) );
287 287
 }
288 288
 
289 289
 /**
@@ -292,42 +292,42 @@  discard block
 block discarded – undo
292 292
  * @return array
293 293
  */
294 294
 function getpaid_get_recaptcha_settings() {
295
-	$settings = array(
296
-		'enabled' => getpaid_is_recaptcha_enabled(),
297
-		'version' => getpaid_get_recaptcha_version(),
298
-	);
299
-
300
-	if ( ! getpaid_is_recaptcha_enabled() ) {
301
-		return $settings;
302
-	}
303
-
304
-	$settings['sitekey'] = getpaid_get_recaptcha_site_key();
305
-
306
-	// Version 2 render params.
307
-	if ( 'v2' === getpaid_get_recaptcha_version() ) {
308
-		$settings['render_params'] = array(
309
-			'sitekey'  => getpaid_get_recaptcha_site_key(),
310
-			'theme'    => 'light',
311
-			'size'     => 'normal',
312
-			'tabindex' => 0,
313
-		);
314
-	}
315
-
316
-	return apply_filters( 'getpaid_recaptcha_settings', $settings );
295
+    $settings = array(
296
+        'enabled' => getpaid_is_recaptcha_enabled(),
297
+        'version' => getpaid_get_recaptcha_version(),
298
+    );
299
+
300
+    if ( ! getpaid_is_recaptcha_enabled() ) {
301
+        return $settings;
302
+    }
303
+
304
+    $settings['sitekey'] = getpaid_get_recaptcha_site_key();
305
+
306
+    // Version 2 render params.
307
+    if ( 'v2' === getpaid_get_recaptcha_version() ) {
308
+        $settings['render_params'] = array(
309
+            'sitekey'  => getpaid_get_recaptcha_site_key(),
310
+            'theme'    => 'light',
311
+            'size'     => 'normal',
312
+            'tabindex' => 0,
313
+        );
314
+    }
315
+
316
+    return apply_filters( 'getpaid_recaptcha_settings', $settings );
317 317
 }
318 318
 
319 319
 /**
320 320
  * Displays reCAPTCHA before payment button.
321 321
  */
322 322
 function getpaid_display_recaptcha_before_payment_button() {
323
-	if ( ! getpaid_is_recaptcha_enabled() || 'v2' !== getpaid_get_recaptcha_version() ) {
324
-		return;
325
-	}
326
-
327
-	printf(
328
-		'<div class="getpaid-recaptcha-wrapper"><div class="g-recaptcha mw-100 overflow-hidden my-2" id="getpaid-recaptcha-%s"></div></div>',
329
-		esc_attr( wp_unique_id() )
330
-	);
323
+    if ( ! getpaid_is_recaptcha_enabled() || 'v2' !== getpaid_get_recaptcha_version() ) {
324
+        return;
325
+    }
326
+
327
+    printf(
328
+        '<div class="getpaid-recaptcha-wrapper"><div class="g-recaptcha mw-100 overflow-hidden my-2" id="getpaid-recaptcha-%s"></div></div>',
329
+        esc_attr( wp_unique_id() )
330
+    );
331 331
 }
332 332
 add_action( 'getpaid_before_payment_form_pay_button', 'getpaid_display_recaptcha_before_payment_button' );
333 333
 
@@ -338,43 +338,43 @@  discard block
 block discarded – undo
338 338
  */
339 339
 function getpaid_validate_recaptcha_response( $submission ) {
340 340
 
341
-	// Check if reCAPTCHA is enabled.
342
-	if ( ! getpaid_is_recaptcha_enabled() ) {
343
-		return;
344
-	}
345
-
346
-	$token = $submission->get_field( 'g-recaptcha-response' );
347
-
348
-	// Abort if no token was provided.
349
-	if ( empty( $token ) ) {
350
-		wp_send_json_error( 'v2' === getpaid_get_recaptcha_version() ? __( 'Please confirm that you are not a robot.', 'invoicing' ) : __( "Unable to verify that you're not a robot. Please try again.", 'invoicing' ) );
351
-	}
352
-
353
-	$result = wp_remote_post(
354
-		'https://www.google.com/recaptcha/api/siteverify',
355
-		array(
356
-			'body' => array(
357
-				'secret'   => getpaid_get_recaptcha_secret_key(),
358
-				'response' => $token,
359
-			),
360
-		)
361
-	);
362
-
363
-	// Site not reachable, give benefit of doubt.
364
-	if ( is_wp_error( $result ) ) {
365
-		return;
366
-	}
367
-
368
-	$result = json_decode( wp_remote_retrieve_body( $result ), true );
369
-
370
-	if ( empty( $result['success'] ) && ! in_array( 'missing-input-secret', $result['error-codes'], true ) && ! in_array( 'invalid-input-secret', $result['error-codes'], true ) ) {
371
-		wp_send_json_error( __( "Unable to verify that you're not a robot. Please try again.", 'invoicing' ) );
372
-	}
373
-
374
-	// For v3, check the score.
375
-	$minimum_score = apply_filters( 'getpaid_recaptcha_minimum_score', 0.4 );
376
-	if ( 'v3' === getpaid_get_recaptcha_version() && ( empty( $result['score'] ) || $result['score'] < $minimum_score ) ) {
377
-		wp_send_json_error( __( "Unable to verify that you're not a robot. Please try again.", 'invoicing' ) );
378
-	}
341
+    // Check if reCAPTCHA is enabled.
342
+    if ( ! getpaid_is_recaptcha_enabled() ) {
343
+        return;
344
+    }
345
+
346
+    $token = $submission->get_field( 'g-recaptcha-response' );
347
+
348
+    // Abort if no token was provided.
349
+    if ( empty( $token ) ) {
350
+        wp_send_json_error( 'v2' === getpaid_get_recaptcha_version() ? __( 'Please confirm that you are not a robot.', 'invoicing' ) : __( "Unable to verify that you're not a robot. Please try again.", 'invoicing' ) );
351
+    }
352
+
353
+    $result = wp_remote_post(
354
+        'https://www.google.com/recaptcha/api/siteverify',
355
+        array(
356
+            'body' => array(
357
+                'secret'   => getpaid_get_recaptcha_secret_key(),
358
+                'response' => $token,
359
+            ),
360
+        )
361
+    );
362
+
363
+    // Site not reachable, give benefit of doubt.
364
+    if ( is_wp_error( $result ) ) {
365
+        return;
366
+    }
367
+
368
+    $result = json_decode( wp_remote_retrieve_body( $result ), true );
369
+
370
+    if ( empty( $result['success'] ) && ! in_array( 'missing-input-secret', $result['error-codes'], true ) && ! in_array( 'invalid-input-secret', $result['error-codes'], true ) ) {
371
+        wp_send_json_error( __( "Unable to verify that you're not a robot. Please try again.", 'invoicing' ) );
372
+    }
373
+
374
+    // For v3, check the score.
375
+    $minimum_score = apply_filters( 'getpaid_recaptcha_minimum_score', 0.4 );
376
+    if ( 'v3' === getpaid_get_recaptcha_version() && ( empty( $result['score'] ) || $result['score'] < $minimum_score ) ) {
377
+        wp_send_json_error( __( "Unable to verify that you're not a robot. Please try again.", 'invoicing' ) );
378
+    }
379 379
 }
380 380
 add_action( 'getpaid_checkout_error_checks', 'getpaid_validate_recaptcha_response' );
Please login to merge, or discard this patch.
vendor/ayecode/wp-deactivation-survey/wp-deactivation-survey.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -1,103 +1,103 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! defined( 'ABSPATH' ) ) {
4
-	exit;
4
+    exit;
5 5
 }
6 6
 
7 7
 if ( ! class_exists( 'AyeCode_Deactivation_Survey' ) ) {
8 8
 
9
-	class AyeCode_Deactivation_Survey {
9
+    class AyeCode_Deactivation_Survey {
10 10
 
11
-		/**
12
-		 * AyeCode_Deactivation_Survey instance.
13
-		 *
14
-		 * @access private
15
-		 * @since  1.0.0
16
-		 * @var    AyeCode_Deactivation_Survey There can be only one!
17
-		 */
18
-		private static $instance = null;
11
+        /**
12
+         * AyeCode_Deactivation_Survey instance.
13
+         *
14
+         * @access private
15
+         * @since  1.0.0
16
+         * @var    AyeCode_Deactivation_Survey There can be only one!
17
+         */
18
+        private static $instance = null;
19 19
 
20
-		public static $plugins;
20
+        public static $plugins;
21 21
 
22
-		public $version = "1.0.6";
22
+        public $version = "1.0.6";
23 23
 
24
-		public static function instance( $plugin = array() ) {
25
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_Deactivation_Survey ) ) {
26
-				self::$instance = new AyeCode_Deactivation_Survey;
27
-				self::$plugins = array();
24
+        public static function instance( $plugin = array() ) {
25
+            if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_Deactivation_Survey ) ) {
26
+                self::$instance = new AyeCode_Deactivation_Survey;
27
+                self::$plugins = array();
28 28
 
29
-				add_action( 'admin_enqueue_scripts', array( self::$instance, 'scripts' ) );
29
+                add_action( 'admin_enqueue_scripts', array( self::$instance, 'scripts' ) );
30 30
 
31
-				do_action( 'ayecode_deactivation_survey_loaded' );
32
-			}
31
+                do_action( 'ayecode_deactivation_survey_loaded' );
32
+            }
33 33
 
34
-			if(!empty($plugin)){
35
-				self::$plugins[] = (object)$plugin;
36
-			}
34
+            if(!empty($plugin)){
35
+                self::$plugins[] = (object)$plugin;
36
+            }
37 37
 
38
-			return self::$instance;
39
-		}
38
+            return self::$instance;
39
+        }
40 40
 
41
-		public function scripts() {
42
-			global $pagenow;
41
+        public function scripts() {
42
+            global $pagenow;
43 43
 
44
-			// Bail if we are not on the plugins page
45
-			if ( $pagenow != "plugins.php" ) {
46
-				return;
47
-			}
44
+            // Bail if we are not on the plugins page
45
+            if ( $pagenow != "plugins.php" ) {
46
+                return;
47
+            }
48 48
 
49
-			// Enqueue scripts
50
-			add_thickbox();
51
-			wp_enqueue_script('ayecode-deactivation-survey', plugin_dir_url(__FILE__) . 'ayecode-ds.js');
49
+            // Enqueue scripts
50
+            add_thickbox();
51
+            wp_enqueue_script('ayecode-deactivation-survey', plugin_dir_url(__FILE__) . 'ayecode-ds.js');
52 52
 
53
-			/*
53
+            /*
54 54
 			 * Localized strings. Strings can be localised by plugins using this class.
55 55
 			 * We deliberately don't add textdomains here so that double textdomain warning is not given in theme review.
56 56
 			 */
57
-			wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_strings', array(
58
-				'quick_feedback'			=> 'Quick Feedback',
59
-				'foreword'					=> 'If you would be kind enough, please tell us why you\'re deactivating?',
60
-				'better_plugins_name'		=> 'Please tell us which plugin?',
61
-				'please_tell_us'			=> 'Please tell us the reason so we can improve the plugin',
62
-				'do_not_attach_email'		=> 'Do not send my e-mail address with this feedback',
63
-				'brief_description'			=> 'Please give us any feedback that could help us improve',
64
-				'cancel'					=> 'Cancel',
65
-				'skip_and_deactivate'		=> 'Skip &amp; Deactivate',
66
-				'submit_and_deactivate'		=> 'Submit &amp; Deactivate',
67
-				'please_wait'				=> 'Please wait',
68
-				'get_support'				=> 'Get Support',
69
-				'documentation'				=> 'Documentation',
70
-				'thank_you'					=> 'Thank you!',
71
-			));
72
-
73
-			// Plugins
74
-			$plugins = apply_filters('ayecode_deactivation_survey_plugins', self::$plugins);
75
-
76
-			// Reasons
77
-			$defaultReasons = array(
78
-				'suddenly-stopped-working'	=> 'The plugin suddenly stopped working',
79
-				'plugin-broke-site'			=> 'The plugin broke my site',
80
-				'plugin-setup-difficult'	=> 'Too difficult to setup',
81
-				'plugin-design-difficult'	=> 'Too difficult to get the design i want',
82
-				'no-longer-needed'			=> 'I don\'t need this plugin any more',
83
-				'found-better-plugin'		=> 'I found a better plugin',
84
-				'temporary-deactivation'	=> 'It\'s a temporary deactivation, I\'m troubleshooting',
85
-				'other'						=> 'Other',
86
-			);
87
-
88
-			foreach($plugins as $plugin)
89
-			{
90
-				$plugin->reasons = apply_filters('ayecode_deactivation_survey_reasons', $defaultReasons, $plugin);
91
-				$plugin->url = home_url();
92
-				$plugin->activated = 0;
93
-			}
94
-
95
-			// Send plugin data
96
-			wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_plugins', $plugins);
97
-
98
-		}
57
+            wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_strings', array(
58
+                'quick_feedback'			=> 'Quick Feedback',
59
+                'foreword'					=> 'If you would be kind enough, please tell us why you\'re deactivating?',
60
+                'better_plugins_name'		=> 'Please tell us which plugin?',
61
+                'please_tell_us'			=> 'Please tell us the reason so we can improve the plugin',
62
+                'do_not_attach_email'		=> 'Do not send my e-mail address with this feedback',
63
+                'brief_description'			=> 'Please give us any feedback that could help us improve',
64
+                'cancel'					=> 'Cancel',
65
+                'skip_and_deactivate'		=> 'Skip &amp; Deactivate',
66
+                'submit_and_deactivate'		=> 'Submit &amp; Deactivate',
67
+                'please_wait'				=> 'Please wait',
68
+                'get_support'				=> 'Get Support',
69
+                'documentation'				=> 'Documentation',
70
+                'thank_you'					=> 'Thank you!',
71
+            ));
72
+
73
+            // Plugins
74
+            $plugins = apply_filters('ayecode_deactivation_survey_plugins', self::$plugins);
75
+
76
+            // Reasons
77
+            $defaultReasons = array(
78
+                'suddenly-stopped-working'	=> 'The plugin suddenly stopped working',
79
+                'plugin-broke-site'			=> 'The plugin broke my site',
80
+                'plugin-setup-difficult'	=> 'Too difficult to setup',
81
+                'plugin-design-difficult'	=> 'Too difficult to get the design i want',
82
+                'no-longer-needed'			=> 'I don\'t need this plugin any more',
83
+                'found-better-plugin'		=> 'I found a better plugin',
84
+                'temporary-deactivation'	=> 'It\'s a temporary deactivation, I\'m troubleshooting',
85
+                'other'						=> 'Other',
86
+            );
87
+
88
+            foreach($plugins as $plugin)
89
+            {
90
+                $plugin->reasons = apply_filters('ayecode_deactivation_survey_reasons', $defaultReasons, $plugin);
91
+                $plugin->url = home_url();
92
+                $plugin->activated = 0;
93
+            }
94
+
95
+            // Send plugin data
96
+            wp_localize_script('ayecode-deactivation-survey', 'ayecodeds_deactivate_feedback_form_plugins', $plugins);
97
+
98
+        }
99 99
 		
100 100
 
101
-	}
101
+    }
102 102
 
103 103
 }
104 104
\ No newline at end of file
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@
 block discarded – undo
7 7
  * Bail if we are not in WP.
8 8
  */
9 9
 if ( ! defined( 'ABSPATH' ) ) {
10
-	exit;
10
+    exit;
11 11
 }
12 12
 
13 13
 /**
14 14
  * Set the version only if its the current newest while loading.
15 15
  */
16 16
 add_action('after_setup_theme', function () {
17
-	global $ayecode_ui_version,$ayecode_ui_file_key;
18
-	$this_version = "0.1.94";
19
-	if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
20
-		$ayecode_ui_version = $this_version ;
21
-		$ayecode_ui_file_key = wp_hash( __FILE__ );
22
-	}
17
+    global $ayecode_ui_version,$ayecode_ui_file_key;
18
+    $this_version = "0.1.94";
19
+    if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){
20
+        $ayecode_ui_version = $this_version ;
21
+        $ayecode_ui_file_key = wp_hash( __FILE__ );
22
+    }
23 23
 },0);
24 24
 
25 25
 /**
26 26
  * Load this version of WP Bootstrap Settings only if the file hash is the current one.
27 27
  */
28 28
 add_action('after_setup_theme', function () {
29
-	global $ayecode_ui_file_key;
30
-	if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
-		include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
-		include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
33
-	}
29
+    global $ayecode_ui_file_key;
30
+    if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){
31
+        include_once( dirname( __FILE__ ) . '/includes/class-aui.php' );
32
+        include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' );
33
+    }
34 34
 },1);
35 35
 
36 36
 /**
37 37
  * Add the function that calls the class.
38 38
  */
39 39
 if(!function_exists('aui')){
40
-	function aui(){
41
-		if(!class_exists("AUI",false)){
42
-			return false;
43
-		}
44
-		return AUI::instance();
45
-	}
40
+    function aui(){
41
+        if(!class_exists("AUI",false)){
42
+            return false;
43
+        }
44
+        return AUI::instance();
45
+    }
46 46
 }
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php 1 patch
Indentation   +1887 added lines, -1887 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * Bail if we are not in WP.
14 14
  */
15 15
 if ( ! defined( 'ABSPATH' ) ) {
16
-	exit;
16
+    exit;
17 17
 }
18 18
 
19 19
 /**
@@ -21,478 +21,478 @@  discard block
 block discarded – undo
21 21
  */
22 22
 if ( ! class_exists( 'AyeCode_UI_Settings' ) ) {
23 23
 
24
-	/**
25
-	 * A Class to be able to change settings for Font Awesome.
26
-	 *
27
-	 * Class AyeCode_UI_Settings
28
-	 * @ver 1.0.0
29
-	 * @todo decide how to implement textdomain
30
-	 */
31
-	class AyeCode_UI_Settings {
32
-
33
-		/**
34
-		 * Class version version.
35
-		 *
36
-		 * @var string
37
-		 */
38
-		public $version = '0.1.94';
39
-
40
-		/**
41
-		 * Class textdomain.
42
-		 *
43
-		 * @var string
44
-		 */
45
-		public $textdomain = 'aui';
46
-
47
-		/**
48
-		 * Latest version of Bootstrap at time of publish published.
49
-		 *
50
-		 * @var string
51
-		 */
52
-		public $latest = "5.2.2";
53
-
54
-		/**
55
-		 * Current version of select2 being used.
56
-		 *
57
-		 * @var string
58
-		 */
59
-		public $select2_version = "4.0.11";
60
-
61
-		/**
62
-		 * The title.
63
-		 *
64
-		 * @var string
65
-		 */
66
-		public $name = 'AyeCode UI';
67
-
68
-		/**
69
-		 * The relative url to the assets.
70
-		 *
71
-		 * @var string
72
-		 */
73
-		public $url = '';
74
-
75
-		/**
76
-		 * Holds the settings values.
77
-		 *
78
-		 * @var array
79
-		 */
80
-		private $settings;
81
-
82
-		/**
83
-		 * AyeCode_UI_Settings instance.
84
-		 *
85
-		 * @access private
86
-		 * @since  1.0.0
87
-		 * @var    AyeCode_UI_Settings There can be only one!
88
-		 */
89
-		private static $instance = null;
90
-
91
-
92
-		/**
93
-		 * Main AyeCode_UI_Settings Instance.
94
-		 *
95
-		 * Ensures only one instance of AyeCode_UI_Settings is loaded or can be loaded.
96
-		 *
97
-		 * @since 1.0.0
98
-		 * @static
99
-		 * @return AyeCode_UI_Settings - Main instance.
100
-		 */
101
-		public static function instance() {
102
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
103
-
104
-				self::$instance = new AyeCode_UI_Settings;
105
-
106
-				add_action( 'init', array( self::$instance, 'init' ) ); // set settings
107
-
108
-				if ( is_admin() ) {
109
-					add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
110
-					add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
111
-
112
-					// Maybe show example page
113
-					add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
114
-
115
-					if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
116
-						add_filter( 'sd_aui_colors', array( self::$instance,'sd_aui_colors' ), 10, 3 );
117
-					}
118
-				}
24
+    /**
25
+     * A Class to be able to change settings for Font Awesome.
26
+     *
27
+     * Class AyeCode_UI_Settings
28
+     * @ver 1.0.0
29
+     * @todo decide how to implement textdomain
30
+     */
31
+    class AyeCode_UI_Settings {
32
+
33
+        /**
34
+         * Class version version.
35
+         *
36
+         * @var string
37
+         */
38
+        public $version = '0.1.94';
39
+
40
+        /**
41
+         * Class textdomain.
42
+         *
43
+         * @var string
44
+         */
45
+        public $textdomain = 'aui';
46
+
47
+        /**
48
+         * Latest version of Bootstrap at time of publish published.
49
+         *
50
+         * @var string
51
+         */
52
+        public $latest = "5.2.2";
53
+
54
+        /**
55
+         * Current version of select2 being used.
56
+         *
57
+         * @var string
58
+         */
59
+        public $select2_version = "4.0.11";
60
+
61
+        /**
62
+         * The title.
63
+         *
64
+         * @var string
65
+         */
66
+        public $name = 'AyeCode UI';
67
+
68
+        /**
69
+         * The relative url to the assets.
70
+         *
71
+         * @var string
72
+         */
73
+        public $url = '';
74
+
75
+        /**
76
+         * Holds the settings values.
77
+         *
78
+         * @var array
79
+         */
80
+        private $settings;
81
+
82
+        /**
83
+         * AyeCode_UI_Settings instance.
84
+         *
85
+         * @access private
86
+         * @since  1.0.0
87
+         * @var    AyeCode_UI_Settings There can be only one!
88
+         */
89
+        private static $instance = null;
90
+
91
+
92
+        /**
93
+         * Main AyeCode_UI_Settings Instance.
94
+         *
95
+         * Ensures only one instance of AyeCode_UI_Settings is loaded or can be loaded.
96
+         *
97
+         * @since 1.0.0
98
+         * @static
99
+         * @return AyeCode_UI_Settings - Main instance.
100
+         */
101
+        public static function instance() {
102
+            if ( ! isset( self::$instance ) && ! ( self::$instance instanceof AyeCode_UI_Settings ) ) {
103
+
104
+                self::$instance = new AyeCode_UI_Settings;
105
+
106
+                add_action( 'init', array( self::$instance, 'init' ) ); // set settings
107
+
108
+                if ( is_admin() ) {
109
+                    add_action( 'admin_menu', array( self::$instance, 'menu_item' ) );
110
+                    add_action( 'admin_init', array( self::$instance, 'register_settings' ) );
111
+
112
+                    // Maybe show example page
113
+                    add_action( 'template_redirect', array( self::$instance,'maybe_show_examples' ) );
114
+
115
+                    if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
116
+                        add_filter( 'sd_aui_colors', array( self::$instance,'sd_aui_colors' ), 10, 3 );
117
+                    }
118
+                }
119 119
 
120
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
120
+                add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
121 121
 
122
-				do_action( 'ayecode_ui_settings_loaded' );
123
-			}
122
+                do_action( 'ayecode_ui_settings_loaded' );
123
+            }
124 124
 
125
-			return self::$instance;
126
-		}
125
+            return self::$instance;
126
+        }
127 127
 
128
-		/**
129
-		 * Add custom colors to the color selector.
130
-		 *
131
-		 * @param $theme_colors
132
-		 * @param $include_outlines
133
-		 * @param $include_branding
134
-		 *
135
-		 * @return mixed
136
-		 */
137
-		public function sd_aui_colors( $theme_colors, $include_outlines, $include_branding ){
128
+        /**
129
+         * Add custom colors to the color selector.
130
+         *
131
+         * @param $theme_colors
132
+         * @param $include_outlines
133
+         * @param $include_branding
134
+         *
135
+         * @return mixed
136
+         */
137
+        public function sd_aui_colors( $theme_colors, $include_outlines, $include_branding ){
138 138
 
139 139
 
140
-			$setting = wp_get_global_settings();
140
+            $setting = wp_get_global_settings();
141 141
 
142
-			if(!empty($setting['color']['palette']['custom'])){
143
-				foreach($setting['color']['palette']['custom'] as $color){
144
-					$theme_colors[$color['slug']] = esc_attr($color['name']);
145
-				}
146
-			}
147
-
148
-			return $theme_colors;
149
-		}
150
-
151
-		/**
152
-		 * Setup some constants.
153
-		 */
154
-		public function constants(){
155
-			define( 'AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be" );
156
-			define( 'AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d' );
157
-			define( 'AUI_INFO_COLOR_ORIGINAL', '#17a2b8' );
158
-			define( 'AUI_WARNING_COLOR_ORIGINAL', '#ffc107' );
159
-			define( 'AUI_DANGER_COLOR_ORIGINAL', '#dc3545' );
160
-			define( 'AUI_SUCCESS_COLOR_ORIGINAL', '#44c553' );
161
-			define( 'AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa' );
162
-			define( 'AUI_DARK_COLOR_ORIGINAL', '#343a40' );
163
-			define( 'AUI_WHITE_COLOR_ORIGINAL', '#fff' );
164
-			define( 'AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd' );
165
-			define( 'AUI_SALMON_COLOR_ORIGINAL', '#ff977a' );
166
-			define( 'AUI_CYAN_COLOR_ORIGINAL', '#35bdff' );
167
-			define( 'AUI_GRAY_COLOR_ORIGINAL', '#ced4da' );
168
-			define( 'AUI_INDIGO_COLOR_ORIGINAL', '#502c6c' );
169
-			define( 'AUI_ORANGE_COLOR_ORIGINAL', '#orange' );
170
-			define( 'AUI_BLACK_COLOR_ORIGINAL', '#000' );
171
-
172
-			if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
173
-				define( 'AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL );
174
-			}
175
-			if ( ! defined( 'AUI_SECONDARY_COLOR' ) ) {
176
-				define( 'AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL );
177
-			}
178
-			if ( ! defined( 'AUI_INFO_COLOR' ) ) {
179
-				define( 'AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL );
180
-			}
181
-			if ( ! defined( 'AUI_WARNING_COLOR' ) ) {
182
-				define( 'AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL );
183
-			}
184
-			if ( ! defined( 'AUI_DANGER_COLOR' ) ) {
185
-				define( 'AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL );
186
-			}
187
-			if ( ! defined( 'AUI_SUCCESS_COLOR' ) ) {
188
-				define( 'AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL );
189
-			}
190
-			if ( ! defined( 'AUI_LIGHT_COLOR' ) ) {
191
-				define( 'AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL );
192
-			}
193
-			if ( ! defined( 'AUI_DARK_COLOR' ) ) {
194
-				define( 'AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL );
195
-			}
196
-			if ( ! defined( 'AUI_WHITE_COLOR' ) ) {
197
-				define( 'AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL );
198
-			}
199
-			if ( ! defined( 'AUI_PURPLE_COLOR' ) ) {
200
-				define( 'AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL );
201
-			}
202
-			if ( ! defined( 'AUI_SALMON_COLOR' ) ) {
203
-				define( 'AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL );
204
-			}
205
-			if ( ! defined( 'AUI_CYAN_COLOR' ) ) {
206
-				define( 'AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL );
207
-			}
208
-			if ( ! defined( 'AUI_GRAY_COLOR' ) ) {
209
-				define( 'AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL );
210
-			}
211
-			if ( ! defined( 'AUI_INDIGO_COLOR' ) ) {
212
-				define( 'AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL );
213
-			}
214
-			if ( ! defined( 'AUI_ORANGE_COLOR' ) ) {
215
-				define( 'AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL );
216
-			}
217
-			if ( ! defined( 'AUI_BLACK_COLOR' ) ) {
218
-				define( 'AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL );
219
-			}
220
-
221
-		}
222
-
223
-		public static function get_colors( $original = false){
224
-
225
-			if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
226
-				return array();
227
-			}
228
-			if ( $original ) {
229
-				return array(
230
-					'primary'   => AUI_PRIMARY_COLOR_ORIGINAL,
231
-					'secondary' => AUI_SECONDARY_COLOR_ORIGINAL,
232
-					'info'      => AUI_INFO_COLOR_ORIGINAL,
233
-					'warning'   => AUI_WARNING_COLOR_ORIGINAL,
234
-					'danger'    => AUI_DANGER_COLOR_ORIGINAL,
235
-					'success'   => AUI_SUCCESS_COLOR_ORIGINAL,
236
-					'light'     => AUI_LIGHT_COLOR_ORIGINAL,
237
-					'dark'      => AUI_DARK_COLOR_ORIGINAL,
238
-					'white'     => AUI_WHITE_COLOR_ORIGINAL,
239
-					'purple'    => AUI_PURPLE_COLOR_ORIGINAL,
240
-					'salmon'    => AUI_SALMON_COLOR_ORIGINAL,
241
-					'cyan'      => AUI_CYAN_COLOR_ORIGINAL,
242
-					'gray'      => AUI_GRAY_COLOR_ORIGINAL,
243
-					'indigo'    => AUI_INDIGO_COLOR_ORIGINAL,
244
-					'orange'    => AUI_ORANGE_COLOR_ORIGINAL,
245
-					'black'     => AUI_BLACK_COLOR_ORIGINAL,
246
-				);
247
-			}
248
-
249
-			return array(
250
-				'primary'   => AUI_PRIMARY_COLOR,
251
-				'secondary' => AUI_SECONDARY_COLOR,
252
-				'info'      => AUI_INFO_COLOR,
253
-				'warning'   => AUI_WARNING_COLOR,
254
-				'danger'    => AUI_DANGER_COLOR,
255
-				'success'   => AUI_SUCCESS_COLOR,
256
-				'light'     => AUI_LIGHT_COLOR,
257
-				'dark'      => AUI_DARK_COLOR,
258
-				'white'     => AUI_WHITE_COLOR,
259
-				'purple'    => AUI_PURPLE_COLOR,
260
-				'salmon'    => AUI_SALMON_COLOR,
261
-				'cyan'      => AUI_CYAN_COLOR,
262
-				'gray'      => AUI_GRAY_COLOR,
263
-				'indigo'    => AUI_INDIGO_COLOR,
264
-				'orange'    => AUI_ORANGE_COLOR,
265
-				'black'     => AUI_BLACK_COLOR,
266
-			);
267
-		}
268
-
269
-		/**
270
-		 * Add admin body class to show when BS5 is active.
271
-		 *
272
-		 * @param $classes
273
-		 *
274
-		 * @return mixed
275
-		 */
276
-		public function add_bs5_admin_body_class( $classes = '' ) {
277
-			$classes .= ' aui_bs5';
278
-
279
-			return $classes;
280
-		}
281
-
282
-		/**
283
-		 * Add a body class to show when BS5 is active.
284
-		 *
285
-		 * @param $classes
286
-		 *
287
-		 * @return mixed
288
-		 */
289
-		public function add_bs5_body_class( $classes ) {
290
-			$classes[] = 'aui_bs5';
291
-
292
-			return $classes;
293
-		}
294
-
295
-		/**
296
-		 * Initiate the settings and add the required action hooks.
297
-		 */
298
-		public function init() {
142
+            if(!empty($setting['color']['palette']['custom'])){
143
+                foreach($setting['color']['palette']['custom'] as $color){
144
+                    $theme_colors[$color['slug']] = esc_attr($color['name']);
145
+                }
146
+            }
147
+
148
+            return $theme_colors;
149
+        }
150
+
151
+        /**
152
+         * Setup some constants.
153
+         */
154
+        public function constants(){
155
+            define( 'AUI_PRIMARY_COLOR_ORIGINAL', "#1e73be" );
156
+            define( 'AUI_SECONDARY_COLOR_ORIGINAL', '#6c757d' );
157
+            define( 'AUI_INFO_COLOR_ORIGINAL', '#17a2b8' );
158
+            define( 'AUI_WARNING_COLOR_ORIGINAL', '#ffc107' );
159
+            define( 'AUI_DANGER_COLOR_ORIGINAL', '#dc3545' );
160
+            define( 'AUI_SUCCESS_COLOR_ORIGINAL', '#44c553' );
161
+            define( 'AUI_LIGHT_COLOR_ORIGINAL', '#f8f9fa' );
162
+            define( 'AUI_DARK_COLOR_ORIGINAL', '#343a40' );
163
+            define( 'AUI_WHITE_COLOR_ORIGINAL', '#fff' );
164
+            define( 'AUI_PURPLE_COLOR_ORIGINAL', '#ad6edd' );
165
+            define( 'AUI_SALMON_COLOR_ORIGINAL', '#ff977a' );
166
+            define( 'AUI_CYAN_COLOR_ORIGINAL', '#35bdff' );
167
+            define( 'AUI_GRAY_COLOR_ORIGINAL', '#ced4da' );
168
+            define( 'AUI_INDIGO_COLOR_ORIGINAL', '#502c6c' );
169
+            define( 'AUI_ORANGE_COLOR_ORIGINAL', '#orange' );
170
+            define( 'AUI_BLACK_COLOR_ORIGINAL', '#000' );
171
+
172
+            if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
173
+                define( 'AUI_PRIMARY_COLOR', AUI_PRIMARY_COLOR_ORIGINAL );
174
+            }
175
+            if ( ! defined( 'AUI_SECONDARY_COLOR' ) ) {
176
+                define( 'AUI_SECONDARY_COLOR', AUI_SECONDARY_COLOR_ORIGINAL );
177
+            }
178
+            if ( ! defined( 'AUI_INFO_COLOR' ) ) {
179
+                define( 'AUI_INFO_COLOR', AUI_INFO_COLOR_ORIGINAL );
180
+            }
181
+            if ( ! defined( 'AUI_WARNING_COLOR' ) ) {
182
+                define( 'AUI_WARNING_COLOR', AUI_WARNING_COLOR_ORIGINAL );
183
+            }
184
+            if ( ! defined( 'AUI_DANGER_COLOR' ) ) {
185
+                define( 'AUI_DANGER_COLOR', AUI_DANGER_COLOR_ORIGINAL );
186
+            }
187
+            if ( ! defined( 'AUI_SUCCESS_COLOR' ) ) {
188
+                define( 'AUI_SUCCESS_COLOR', AUI_SUCCESS_COLOR_ORIGINAL );
189
+            }
190
+            if ( ! defined( 'AUI_LIGHT_COLOR' ) ) {
191
+                define( 'AUI_LIGHT_COLOR', AUI_LIGHT_COLOR_ORIGINAL );
192
+            }
193
+            if ( ! defined( 'AUI_DARK_COLOR' ) ) {
194
+                define( 'AUI_DARK_COLOR', AUI_DARK_COLOR_ORIGINAL );
195
+            }
196
+            if ( ! defined( 'AUI_WHITE_COLOR' ) ) {
197
+                define( 'AUI_WHITE_COLOR', AUI_WHITE_COLOR_ORIGINAL );
198
+            }
199
+            if ( ! defined( 'AUI_PURPLE_COLOR' ) ) {
200
+                define( 'AUI_PURPLE_COLOR', AUI_PURPLE_COLOR_ORIGINAL );
201
+            }
202
+            if ( ! defined( 'AUI_SALMON_COLOR' ) ) {
203
+                define( 'AUI_SALMON_COLOR', AUI_SALMON_COLOR_ORIGINAL );
204
+            }
205
+            if ( ! defined( 'AUI_CYAN_COLOR' ) ) {
206
+                define( 'AUI_CYAN_COLOR', AUI_CYAN_COLOR_ORIGINAL );
207
+            }
208
+            if ( ! defined( 'AUI_GRAY_COLOR' ) ) {
209
+                define( 'AUI_GRAY_COLOR', AUI_GRAY_COLOR_ORIGINAL );
210
+            }
211
+            if ( ! defined( 'AUI_INDIGO_COLOR' ) ) {
212
+                define( 'AUI_INDIGO_COLOR', AUI_INDIGO_COLOR_ORIGINAL );
213
+            }
214
+            if ( ! defined( 'AUI_ORANGE_COLOR' ) ) {
215
+                define( 'AUI_ORANGE_COLOR', AUI_ORANGE_COLOR_ORIGINAL );
216
+            }
217
+            if ( ! defined( 'AUI_BLACK_COLOR' ) ) {
218
+                define( 'AUI_BLACK_COLOR', AUI_BLACK_COLOR_ORIGINAL );
219
+            }
220
+
221
+        }
222
+
223
+        public static function get_colors( $original = false){
224
+
225
+            if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
226
+                return array();
227
+            }
228
+            if ( $original ) {
229
+                return array(
230
+                    'primary'   => AUI_PRIMARY_COLOR_ORIGINAL,
231
+                    'secondary' => AUI_SECONDARY_COLOR_ORIGINAL,
232
+                    'info'      => AUI_INFO_COLOR_ORIGINAL,
233
+                    'warning'   => AUI_WARNING_COLOR_ORIGINAL,
234
+                    'danger'    => AUI_DANGER_COLOR_ORIGINAL,
235
+                    'success'   => AUI_SUCCESS_COLOR_ORIGINAL,
236
+                    'light'     => AUI_LIGHT_COLOR_ORIGINAL,
237
+                    'dark'      => AUI_DARK_COLOR_ORIGINAL,
238
+                    'white'     => AUI_WHITE_COLOR_ORIGINAL,
239
+                    'purple'    => AUI_PURPLE_COLOR_ORIGINAL,
240
+                    'salmon'    => AUI_SALMON_COLOR_ORIGINAL,
241
+                    'cyan'      => AUI_CYAN_COLOR_ORIGINAL,
242
+                    'gray'      => AUI_GRAY_COLOR_ORIGINAL,
243
+                    'indigo'    => AUI_INDIGO_COLOR_ORIGINAL,
244
+                    'orange'    => AUI_ORANGE_COLOR_ORIGINAL,
245
+                    'black'     => AUI_BLACK_COLOR_ORIGINAL,
246
+                );
247
+            }
248
+
249
+            return array(
250
+                'primary'   => AUI_PRIMARY_COLOR,
251
+                'secondary' => AUI_SECONDARY_COLOR,
252
+                'info'      => AUI_INFO_COLOR,
253
+                'warning'   => AUI_WARNING_COLOR,
254
+                'danger'    => AUI_DANGER_COLOR,
255
+                'success'   => AUI_SUCCESS_COLOR,
256
+                'light'     => AUI_LIGHT_COLOR,
257
+                'dark'      => AUI_DARK_COLOR,
258
+                'white'     => AUI_WHITE_COLOR,
259
+                'purple'    => AUI_PURPLE_COLOR,
260
+                'salmon'    => AUI_SALMON_COLOR,
261
+                'cyan'      => AUI_CYAN_COLOR,
262
+                'gray'      => AUI_GRAY_COLOR,
263
+                'indigo'    => AUI_INDIGO_COLOR,
264
+                'orange'    => AUI_ORANGE_COLOR,
265
+                'black'     => AUI_BLACK_COLOR,
266
+            );
267
+        }
268
+
269
+        /**
270
+         * Add admin body class to show when BS5 is active.
271
+         *
272
+         * @param $classes
273
+         *
274
+         * @return mixed
275
+         */
276
+        public function add_bs5_admin_body_class( $classes = '' ) {
277
+            $classes .= ' aui_bs5';
278
+
279
+            return $classes;
280
+        }
281
+
282
+        /**
283
+         * Add a body class to show when BS5 is active.
284
+         *
285
+         * @param $classes
286
+         *
287
+         * @return mixed
288
+         */
289
+        public function add_bs5_body_class( $classes ) {
290
+            $classes[] = 'aui_bs5';
291
+
292
+            return $classes;
293
+        }
294
+
295
+        /**
296
+         * Initiate the settings and add the required action hooks.
297
+         */
298
+        public function init() {
299 299
             global $aui_bs5;
300 300
 
301
-			// Maybe fix settings
302
-			if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
303
-				$db_settings = get_option( 'ayecode-ui-settings' );
304
-				if ( ! empty( $db_settings ) ) {
305
-					$db_settings['css_backend'] = 'compatibility';
306
-					$db_settings['js_backend'] = 'core-popper';
307
-					update_option( 'ayecode-ui-settings', $db_settings );
308
-					wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
309
-				}
310
-			}
301
+            // Maybe fix settings
302
+            if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
303
+                $db_settings = get_option( 'ayecode-ui-settings' );
304
+                if ( ! empty( $db_settings ) ) {
305
+                    $db_settings['css_backend'] = 'compatibility';
306
+                    $db_settings['js_backend'] = 'core-popper';
307
+                    update_option( 'ayecode-ui-settings', $db_settings );
308
+                    wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
309
+                }
310
+            }
311 311
 
312
-			$this->constants();
313
-			$this->settings = $this->get_settings();
314
-			$this->url = $this->get_url();
312
+            $this->constants();
313
+            $this->settings = $this->get_settings();
314
+            $this->url = $this->get_url();
315 315
 
316 316
             // define the version
317
-			$aui_bs5 = $this->settings['bs_ver'] === '5';
318
-
319
-			if ( $aui_bs5 ) {
320
-				include_once( dirname( __FILE__ ) . '/inc/bs-conversion.php' );
321
-				add_filter( 'admin_body_class', array( $this, 'add_bs5_admin_body_class' ), 99, 1 );
322
-				add_filter( 'body_class', array( $this, 'add_bs5_body_class' ) );
323
-			}
324
-
325
-			/**
326
-			 * Maybe load CSS
327
-			 *
328
-			 * We load super early in case there is a theme version that might change the colors
329
-			 */
330
-			if ( $this->settings['css'] ) {
331
-				$priority = $this->is_bs3_compat() ? 100 : 1;
317
+            $aui_bs5 = $this->settings['bs_ver'] === '5';
318
+
319
+            if ( $aui_bs5 ) {
320
+                include_once( dirname( __FILE__ ) . '/inc/bs-conversion.php' );
321
+                add_filter( 'admin_body_class', array( $this, 'add_bs5_admin_body_class' ), 99, 1 );
322
+                add_filter( 'body_class', array( $this, 'add_bs5_body_class' ) );
323
+            }
324
+
325
+            /**
326
+             * Maybe load CSS
327
+             *
328
+             * We load super early in case there is a theme version that might change the colors
329
+             */
330
+            if ( $this->settings['css'] ) {
331
+                $priority = $this->is_bs3_compat() ? 100 : 1;
332 332
                 $priority = $aui_bs5 ? 10 : $priority;
333
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
334
-			}
335
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
336
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
337
-			}
338
-
339
-			// maybe load JS
340
-			if ( $this->settings['js'] ) {
341
-				$priority = $this->is_bs3_compat() ? 100 : 1;
342
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
343
-			}
344
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
345
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
346
-			}
347
-
348
-			// Maybe set the HTML font size
349
-			if ( $this->settings['html_font_size'] ) {
350
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
351
-			}
352
-
353
-			// Maybe show backend style error
354
-			if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
355
-				add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
356
-			}
357
-
358
-		}
359
-
360
-		/**
361
-		 * Show admin notice if backend scripts not loaded.
362
-		 */
363
-		public function show_admin_style_notice(){
364
-			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
365
-			$button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
366
-			$message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
367
-			echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$message.'</p></div>';
368
-		}
369
-
370
-		/**
371
-		 * Check if we should load the admin scripts or not.
372
-		 *
373
-		 * @return bool
374
-		 */
375
-		public function load_admin_scripts(){
376
-			$result = true;
377
-
378
-			// check if specifically disabled
379
-			if(!empty($this->settings['disable_admin'])){
380
-				$url_parts = explode("\n",$this->settings['disable_admin']);
381
-				foreach($url_parts as $part){
382
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
383
-						return false; // return early, no point checking further
384
-					}
385
-				}
386
-			}
387
-
388
-			return $result;
389
-		}
390
-
391
-		/**
392
-		 * Add a html font size to the footer.
393
-		 */
394
-		public function html_font_size(){
395
-			$this->settings = $this->get_settings();
396
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
397
-		}
398
-
399
-		/**
400
-		 * Check if the current admin screen should load scripts.
401
-		 *
402
-		 * @return bool
403
-		 */
404
-		public function is_aui_screen(){
333
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
334
+            }
335
+            if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
336
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
337
+            }
338
+
339
+            // maybe load JS
340
+            if ( $this->settings['js'] ) {
341
+                $priority = $this->is_bs3_compat() ? 100 : 1;
342
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
343
+            }
344
+            if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
345
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
346
+            }
347
+
348
+            // Maybe set the HTML font size
349
+            if ( $this->settings['html_font_size'] ) {
350
+                add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
351
+            }
352
+
353
+            // Maybe show backend style error
354
+            if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
355
+                add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
356
+            }
357
+
358
+        }
359
+
360
+        /**
361
+         * Show admin notice if backend scripts not loaded.
362
+         */
363
+        public function show_admin_style_notice(){
364
+            $fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
365
+            $button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
366
+            $message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
367
+            echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$message.'</p></div>';
368
+        }
369
+
370
+        /**
371
+         * Check if we should load the admin scripts or not.
372
+         *
373
+         * @return bool
374
+         */
375
+        public function load_admin_scripts(){
376
+            $result = true;
377
+
378
+            // check if specifically disabled
379
+            if(!empty($this->settings['disable_admin'])){
380
+                $url_parts = explode("\n",$this->settings['disable_admin']);
381
+                foreach($url_parts as $part){
382
+                    if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
383
+                        return false; // return early, no point checking further
384
+                    }
385
+                }
386
+            }
387
+
388
+            return $result;
389
+        }
390
+
391
+        /**
392
+         * Add a html font size to the footer.
393
+         */
394
+        public function html_font_size(){
395
+            $this->settings = $this->get_settings();
396
+            echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
397
+        }
398
+
399
+        /**
400
+         * Check if the current admin screen should load scripts.
401
+         *
402
+         * @return bool
403
+         */
404
+        public function is_aui_screen(){
405 405
 //			echo '###';exit;
406
-			$load = false;
407
-			// check if we should load or not
408
-			if ( is_admin() ) {
409
-				// Only enable on set pages
410
-				$aui_screens = array(
411
-					'page',
406
+            $load = false;
407
+            // check if we should load or not
408
+            if ( is_admin() ) {
409
+                // Only enable on set pages
410
+                $aui_screens = array(
411
+                    'page',
412 412
                     //'docs',
413
-					'post',
414
-					'settings_page_ayecode-ui-settings',
415
-					'appearance_page_gutenberg-widgets',
416
-					'widgets',
417
-					'ayecode-ui-settings',
418
-					'site-editor'
419
-				);
420
-				$screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
413
+                    'post',
414
+                    'settings_page_ayecode-ui-settings',
415
+                    'appearance_page_gutenberg-widgets',
416
+                    'widgets',
417
+                    'ayecode-ui-settings',
418
+                    'site-editor'
419
+                );
420
+                $screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
421 421
 
422
-				$screen = get_current_screen();
422
+                $screen = get_current_screen();
423 423
 
424 424
 //				echo '###'.$screen->id;
425 425
 
426
-				// check if we are on a AUI screen
427
-				if ( $screen && in_array( $screen->id, $screen_ids ) ) {
428
-					$load = true;
429
-				}
426
+                // check if we are on a AUI screen
427
+                if ( $screen && in_array( $screen->id, $screen_ids ) ) {
428
+                    $load = true;
429
+                }
430 430
 
431
-				//load for widget previews in WP 5.8
432
-				if( !empty($_REQUEST['legacy-widget-preview'])){
433
-					$load = true;
434
-				}
435
-			}
436
-
437
-			return apply_filters( 'aui_load_on_admin' , $load );
438
-		}
439
-
440
-		/**
441
-		 * Check if the current theme is a block theme.
442
-		 *
443
-		 * @return bool
444
-		 */
445
-		public static function is_block_theme() {
446
-			if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) {
447
-				return true;
448
-			}
449
-
450
-			return false;
451
-		}
452
-
453
-		/**
454
-		 * Adds the styles.
455
-		 */
456
-		public function enqueue_style() {
431
+                //load for widget previews in WP 5.8
432
+                if( !empty($_REQUEST['legacy-widget-preview'])){
433
+                    $load = true;
434
+                }
435
+            }
436
+
437
+            return apply_filters( 'aui_load_on_admin' , $load );
438
+        }
439
+
440
+        /**
441
+         * Check if the current theme is a block theme.
442
+         *
443
+         * @return bool
444
+         */
445
+        public static function is_block_theme() {
446
+            if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) {
447
+                return true;
448
+            }
449
+
450
+            return false;
451
+        }
452
+
453
+        /**
454
+         * Adds the styles.
455
+         */
456
+        public function enqueue_style() {
457 457
             global $aui_bs5;
458 458
 
459 459
             $load_fse = false;
460 460
 
461
-			if( is_admin() && !$this->is_aui_screen()){
462
-				// don't add wp-admin scripts if not requested to
463
-			}else{
464
-				$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
461
+            if( is_admin() && !$this->is_aui_screen()){
462
+                // don't add wp-admin scripts if not requested to
463
+            }else{
464
+                $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
465 465
 
466
-				$rtl = is_rtl() && ! $aui_bs5 ? '-rtl' : '';
466
+                $rtl = is_rtl() && ! $aui_bs5 ? '-rtl' : '';
467 467
 
468 468
                 $bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : '';
469 469
 
470
-				if($this->settings[$css_setting]){
471
-					$compatibility = $this->settings[$css_setting]=='core' ? false : true;
472
-					$url = $this->settings[$css_setting]=='core' ? $this->url.'assets'.$bs_ver.'/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets'.$bs_ver.'/css/ayecode-ui-compatibility'.$rtl.'.css';
470
+                if($this->settings[$css_setting]){
471
+                    $compatibility = $this->settings[$css_setting]=='core' ? false : true;
472
+                    $url = $this->settings[$css_setting]=='core' ? $this->url.'assets'.$bs_ver.'/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets'.$bs_ver.'/css/ayecode-ui-compatibility'.$rtl.'.css';
473 473
 
474 474
 
475 475
 
476
-					wp_register_style( 'ayecode-ui', $url, array(), $this->version );
477
-					wp_enqueue_style( 'ayecode-ui' );
476
+                    wp_register_style( 'ayecode-ui', $url, array(), $this->version );
477
+                    wp_enqueue_style( 'ayecode-ui' );
478 478
 
479
-					$current_screen = function_exists('get_current_screen' ) ? get_current_screen() : '';
479
+                    $current_screen = function_exists('get_current_screen' ) ? get_current_screen() : '';
480 480
 
481 481
 //					if ( is_admin() && !empty($_REQUEST['postType']) ) {
482
-					if ( is_admin() && ( !empty($_REQUEST['postType']) || $current_screen->is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) )  ) {
483
-						$url = $this->url.'assets'.$bs_ver.'/css/ayecode-ui-fse.css';
484
-						wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version );
485
-						wp_enqueue_style( 'ayecode-ui-fse' );
486
-						$load_fse = true;
487
-					}
482
+                    if ( is_admin() && ( !empty($_REQUEST['postType']) || $current_screen->is_block_editor() ) && ( defined( 'BLOCKSTRAP_VERSION' ) || defined( 'AUI_FSE' ) )  ) {
483
+                        $url = $this->url.'assets'.$bs_ver.'/css/ayecode-ui-fse.css';
484
+                        wp_register_style( 'ayecode-ui-fse', $url, array(), $this->version );
485
+                        wp_enqueue_style( 'ayecode-ui-fse' );
486
+                        $load_fse = true;
487
+                    }
488 488
 
489 489
 
490
-					// flatpickr
491
-					wp_register_style( 'flatpickr', $this->url.'assets'.$bs_ver.'/css/flatpickr.min.css', array(), $this->version );
490
+                    // flatpickr
491
+                    wp_register_style( 'flatpickr', $this->url.'assets'.$bs_ver.'/css/flatpickr.min.css', array(), $this->version );
492 492
 
493
-					// fix some wp-admin issues
494
-					if(is_admin()){
495
-						$custom_css = "
493
+                    // fix some wp-admin issues
494
+                    if(is_admin()){
495
+                        $custom_css = "
496 496
                 body{
497 497
                     background-color: #f1f1f1;
498 498
                     font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;
@@ -538,67 +538,67 @@  discard block
 block discarded – undo
538 538
 				}
539 539
                 ";
540 540
 
541
-						// @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
542
-						$custom_css .= "
541
+                        // @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
542
+                        $custom_css .= "
543 543
 						.edit-post-sidebar input[type=color].components-text-control__input{
544 544
 						    padding: 0;
545 545
 						}
546 546
 					";
547
-						wp_add_inline_style( 'ayecode-ui', $custom_css );
548
-					}
547
+                        wp_add_inline_style( 'ayecode-ui', $custom_css );
548
+                    }
549 549
 
550
-					// custom changes
551
-					if ( $load_fse ) {
552
-						wp_add_inline_style( 'ayecode-ui-fse', self::custom_css($compatibility) );
553
-					}else{
554
-						wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
550
+                    // custom changes
551
+                    if ( $load_fse ) {
552
+                        wp_add_inline_style( 'ayecode-ui-fse', self::custom_css($compatibility) );
553
+                    }else{
554
+                        wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
555 555
 
556
-					}
556
+                    }
557 557
 
558
-				}
559
-			}
558
+                }
559
+            }
560 560
 
561 561
 
562
-		}
562
+        }
563 563
 
564
-		/**
565
-		 * Get inline script used if bootstrap enqueued
566
-		 *
567
-		 * If this remains small then its best to use this than to add another JS file.
568
-		 */
569
-		public function inline_script() {
564
+        /**
565
+         * Get inline script used if bootstrap enqueued
566
+         *
567
+         * If this remains small then its best to use this than to add another JS file.
568
+         */
569
+        public function inline_script() {
570 570
             global $aui_bs5;
571
-			// Flatpickr calendar locale
572
-			$flatpickr_locale = self::flatpickr_locale();
573
-
574
-			ob_start();
575
-			if ( $aui_bs5 ) {
576
-				include_once( dirname( __FILE__ ) . '/inc/bs5-js.php' );
577
-			}else{
578
-				include_once( dirname( __FILE__ ) . '/inc/bs4-js.php' );
571
+            // Flatpickr calendar locale
572
+            $flatpickr_locale = self::flatpickr_locale();
573
+
574
+            ob_start();
575
+            if ( $aui_bs5 ) {
576
+                include_once( dirname( __FILE__ ) . '/inc/bs5-js.php' );
577
+            }else{
578
+                include_once( dirname( __FILE__ ) . '/inc/bs4-js.php' );
579 579
             }
580 580
 
581
-			$output = ob_get_clean();
581
+            $output = ob_get_clean();
582 582
 
583
-			/*
583
+            /*
584 584
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
585 585
 			 */
586
-			return str_replace( array(
587
-				'<script>',
588
-				'</script>'
589
-			), '', self::minify_js($output) );
590
-		}
591
-
592
-
593
-		/**
594
-		 * JS to help with conflict issues with other plugins and themes using bootstrap v3.
595
-		 *
596
-		 * @TODO we may need this when other conflicts arrise.
597
-		 * @return mixed
598
-		 */
599
-		public static function bs3_compat_js() {
600
-			ob_start();
601
-			?>
586
+            return str_replace( array(
587
+                '<script>',
588
+                '</script>'
589
+            ), '', self::minify_js($output) );
590
+        }
591
+
592
+
593
+        /**
594
+         * JS to help with conflict issues with other plugins and themes using bootstrap v3.
595
+         *
596
+         * @TODO we may need this when other conflicts arrise.
597
+         * @return mixed
598
+         */
599
+        public static function bs3_compat_js() {
600
+            ob_start();
601
+            ?>
602 602
             <script>
603 603
 				<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
604 604
                 /* With Avada builder */
@@ -606,20 +606,20 @@  discard block
 block discarded – undo
606 606
 				<?php } ?>
607 607
             </script>
608 608
 			<?php
609
-			return str_replace( array(
610
-				'<script>',
611
-				'</script>'
612
-			), '', ob_get_clean());
613
-		}
614
-
615
-		/**
616
-		 * Get inline script used if bootstrap file browser enqueued.
617
-		 *
618
-		 * If this remains small then its best to use this than to add another JS file.
619
-		 */
620
-		public function inline_script_file_browser(){
621
-			ob_start();
622
-			?>
609
+            return str_replace( array(
610
+                '<script>',
611
+                '</script>'
612
+            ), '', ob_get_clean());
613
+        }
614
+
615
+        /**
616
+         * Get inline script used if bootstrap file browser enqueued.
617
+         *
618
+         * If this remains small then its best to use this than to add another JS file.
619
+         */
620
+        public function inline_script_file_browser(){
621
+            ob_start();
622
+            ?>
623 623
             <script>
624 624
                 // run on doc ready
625 625
                 jQuery(document).ready(function () {
@@ -627,243 +627,243 @@  discard block
 block discarded – undo
627 627
                 });
628 628
             </script>
629 629
 			<?php
630
-			$output = ob_get_clean();
630
+            $output = ob_get_clean();
631 631
 
632
-			/*
632
+            /*
633 633
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
634 634
 			 */
635
-			return str_replace( array(
636
-				'<script>',
637
-				'</script>'
638
-			), '', $output );
639
-		}
640
-
641
-		/**
642
-		 * Adds the Font Awesome JS.
643
-		 */
644
-		public function enqueue_scripts() {
645
-
646
-			if( is_admin() && !$this->is_aui_screen()){
647
-				// don't add wp-admin scripts if not requested to
648
-			}else {
649
-
650
-				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
651
-
652
-				$bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : '';
653
-
654
-				// select2
655
-				wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
656
-
657
-				// flatpickr
658
-				wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
659
-
660
-				// flatpickr
661
-				wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
662
-
663
-				// Bootstrap file browser
664
-				wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
665
-				wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
666
-
667
-				$load_inline = false;
668
-
669
-				if ( $this->settings[ $js_setting ] == 'core-popper' ) {
670
-					// Bootstrap bundle
671
-					$url = $this->url . 'assets' . $bs_ver . '/js/bootstrap.bundle.min.js';
672
-					wp_register_script( 'bootstrap-js-bundle', $url, array(
673
-						'select2',
674
-						'jquery'
675
-					), $this->version, $this->is_bs3_compat() );
676
-					// if in admin then add to footer for compatibility.
677
-					is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
678
-					$script = $this->inline_script();
679
-					wp_add_inline_script( 'bootstrap-js-bundle', $script );
680
-				} elseif ( $this->settings[ $js_setting ] == 'popper' ) {
681
-					$url = $this->url . 'assets/js/popper.min.js'; //@todo we need to update this to bs5
682
-					wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version );
683
-					wp_enqueue_script( 'bootstrap-js-popper' );
684
-					$load_inline = true;
685
-				} else {
686
-					$load_inline = true;
687
-				}
635
+            return str_replace( array(
636
+                '<script>',
637
+                '</script>'
638
+            ), '', $output );
639
+        }
688 640
 
689
-				// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
690
-				if ( $load_inline ) {
691
-					wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
692
-					wp_enqueue_script( 'bootstrap-dummy' );
693
-					$script = $this->inline_script();
694
-					wp_add_inline_script( 'bootstrap-dummy', $script );
695
-				}
696
-			}
697
-
698
-		}
699
-
700
-		/**
701
-		 * Enqueue flatpickr if called.
702
-		 */
703
-		public function enqueue_flatpickr(){
704
-			wp_enqueue_style( 'flatpickr' );
705
-			wp_enqueue_script( 'flatpickr' );
706
-		}
707
-
708
-		/**
709
-		 * Enqueue iconpicker if called.
710
-		 */
711
-		public function enqueue_iconpicker(){
712
-			wp_enqueue_style( 'iconpicker' );
713
-			wp_enqueue_script( 'iconpicker' );
714
-		}
715
-
716
-		/**
717
-		 * Get the url path to the current folder.
718
-		 *
719
-		 * @return string
720
-		 */
721
-		public function get_url() {
722
-			$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
723
-			$content_url = untrailingslashit( WP_CONTENT_URL );
724
-
725
-			// Replace http:// to https://.
726
-			if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
727
-				$content_url = str_replace( 'http://', 'https://', $content_url );
728
-			}
729
-
730
-			// Check if we are inside a plugin
731
-			$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
732
-			$url = str_replace( $content_dir, $content_url, $file_dir );
733
-
734
-			return trailingslashit( $url );
735
-		}
736
-
737
-		/**
738
-		 * Get the url path to the current folder.
739
-		 *
740
-		 * @return string
741
-		 */
742
-		public function get_url_old() {
743
-
744
-			$url = '';
745
-			// check if we are inside a plugin
746
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
747
-
748
-			// add check in-case user has changed wp-content dir name.
749
-			$wp_content_folder_name = basename(WP_CONTENT_DIR);
750
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
751
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
752
-
753
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
754
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
755
-			}
756
-
757
-			return $url;
758
-		}
759
-
760
-		/**
761
-		 * Register the database settings with WordPress.
762
-		 */
763
-		public function register_settings() {
764
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
765
-		}
766
-
767
-		/**
768
-		 * Add the WordPress settings menu item.
769
-		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
770
-		 */
771
-		public function menu_item() {
772
-			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
773
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
774
-				$this,
775
-				'settings_page'
776
-			) );
777
-		}
778
-
779
-		/**
780
-		 * Get a list of themes and their default JS settings.
781
-		 *
782
-		 * @return array
783
-		 */
784
-		public function theme_js_settings(){
785
-			return array(
786
-				'ayetheme' => 'popper',
787
-				'listimia' => 'required',
788
-				'listimia_backend' => 'core-popper',
789
-				//'avada'    => 'required', // removed as we now add compatibility
790
-			);
791
-		}
792
-
793
-		/**
794
-		 * Get the current Font Awesome output settings.
795
-		 *
796
-		 * @return array The array of settings.
797
-		 */
798
-		public function get_settings() {
799
-
800
-			$db_settings = get_option( 'ayecode-ui-settings' );
801
-			$js_default = 'core-popper';
802
-			$js_default_backend = $js_default;
803
-
804
-			// maybe set defaults (if no settings set)
805
-			if(empty($db_settings)){
806
-				$active_theme = strtolower( get_template() ); // active parent theme.
807
-				$theme_js_settings = self::theme_js_settings();
808
-				if(isset($theme_js_settings[$active_theme])){
809
-					$js_default = $theme_js_settings[$active_theme];
810
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
811
-				}
812
-			}
641
+        /**
642
+         * Adds the Font Awesome JS.
643
+         */
644
+        public function enqueue_scripts() {
813 645
 
814
-			/**
815
-			 * Filter the default settings.
816
-			 */
817
-			$defaults = apply_filters( 'ayecode-ui-default-settings', array(
818
-				'css'            => 'compatibility', // core, compatibility
819
-				'js'             => $js_default, // js to load, core-popper, popper
820
-				'html_font_size' => '16', // js to load, core-popper, popper
821
-				'css_backend'    => 'compatibility', // core, compatibility
822
-				'js_backend'     => $js_default_backend, // js to load, core-popper, popper
823
-				'disable_admin'  => '', // URL snippets to disable loading on admin
646
+            if( is_admin() && !$this->is_aui_screen()){
647
+                // don't add wp-admin scripts if not requested to
648
+            }else {
649
+
650
+                $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
651
+
652
+                $bs_ver = $this->settings['bs_ver'] == '5' ? '-v5' : '';
653
+
654
+                // select2
655
+                wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
656
+
657
+                // flatpickr
658
+                wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
659
+
660
+                // flatpickr
661
+                wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
662
+
663
+                // Bootstrap file browser
664
+                wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
665
+                wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
666
+
667
+                $load_inline = false;
668
+
669
+                if ( $this->settings[ $js_setting ] == 'core-popper' ) {
670
+                    // Bootstrap bundle
671
+                    $url = $this->url . 'assets' . $bs_ver . '/js/bootstrap.bundle.min.js';
672
+                    wp_register_script( 'bootstrap-js-bundle', $url, array(
673
+                        'select2',
674
+                        'jquery'
675
+                    ), $this->version, $this->is_bs3_compat() );
676
+                    // if in admin then add to footer for compatibility.
677
+                    is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
678
+                    $script = $this->inline_script();
679
+                    wp_add_inline_script( 'bootstrap-js-bundle', $script );
680
+                } elseif ( $this->settings[ $js_setting ] == 'popper' ) {
681
+                    $url = $this->url . 'assets/js/popper.min.js'; //@todo we need to update this to bs5
682
+                    wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version );
683
+                    wp_enqueue_script( 'bootstrap-js-popper' );
684
+                    $load_inline = true;
685
+                } else {
686
+                    $load_inline = true;
687
+                }
688
+
689
+                // Load needed inline scripts by faking the loading of a script if the main script is not being loaded
690
+                if ( $load_inline ) {
691
+                    wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
692
+                    wp_enqueue_script( 'bootstrap-dummy' );
693
+                    $script = $this->inline_script();
694
+                    wp_add_inline_script( 'bootstrap-dummy', $script );
695
+                }
696
+            }
697
+
698
+        }
699
+
700
+        /**
701
+         * Enqueue flatpickr if called.
702
+         */
703
+        public function enqueue_flatpickr(){
704
+            wp_enqueue_style( 'flatpickr' );
705
+            wp_enqueue_script( 'flatpickr' );
706
+        }
707
+
708
+        /**
709
+         * Enqueue iconpicker if called.
710
+         */
711
+        public function enqueue_iconpicker(){
712
+            wp_enqueue_style( 'iconpicker' );
713
+            wp_enqueue_script( 'iconpicker' );
714
+        }
715
+
716
+        /**
717
+         * Get the url path to the current folder.
718
+         *
719
+         * @return string
720
+         */
721
+        public function get_url() {
722
+            $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
723
+            $content_url = untrailingslashit( WP_CONTENT_URL );
724
+
725
+            // Replace http:// to https://.
726
+            if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
727
+                $content_url = str_replace( 'http://', 'https://', $content_url );
728
+            }
729
+
730
+            // Check if we are inside a plugin
731
+            $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
732
+            $url = str_replace( $content_dir, $content_url, $file_dir );
733
+
734
+            return trailingslashit( $url );
735
+        }
736
+
737
+        /**
738
+         * Get the url path to the current folder.
739
+         *
740
+         * @return string
741
+         */
742
+        public function get_url_old() {
743
+
744
+            $url = '';
745
+            // check if we are inside a plugin
746
+            $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
747
+
748
+            // add check in-case user has changed wp-content dir name.
749
+            $wp_content_folder_name = basename(WP_CONTENT_DIR);
750
+            $dir_parts = explode("/$wp_content_folder_name/",$file_dir);
751
+            $url_parts = explode("/$wp_content_folder_name/",plugins_url());
752
+
753
+            if(!empty($url_parts[0]) && !empty($dir_parts[1])){
754
+                $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
755
+            }
756
+
757
+            return $url;
758
+        }
759
+
760
+        /**
761
+         * Register the database settings with WordPress.
762
+         */
763
+        public function register_settings() {
764
+            register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
765
+        }
766
+
767
+        /**
768
+         * Add the WordPress settings menu item.
769
+         * @since 1.0.10 Calling function name direct will fail theme check so we don't.
770
+         */
771
+        public function menu_item() {
772
+            $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
773
+            call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
774
+                $this,
775
+                'settings_page'
776
+            ) );
777
+        }
778
+
779
+        /**
780
+         * Get a list of themes and their default JS settings.
781
+         *
782
+         * @return array
783
+         */
784
+        public function theme_js_settings(){
785
+            return array(
786
+                'ayetheme' => 'popper',
787
+                'listimia' => 'required',
788
+                'listimia_backend' => 'core-popper',
789
+                //'avada'    => 'required', // removed as we now add compatibility
790
+            );
791
+        }
792
+
793
+        /**
794
+         * Get the current Font Awesome output settings.
795
+         *
796
+         * @return array The array of settings.
797
+         */
798
+        public function get_settings() {
799
+
800
+            $db_settings = get_option( 'ayecode-ui-settings' );
801
+            $js_default = 'core-popper';
802
+            $js_default_backend = $js_default;
803
+
804
+            // maybe set defaults (if no settings set)
805
+            if(empty($db_settings)){
806
+                $active_theme = strtolower( get_template() ); // active parent theme.
807
+                $theme_js_settings = self::theme_js_settings();
808
+                if(isset($theme_js_settings[$active_theme])){
809
+                    $js_default = $theme_js_settings[$active_theme];
810
+                    $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
811
+                }
812
+            }
813
+
814
+            /**
815
+             * Filter the default settings.
816
+             */
817
+            $defaults = apply_filters( 'ayecode-ui-default-settings', array(
818
+                'css'            => 'compatibility', // core, compatibility
819
+                'js'             => $js_default, // js to load, core-popper, popper
820
+                'html_font_size' => '16', // js to load, core-popper, popper
821
+                'css_backend'    => 'compatibility', // core, compatibility
822
+                'js_backend'     => $js_default_backend, // js to load, core-popper, popper
823
+                'disable_admin'  => '', // URL snippets to disable loading on admin
824 824
                 'bs_ver'         => '4', // The default bootstrap version to sue by default
825
-			), $db_settings );
825
+            ), $db_settings );
826 826
 
827
-			$settings = wp_parse_args( $db_settings, $defaults );
827
+            $settings = wp_parse_args( $db_settings, $defaults );
828 828
 
829
-			/**
830
-			 * Filter the Bootstrap settings.
831
-			 *
832
-			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
833
-			 */
834
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
835
-		}
829
+            /**
830
+             * Filter the Bootstrap settings.
831
+             *
832
+             * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
833
+             */
834
+            return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
835
+        }
836 836
 
837 837
 
838
-		/**
839
-		 * The settings page html output.
840
-		 */
841
-		public function settings_page() {
842
-			if ( ! current_user_can( 'manage_options' ) ) {
843
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
844
-			}
838
+        /**
839
+         * The settings page html output.
840
+         */
841
+        public function settings_page() {
842
+            if ( ! current_user_can( 'manage_options' ) ) {
843
+                wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
844
+            }
845 845
             $overrides = apply_filters( 'ayecode-ui-settings', array(), array(), array() );
846 846
 
847
-			?>
847
+            ?>
848 848
             <div class="wrap">
849 849
                 <h1><?php echo $this->name; ?></h1>
850 850
                 <p><?php echo apply_filters( 'ayecode-ui-settings-message', __("Here you can adjust settings if you are having compatibility issues.",'aui') );?></p>
851 851
                 <form method="post" action="options.php">
852 852
 					<?php
853
-					settings_fields( 'ayecode-ui-settings' );
854
-					do_settings_sections( 'ayecode-ui-settings' );
855
-					?>
853
+                    settings_fields( 'ayecode-ui-settings' );
854
+                    do_settings_sections( 'ayecode-ui-settings' );
855
+                    ?>
856 856
 
857 857
                     <h2><?php _e( 'BootStrap Version', 'aui' ); ?></h2>
858 858
                     <p><?php echo apply_filters( 'ayecode-ui-version-settings-message', __("V5 is recommended, however if you have another plugin installed using v4, you may need to use v4 also.",'aui') );?></p>
859 859
 	                <div class="bsui"><?php
860
-	                if ( ! empty( $overrides ) ) {
861
-		                echo aui()->alert(array(
862
-			                'type'=> 'info',
863
-			                'content'=> __("Some options are disabled as your current theme is overriding them.",'aui')
864
-		                ));
865
-	                }
866
-	                ?>
860
+                    if ( ! empty( $overrides ) ) {
861
+                        echo aui()->alert(array(
862
+                            'type'=> 'info',
863
+                            'content'=> __("Some options are disabled as your current theme is overriding them.",'aui')
864
+                        ));
865
+                    }
866
+                    ?>
867 867
                     </div>
868 868
                     <table class="form-table wpbs-table-version-settings">
869 869
                         <tr valign="top">
@@ -956,79 +956,79 @@  discard block
 block discarded – undo
956 956
                     </table>
957 957
 
958 958
 					<?php
959
-					submit_button();
960
-					?>
959
+                    submit_button();
960
+                    ?>
961 961
                 </form>
962 962
 
963 963
                 <div id="wpbs-version" data-aui-source="<?php echo esc_attr( $this->get_load_source() ); ?>"><?php echo $this->version; ?></div>
964 964
             </div>
965 965
 
966 966
 			<?php
967
-		}
967
+        }
968 968
 
969 969
         public function get_load_source(){
970
-	        $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) );
971
-	        $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) );
972
-
973
-	        // Find source plugin/theme of SD
974
-	        $source = array();
975
-	        if ( strpos( $file, $plugins_dir ) !== false ) {
976
-		        $source = explode( "/", plugin_basename( $file ) );
977
-	        } else if ( function_exists( 'get_theme_root' ) ) {
978
-		        $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) );
979
-
980
-		        if ( strpos( $file, $themes_dir ) !== false ) {
981
-			        $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) );
982
-		        }
983
-	        }
970
+            $file = str_replace( array( "/", "\\" ), "/", realpath( __FILE__ ) );
971
+            $plugins_dir = str_replace( array( "/", "\\" ), "/", realpath( WP_PLUGIN_DIR ) );
972
+
973
+            // Find source plugin/theme of SD
974
+            $source = array();
975
+            if ( strpos( $file, $plugins_dir ) !== false ) {
976
+                $source = explode( "/", plugin_basename( $file ) );
977
+            } else if ( function_exists( 'get_theme_root' ) ) {
978
+                $themes_dir = str_replace( array( "/", "\\" ), "/", realpath( get_theme_root() ) );
979
+
980
+                if ( strpos( $file, $themes_dir ) !== false ) {
981
+                    $source = explode( "/", ltrim( str_replace( $themes_dir, "", $file ), "/" ) );
982
+                }
983
+            }
984 984
 
985 985
             return isset($source[0]) ? esc_attr($source[0]) : '';
986 986
         }
987 987
 
988
-		public function customizer_settings($wp_customize){
989
-			$wp_customize->add_section('aui_settings', array(
990
-				'title'    => __('AyeCode UI','aui'),
991
-				'priority' => 120,
992
-			));
993
-
994
-			//  =============================
995
-			//  = Color Picker              =
996
-			//  =============================
997
-			$wp_customize->add_setting('aui_options[color_primary]', array(
998
-				'default'           => AUI_PRIMARY_COLOR,
999
-				'sanitize_callback' => 'sanitize_hex_color',
1000
-				'capability'        => 'edit_theme_options',
1001
-				'type'              => 'option',
1002
-				'transport'         => 'refresh',
1003
-			));
1004
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1005
-				'label'    => __('Primary Color','aui'),
1006
-				'section'  => 'aui_settings',
1007
-				'settings' => 'aui_options[color_primary]',
1008
-			)));
1009
-
1010
-			$wp_customize->add_setting('aui_options[color_secondary]', array(
1011
-				'default'           => '#6c757d',
1012
-				'sanitize_callback' => 'sanitize_hex_color',
1013
-				'capability'        => 'edit_theme_options',
1014
-				'type'              => 'option',
1015
-				'transport'         => 'refresh',
1016
-			));
1017
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1018
-				'label'    => __('Secondary Color','aui'),
1019
-				'section'  => 'aui_settings',
1020
-				'settings' => 'aui_options[color_secondary]',
1021
-			)));
1022
-		}
1023
-
1024
-		/**
1025
-		 * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1026
-		 *
1027
-		 * @return mixed
1028
-		 */
1029
-		public static function bs3_compat_css() {
1030
-			ob_start();
1031
-			?>
988
+        public function customizer_settings($wp_customize){
989
+            $wp_customize->add_section('aui_settings', array(
990
+                'title'    => __('AyeCode UI','aui'),
991
+                'priority' => 120,
992
+            ));
993
+
994
+            //  =============================
995
+            //  = Color Picker              =
996
+            //  =============================
997
+            $wp_customize->add_setting('aui_options[color_primary]', array(
998
+                'default'           => AUI_PRIMARY_COLOR,
999
+                'sanitize_callback' => 'sanitize_hex_color',
1000
+                'capability'        => 'edit_theme_options',
1001
+                'type'              => 'option',
1002
+                'transport'         => 'refresh',
1003
+            ));
1004
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1005
+                'label'    => __('Primary Color','aui'),
1006
+                'section'  => 'aui_settings',
1007
+                'settings' => 'aui_options[color_primary]',
1008
+            )));
1009
+
1010
+            $wp_customize->add_setting('aui_options[color_secondary]', array(
1011
+                'default'           => '#6c757d',
1012
+                'sanitize_callback' => 'sanitize_hex_color',
1013
+                'capability'        => 'edit_theme_options',
1014
+                'type'              => 'option',
1015
+                'transport'         => 'refresh',
1016
+            ));
1017
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1018
+                'label'    => __('Secondary Color','aui'),
1019
+                'section'  => 'aui_settings',
1020
+                'settings' => 'aui_options[color_secondary]',
1021
+            )));
1022
+        }
1023
+
1024
+        /**
1025
+         * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1026
+         *
1027
+         * @return mixed
1028
+         */
1029
+        public static function bs3_compat_css() {
1030
+            ob_start();
1031
+            ?>
1032 1032
             <style>
1033 1033
                 /* Bootstrap 3 compatibility */
1034 1034
                 body.modal-open .modal-backdrop.show:not(.in) {opacity:0.5;}
@@ -1057,57 +1057,57 @@  discard block
 block discarded – undo
1057 1057
                 <?php } ?>
1058 1058
             </style>
1059 1059
 			<?php
1060
-			return str_replace( array(
1061
-				'<style>',
1062
-				'</style>'
1063
-			), '', self::minify_css( ob_get_clean() ) );
1064
-		}
1060
+            return str_replace( array(
1061
+                '<style>',
1062
+                '</style>'
1063
+            ), '', self::minify_css( ob_get_clean() ) );
1064
+        }
1065 1065
 
1066 1066
 
1067
-		public static function custom_css($compatibility = true) {
1067
+        public static function custom_css($compatibility = true) {
1068 1068
             global $aui_bs5;
1069 1069
 
1070
-			$colors = array();
1071
-			if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1070
+            $colors = array();
1071
+            if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1072 1072
 
1073
-				$setting = wp_get_global_settings();
1073
+                $setting = wp_get_global_settings();
1074 1074
 
1075 1075
 //                print_r(wp_get_global_styles());exit;
1076 1076
 //                print_r(get_default_block_editor_settings());exit;
1077 1077
 
1078 1078
 //                print_r($setting);echo  '###';exit;
1079
-				if(!empty($setting['color']['palette']['theme'])){
1080
-					foreach($setting['color']['palette']['theme'] as $color){
1081
-						$colors[$color['slug']] = esc_attr($color['color']);
1082
-					}
1083
-				}
1079
+                if(!empty($setting['color']['palette']['theme'])){
1080
+                    foreach($setting['color']['palette']['theme'] as $color){
1081
+                        $colors[$color['slug']] = esc_attr($color['color']);
1082
+                    }
1083
+                }
1084 1084
 
1085
-				if(!empty($setting['color']['palette']['custom'])){
1086
-					foreach($setting['color']['palette']['custom'] as $color){
1087
-						$colors[$color['slug']] = esc_attr($color['color']);
1088
-					}
1089
-				}
1090
-			}else{
1091
-				$settings = get_option('aui_options');
1092
-				$colors = array(
1093
-					'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1094
-					'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1095
-				);
1096
-			}
1085
+                if(!empty($setting['color']['palette']['custom'])){
1086
+                    foreach($setting['color']['palette']['custom'] as $color){
1087
+                        $colors[$color['slug']] = esc_attr($color['color']);
1088
+                    }
1089
+                }
1090
+            }else{
1091
+                $settings = get_option('aui_options');
1092
+                $colors = array(
1093
+                    'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1094
+                    'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1095
+                );
1096
+            }
1097 1097
 
1098
-			ob_start();
1098
+            ob_start();
1099 1099
 
1100
-			?>
1100
+            ?>
1101 1101
             <style>
1102 1102
                 <?php
1103 1103
 
1104
-					// BS v3 compat
1105
-					if( self::is_bs3_compat() ){
1106
-						echo self::bs3_compat_css();
1107
-					}
1104
+                    // BS v3 compat
1105
+                    if( self::is_bs3_compat() ){
1106
+                        echo self::bs3_compat_css();
1107
+                    }
1108 1108
 
1109
-					if(!empty($colors)){
1110
-						$d_colors = self::get_colors(true);
1109
+                    if(!empty($colors)){
1110
+                        $d_colors = self::get_colors(true);
1111 1111
 
1112 1112
                         $current_screen = function_exists('get_current_screen' ) ? get_current_screen() : '';
1113 1113
                         $is_fse = false;
@@ -1116,22 +1116,22 @@  discard block
 block discarded – undo
1116 1116
                         }
1117 1117
 
1118 1118
 //						$is_fse = !empty($_REQUEST['postType']) && $_REQUEST['postType']=='wp_template';
1119
-						foreach($colors as $key => $color ){
1120
-							if((empty( $d_colors[$key]) ||  $d_colors[$key] != $color) || $is_fse ) {
1121
-								$var = $is_fse ? "var(--wp--preset--color--$key)" : $color;
1122
-								$compat = $is_fse ? '.editor-styles-wrapper' : $compatibility;
1123
-								echo $aui_bs5 ? self::css_overwrite_bs5($key,$var,$compat,$color) : self::css_overwrite($key,$var,$compat,$color);
1124
-							}
1125
-						}
1126
-					   // exit;
1127
-					}
1119
+                        foreach($colors as $key => $color ){
1120
+                            if((empty( $d_colors[$key]) ||  $d_colors[$key] != $color) || $is_fse ) {
1121
+                                $var = $is_fse ? "var(--wp--preset--color--$key)" : $color;
1122
+                                $compat = $is_fse ? '.editor-styles-wrapper' : $compatibility;
1123
+                                echo $aui_bs5 ? self::css_overwrite_bs5($key,$var,$compat,$color) : self::css_overwrite($key,$var,$compat,$color);
1124
+                            }
1125
+                        }
1126
+                        // exit;
1127
+                    }
1128 1128
 
1129
-					// Set admin bar z-index lower when modal is open.
1130
-					echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1129
+                    // Set admin bar z-index lower when modal is open.
1130
+                    echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1131 1131
 
1132
-					if(is_admin()){
1133
-						echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1134
-					}
1132
+                    if(is_admin()){
1133
+                        echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1134
+                    }
1135 1135
 
1136 1136
                     if( $aui_bs5 && defined( 'BLOCKSTRAP_VERSION' ) ){
1137 1137
                         $css = '';
@@ -1151,170 +1151,170 @@  discard block
 block discarded – undo
1151 1151
                             echo 'body{' . $css . '}';
1152 1152
                         }
1153 1153
                     }
1154
-				?>
1154
+                ?>
1155 1155
             </style>
1156 1156
 			<?php
1157 1157
 
1158 1158
 
1159
-			/*
1159
+            /*
1160 1160
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1161 1161
 			 */
1162
-			return str_replace( array(
1163
-				'<style>',
1164
-				'</style>'
1165
-			), '', self::minify_css( ob_get_clean() ) );
1166
-		}
1167
-
1168
-
1169
-
1170
-		/**
1171
-		 * Check if we should add booststrap 3 compatibility changes.
1172
-		 *
1173
-		 * @return bool
1174
-		 */
1175
-		public static function is_bs3_compat(){
1176
-			return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1177
-		}
1178
-
1179
-		public static function hex_to_rgb($hex) {
1180
-			// Remove '#' if present
1181
-			$hex = str_replace('#', '', $hex);
1182
-
1183
-			// Convert 3-digit hex to 6-digit hex
1184
-			if(strlen($hex) == 3) {
1185
-				$hex = str_repeat(substr($hex, 0, 1), 2) . str_repeat(substr($hex, 1, 1), 2) . str_repeat(substr($hex, 2, 1), 2);
1186
-			}
1187
-
1188
-			// Convert hex to RGB
1189
-			$r = hexdec(substr($hex, 0, 2));
1190
-			$g = hexdec(substr($hex, 2, 2));
1191
-			$b = hexdec(substr($hex, 4, 2));
1192
-
1193
-			// Return RGB values as an array
1194
-			return $r . ',' . $g . ',' . $b;
1195
-		}
1196
-
1197
-		/**
1198
-		 * Build the CSS to overwrite a bootstrap color variable.
1199
-		 *
1200
-		 * @param $type
1201
-		 * @param $color_code
1202
-		 * @param $compatibility
1203
-		 *
1204
-		 * @return string
1205
-		 */
1206
-		public static function css_overwrite_bs5($type,$color_code,$compatibility, $hex = '' ){
1207
-			global $aui_bs5;
1208
-
1209
-			$is_var = false;
1210
-			if(!$color_code){return '';}
1211
-			if(strpos($color_code, 'var') !== false){
1212
-				//if(!sanitize_hex_color($color_code)){
1213
-				$color_code = esc_attr($color_code);
1214
-				$is_var = true;
1162
+            return str_replace( array(
1163
+                '<style>',
1164
+                '</style>'
1165
+            ), '', self::minify_css( ob_get_clean() ) );
1166
+        }
1167
+
1168
+
1169
+
1170
+        /**
1171
+         * Check if we should add booststrap 3 compatibility changes.
1172
+         *
1173
+         * @return bool
1174
+         */
1175
+        public static function is_bs3_compat(){
1176
+            return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1177
+        }
1178
+
1179
+        public static function hex_to_rgb($hex) {
1180
+            // Remove '#' if present
1181
+            $hex = str_replace('#', '', $hex);
1182
+
1183
+            // Convert 3-digit hex to 6-digit hex
1184
+            if(strlen($hex) == 3) {
1185
+                $hex = str_repeat(substr($hex, 0, 1), 2) . str_repeat(substr($hex, 1, 1), 2) . str_repeat(substr($hex, 2, 1), 2);
1186
+            }
1187
+
1188
+            // Convert hex to RGB
1189
+            $r = hexdec(substr($hex, 0, 2));
1190
+            $g = hexdec(substr($hex, 2, 2));
1191
+            $b = hexdec(substr($hex, 4, 2));
1192
+
1193
+            // Return RGB values as an array
1194
+            return $r . ',' . $g . ',' . $b;
1195
+        }
1196
+
1197
+        /**
1198
+         * Build the CSS to overwrite a bootstrap color variable.
1199
+         *
1200
+         * @param $type
1201
+         * @param $color_code
1202
+         * @param $compatibility
1203
+         *
1204
+         * @return string
1205
+         */
1206
+        public static function css_overwrite_bs5($type,$color_code,$compatibility, $hex = '' ){
1207
+            global $aui_bs5;
1208
+
1209
+            $is_var = false;
1210
+            if(!$color_code){return '';}
1211
+            if(strpos($color_code, 'var') !== false){
1212
+                //if(!sanitize_hex_color($color_code)){
1213
+                $color_code = esc_attr($color_code);
1214
+                $is_var = true;
1215 1215
 //				$color_code = "rgba($color_code, 0.5)";
1216 1216
 //                echo '###1'.$color_code.'###';//exit;
1217
-			}
1217
+            }
1218 1218
 
1219 1219
 //            echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit;
1220 1220
 
1221
-			if(!$color_code){return '';}
1221
+            if(!$color_code){return '';}
1222 1222
 
1223
-			$rgb = self::hex_to_rgb($hex);
1223
+            $rgb = self::hex_to_rgb($hex);
1224 1224
 
1225
-			if($compatibility===true || $compatibility===1){
1226
-				$compatibility = '.bsui';
1227
-			}elseif(!$compatibility){
1228
-				$compatibility = '';
1229
-			}else{
1230
-				$compatibility = esc_attr($compatibility);
1231
-			}
1225
+            if($compatibility===true || $compatibility===1){
1226
+                $compatibility = '.bsui';
1227
+            }elseif(!$compatibility){
1228
+                $compatibility = '';
1229
+            }else{
1230
+                $compatibility = esc_attr($compatibility);
1231
+            }
1232 1232
 
1233
-			$prefix = $compatibility ? $compatibility . " " : "";
1233
+            $prefix = $compatibility ? $compatibility . " " : "";
1234 1234
 
1235 1235
 
1236 1236
             $output = '';
1237 1237
 
1238 1238
 //            echo '####'.$color_code;exit;
1239 1239
 
1240
-			$type = sanitize_html_class($type);
1240
+            $type = sanitize_html_class($type);
1241
+
1242
+            /**
1243
+             * c = color, b = background color, o = border-color, f = fill
1244
+             */
1245
+            $selectors = array(
1246
+                ".btn-{$type}"                                              => array( 'b', 'o' ),
1247
+                ".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
1248
+                ".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
1249
+                ".btn-outline-{$type}"                                      => array( 'c', 'o' ),
1250
+                ".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
1251
+                ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
1252
+                ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
1253
+                ".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
1254
+                ".badge-{$type}"                                            => array( 'b' ),
1255
+                ".alert-{$type}"                                            => array( 'b', 'o' ),
1256
+                ".bg-{$type}"                                               => array( 'b', 'f' ),
1257
+                ".btn-link.btn-{$type}"                                     => array( 'c' ),
1258
+            );
1259
+
1260
+            if ( $aui_bs5 ) {
1261
+                unset($selectors[".alert-{$type}" ]);
1262
+            }
1241 1263
 
1242
-			/**
1243
-			 * c = color, b = background color, o = border-color, f = fill
1244
-			 */
1245
-			$selectors = array(
1246
-				".btn-{$type}"                                              => array( 'b', 'o' ),
1247
-				".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
1248
-				".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
1249
-				".btn-outline-{$type}"                                      => array( 'c', 'o' ),
1250
-				".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
1251
-				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
1252
-				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
1253
-				".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
1254
-				".badge-{$type}"                                            => array( 'b' ),
1255
-				".alert-{$type}"                                            => array( 'b', 'o' ),
1256
-				".bg-{$type}"                                               => array( 'b', 'f' ),
1257
-				".btn-link.btn-{$type}"                                     => array( 'c' ),
1258
-			);
1259
-
1260
-			if ( $aui_bs5 ) {
1261
-				unset($selectors[".alert-{$type}" ]);
1262
-			}
1263
-
1264
-			if ( $type == 'primary' ) {
1265
-				$selectors = $selectors + array(
1266
-						'a'                                                                                                    => array( 'c' ),
1267
-						'.btn-link'                                                                                            => array( 'c' ),
1268
-						'.dropdown-item.active'                                                                                => array( 'b' ),
1269
-						'.custom-control-input:checked~.custom-control-label::before'                                          => array(
1270
-							'b',
1271
-							'o'
1272
-						),
1273
-						'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
1274
-							'b',
1275
-							'o'
1276
-						),
1277
-						'.nav-pills .nav-link.active'                                                                          => array( 'b' ),
1278
-						'.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
1279
-						'.page-link'                                                                                           => array( 'c' ),
1280
-						'.page-item.active .page-link'                                                                         => array(
1281
-							'b',
1282
-							'o'
1283
-						),
1284
-						'.progress-bar'                                                                                        => array( 'b' ),
1285
-						'.list-group-item.active'                                                                              => array(
1286
-							'b',
1287
-							'o'
1288
-						),
1289
-						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
1290
-					);
1291
-			}
1264
+            if ( $type == 'primary' ) {
1265
+                $selectors = $selectors + array(
1266
+                        'a'                                                                                                    => array( 'c' ),
1267
+                        '.btn-link'                                                                                            => array( 'c' ),
1268
+                        '.dropdown-item.active'                                                                                => array( 'b' ),
1269
+                        '.custom-control-input:checked~.custom-control-label::before'                                          => array(
1270
+                            'b',
1271
+                            'o'
1272
+                        ),
1273
+                        '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
1274
+                            'b',
1275
+                            'o'
1276
+                        ),
1277
+                        '.nav-pills .nav-link.active'                                                                          => array( 'b' ),
1278
+                        '.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
1279
+                        '.page-link'                                                                                           => array( 'c' ),
1280
+                        '.page-item.active .page-link'                                                                         => array(
1281
+                            'b',
1282
+                            'o'
1283
+                        ),
1284
+                        '.progress-bar'                                                                                        => array( 'b' ),
1285
+                        '.list-group-item.active'                                                                              => array(
1286
+                            'b',
1287
+                            'o'
1288
+                        ),
1289
+                        '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
1290
+                    );
1291
+            }
1292 1292
 
1293 1293
 
1294 1294
 
1295 1295
             // link
1296
-			if ( $type === 'primary' ) {
1297
-				$output .= 'html body {--bs-link-hover-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .75); --bs-link-color: var(--bs-'.esc_attr($type).'); }';
1298
-				$output .= $prefix . ' .breadcrumb{--bs-breadcrumb-item-active-color: '.esc_attr($color_code).';  }';
1299
-				$output .= $prefix . ' .navbar { --bs-nav-link-hover-color: '.esc_attr($color_code).'; --bs-navbar-hover-color: '.esc_attr($color_code).'; --bs-navbar-active-color: '.esc_attr($color_code).'; }';
1296
+            if ( $type === 'primary' ) {
1297
+                $output .= 'html body {--bs-link-hover-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .75); --bs-link-color: var(--bs-'.esc_attr($type).'); }';
1298
+                $output .= $prefix . ' .breadcrumb{--bs-breadcrumb-item-active-color: '.esc_attr($color_code).';  }';
1299
+                $output .= $prefix . ' .navbar { --bs-nav-link-hover-color: '.esc_attr($color_code).'; --bs-navbar-hover-color: '.esc_attr($color_code).'; --bs-navbar-active-color: '.esc_attr($color_code).'; }';
1300 1300
 
1301
-				$output .= $prefix . ' a{color: var(--bs-'.esc_attr($type).');}';
1302
-				$output .= $prefix . ' .text-primary{color: var(--bs-'.esc_attr($type).') !important;}';
1301
+                $output .= $prefix . ' a{color: var(--bs-'.esc_attr($type).');}';
1302
+                $output .= $prefix . ' .text-primary{color: var(--bs-'.esc_attr($type).') !important;}';
1303 1303
 
1304 1304
                 // dropdown
1305
-				$output .= $prefix . ' .dropdown-menu{--bs-dropdown-link-hover-color: var(--bs-'.esc_attr($type).'); --bs-dropdown-link-active-color: var(--bs-'.esc_attr($type).');}';
1305
+                $output .= $prefix . ' .dropdown-menu{--bs-dropdown-link-hover-color: var(--bs-'.esc_attr($type).'); --bs-dropdown-link-active-color: var(--bs-'.esc_attr($type).');}';
1306 1306
 
1307 1307
                 // pagination
1308
-				$output .= $prefix . ' .pagination{--bs-pagination-hover-color: var(--bs-'.esc_attr($type).'); --bs-pagination-active-bg: var(--bs-'.esc_attr($type).');}';
1308
+                $output .= $prefix . ' .pagination{--bs-pagination-hover-color: var(--bs-'.esc_attr($type).'); --bs-pagination-active-bg: var(--bs-'.esc_attr($type).');}';
1309 1309
 
1310
-			}
1310
+            }
1311 1311
 
1312
-			$output .= $prefix . ' .link-'.esc_attr($type).':hover {color: rgba(var(--bs-'.esc_attr($type).'-rgb), .8) !important;}';
1312
+            $output .= $prefix . ' .link-'.esc_attr($type).':hover {color: rgba(var(--bs-'.esc_attr($type).'-rgb), .8) !important;}';
1313 1313
 
1314 1314
 
1315
-			//  buttons
1316
-			$output .= $prefix . ' .btn-'.esc_attr($type).'{';
1317
-			$output .= ' 
1315
+            //  buttons
1316
+            $output .= $prefix . ' .btn-'.esc_attr($type).'{';
1317
+            $output .= ' 
1318 1318
             --bs-btn-bg: '.esc_attr($color_code).';
1319 1319
             --bs-btn-border-color: '.esc_attr($color_code).';
1320 1320
             --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
@@ -1332,11 +1332,11 @@  discard block
 block discarded – undo
1332 1332
 //			--bs-btn-active-color: #fff;
1333 1333
 //			--bs-btn-disabled-color: #fff;
1334 1334
 //            ';
1335
-			$output .= '}';
1335
+            $output .= '}';
1336 1336
 
1337
-			//  buttons outline
1338
-			$output .= $prefix . ' .btn-outline-'.esc_attr($type).'{';
1339
-			$output .= ' 
1337
+            //  buttons outline
1338
+            $output .= $prefix . ' .btn-outline-'.esc_attr($type).'{';
1339
+            $output .= ' 
1340 1340
             --bs-btn-border-color: '.esc_attr($color_code).';
1341 1341
             --bs-btn-hover-bg: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
1342 1342
             --bs-btn-hover-border-color: rgba(var(--bs-'.esc_attr($type).'-rgb), .9);
@@ -1353,48 +1353,48 @@  discard block
 block discarded – undo
1353 1353
 //			--bs-btn-active-color: #fff;
1354 1354
 //			--bs-btn-disabled-color: #fff;
1355 1355
 //            ';
1356
-			$output .= '}';
1356
+            $output .= '}';
1357 1357
 
1358 1358
 
1359 1359
             // button hover
1360
-			$output .= $prefix . ' .btn-'.esc_attr($type).':hover{';
1361
-			$output .= ' 
1360
+            $output .= $prefix . ' .btn-'.esc_attr($type).':hover{';
1361
+            $output .= ' 
1362 1362
             box-shadow: 0 0.25rem 0.25rem 0.125rem rgb(var(--bs-'.esc_attr($type).'-rgb), .1), 0 0.375rem 0.75rem -0.125rem rgb(var(--bs-'.esc_attr($type).'-rgb) , .4);
1363 1363
             }
1364 1364
             ';
1365 1365
 
1366 1366
 
1367
-			if ( $aui_bs5 ) {
1367
+            if ( $aui_bs5 ) {
1368 1368
 //				$output .= $is_var ? 'html body {--bs-'.esc_attr($type).'-rgb: '.$color_code.'; }' : 'html body {--bs-'.esc_attr($type).'-rgb: '.self::hex_to_rgb($color_code).'; }';
1369
-				$output .= 'html body {--bs-'.esc_attr($type).': '.esc_attr($color_code).'; }';
1370
-				$output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }';
1371
-			}
1369
+                $output .= 'html body {--bs-'.esc_attr($type).': '.esc_attr($color_code).'; }';
1370
+                $output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }';
1371
+            }
1372 1372
 
1373 1373
 
1374 1374
 
1375 1375
 
1376 1376
 
1377
-			$transition = $is_var ? 'transition: color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out,filter 0.15s ease-in-out;' : '';
1378
-			// darken
1379
-			$darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
1380
-			$darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
1381
-			$darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
1382
-			$darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4");
1377
+            $transition = $is_var ? 'transition: color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out,filter 0.15s ease-in-out;' : '';
1378
+            // darken
1379
+            $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
1380
+            $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
1381
+            $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
1382
+            $darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4");
1383 1383
 
1384
-			// lighten
1385
-			$lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
1384
+            // lighten
1385
+            $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
1386 1386
 
1387
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
1388
-			$op_25 = $color_code."40"; // 25% opacity
1387
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
1388
+            $op_25 = $color_code."40"; // 25% opacity
1389 1389
 
1390 1390
 
1391
-			// button states
1392
-			$output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
1393
-			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1391
+            // button states
1392
+            $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
1393
+            $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1394 1394
 //			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000;    border-color: #000;} ";
1395
-			$output .= $prefix ." .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1396
-			$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1397
-			$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1395
+            $output .= $prefix ." .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1396
+            $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1397
+            $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1398 1398
 
1399 1399
 //			if ( $type == 'primary' ) {
1400 1400
 //				// dropdown's
@@ -1407,773 +1407,773 @@  discard block
 block discarded – undo
1407 1407
 //				$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1408 1408
 //			}
1409 1409
 
1410
-			// alerts
1411
-			if ( $aui_bs5 ) {
1410
+            // alerts
1411
+            if ( $aui_bs5 ) {
1412 1412
 //				$output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20;    border-color: ".$color_code."30;color:$darker_40} ";
1413
-				$output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1414
-			}
1415
-
1416
-			return $output;
1417
-		}
1418
-
1419
-		/**
1420
-		 * Build the CSS to overwrite a bootstrap color variable.
1421
-		 *
1422
-		 * @param $type
1423
-		 * @param $color_code
1424
-		 * @param $compatibility
1425
-		 *
1426
-		 * @return string
1427
-		 */
1428
-		public static function css_overwrite($type,$color_code,$compatibility, $hex = '' ){
1413
+                $output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1414
+            }
1415
+
1416
+            return $output;
1417
+        }
1418
+
1419
+        /**
1420
+         * Build the CSS to overwrite a bootstrap color variable.
1421
+         *
1422
+         * @param $type
1423
+         * @param $color_code
1424
+         * @param $compatibility
1425
+         *
1426
+         * @return string
1427
+         */
1428
+        public static function css_overwrite($type,$color_code,$compatibility, $hex = '' ){
1429 1429
             global $aui_bs5;
1430 1430
 
1431
-			$is_var = false;
1432
-			if(!$color_code){return '';}
1433
-			if(strpos($color_code, 'var') !== false){
1434
-				//if(!sanitize_hex_color($color_code)){
1435
-				$color_code = esc_attr($color_code);
1436
-				$is_var = true;
1431
+            $is_var = false;
1432
+            if(!$color_code){return '';}
1433
+            if(strpos($color_code, 'var') !== false){
1434
+                //if(!sanitize_hex_color($color_code)){
1435
+                $color_code = esc_attr($color_code);
1436
+                $is_var = true;
1437 1437
 //				$color_code = "rgba($color_code, 0.5)";
1438 1438
 //                echo '###1'.$color_code.'###';//exit;
1439
-			}
1439
+            }
1440 1440
 
1441 1441
 //            echo '@@@'.$color_code.'==='.self::hex_to_rgb($color_code);exit;
1442 1442
 
1443
-			if(!$color_code){return '';}
1443
+            if(!$color_code){return '';}
1444 1444
 
1445 1445
             $rgb = self::hex_to_rgb($hex);
1446 1446
 
1447
-			if($compatibility===true || $compatibility===1){
1448
-				$compatibility = '.bsui';
1449
-			}elseif(!$compatibility){
1450
-				$compatibility = '';
1451
-			}else{
1452
-				$compatibility = esc_attr($compatibility);
1453
-			}
1447
+            if($compatibility===true || $compatibility===1){
1448
+                $compatibility = '.bsui';
1449
+            }elseif(!$compatibility){
1450
+                $compatibility = '';
1451
+            }else{
1452
+                $compatibility = esc_attr($compatibility);
1453
+            }
1454 1454
 
1455 1455
 
1456 1456
 
1457 1457
 //            echo '####'.$color_code;exit;
1458 1458
 
1459
-			$type = sanitize_html_class($type);
1460
-
1461
-			/**
1462
-			 * c = color, b = background color, o = border-color, f = fill
1463
-			 */
1464
-			$selectors = array(
1465
-				".btn-{$type}"                                              => array( 'b', 'o' ),
1466
-				".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
1467
-				".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
1468
-				".btn-outline-{$type}"                                      => array( 'c', 'o' ),
1469
-				".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
1470
-				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
1471
-				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
1472
-				".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
1473
-				".badge-{$type}"                                            => array( 'b' ),
1474
-				".alert-{$type}"                                            => array( 'b', 'o' ),
1475
-				".bg-{$type}"                                               => array( 'b', 'f' ),
1476
-				".btn-link.btn-{$type}"                                     => array( 'c' ),
1477
-			);
1478
-
1479
-			if ( $aui_bs5 ) {
1459
+            $type = sanitize_html_class($type);
1460
+
1461
+            /**
1462
+             * c = color, b = background color, o = border-color, f = fill
1463
+             */
1464
+            $selectors = array(
1465
+                ".btn-{$type}"                                              => array( 'b', 'o' ),
1466
+                ".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
1467
+                ".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
1468
+                ".btn-outline-{$type}"                                      => array( 'c', 'o' ),
1469
+                ".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
1470
+                ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
1471
+                ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
1472
+                ".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
1473
+                ".badge-{$type}"                                            => array( 'b' ),
1474
+                ".alert-{$type}"                                            => array( 'b', 'o' ),
1475
+                ".bg-{$type}"                                               => array( 'b', 'f' ),
1476
+                ".btn-link.btn-{$type}"                                     => array( 'c' ),
1477
+            );
1478
+
1479
+            if ( $aui_bs5 ) {
1480 1480
                 unset($selectors[".alert-{$type}" ]);
1481
-			}
1482
-
1483
-			if ( $type == 'primary' ) {
1484
-				$selectors = $selectors + array(
1485
-						'a'                                                                                                    => array( 'c' ),
1486
-						'.btn-link'                                                                                            => array( 'c' ),
1487
-						'.dropdown-item.active'                                                                                => array( 'b' ),
1488
-						'.custom-control-input:checked~.custom-control-label::before'                                          => array(
1489
-							'b',
1490
-							'o'
1491
-						),
1492
-						'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
1493
-							'b',
1494
-							'o'
1495
-						),
1496
-						'.nav-pills .nav-link.active'                                                                          => array( 'b' ),
1497
-						'.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
1498
-						'.page-link'                                                                                           => array( 'c' ),
1499
-						'.page-item.active .page-link'                                                                         => array(
1500
-							'b',
1501
-							'o'
1502
-						),
1503
-						'.progress-bar'                                                                                        => array( 'b' ),
1504
-						'.list-group-item.active'                                                                              => array(
1505
-							'b',
1506
-							'o'
1507
-						),
1508
-						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
1481
+            }
1482
+
1483
+            if ( $type == 'primary' ) {
1484
+                $selectors = $selectors + array(
1485
+                        'a'                                                                                                    => array( 'c' ),
1486
+                        '.btn-link'                                                                                            => array( 'c' ),
1487
+                        '.dropdown-item.active'                                                                                => array( 'b' ),
1488
+                        '.custom-control-input:checked~.custom-control-label::before'                                          => array(
1489
+                            'b',
1490
+                            'o'
1491
+                        ),
1492
+                        '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
1493
+                            'b',
1494
+                            'o'
1495
+                        ),
1496
+                        '.nav-pills .nav-link.active'                                                                          => array( 'b' ),
1497
+                        '.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
1498
+                        '.page-link'                                                                                           => array( 'c' ),
1499
+                        '.page-item.active .page-link'                                                                         => array(
1500
+                            'b',
1501
+                            'o'
1502
+                        ),
1503
+                        '.progress-bar'                                                                                        => array( 'b' ),
1504
+                        '.list-group-item.active'                                                                              => array(
1505
+                            'b',
1506
+                            'o'
1507
+                        ),
1508
+                        '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
1509 1509
 //				    '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1510 1510
 //				    '.custom-range::-moz-range-thumb' => array('b'),
1511 1511
 //				    '.custom-range::-ms-thumb' => array('b'),
1512
-					);
1513
-			}
1514
-
1515
-			$important_selectors = array(
1516
-				".bg-{$type}" => array('b','f'),
1517
-				".border-{$type}" => array('o'),
1518
-				".text-{$type}" => array('c'),
1519
-			);
1520
-
1521
-			$color = array();
1522
-			$color_i = array();
1523
-			$background = array();
1524
-			$background_i = array();
1525
-			$border = array();
1526
-			$border_i = array();
1527
-			$fill = array();
1528
-			$fill_i = array();
1529
-
1530
-			$output = '';
1531
-
1532
-			if ( $aui_bs5 ) {
1512
+                    );
1513
+            }
1514
+
1515
+            $important_selectors = array(
1516
+                ".bg-{$type}" => array('b','f'),
1517
+                ".border-{$type}" => array('o'),
1518
+                ".text-{$type}" => array('c'),
1519
+            );
1520
+
1521
+            $color = array();
1522
+            $color_i = array();
1523
+            $background = array();
1524
+            $background_i = array();
1525
+            $border = array();
1526
+            $border_i = array();
1527
+            $fill = array();
1528
+            $fill_i = array();
1529
+
1530
+            $output = '';
1531
+
1532
+            if ( $aui_bs5 ) {
1533 1533
 //				$output .= $is_var ? 'html body {--bs-'.esc_attr($type).'-rgb: '.$color_code.'; }' : 'html body {--bs-'.esc_attr($type).'-rgb: '.self::hex_to_rgb($color_code).'; }';
1534
-				$output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }';
1535
-			}
1536
-
1537
-			// build rules into each type
1538
-			foreach($selectors as $selector => $types){
1539
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
1540
-				$types = array_combine($types,$types);
1541
-				if(isset($types['c'])){$color[] = $selector;}
1542
-				if(isset($types['b'])){$background[] = $selector;}
1543
-				if(isset($types['o'])){$border[] = $selector;}
1544
-				if(isset($types['f'])){$fill[] = $selector;}
1545
-			}
1546
-
1547
-			// build rules into each type
1548
-			foreach($important_selectors as $selector => $types){
1549
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
1550
-				$types = array_combine($types,$types);
1551
-				if(isset($types['c'])){$color_i[] = $selector;}
1552
-				if(isset($types['b'])){$background_i[] = $selector;}
1553
-				if(isset($types['o'])){$border_i[] = $selector;}
1554
-				if(isset($types['f'])){$fill_i[] = $selector;}
1555
-			}
1556
-
1557
-			// add any color rules
1558
-			if(!empty($color)){
1559
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1560
-			}
1561
-			if(!empty($color_i)){
1562
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1563
-			}
1564
-
1565
-			// add any background color rules
1566
-			if(!empty($background)){
1567
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1568
-			}
1569
-			if(!empty($background_i)){
1570
-				$output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} ";
1534
+                $output .= 'html body {--bs-'.esc_attr($type).'-rgb: '.$rgb.'; }';
1535
+            }
1536
+
1537
+            // build rules into each type
1538
+            foreach($selectors as $selector => $types){
1539
+                $selector = $compatibility ? $compatibility . " ".$selector : $selector;
1540
+                $types = array_combine($types,$types);
1541
+                if(isset($types['c'])){$color[] = $selector;}
1542
+                if(isset($types['b'])){$background[] = $selector;}
1543
+                if(isset($types['o'])){$border[] = $selector;}
1544
+                if(isset($types['f'])){$fill[] = $selector;}
1545
+            }
1546
+
1547
+            // build rules into each type
1548
+            foreach($important_selectors as $selector => $types){
1549
+                $selector = $compatibility ? $compatibility . " ".$selector : $selector;
1550
+                $types = array_combine($types,$types);
1551
+                if(isset($types['c'])){$color_i[] = $selector;}
1552
+                if(isset($types['b'])){$background_i[] = $selector;}
1553
+                if(isset($types['o'])){$border_i[] = $selector;}
1554
+                if(isset($types['f'])){$fill_i[] = $selector;}
1555
+            }
1556
+
1557
+            // add any color rules
1558
+            if(!empty($color)){
1559
+                $output .= implode(",",$color) . "{color: $color_code;} ";
1560
+            }
1561
+            if(!empty($color_i)){
1562
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1563
+            }
1564
+
1565
+            // add any background color rules
1566
+            if(!empty($background)){
1567
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
1568
+            }
1569
+            if(!empty($background_i)){
1570
+                $output .= $aui_bs5 ? '' : implode(",",$background_i) . "{background-color: $color_code !important;} ";
1571 1571
 //				$output .= implode(",",$background_i) . "{background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;} ";
1572
-			}
1572
+            }
1573 1573
 
1574
-			// add any border color rules
1575
-			if(!empty($border)){
1576
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1577
-			}
1578
-			if(!empty($border_i)){
1579
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1580
-			}
1574
+            // add any border color rules
1575
+            if(!empty($border)){
1576
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
1577
+            }
1578
+            if(!empty($border_i)){
1579
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1580
+            }
1581 1581
 
1582
-			// add any fill color rules
1583
-			if(!empty($fill)){
1584
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1585
-			}
1586
-			if(!empty($fill_i)){
1587
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1588
-			}
1582
+            // add any fill color rules
1583
+            if(!empty($fill)){
1584
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
1585
+            }
1586
+            if(!empty($fill_i)){
1587
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1588
+            }
1589 1589
 
1590 1590
 
1591
-			$prefix = $compatibility ? $compatibility . " " : "";
1591
+            $prefix = $compatibility ? $compatibility . " " : "";
1592 1592
 
1593
-			$transition = $is_var ? 'transition: color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out,filter 0.15s ease-in-out;' : '';
1594
-			// darken
1595
-			$darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
1596
-			$darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
1597
-			$darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
1598
-			$darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4");
1593
+            $transition = $is_var ? 'transition: color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out,filter 0.15s ease-in-out;' : '';
1594
+            // darken
1595
+            $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
1596
+            $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
1597
+            $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
1598
+            $darker_40 = $is_var ? $color_code.';filter:brightness(0.6)' : self::css_hex_lighten_darken($color_code,"-0.4");
1599 1599
 
1600
-			// lighten
1601
-			$lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
1600
+            // lighten
1601
+            $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
1602 1602
 
1603
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
1604
-			$op_25 = $color_code."40"; // 25% opacity
1603
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
1604
+            $op_25 = $color_code."40"; // 25% opacity
1605 1605
 
1606 1606
 
1607
-			// button states
1608
-			$output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
1609
-			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1607
+            // button states
1608
+            $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
1609
+            $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1610 1610
 //			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000;    border-color: #000;} ";
1611
-			$output .= $prefix ." .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1612
-			$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1613
-			$output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1611
+            $output .= $prefix ." .btn-outline-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-{$type}.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1612
+            $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active, $prefix .btn-{$type}:not(:disabled):not(.disabled).active, .show>$prefix .btn-{$type}.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1613
+            $output .= $prefix ." .btn-{$type}:not(:disabled):not(.disabled):active:focus, $prefix .btn-{$type}:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-{$type}.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1614 1614
 
1615
-			if ( $type == 'primary' ) {
1616
-				// dropdown's
1617
-				$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1615
+            if ( $type == 'primary' ) {
1616
+                // dropdown's
1617
+                $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1618 1618
 
1619
-				// input states
1620
-				$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
1619
+                // input states
1620
+                $output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
1621 1621
 
1622
-				// page link
1623
-				$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1624
-			}
1622
+                // page link
1623
+                $output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1624
+            }
1625 1625
 
1626 1626
             // alerts
1627
-			if ( $aui_bs5 ) {
1627
+            if ( $aui_bs5 ) {
1628 1628
 //				$output .= $is_var ? '' : $prefix ." .alert-{$type} {background-color: ".$color_code."20;    border-color: ".$color_code."30;color:$darker_40} ";
1629
-				$output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1630
-			}
1631
-
1632
-			return $output;
1633
-		}
1634
-
1635
-		/**
1636
-		 *
1637
-		 * @deprecated 0.1.76 Use css_overwrite()
1638
-		 *
1639
-		 * @param $color_code
1640
-		 * @param $compatibility
1641
-		 * @param $use_variable
1642
-		 *
1643
-		 * @return string
1644
-		 */
1645
-		public static function css_primary($color_code,$compatibility, $use_variable = false){
1646
-
1647
-			if(!$use_variable){
1648
-				$color_code = sanitize_hex_color($color_code);
1649
-				if(!$color_code){return '';}
1650
-			}
1651
-
1652
-			/**
1653
-			 * c = color, b = background color, o = border-color, f = fill
1654
-			 */
1655
-			$selectors = array(
1656
-				'a' => array('c'),
1657
-				'.btn-primary' => array('b','o'),
1658
-				'.btn-primary.disabled' => array('b','o'),
1659
-				'.btn-primary:disabled' => array('b','o'),
1660
-				'.btn-outline-primary' => array('c','o'),
1661
-				'.btn-outline-primary:hover' => array('b','o'),
1662
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1663
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1664
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1665
-				'.btn-link' => array('c'),
1666
-				'.dropdown-item.active' => array('b'),
1667
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1668
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1629
+                $output .= $prefix ." .alert-{$type} {--bs-alert-bg: rgba(var(--bs-{$type}-rgb), .1 ) !important;--bs-alert-border-color: rgba(var(--bs-{$type}-rgb), .25 ) !important;--bs-alert-color: rgba(var(--bs-{$type}-rgb), 1 ) !important;} ";
1630
+            }
1631
+
1632
+            return $output;
1633
+        }
1634
+
1635
+        /**
1636
+         *
1637
+         * @deprecated 0.1.76 Use css_overwrite()
1638
+         *
1639
+         * @param $color_code
1640
+         * @param $compatibility
1641
+         * @param $use_variable
1642
+         *
1643
+         * @return string
1644
+         */
1645
+        public static function css_primary($color_code,$compatibility, $use_variable = false){
1646
+
1647
+            if(!$use_variable){
1648
+                $color_code = sanitize_hex_color($color_code);
1649
+                if(!$color_code){return '';}
1650
+            }
1651
+
1652
+            /**
1653
+             * c = color, b = background color, o = border-color, f = fill
1654
+             */
1655
+            $selectors = array(
1656
+                'a' => array('c'),
1657
+                '.btn-primary' => array('b','o'),
1658
+                '.btn-primary.disabled' => array('b','o'),
1659
+                '.btn-primary:disabled' => array('b','o'),
1660
+                '.btn-outline-primary' => array('c','o'),
1661
+                '.btn-outline-primary:hover' => array('b','o'),
1662
+                '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
1663
+                '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
1664
+                '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
1665
+                '.btn-link' => array('c'),
1666
+                '.dropdown-item.active' => array('b'),
1667
+                '.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
1668
+                '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
1669 1669
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
1670 1670
 //				'.custom-range::-moz-range-thumb' => array('b'),
1671 1671
 //				'.custom-range::-ms-thumb' => array('b'),
1672
-				'.nav-pills .nav-link.active' => array('b'),
1673
-				'.nav-pills .show>.nav-link' => array('b'),
1674
-				'.page-link' => array('c'),
1675
-				'.page-item.active .page-link' => array('b','o'),
1676
-				'.badge-primary' => array('b'),
1677
-				'.alert-primary' => array('b','o'),
1678
-				'.progress-bar' => array('b'),
1679
-				'.list-group-item.active' => array('b','o'),
1680
-				'.bg-primary' => array('b','f'),
1681
-				'.btn-link.btn-primary' => array('c'),
1682
-				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1683
-			);
1684
-
1685
-			$important_selectors = array(
1686
-				'.bg-primary' => array('b','f'),
1687
-				'.border-primary' => array('o'),
1688
-				'.text-primary' => array('c'),
1689
-			);
1690
-
1691
-			$color = array();
1692
-			$color_i = array();
1693
-			$background = array();
1694
-			$background_i = array();
1695
-			$border = array();
1696
-			$border_i = array();
1697
-			$fill = array();
1698
-			$fill_i = array();
1699
-
1700
-			$output = '';
1701
-
1702
-			// build rules into each type
1703
-			foreach($selectors as $selector => $types){
1704
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1705
-				$types = array_combine($types,$types);
1706
-				if(isset($types['c'])){$color[] = $selector;}
1707
-				if(isset($types['b'])){$background[] = $selector;}
1708
-				if(isset($types['o'])){$border[] = $selector;}
1709
-				if(isset($types['f'])){$fill[] = $selector;}
1710
-			}
1711
-
1712
-			// build rules into each type
1713
-			foreach($important_selectors as $selector => $types){
1714
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1715
-				$types = array_combine($types,$types);
1716
-				if(isset($types['c'])){$color_i[] = $selector;}
1717
-				if(isset($types['b'])){$background_i[] = $selector;}
1718
-				if(isset($types['o'])){$border_i[] = $selector;}
1719
-				if(isset($types['f'])){$fill_i[] = $selector;}
1720
-			}
1721
-
1722
-			// add any color rules
1723
-			if(!empty($color)){
1724
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1725
-			}
1726
-			if(!empty($color_i)){
1727
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1728
-			}
1729
-
1730
-			// add any background color rules
1731
-			if(!empty($background)){
1732
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1733
-			}
1734
-			if(!empty($background_i)){
1735
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1736
-			}
1737
-
1738
-			// add any border color rules
1739
-			if(!empty($border)){
1740
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1741
-			}
1742
-			if(!empty($border_i)){
1743
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1744
-			}
1745
-
1746
-			// add any fill color rules
1747
-			if(!empty($fill)){
1748
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1749
-			}
1750
-			if(!empty($fill_i)){
1751
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1752
-			}
1753
-
1754
-
1755
-			$prefix = $compatibility ? ".bsui " : "";
1756
-
1757
-			// darken
1758
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1759
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1760
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1761
-
1762
-			// lighten
1763
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1764
-
1765
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
1766
-			$op_25 = $color_code."40"; // 25% opacity
1767
-
1768
-
1769
-			// button states
1770
-			$output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1771
-			$output .= $prefix ." .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1772
-			$output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1773
-			$output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1774
-
1775
-
1776
-			// dropdown's
1777
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1778
-
1779
-
1780
-			// input states
1781
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
1782
-
1783
-			// page link
1784
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1785
-
1786
-			return $output;
1787
-		}
1788
-
1789
-		/**
1790
-		 *
1791
-		 * @deprecated 0.1.76 Use css_overwrite()
1792
-		 *
1793
-		 * @param $color_code
1794
-		 * @param $compatibility
1795
-		 *
1796
-		 * @return string
1797
-		 */
1798
-		public static function css_secondary($color_code,$compatibility){;
1799
-			$color_code = sanitize_hex_color($color_code);
1800
-			if(!$color_code){return '';}
1801
-			/**
1802
-			 * c = color, b = background color, o = border-color, f = fill
1803
-			 */
1804
-			$selectors = array(
1805
-				'.btn-secondary' => array('b','o'),
1806
-				'.btn-secondary.disabled' => array('b','o'),
1807
-				'.btn-secondary:disabled' => array('b','o'),
1808
-				'.btn-outline-secondary' => array('c','o'),
1809
-				'.btn-outline-secondary:hover' => array('b','o'),
1810
-				'.btn-outline-secondary.disabled' => array('c'),
1811
-				'.btn-outline-secondary:disabled' => array('c'),
1812
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
1813
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
1814
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
1815
-				'.badge-secondary' => array('b'),
1816
-				'.alert-secondary' => array('b','o'),
1817
-				'.btn-link.btn-secondary' => array('c'),
1818
-			);
1819
-
1820
-			$important_selectors = array(
1821
-				'.bg-secondary' => array('b','f'),
1822
-				'.border-secondary' => array('o'),
1823
-				'.text-secondary' => array('c'),
1824
-			);
1825
-
1826
-			$color = array();
1827
-			$color_i = array();
1828
-			$background = array();
1829
-			$background_i = array();
1830
-			$border = array();
1831
-			$border_i = array();
1832
-			$fill = array();
1833
-			$fill_i = array();
1834
-
1835
-			$output = '';
1836
-
1837
-			// build rules into each type
1838
-			foreach($selectors as $selector => $types){
1839
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1840
-				$types = array_combine($types,$types);
1841
-				if(isset($types['c'])){$color[] = $selector;}
1842
-				if(isset($types['b'])){$background[] = $selector;}
1843
-				if(isset($types['o'])){$border[] = $selector;}
1844
-				if(isset($types['f'])){$fill[] = $selector;}
1845
-			}
1846
-
1847
-			// build rules into each type
1848
-			foreach($important_selectors as $selector => $types){
1849
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
1850
-				$types = array_combine($types,$types);
1851
-				if(isset($types['c'])){$color_i[] = $selector;}
1852
-				if(isset($types['b'])){$background_i[] = $selector;}
1853
-				if(isset($types['o'])){$border_i[] = $selector;}
1854
-				if(isset($types['f'])){$fill_i[] = $selector;}
1855
-			}
1856
-
1857
-			// add any color rules
1858
-			if(!empty($color)){
1859
-				$output .= implode(",",$color) . "{color: $color_code;} ";
1860
-			}
1861
-			if(!empty($color_i)){
1862
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1863
-			}
1864
-
1865
-			// add any background color rules
1866
-			if(!empty($background)){
1867
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
1868
-			}
1869
-			if(!empty($background_i)){
1870
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1871
-			}
1872
-
1873
-			// add any border color rules
1874
-			if(!empty($border)){
1875
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
1876
-			}
1877
-			if(!empty($border_i)){
1878
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1879
-			}
1880
-
1881
-			// add any fill color rules
1882
-			if(!empty($fill)){
1883
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
1884
-			}
1885
-			if(!empty($fill_i)){
1886
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1887
-			}
1888
-
1889
-
1890
-			$prefix = $compatibility ? ".bsui " : "";
1891
-
1892
-			// darken
1893
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1894
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1895
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1896
-
1897
-			// lighten
1898
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1899
-
1900
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
1901
-			$op_25 = $color_code."40"; // 25% opacity
1902
-
1903
-
1904
-			// button states
1905
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1906
-			$output .= $prefix ." .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1907
-			$output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1908
-			$output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1909
-
1910
-
1911
-			return $output;
1912
-		}
1913
-
1914
-		/**
1915
-		 * Increases or decreases the brightness of a color by a percentage of the current brightness.
1916
-		 *
1917
-		 * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
1918
-		 * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
1919
-		 *
1920
-		 * @return  string
1921
-		 */
1922
-		public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
1923
-			$hexCode = ltrim($hexCode, '#');
1924
-
1925
-			if (strlen($hexCode) == 3) {
1926
-				$hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
1927
-			}
1928
-
1929
-			$hexCode = array_map('hexdec', str_split($hexCode, 2));
1930
-
1931
-			foreach ($hexCode as & $color) {
1932
-				$adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
1933
-				$adjustAmount = ceil($adjustableLimit * $adjustPercent);
1934
-
1935
-				$color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
1936
-			}
1937
-
1938
-			return '#' . implode($hexCode);
1939
-		}
1940
-
1941
-		/**
1942
-		 * Check if we should display examples.
1943
-		 */
1944
-		public function maybe_show_examples(){
1945
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1946
-				echo "<head>";
1947
-				wp_head();
1948
-				echo "</head>";
1949
-				echo "<body>";
1950
-				echo $this->get_examples();
1951
-				echo "</body>";
1952
-				exit;
1953
-			}
1954
-		}
1955
-
1956
-		/**
1957
-		 * Get developer examples.
1958
-		 *
1959
-		 * @return string
1960
-		 */
1961
-		public function get_examples(){
1962
-			$output = '';
1963
-
1964
-
1965
-			// open form
1966
-			$output .= "<form class='p-5 m-5 border rounded'>";
1967
-
1968
-			// input example
1969
-			$output .= aui()->input(array(
1970
-				'type'  =>  'text',
1971
-				'id'    =>  'text-example',
1972
-				'name'    =>  'text-example',
1973
-				'placeholder'   => 'text placeholder',
1974
-				'title'   => 'Text input example',
1975
-				'value' =>  '',
1976
-				'required'  => false,
1977
-				'help_text' => 'help text',
1978
-				'label' => 'Text input example label'
1979
-			));
1980
-
1981
-			// input example
1982
-			$output .= aui()->input(array(
1983
-				'type'  =>  'url',
1984
-				'id'    =>  'text-example2',
1985
-				'name'    =>  'text-example',
1986
-				'placeholder'   => 'url placeholder',
1987
-				'title'   => 'Text input example',
1988
-				'value' =>  '',
1989
-				'required'  => false,
1990
-				'help_text' => 'help text',
1991
-				'label' => 'Text input example label'
1992
-			));
1993
-
1994
-			// checkbox example
1995
-			$output .= aui()->input(array(
1996
-				'type'  =>  'checkbox',
1997
-				'id'    =>  'checkbox-example',
1998
-				'name'    =>  'checkbox-example',
1999
-				'placeholder'   => 'checkbox-example',
2000
-				'title'   => 'Checkbox example',
2001
-				'value' =>  '1',
2002
-				'checked'   => true,
2003
-				'required'  => false,
2004
-				'help_text' => 'help text',
2005
-				'label' => 'Checkbox checked'
2006
-			));
2007
-
2008
-			// checkbox example
2009
-			$output .= aui()->input(array(
2010
-				'type'  =>  'checkbox',
2011
-				'id'    =>  'checkbox-example2',
2012
-				'name'    =>  'checkbox-example2',
2013
-				'placeholder'   => 'checkbox-example',
2014
-				'title'   => 'Checkbox example',
2015
-				'value' =>  '1',
2016
-				'checked'   => false,
2017
-				'required'  => false,
2018
-				'help_text' => 'help text',
2019
-				'label' => 'Checkbox un-checked'
2020
-			));
2021
-
2022
-			// switch example
2023
-			$output .= aui()->input(array(
2024
-				'type'  =>  'checkbox',
2025
-				'id'    =>  'switch-example',
2026
-				'name'    =>  'switch-example',
2027
-				'placeholder'   => 'checkbox-example',
2028
-				'title'   => 'Switch example',
2029
-				'value' =>  '1',
2030
-				'checked'   => true,
2031
-				'switch'    => true,
2032
-				'required'  => false,
2033
-				'help_text' => 'help text',
2034
-				'label' => 'Switch on'
2035
-			));
2036
-
2037
-			// switch example
2038
-			$output .= aui()->input(array(
2039
-				'type'  =>  'checkbox',
2040
-				'id'    =>  'switch-example2',
2041
-				'name'    =>  'switch-example2',
2042
-				'placeholder'   => 'checkbox-example',
2043
-				'title'   => 'Switch example',
2044
-				'value' =>  '1',
2045
-				'checked'   => false,
2046
-				'switch'    => true,
2047
-				'required'  => false,
2048
-				'help_text' => 'help text',
2049
-				'label' => 'Switch off'
2050
-			));
2051
-
2052
-			// close form
2053
-			$output .= "</form>";
2054
-
2055
-			return $output;
2056
-		}
2057
-
2058
-		/**
2059
-		 * Calendar params.
2060
-		 *
2061
-		 * @since 0.1.44
2062
-		 *
2063
-		 * @return array Calendar params.
2064
-		 */
2065
-		public static function calendar_params() {
2066
-			$params = array(
2067
-				'month_long_1' => __( 'January', 'aui' ),
2068
-				'month_long_2' => __( 'February', 'aui' ),
2069
-				'month_long_3' => __( 'March', 'aui' ),
2070
-				'month_long_4' => __( 'April', 'aui' ),
2071
-				'month_long_5' => __( 'May', 'aui' ),
2072
-				'month_long_6' => __( 'June', 'aui' ),
2073
-				'month_long_7' => __( 'July', 'aui' ),
2074
-				'month_long_8' => __( 'August', 'aui' ),
2075
-				'month_long_9' => __( 'September', 'aui' ),
2076
-				'month_long_10' => __( 'October', 'aui' ),
2077
-				'month_long_11' => __( 'November', 'aui' ),
2078
-				'month_long_12' => __( 'December', 'aui' ),
2079
-				'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2080
-				'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2081
-				'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2082
-				'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2083
-				'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2084
-				'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2085
-				'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2086
-				'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2087
-				'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2088
-				'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2089
-				'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2090
-				'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2091
-				'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2092
-				'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2093
-				'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2094
-				'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2095
-				'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2096
-				'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2097
-				'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2098
-				'day_s2_1' => __( 'Su', 'aui' ),
2099
-				'day_s2_2' => __( 'Mo', 'aui' ),
2100
-				'day_s2_3' => __( 'Tu', 'aui' ),
2101
-				'day_s2_4' => __( 'We', 'aui' ),
2102
-				'day_s2_5' => __( 'Th', 'aui' ),
2103
-				'day_s2_6' => __( 'Fr', 'aui' ),
2104
-				'day_s2_7' => __( 'Sa', 'aui' ),
2105
-				'day_s3_1' => __( 'Sun', 'aui' ),
2106
-				'day_s3_2' => __( 'Mon', 'aui' ),
2107
-				'day_s3_3' => __( 'Tue', 'aui' ),
2108
-				'day_s3_4' => __( 'Wed', 'aui' ),
2109
-				'day_s3_5' => __( 'Thu', 'aui' ),
2110
-				'day_s3_6' => __( 'Fri', 'aui' ),
2111
-				'day_s3_7' => __( 'Sat', 'aui' ),
2112
-				'day_s5_1' => __( 'Sunday', 'aui' ),
2113
-				'day_s5_2' => __( 'Monday', 'aui' ),
2114
-				'day_s5_3' => __( 'Tuesday', 'aui' ),
2115
-				'day_s5_4' => __( 'Wednesday', 'aui' ),
2116
-				'day_s5_5' => __( 'Thursday', 'aui' ),
2117
-				'day_s5_6' => __( 'Friday', 'aui' ),
2118
-				'day_s5_7' => __( 'Saturday', 'aui' ),
2119
-				'am_lower' => __( 'am', 'aui' ),
2120
-				'pm_lower' => __( 'pm', 'aui' ),
2121
-				'am_upper' => __( 'AM', 'aui' ),
2122
-				'pm_upper' => __( 'PM', 'aui' ),
2123
-				'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2124
-				'time_24hr' => false,
2125
-				'year' => __( 'Year', 'aui' ),
2126
-				'hour' => __( 'Hour', 'aui' ),
2127
-				'minute' => __( 'Minute', 'aui' ),
2128
-				'weekAbbreviation' => __( 'Wk', 'aui' ),
2129
-				'rangeSeparator' => __( ' to ', 'aui' ),
2130
-				'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2131
-				'toggleTitle' => __( 'Click to toggle', 'aui' )
2132
-			);
2133
-
2134
-			return apply_filters( 'ayecode_ui_calendar_params', $params );
2135
-		}
2136
-
2137
-		/**
2138
-		 * Flatpickr calendar localize.
2139
-		 *
2140
-		 * @since 0.1.44
2141
-		 *
2142
-		 * @return string Calendar locale.
2143
-		 */
2144
-		public static function flatpickr_locale() {
2145
-			$params = self::calendar_params();
2146
-
2147
-			if ( is_string( $params ) ) {
2148
-				$params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2149
-			} else {
2150
-				foreach ( (array) $params as $key => $value ) {
2151
-					if ( ! is_scalar( $value ) ) {
2152
-						continue;
2153
-					}
2154
-
2155
-					$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2156
-				}
2157
-			}
1672
+                '.nav-pills .nav-link.active' => array('b'),
1673
+                '.nav-pills .show>.nav-link' => array('b'),
1674
+                '.page-link' => array('c'),
1675
+                '.page-item.active .page-link' => array('b','o'),
1676
+                '.badge-primary' => array('b'),
1677
+                '.alert-primary' => array('b','o'),
1678
+                '.progress-bar' => array('b'),
1679
+                '.list-group-item.active' => array('b','o'),
1680
+                '.bg-primary' => array('b','f'),
1681
+                '.btn-link.btn-primary' => array('c'),
1682
+                '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
1683
+            );
1684
+
1685
+            $important_selectors = array(
1686
+                '.bg-primary' => array('b','f'),
1687
+                '.border-primary' => array('o'),
1688
+                '.text-primary' => array('c'),
1689
+            );
1690
+
1691
+            $color = array();
1692
+            $color_i = array();
1693
+            $background = array();
1694
+            $background_i = array();
1695
+            $border = array();
1696
+            $border_i = array();
1697
+            $fill = array();
1698
+            $fill_i = array();
1699
+
1700
+            $output = '';
1701
+
1702
+            // build rules into each type
1703
+            foreach($selectors as $selector => $types){
1704
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1705
+                $types = array_combine($types,$types);
1706
+                if(isset($types['c'])){$color[] = $selector;}
1707
+                if(isset($types['b'])){$background[] = $selector;}
1708
+                if(isset($types['o'])){$border[] = $selector;}
1709
+                if(isset($types['f'])){$fill[] = $selector;}
1710
+            }
1711
+
1712
+            // build rules into each type
1713
+            foreach($important_selectors as $selector => $types){
1714
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1715
+                $types = array_combine($types,$types);
1716
+                if(isset($types['c'])){$color_i[] = $selector;}
1717
+                if(isset($types['b'])){$background_i[] = $selector;}
1718
+                if(isset($types['o'])){$border_i[] = $selector;}
1719
+                if(isset($types['f'])){$fill_i[] = $selector;}
1720
+            }
2158 1721
 
2159
-			$day_s3 = array();
2160
-			$day_s5 = array();
1722
+            // add any color rules
1723
+            if(!empty($color)){
1724
+                $output .= implode(",",$color) . "{color: $color_code;} ";
1725
+            }
1726
+            if(!empty($color_i)){
1727
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1728
+            }
1729
+
1730
+            // add any background color rules
1731
+            if(!empty($background)){
1732
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
1733
+            }
1734
+            if(!empty($background_i)){
1735
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1736
+            }
1737
+
1738
+            // add any border color rules
1739
+            if(!empty($border)){
1740
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
1741
+            }
1742
+            if(!empty($border_i)){
1743
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1744
+            }
1745
+
1746
+            // add any fill color rules
1747
+            if(!empty($fill)){
1748
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
1749
+            }
1750
+            if(!empty($fill_i)){
1751
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1752
+            }
2161 1753
 
2162
-			for ( $i = 1; $i <= 7; $i ++ ) {
2163
-				$day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2164
-				$day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2165
-			}
2166 1754
 
2167
-			$month_s = array();
2168
-			$month_long = array();
1755
+            $prefix = $compatibility ? ".bsui " : "";
2169 1756
 
2170
-			for ( $i = 1; $i <= 12; $i ++ ) {
2171
-				$month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2172
-				$month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2173
-			}
1757
+            // darken
1758
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1759
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1760
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2174 1761
 
2175
-			ob_start();
2176
-		if ( 0 ) { ?><script><?php } ?>
1762
+            // lighten
1763
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1764
+
1765
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
1766
+            $op_25 = $color_code."40"; // 25% opacity
1767
+
1768
+
1769
+            // button states
1770
+            $output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1771
+            $output .= $prefix ." .btn-outline-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-primary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1772
+            $output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active, $prefix .btn-primary:not(:disabled):not(.disabled).active, .show>$prefix .btn-primary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1773
+            $output .= $prefix ." .btn-primary:not(:disabled):not(.disabled):active:focus, $prefix .btn-primary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-primary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1774
+
1775
+
1776
+            // dropdown's
1777
+            $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
1778
+
1779
+
1780
+            // input states
1781
+            $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
1782
+
1783
+            // page link
1784
+            $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1785
+
1786
+            return $output;
1787
+        }
1788
+
1789
+        /**
1790
+         *
1791
+         * @deprecated 0.1.76 Use css_overwrite()
1792
+         *
1793
+         * @param $color_code
1794
+         * @param $compatibility
1795
+         *
1796
+         * @return string
1797
+         */
1798
+        public static function css_secondary($color_code,$compatibility){;
1799
+            $color_code = sanitize_hex_color($color_code);
1800
+            if(!$color_code){return '';}
1801
+            /**
1802
+             * c = color, b = background color, o = border-color, f = fill
1803
+             */
1804
+            $selectors = array(
1805
+                '.btn-secondary' => array('b','o'),
1806
+                '.btn-secondary.disabled' => array('b','o'),
1807
+                '.btn-secondary:disabled' => array('b','o'),
1808
+                '.btn-outline-secondary' => array('c','o'),
1809
+                '.btn-outline-secondary:hover' => array('b','o'),
1810
+                '.btn-outline-secondary.disabled' => array('c'),
1811
+                '.btn-outline-secondary:disabled' => array('c'),
1812
+                '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
1813
+                '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
1814
+                '.btn-outline-secondary.dropdown-toggle' => array('b','o'),
1815
+                '.badge-secondary' => array('b'),
1816
+                '.alert-secondary' => array('b','o'),
1817
+                '.btn-link.btn-secondary' => array('c'),
1818
+            );
1819
+
1820
+            $important_selectors = array(
1821
+                '.bg-secondary' => array('b','f'),
1822
+                '.border-secondary' => array('o'),
1823
+                '.text-secondary' => array('c'),
1824
+            );
1825
+
1826
+            $color = array();
1827
+            $color_i = array();
1828
+            $background = array();
1829
+            $background_i = array();
1830
+            $border = array();
1831
+            $border_i = array();
1832
+            $fill = array();
1833
+            $fill_i = array();
1834
+
1835
+            $output = '';
1836
+
1837
+            // build rules into each type
1838
+            foreach($selectors as $selector => $types){
1839
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1840
+                $types = array_combine($types,$types);
1841
+                if(isset($types['c'])){$color[] = $selector;}
1842
+                if(isset($types['b'])){$background[] = $selector;}
1843
+                if(isset($types['o'])){$border[] = $selector;}
1844
+                if(isset($types['f'])){$fill[] = $selector;}
1845
+            }
1846
+
1847
+            // build rules into each type
1848
+            foreach($important_selectors as $selector => $types){
1849
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
1850
+                $types = array_combine($types,$types);
1851
+                if(isset($types['c'])){$color_i[] = $selector;}
1852
+                if(isset($types['b'])){$background_i[] = $selector;}
1853
+                if(isset($types['o'])){$border_i[] = $selector;}
1854
+                if(isset($types['f'])){$fill_i[] = $selector;}
1855
+            }
1856
+
1857
+            // add any color rules
1858
+            if(!empty($color)){
1859
+                $output .= implode(",",$color) . "{color: $color_code;} ";
1860
+            }
1861
+            if(!empty($color_i)){
1862
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
1863
+            }
1864
+
1865
+            // add any background color rules
1866
+            if(!empty($background)){
1867
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
1868
+            }
1869
+            if(!empty($background_i)){
1870
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
1871
+            }
1872
+
1873
+            // add any border color rules
1874
+            if(!empty($border)){
1875
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
1876
+            }
1877
+            if(!empty($border_i)){
1878
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
1879
+            }
1880
+
1881
+            // add any fill color rules
1882
+            if(!empty($fill)){
1883
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
1884
+            }
1885
+            if(!empty($fill_i)){
1886
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
1887
+            }
1888
+
1889
+
1890
+            $prefix = $compatibility ? ".bsui " : "";
1891
+
1892
+            // darken
1893
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
1894
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
1895
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
1896
+
1897
+            // lighten
1898
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
1899
+
1900
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
1901
+            $op_25 = $color_code."40"; // 25% opacity
1902
+
1903
+
1904
+            // button states
1905
+            $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
1906
+            $output .= $prefix ." .btn-outline-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-outline-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-outline-secondary.dropdown-toggle:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
1907
+            $output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active, $prefix .btn-secondary:not(:disabled):not(.disabled).active, .show>$prefix .btn-secondary.dropdown-toggle{background-color: ".$darker_10.";    border-color: ".$darker_125.";} ";
1908
+            $output .= $prefix ." .btn-secondary:not(:disabled):not(.disabled):active:focus, $prefix .btn-secondary:not(:disabled):not(.disabled).active:focus, .show>$prefix .btn-secondary.dropdown-toggle:focus {box-shadow: 0 0 0 0.2rem $op_25;} ";
1909
+
1910
+
1911
+            return $output;
1912
+        }
1913
+
1914
+        /**
1915
+         * Increases or decreases the brightness of a color by a percentage of the current brightness.
1916
+         *
1917
+         * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
1918
+         * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
1919
+         *
1920
+         * @return  string
1921
+         */
1922
+        public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
1923
+            $hexCode = ltrim($hexCode, '#');
1924
+
1925
+            if (strlen($hexCode) == 3) {
1926
+                $hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
1927
+            }
1928
+
1929
+            $hexCode = array_map('hexdec', str_split($hexCode, 2));
1930
+
1931
+            foreach ($hexCode as & $color) {
1932
+                $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
1933
+                $adjustAmount = ceil($adjustableLimit * $adjustPercent);
1934
+
1935
+                $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
1936
+            }
1937
+
1938
+            return '#' . implode($hexCode);
1939
+        }
1940
+
1941
+        /**
1942
+         * Check if we should display examples.
1943
+         */
1944
+        public function maybe_show_examples(){
1945
+            if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
1946
+                echo "<head>";
1947
+                wp_head();
1948
+                echo "</head>";
1949
+                echo "<body>";
1950
+                echo $this->get_examples();
1951
+                echo "</body>";
1952
+                exit;
1953
+            }
1954
+        }
1955
+
1956
+        /**
1957
+         * Get developer examples.
1958
+         *
1959
+         * @return string
1960
+         */
1961
+        public function get_examples(){
1962
+            $output = '';
1963
+
1964
+
1965
+            // open form
1966
+            $output .= "<form class='p-5 m-5 border rounded'>";
1967
+
1968
+            // input example
1969
+            $output .= aui()->input(array(
1970
+                'type'  =>  'text',
1971
+                'id'    =>  'text-example',
1972
+                'name'    =>  'text-example',
1973
+                'placeholder'   => 'text placeholder',
1974
+                'title'   => 'Text input example',
1975
+                'value' =>  '',
1976
+                'required'  => false,
1977
+                'help_text' => 'help text',
1978
+                'label' => 'Text input example label'
1979
+            ));
1980
+
1981
+            // input example
1982
+            $output .= aui()->input(array(
1983
+                'type'  =>  'url',
1984
+                'id'    =>  'text-example2',
1985
+                'name'    =>  'text-example',
1986
+                'placeholder'   => 'url placeholder',
1987
+                'title'   => 'Text input example',
1988
+                'value' =>  '',
1989
+                'required'  => false,
1990
+                'help_text' => 'help text',
1991
+                'label' => 'Text input example label'
1992
+            ));
1993
+
1994
+            // checkbox example
1995
+            $output .= aui()->input(array(
1996
+                'type'  =>  'checkbox',
1997
+                'id'    =>  'checkbox-example',
1998
+                'name'    =>  'checkbox-example',
1999
+                'placeholder'   => 'checkbox-example',
2000
+                'title'   => 'Checkbox example',
2001
+                'value' =>  '1',
2002
+                'checked'   => true,
2003
+                'required'  => false,
2004
+                'help_text' => 'help text',
2005
+                'label' => 'Checkbox checked'
2006
+            ));
2007
+
2008
+            // checkbox example
2009
+            $output .= aui()->input(array(
2010
+                'type'  =>  'checkbox',
2011
+                'id'    =>  'checkbox-example2',
2012
+                'name'    =>  'checkbox-example2',
2013
+                'placeholder'   => 'checkbox-example',
2014
+                'title'   => 'Checkbox example',
2015
+                'value' =>  '1',
2016
+                'checked'   => false,
2017
+                'required'  => false,
2018
+                'help_text' => 'help text',
2019
+                'label' => 'Checkbox un-checked'
2020
+            ));
2021
+
2022
+            // switch example
2023
+            $output .= aui()->input(array(
2024
+                'type'  =>  'checkbox',
2025
+                'id'    =>  'switch-example',
2026
+                'name'    =>  'switch-example',
2027
+                'placeholder'   => 'checkbox-example',
2028
+                'title'   => 'Switch example',
2029
+                'value' =>  '1',
2030
+                'checked'   => true,
2031
+                'switch'    => true,
2032
+                'required'  => false,
2033
+                'help_text' => 'help text',
2034
+                'label' => 'Switch on'
2035
+            ));
2036
+
2037
+            // switch example
2038
+            $output .= aui()->input(array(
2039
+                'type'  =>  'checkbox',
2040
+                'id'    =>  'switch-example2',
2041
+                'name'    =>  'switch-example2',
2042
+                'placeholder'   => 'checkbox-example',
2043
+                'title'   => 'Switch example',
2044
+                'value' =>  '1',
2045
+                'checked'   => false,
2046
+                'switch'    => true,
2047
+                'required'  => false,
2048
+                'help_text' => 'help text',
2049
+                'label' => 'Switch off'
2050
+            ));
2051
+
2052
+            // close form
2053
+            $output .= "</form>";
2054
+
2055
+            return $output;
2056
+        }
2057
+
2058
+        /**
2059
+         * Calendar params.
2060
+         *
2061
+         * @since 0.1.44
2062
+         *
2063
+         * @return array Calendar params.
2064
+         */
2065
+        public static function calendar_params() {
2066
+            $params = array(
2067
+                'month_long_1' => __( 'January', 'aui' ),
2068
+                'month_long_2' => __( 'February', 'aui' ),
2069
+                'month_long_3' => __( 'March', 'aui' ),
2070
+                'month_long_4' => __( 'April', 'aui' ),
2071
+                'month_long_5' => __( 'May', 'aui' ),
2072
+                'month_long_6' => __( 'June', 'aui' ),
2073
+                'month_long_7' => __( 'July', 'aui' ),
2074
+                'month_long_8' => __( 'August', 'aui' ),
2075
+                'month_long_9' => __( 'September', 'aui' ),
2076
+                'month_long_10' => __( 'October', 'aui' ),
2077
+                'month_long_11' => __( 'November', 'aui' ),
2078
+                'month_long_12' => __( 'December', 'aui' ),
2079
+                'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2080
+                'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2081
+                'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2082
+                'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2083
+                'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2084
+                'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2085
+                'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2086
+                'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2087
+                'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2088
+                'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2089
+                'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2090
+                'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2091
+                'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2092
+                'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2093
+                'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2094
+                'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2095
+                'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2096
+                'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2097
+                'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2098
+                'day_s2_1' => __( 'Su', 'aui' ),
2099
+                'day_s2_2' => __( 'Mo', 'aui' ),
2100
+                'day_s2_3' => __( 'Tu', 'aui' ),
2101
+                'day_s2_4' => __( 'We', 'aui' ),
2102
+                'day_s2_5' => __( 'Th', 'aui' ),
2103
+                'day_s2_6' => __( 'Fr', 'aui' ),
2104
+                'day_s2_7' => __( 'Sa', 'aui' ),
2105
+                'day_s3_1' => __( 'Sun', 'aui' ),
2106
+                'day_s3_2' => __( 'Mon', 'aui' ),
2107
+                'day_s3_3' => __( 'Tue', 'aui' ),
2108
+                'day_s3_4' => __( 'Wed', 'aui' ),
2109
+                'day_s3_5' => __( 'Thu', 'aui' ),
2110
+                'day_s3_6' => __( 'Fri', 'aui' ),
2111
+                'day_s3_7' => __( 'Sat', 'aui' ),
2112
+                'day_s5_1' => __( 'Sunday', 'aui' ),
2113
+                'day_s5_2' => __( 'Monday', 'aui' ),
2114
+                'day_s5_3' => __( 'Tuesday', 'aui' ),
2115
+                'day_s5_4' => __( 'Wednesday', 'aui' ),
2116
+                'day_s5_5' => __( 'Thursday', 'aui' ),
2117
+                'day_s5_6' => __( 'Friday', 'aui' ),
2118
+                'day_s5_7' => __( 'Saturday', 'aui' ),
2119
+                'am_lower' => __( 'am', 'aui' ),
2120
+                'pm_lower' => __( 'pm', 'aui' ),
2121
+                'am_upper' => __( 'AM', 'aui' ),
2122
+                'pm_upper' => __( 'PM', 'aui' ),
2123
+                'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2124
+                'time_24hr' => false,
2125
+                'year' => __( 'Year', 'aui' ),
2126
+                'hour' => __( 'Hour', 'aui' ),
2127
+                'minute' => __( 'Minute', 'aui' ),
2128
+                'weekAbbreviation' => __( 'Wk', 'aui' ),
2129
+                'rangeSeparator' => __( ' to ', 'aui' ),
2130
+                'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2131
+                'toggleTitle' => __( 'Click to toggle', 'aui' )
2132
+            );
2133
+
2134
+            return apply_filters( 'ayecode_ui_calendar_params', $params );
2135
+        }
2136
+
2137
+        /**
2138
+         * Flatpickr calendar localize.
2139
+         *
2140
+         * @since 0.1.44
2141
+         *
2142
+         * @return string Calendar locale.
2143
+         */
2144
+        public static function flatpickr_locale() {
2145
+            $params = self::calendar_params();
2146
+
2147
+            if ( is_string( $params ) ) {
2148
+                $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2149
+            } else {
2150
+                foreach ( (array) $params as $key => $value ) {
2151
+                    if ( ! is_scalar( $value ) ) {
2152
+                        continue;
2153
+                    }
2154
+
2155
+                    $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2156
+                }
2157
+            }
2158
+
2159
+            $day_s3 = array();
2160
+            $day_s5 = array();
2161
+
2162
+            for ( $i = 1; $i <= 7; $i ++ ) {
2163
+                $day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2164
+                $day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2165
+            }
2166
+
2167
+            $month_s = array();
2168
+            $month_long = array();
2169
+
2170
+            for ( $i = 1; $i <= 12; $i ++ ) {
2171
+                $month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2172
+                $month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2173
+            }
2174
+
2175
+            ob_start();
2176
+        if ( 0 ) { ?><script><?php } ?>
2177 2177
                 {
2178 2178
                     weekdays: {
2179 2179
                         shorthand: ['<?php echo implode( "','", $day_s3 ); ?>'],
@@ -2212,189 +2212,189 @@  discard block
 block discarded – undo
2212 2212
                 }
2213 2213
 				<?php if ( 0 ) { ?></script><?php } ?>
2214 2214
 			<?php
2215
-			$locale = ob_get_clean();
2216
-
2217
-			return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2218
-		}
2219
-
2220
-		/**
2221
-		 * Select2 JS params.
2222
-		 *
2223
-		 * @since 0.1.44
2224
-		 *
2225
-		 * @return array Select2 JS params.
2226
-		 */
2227
-		public static function select2_params() {
2228
-			$params = array(
2229
-				'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2230
-				'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2231
-				'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2232
-				'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2233
-				'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2234
-				'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2235
-				'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2236
-				'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2237
-				'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2238
-				'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2239
-				'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2240
-			);
2241
-
2242
-			return apply_filters( 'ayecode_ui_select2_params', $params );
2243
-		}
2244
-
2245
-		/**
2246
-		 * Select2 JS localize.
2247
-		 *
2248
-		 * @since 0.1.44
2249
-		 *
2250
-		 * @return string Select2 JS locale.
2251
-		 */
2252
-		public static function select2_locale() {
2253
-			$params = self::select2_params();
2254
-
2255
-			foreach ( (array) $params as $key => $value ) {
2256
-				if ( ! is_scalar( $value ) ) {
2257
-					continue;
2258
-				}
2215
+            $locale = ob_get_clean();
2259 2216
 
2260
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2261
-			}
2262
-
2263
-			$locale = json_encode( $params );
2264
-
2265
-			return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2266
-		}
2267
-
2268
-		/**
2269
-		 * Time ago JS localize.
2270
-		 *
2271
-		 * @since 0.1.47
2272
-		 *
2273
-		 * @return string Time ago JS locale.
2274
-		 */
2275
-		public static function timeago_locale() {
2276
-			$params = array(
2277
-				'prefix_ago' => '',
2278
-				'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2279
-				'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2280
-				'suffix_after' => '',
2281
-				'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2282
-				'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2283
-				'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2284
-				'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2285
-				'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2286
-				'day' => _x( 'a day', 'time ago', 'aui' ),
2287
-				'days' => _x( '%d days', 'time ago', 'aui' ),
2288
-				'month' => _x( 'about a month', 'time ago', 'aui' ),
2289
-				'months' => _x( '%d months', 'time ago', 'aui' ),
2290
-				'year' => _x( 'about a year', 'time ago', 'aui' ),
2291
-				'years' => _x( '%d years', 'time ago', 'aui' ),
2292
-			);
2293
-
2294
-			$params = apply_filters( 'ayecode_ui_timeago_params', $params );
2295
-
2296
-			foreach ( (array) $params as $key => $value ) {
2297
-				if ( ! is_scalar( $value ) ) {
2298
-					continue;
2299
-				}
2217
+            return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2218
+        }
2300 2219
 
2301
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2302
-			}
2303
-
2304
-			$locale = json_encode( $params );
2305
-
2306
-			return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2307
-		}
2308
-
2309
-		/**
2310
-		 * JavaScript Minifier
2311
-		 *
2312
-		 * @param $input
2313
-		 *
2314
-		 * @return mixed
2315
-		 */
2316
-		public static function minify_js($input) {
2317
-			if(trim($input) === "") return $input;
2318
-			return preg_replace(
2319
-				array(
2320
-					// Remove comment(s)
2321
-					'#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2322
-					// Remove white-space(s) outside the string and regex
2323
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2324
-					// Remove the last semicolon
2325
-					'#;+\}#',
2326
-					// Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2327
-					'#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2328
-					// --ibid. From `foo['bar']` to `foo.bar`
2329
-					'#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2330
-				),
2331
-				array(
2332
-					'$1',
2333
-					'$1$2',
2334
-					'}',
2335
-					'$1$3',
2336
-					'$1.$3'
2337
-				),
2338
-				$input);
2339
-		}
2340
-
2341
-		/**
2342
-		 * Minify CSS
2343
-		 *
2344
-		 * @param $input
2345
-		 *
2346
-		 * @return mixed
2347
-		 */
2348
-		public static function minify_css($input) {
2349
-			if(trim($input) === "") return $input;
2350
-			return preg_replace(
2351
-				array(
2352
-					// Remove comment(s)
2353
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2354
-					// Remove unused white-space(s)
2355
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2356
-					// Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2357
-					'#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2358
-					// Replace `:0 0 0 0` with `:0`
2359
-					'#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2360
-					// Replace `background-position:0` with `background-position:0 0`
2361
-					'#(background-position):0(?=[;\}])#si',
2362
-					// Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2363
-					'#(?<=[\s:,\-])0+\.(\d+)#s',
2364
-					// Minify string value
2365
-					'#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2366
-					'#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2367
-					// Minify HEX color code
2368
-					'#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2369
-					// Replace `(border|outline):none` with `(border|outline):0`
2370
-					'#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2371
-					// Remove empty selector(s)
2372
-					'#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2373
-				),
2374
-				array(
2375
-					'$1',
2376
-					'$1$2$3$4$5$6$7',
2377
-					'$1',
2378
-					':0',
2379
-					'$1:0 0',
2380
-					'.$1',
2381
-					'$1$3',
2382
-					'$1$2$4$5',
2383
-					'$1$2$3',
2384
-					'$1:0',
2385
-					'$1$2'
2386
-				),
2387
-				$input);
2388
-		}
2389
-
2390
-		/**
2391
-		 * Get the conditional fields JavaScript.
2392
-		 *
2393
-		 * @return mixed
2394
-		 */
2395
-		public function conditional_fields_js() {
2396
-			ob_start();
2397
-			?>
2220
+        /**
2221
+         * Select2 JS params.
2222
+         *
2223
+         * @since 0.1.44
2224
+         *
2225
+         * @return array Select2 JS params.
2226
+         */
2227
+        public static function select2_params() {
2228
+            $params = array(
2229
+                'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2230
+                'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2231
+                'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2232
+                'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2233
+                'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2234
+                'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2235
+                'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2236
+                'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2237
+                'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2238
+                'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2239
+                'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2240
+            );
2241
+
2242
+            return apply_filters( 'ayecode_ui_select2_params', $params );
2243
+        }
2244
+
2245
+        /**
2246
+         * Select2 JS localize.
2247
+         *
2248
+         * @since 0.1.44
2249
+         *
2250
+         * @return string Select2 JS locale.
2251
+         */
2252
+        public static function select2_locale() {
2253
+            $params = self::select2_params();
2254
+
2255
+            foreach ( (array) $params as $key => $value ) {
2256
+                if ( ! is_scalar( $value ) ) {
2257
+                    continue;
2258
+                }
2259
+
2260
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2261
+            }
2262
+
2263
+            $locale = json_encode( $params );
2264
+
2265
+            return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2266
+        }
2267
+
2268
+        /**
2269
+         * Time ago JS localize.
2270
+         *
2271
+         * @since 0.1.47
2272
+         *
2273
+         * @return string Time ago JS locale.
2274
+         */
2275
+        public static function timeago_locale() {
2276
+            $params = array(
2277
+                'prefix_ago' => '',
2278
+                'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2279
+                'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2280
+                'suffix_after' => '',
2281
+                'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2282
+                'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2283
+                'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2284
+                'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2285
+                'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2286
+                'day' => _x( 'a day', 'time ago', 'aui' ),
2287
+                'days' => _x( '%d days', 'time ago', 'aui' ),
2288
+                'month' => _x( 'about a month', 'time ago', 'aui' ),
2289
+                'months' => _x( '%d months', 'time ago', 'aui' ),
2290
+                'year' => _x( 'about a year', 'time ago', 'aui' ),
2291
+                'years' => _x( '%d years', 'time ago', 'aui' ),
2292
+            );
2293
+
2294
+            $params = apply_filters( 'ayecode_ui_timeago_params', $params );
2295
+
2296
+            foreach ( (array) $params as $key => $value ) {
2297
+                if ( ! is_scalar( $value ) ) {
2298
+                    continue;
2299
+                }
2300
+
2301
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2302
+            }
2303
+
2304
+            $locale = json_encode( $params );
2305
+
2306
+            return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2307
+        }
2308
+
2309
+        /**
2310
+         * JavaScript Minifier
2311
+         *
2312
+         * @param $input
2313
+         *
2314
+         * @return mixed
2315
+         */
2316
+        public static function minify_js($input) {
2317
+            if(trim($input) === "") return $input;
2318
+            return preg_replace(
2319
+                array(
2320
+                    // Remove comment(s)
2321
+                    '#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2322
+                    // Remove white-space(s) outside the string and regex
2323
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2324
+                    // Remove the last semicolon
2325
+                    '#;+\}#',
2326
+                    // Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2327
+                    '#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2328
+                    // --ibid. From `foo['bar']` to `foo.bar`
2329
+                    '#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2330
+                ),
2331
+                array(
2332
+                    '$1',
2333
+                    '$1$2',
2334
+                    '}',
2335
+                    '$1$3',
2336
+                    '$1.$3'
2337
+                ),
2338
+                $input);
2339
+        }
2340
+
2341
+        /**
2342
+         * Minify CSS
2343
+         *
2344
+         * @param $input
2345
+         *
2346
+         * @return mixed
2347
+         */
2348
+        public static function minify_css($input) {
2349
+            if(trim($input) === "") return $input;
2350
+            return preg_replace(
2351
+                array(
2352
+                    // Remove comment(s)
2353
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2354
+                    // Remove unused white-space(s)
2355
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2356
+                    // Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2357
+                    '#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2358
+                    // Replace `:0 0 0 0` with `:0`
2359
+                    '#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2360
+                    // Replace `background-position:0` with `background-position:0 0`
2361
+                    '#(background-position):0(?=[;\}])#si',
2362
+                    // Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2363
+                    '#(?<=[\s:,\-])0+\.(\d+)#s',
2364
+                    // Minify string value
2365
+                    '#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2366
+                    '#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2367
+                    // Minify HEX color code
2368
+                    '#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2369
+                    // Replace `(border|outline):none` with `(border|outline):0`
2370
+                    '#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2371
+                    // Remove empty selector(s)
2372
+                    '#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2373
+                ),
2374
+                array(
2375
+                    '$1',
2376
+                    '$1$2$3$4$5$6$7',
2377
+                    '$1',
2378
+                    ':0',
2379
+                    '$1:0 0',
2380
+                    '.$1',
2381
+                    '$1$3',
2382
+                    '$1$2$4$5',
2383
+                    '$1$2$3',
2384
+                    '$1:0',
2385
+                    '$1$2'
2386
+                ),
2387
+                $input);
2388
+        }
2389
+
2390
+        /**
2391
+         * Get the conditional fields JavaScript.
2392
+         *
2393
+         * @return mixed
2394
+         */
2395
+        public function conditional_fields_js() {
2396
+            ob_start();
2397
+            ?>
2398 2398
             <script>
2399 2399
                 /**
2400 2400
                  * Conditional Fields
@@ -2899,14 +2899,14 @@  discard block
 block discarded – undo
2899 2899
 				<?php do_action( 'aui_conditional_fields_js', $this ); ?>
2900 2900
             </script>
2901 2901
 			<?php
2902
-			$output = ob_get_clean();
2902
+            $output = ob_get_clean();
2903 2903
 
2904
-			return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
2905
-		}
2906
-	}
2904
+            return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
2905
+        }
2906
+    }
2907 2907
 
2908
-	/**
2909
-	 * Run the class if found.
2910
-	 */
2911
-	AyeCode_UI_Settings::instance();
2908
+    /**
2909
+     * Run the class if found.
2910
+     */
2911
+    AyeCode_UI_Settings::instance();
2912 2912
 }
2913 2913
\ No newline at end of file
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/sd-functions.php 1 patch
Indentation   +2434 added lines, -2434 removed lines patch added patch discarded remove patch
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
  * @return mixed|void
12 12
  */
13 13
 function sd_pagenow_exclude() {
14
-	return apply_filters(
15
-		'sd_pagenow_exclude',
16
-		array(
17
-			'upload.php',
18
-			'edit-comments.php',
19
-			'edit-tags.php',
20
-			'index.php',
21
-			'media-new.php',
22
-			'options-discussion.php',
23
-			'options-writing.php',
24
-			'edit.php',
25
-			'themes.php',
26
-			'users.php',
27
-		)
28
-	);
14
+    return apply_filters(
15
+        'sd_pagenow_exclude',
16
+        array(
17
+            'upload.php',
18
+            'edit-comments.php',
19
+            'edit-tags.php',
20
+            'index.php',
21
+            'media-new.php',
22
+            'options-discussion.php',
23
+            'options-writing.php',
24
+            'edit.php',
25
+            'themes.php',
26
+            'users.php',
27
+        )
28
+    );
29 29
 }
30 30
 
31 31
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  * @return mixed|void
38 38
  */
39 39
 function sd_widget_exclude() {
40
-	return apply_filters( 'sd_widget_exclude', array() );
40
+    return apply_filters( 'sd_widget_exclude', array() );
41 41
 }
42 42
 
43 43
 
@@ -50,83 +50,83 @@  discard block
 block discarded – undo
50 50
  * @return array
51 51
  */
52 52
 function sd_get_margin_input( $type = 'mt', $overwrite = array(), $include_negatives = true ) {
53
-	global $aui_bs5;
54
-	$options = array(
55
-		''     => __( 'None', 'super-duper' ),
56
-		'auto' => __( 'auto', 'super-duper' ),
57
-		'0'    => '0',
58
-		'1'    => '1',
59
-		'2'    => '2',
60
-		'3'    => '3',
61
-		'4'    => '4',
62
-		'5'    => '5',
63
-		'6'    => '6',
64
-		'7'    => '7',
65
-		'8'    => '8',
66
-		'9'    => '9',
67
-		'10'   => '10',
68
-		'11'   => '11',
69
-		'12'   => '12',
70
-	);
71
-
72
-	if ( $include_negatives ) {
73
-		$options['n1']  = '-1';
74
-		$options['n2']  = '-2';
75
-		$options['n3']  = '-3';
76
-		$options['n4']  = '-4';
77
-		$options['n5']  = '-5';
78
-		$options['n6']  = '-6';
79
-		$options['n7']  = '-7';
80
-		$options['n8']  = '-8';
81
-		$options['n9']  = '-9';
82
-		$options['n10'] = '-10';
83
-		$options['n11'] = '-11';
84
-		$options['n12'] = '-12';
85
-	}
86
-
87
-	$defaults = array(
88
-		'type'     => 'select',
89
-		'title'    => __( 'Margin top', 'super-duper' ),
90
-		'options'  => $options,
91
-		'default'  => '',
92
-		'desc_tip' => true,
93
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
94
-	);
95
-
96
-	// title
97
-	if ( $type == 'mt' ) {
98
-		$defaults['title'] = __( 'Margin top', 'super-duper' );
99
-		$defaults['icon']  = 'box-top';
100
-		$defaults['row']   = array(
101
-			'title' => __( 'Margins', 'super-duper' ),
102
-			'key'   => 'wrapper-margins',
103
-			'open'  => true,
104
-			'class' => 'text-center',
105
-		);
106
-	} elseif ( $type == 'mr' ) {
107
-		$defaults['title'] = __( 'Margin right', 'super-duper' );
108
-		$defaults['icon']  = 'box-right';
109
-		$defaults['row']   = array(
110
-			'key' => 'wrapper-margins',
111
-		);
112
-	} elseif ( $type == 'mb' ) {
113
-		$defaults['title'] = __( 'Margin bottom', 'super-duper' );
114
-		$defaults['icon']  = 'box-bottom';
115
-		$defaults['row']   = array(
116
-			'key' => 'wrapper-margins',
117
-		);
118
-	} elseif ( $type == 'ml' ) {
119
-		$defaults['title'] = __( 'Margin left', 'super-duper' );
120
-		$defaults['icon']  = 'box-left';
121
-		$defaults['row']   = array(
122
-			'key'   => 'wrapper-margins',
123
-			'close' => true,
124
-		);
125
-	}
126
-
127
-	$input = wp_parse_args( $overwrite, $defaults );
128
-
129
-	return $input;
53
+    global $aui_bs5;
54
+    $options = array(
55
+        ''     => __( 'None', 'super-duper' ),
56
+        'auto' => __( 'auto', 'super-duper' ),
57
+        '0'    => '0',
58
+        '1'    => '1',
59
+        '2'    => '2',
60
+        '3'    => '3',
61
+        '4'    => '4',
62
+        '5'    => '5',
63
+        '6'    => '6',
64
+        '7'    => '7',
65
+        '8'    => '8',
66
+        '9'    => '9',
67
+        '10'   => '10',
68
+        '11'   => '11',
69
+        '12'   => '12',
70
+    );
71
+
72
+    if ( $include_negatives ) {
73
+        $options['n1']  = '-1';
74
+        $options['n2']  = '-2';
75
+        $options['n3']  = '-3';
76
+        $options['n4']  = '-4';
77
+        $options['n5']  = '-5';
78
+        $options['n6']  = '-6';
79
+        $options['n7']  = '-7';
80
+        $options['n8']  = '-8';
81
+        $options['n9']  = '-9';
82
+        $options['n10'] = '-10';
83
+        $options['n11'] = '-11';
84
+        $options['n12'] = '-12';
85
+    }
86
+
87
+    $defaults = array(
88
+        'type'     => 'select',
89
+        'title'    => __( 'Margin top', 'super-duper' ),
90
+        'options'  => $options,
91
+        'default'  => '',
92
+        'desc_tip' => true,
93
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
94
+    );
95
+
96
+    // title
97
+    if ( $type == 'mt' ) {
98
+        $defaults['title'] = __( 'Margin top', 'super-duper' );
99
+        $defaults['icon']  = 'box-top';
100
+        $defaults['row']   = array(
101
+            'title' => __( 'Margins', 'super-duper' ),
102
+            'key'   => 'wrapper-margins',
103
+            'open'  => true,
104
+            'class' => 'text-center',
105
+        );
106
+    } elseif ( $type == 'mr' ) {
107
+        $defaults['title'] = __( 'Margin right', 'super-duper' );
108
+        $defaults['icon']  = 'box-right';
109
+        $defaults['row']   = array(
110
+            'key' => 'wrapper-margins',
111
+        );
112
+    } elseif ( $type == 'mb' ) {
113
+        $defaults['title'] = __( 'Margin bottom', 'super-duper' );
114
+        $defaults['icon']  = 'box-bottom';
115
+        $defaults['row']   = array(
116
+            'key' => 'wrapper-margins',
117
+        );
118
+    } elseif ( $type == 'ml' ) {
119
+        $defaults['title'] = __( 'Margin left', 'super-duper' );
120
+        $defaults['icon']  = 'box-left';
121
+        $defaults['row']   = array(
122
+            'key'   => 'wrapper-margins',
123
+            'close' => true,
124
+        );
125
+    }
126
+
127
+    $input = wp_parse_args( $overwrite, $defaults );
128
+
129
+    return $input;
130 130
 }
131 131
 
132 132
 /**
@@ -138,67 +138,67 @@  discard block
 block discarded – undo
138 138
  * @return array
139 139
  */
140 140
 function sd_get_padding_input( $type = 'pt', $overwrite = array() ) {
141
-	$options = array(
142
-		''   => __( 'None', 'super-duper' ),
143
-		'0'  => '0',
144
-		'1'  => '1',
145
-		'2'  => '2',
146
-		'3'  => '3',
147
-		'4'  => '4',
148
-		'5'  => '5',
149
-		'6'  => '6',
150
-		'7'  => '7',
151
-		'8'  => '8',
152
-		'9'  => '9',
153
-		'10' => '10',
154
-		'11' => '11',
155
-		'12' => '12',
156
-	);
157
-
158
-	$defaults = array(
159
-		'type'     => 'select',
160
-		'title'    => __( 'Padding top', 'super-duper' ),
161
-		'options'  => $options,
162
-		'default'  => '',
163
-		'desc_tip' => true,
164
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
165
-	);
166
-
167
-	// title
168
-	if ( $type == 'pt' ) {
169
-		$defaults['title'] = __( 'Padding top', 'super-duper' );
170
-		$defaults['icon']  = 'box-top';
171
-		$defaults['row']   = array(
172
-			'title' => __( 'Padding', 'super-duper' ),
173
-			'key'   => 'wrapper-padding',
174
-			'open'  => true,
175
-			'class' => 'text-center',
176
-		);
177
-	} elseif ( $type == 'pr' ) {
178
-		$defaults['title'] = __( 'Padding right', 'super-duper' );
179
-		$defaults['icon']  = 'box-right';
180
-		$defaults['row']   = array(
181
-			'key' => 'wrapper-padding',
182
-		);
183
-	} elseif ( $type == 'pb' ) {
184
-		$defaults['title'] = __( 'Padding bottom', 'super-duper' );
185
-		$defaults['icon']  = 'box-bottom';
186
-		$defaults['row']   = array(
187
-			'key' => 'wrapper-padding',
188
-		);
189
-	} elseif ( $type == 'pl' ) {
190
-		$defaults['title'] = __( 'Padding left', 'super-duper' );
191
-		$defaults['icon']  = 'box-left';
192
-		$defaults['row']   = array(
193
-			'key'   => 'wrapper-padding',
194
-			'close' => true,
195
-
196
-		);
197
-	}
198
-
199
-	$input = wp_parse_args( $overwrite, $defaults );
200
-
201
-	return $input;
141
+    $options = array(
142
+        ''   => __( 'None', 'super-duper' ),
143
+        '0'  => '0',
144
+        '1'  => '1',
145
+        '2'  => '2',
146
+        '3'  => '3',
147
+        '4'  => '4',
148
+        '5'  => '5',
149
+        '6'  => '6',
150
+        '7'  => '7',
151
+        '8'  => '8',
152
+        '9'  => '9',
153
+        '10' => '10',
154
+        '11' => '11',
155
+        '12' => '12',
156
+    );
157
+
158
+    $defaults = array(
159
+        'type'     => 'select',
160
+        'title'    => __( 'Padding top', 'super-duper' ),
161
+        'options'  => $options,
162
+        'default'  => '',
163
+        'desc_tip' => true,
164
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
165
+    );
166
+
167
+    // title
168
+    if ( $type == 'pt' ) {
169
+        $defaults['title'] = __( 'Padding top', 'super-duper' );
170
+        $defaults['icon']  = 'box-top';
171
+        $defaults['row']   = array(
172
+            'title' => __( 'Padding', 'super-duper' ),
173
+            'key'   => 'wrapper-padding',
174
+            'open'  => true,
175
+            'class' => 'text-center',
176
+        );
177
+    } elseif ( $type == 'pr' ) {
178
+        $defaults['title'] = __( 'Padding right', 'super-duper' );
179
+        $defaults['icon']  = 'box-right';
180
+        $defaults['row']   = array(
181
+            'key' => 'wrapper-padding',
182
+        );
183
+    } elseif ( $type == 'pb' ) {
184
+        $defaults['title'] = __( 'Padding bottom', 'super-duper' );
185
+        $defaults['icon']  = 'box-bottom';
186
+        $defaults['row']   = array(
187
+            'key' => 'wrapper-padding',
188
+        );
189
+    } elseif ( $type == 'pl' ) {
190
+        $defaults['title'] = __( 'Padding left', 'super-duper' );
191
+        $defaults['icon']  = 'box-left';
192
+        $defaults['row']   = array(
193
+            'key'   => 'wrapper-padding',
194
+            'close' => true,
195
+
196
+        );
197
+    }
198
+
199
+    $input = wp_parse_args( $overwrite, $defaults );
200
+
201
+    return $input;
202 202
 }
203 203
 
204 204
 /**
@@ -210,97 +210,97 @@  discard block
 block discarded – undo
210 210
  * @return array
211 211
  */
212 212
 function sd_get_border_input( $type = 'border', $overwrite = array() ) {
213
-	global $aui_bs5;
214
-
215
-	$defaults = array(
216
-		'type'     => 'select',
217
-		'title'    => __( 'Border', 'super-duper' ),
218
-		'options'  => array(),
219
-		'default'  => '',
220
-		'desc_tip' => true,
221
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
222
-	);
223
-
224
-	// title
225
-	if ( 'rounded' === $type ) {
226
-		$defaults['title']           = __( 'Border radius type', 'super-duper' );
227
-		$defaults['options']         = array(
228
-			''               => __( 'Default', 'super-duper' ),
229
-			'rounded'        => 'rounded',
230
-			'rounded-top'    => 'rounded-top',
231
-			'rounded-right'  => 'rounded-right',
232
-			'rounded-bottom' => 'rounded-bottom',
233
-			'rounded-left'   => 'rounded-left',
234
-		);
235
-		$defaults['element_require'] = '[%border%]';
236
-	} elseif ( 'rounded_size' === $type ) {
237
-		$defaults['title'] = __( 'Border radius size', 'super-duper' );
238
-
239
-		if ( $aui_bs5 ) {
240
-			$defaults['options'] = array(
241
-				''       => __( 'Default', 'super-duper' ),
242
-				'0'      => '0',
243
-				'1'      => '1',
244
-				'2'      => '2',
245
-				'3'      => '3',
246
-				'4'      => '4',
247
-				'circle' => 'circle',
248
-				'pill'   => 'pill',
249
-			);
250
-		} else {
251
-			$defaults['options'] = array(
252
-				''   => __( 'Default', 'super-duper' ),
253
-				'sm' => __( 'Small', 'super-duper' ),
254
-				'lg' => __( 'Large', 'super-duper' ),
255
-			);
256
-		}
257
-		$defaults['element_require'] = '[%border%]';
258
-	} elseif ( 'width' === $type ) { // BS%
259
-		$defaults['title']           = __( 'Border width', 'super-duper' );
260
-		$defaults['options']         = array(
261
-			''         => __( 'Default', 'super-duper' ),
262
-			'border-2' => '2',
263
-			'border-3' => '3',
264
-			'border-4' => '4',
265
-			'border-5' => '5',
266
-		);
267
-		$defaults['element_require'] = $aui_bs5 ? '[%border%]' : '1==2';
268
-	} elseif ( 'opacity' === $type ) { // BS%
269
-		$defaults['title']           = __( 'Border opacity', 'super-duper' );
270
-		$defaults['options']         = array(
271
-			''                  => __( 'Default', 'super-duper' ),
272
-			'border-opacity-75' => '75%',
273
-			'border-opacity-50' => '50%',
274
-			'border-opacity-25' => '25%',
275
-			'border-opacity-10' => '10%',
276
-		);
277
-		$defaults['element_require'] = $aui_bs5 ? '[%border%]' : '1==2';
278
-	} elseif ( 'type' === $type ) {
279
-		$defaults['title']           = __( 'Border show', 'super-duper' );
280
-		$defaults['options']         = array(
281
-			'border'          => __( 'Full (set color to show)', 'super-duper' ),
282
-			'border-top'      => __( 'Top', 'super-duper' ),
283
-			'border-bottom'   => __( 'Bottom', 'super-duper' ),
284
-			'border-left'     => __( 'Left', 'super-duper' ),
285
-			'border-right'    => __( 'Right', 'super-duper' ),
286
-			'border-top-0'    => __( '-Top', 'super-duper' ),
287
-			'border-bottom-0' => __( '-Bottom', 'super-duper' ),
288
-			'border-left-0'   => __( '-Left', 'super-duper' ),
289
-			'border-right-0'  => __( '-Right', 'super-duper' ),
290
-		);
291
-		$defaults['element_require'] = '[%border%]';
292
-
293
-	} else {
294
-		$defaults['title']   = __( 'Border color', 'super-duper' );
295
-		$defaults['options'] = array(
296
-			                       ''  => __( 'Default', 'super-duper' ),
297
-			                       '0' => __( 'None', 'super-duper' ),
298
-		                       ) + sd_aui_colors();
299
-	}
300
-
301
-	$input = wp_parse_args( $overwrite, $defaults );
302
-
303
-	return $input;
213
+    global $aui_bs5;
214
+
215
+    $defaults = array(
216
+        'type'     => 'select',
217
+        'title'    => __( 'Border', 'super-duper' ),
218
+        'options'  => array(),
219
+        'default'  => '',
220
+        'desc_tip' => true,
221
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
222
+    );
223
+
224
+    // title
225
+    if ( 'rounded' === $type ) {
226
+        $defaults['title']           = __( 'Border radius type', 'super-duper' );
227
+        $defaults['options']         = array(
228
+            ''               => __( 'Default', 'super-duper' ),
229
+            'rounded'        => 'rounded',
230
+            'rounded-top'    => 'rounded-top',
231
+            'rounded-right'  => 'rounded-right',
232
+            'rounded-bottom' => 'rounded-bottom',
233
+            'rounded-left'   => 'rounded-left',
234
+        );
235
+        $defaults['element_require'] = '[%border%]';
236
+    } elseif ( 'rounded_size' === $type ) {
237
+        $defaults['title'] = __( 'Border radius size', 'super-duper' );
238
+
239
+        if ( $aui_bs5 ) {
240
+            $defaults['options'] = array(
241
+                ''       => __( 'Default', 'super-duper' ),
242
+                '0'      => '0',
243
+                '1'      => '1',
244
+                '2'      => '2',
245
+                '3'      => '3',
246
+                '4'      => '4',
247
+                'circle' => 'circle',
248
+                'pill'   => 'pill',
249
+            );
250
+        } else {
251
+            $defaults['options'] = array(
252
+                ''   => __( 'Default', 'super-duper' ),
253
+                'sm' => __( 'Small', 'super-duper' ),
254
+                'lg' => __( 'Large', 'super-duper' ),
255
+            );
256
+        }
257
+        $defaults['element_require'] = '[%border%]';
258
+    } elseif ( 'width' === $type ) { // BS%
259
+        $defaults['title']           = __( 'Border width', 'super-duper' );
260
+        $defaults['options']         = array(
261
+            ''         => __( 'Default', 'super-duper' ),
262
+            'border-2' => '2',
263
+            'border-3' => '3',
264
+            'border-4' => '4',
265
+            'border-5' => '5',
266
+        );
267
+        $defaults['element_require'] = $aui_bs5 ? '[%border%]' : '1==2';
268
+    } elseif ( 'opacity' === $type ) { // BS%
269
+        $defaults['title']           = __( 'Border opacity', 'super-duper' );
270
+        $defaults['options']         = array(
271
+            ''                  => __( 'Default', 'super-duper' ),
272
+            'border-opacity-75' => '75%',
273
+            'border-opacity-50' => '50%',
274
+            'border-opacity-25' => '25%',
275
+            'border-opacity-10' => '10%',
276
+        );
277
+        $defaults['element_require'] = $aui_bs5 ? '[%border%]' : '1==2';
278
+    } elseif ( 'type' === $type ) {
279
+        $defaults['title']           = __( 'Border show', 'super-duper' );
280
+        $defaults['options']         = array(
281
+            'border'          => __( 'Full (set color to show)', 'super-duper' ),
282
+            'border-top'      => __( 'Top', 'super-duper' ),
283
+            'border-bottom'   => __( 'Bottom', 'super-duper' ),
284
+            'border-left'     => __( 'Left', 'super-duper' ),
285
+            'border-right'    => __( 'Right', 'super-duper' ),
286
+            'border-top-0'    => __( '-Top', 'super-duper' ),
287
+            'border-bottom-0' => __( '-Bottom', 'super-duper' ),
288
+            'border-left-0'   => __( '-Left', 'super-duper' ),
289
+            'border-right-0'  => __( '-Right', 'super-duper' ),
290
+        );
291
+        $defaults['element_require'] = '[%border%]';
292
+
293
+    } else {
294
+        $defaults['title']   = __( 'Border color', 'super-duper' );
295
+        $defaults['options'] = array(
296
+                                    ''  => __( 'Default', 'super-duper' ),
297
+                                    '0' => __( 'None', 'super-duper' ),
298
+                                ) + sd_aui_colors();
299
+    }
300
+
301
+    $input = wp_parse_args( $overwrite, $defaults );
302
+
303
+    return $input;
304 304
 }
305 305
 
306 306
 /**
@@ -312,25 +312,25 @@  discard block
 block discarded – undo
312 312
  * @return array
313 313
  */
314 314
 function sd_get_shadow_input( $type = 'shadow', $overwrite = array() ) {
315
-	$options = array(
316
-		''          => __( 'None', 'super-duper' ),
317
-		'shadow-sm' => __( 'Small', 'super-duper' ),
318
-		'shadow'    => __( 'Regular', 'super-duper' ),
319
-		'shadow-lg' => __( 'Large', 'super-duper' ),
320
-	);
315
+    $options = array(
316
+        ''          => __( 'None', 'super-duper' ),
317
+        'shadow-sm' => __( 'Small', 'super-duper' ),
318
+        'shadow'    => __( 'Regular', 'super-duper' ),
319
+        'shadow-lg' => __( 'Large', 'super-duper' ),
320
+    );
321 321
 
322
-	$defaults = array(
323
-		'type'     => 'select',
324
-		'title'    => __( 'Shadow', 'super-duper' ),
325
-		'options'  => $options,
326
-		'default'  => '',
327
-		'desc_tip' => true,
328
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
329
-	);
322
+    $defaults = array(
323
+        'type'     => 'select',
324
+        'title'    => __( 'Shadow', 'super-duper' ),
325
+        'options'  => $options,
326
+        'default'  => '',
327
+        'desc_tip' => true,
328
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
329
+    );
330 330
 
331
-	$input = wp_parse_args( $overwrite, $defaults );
331
+    $input = wp_parse_args( $overwrite, $defaults );
332 332
 
333
-	return $input;
333
+    return $input;
334 334
 }
335 335
 
336 336
 /**
@@ -342,23 +342,23 @@  discard block
 block discarded – undo
342 342
  * @return array
343 343
  */
344 344
 function sd_get_background_input( $type = 'bg', $overwrite = array() ) {
345
-	$options = array(
346
-		           ''            => __( 'None', 'super-duper' ),
347
-		           'transparent' => __( 'Transparent', 'super-duper' ),
348
-	           ) + sd_aui_colors();
345
+    $options = array(
346
+                    ''            => __( 'None', 'super-duper' ),
347
+                    'transparent' => __( 'Transparent', 'super-duper' ),
348
+                ) + sd_aui_colors();
349 349
 
350
-	$defaults = array(
351
-		'type'     => 'select',
352
-		'title'    => __( 'Background color', 'super-duper' ),
353
-		'options'  => $options,
354
-		'default'  => '',
355
-		'desc_tip' => true,
356
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
357
-	);
350
+    $defaults = array(
351
+        'type'     => 'select',
352
+        'title'    => __( 'Background color', 'super-duper' ),
353
+        'options'  => $options,
354
+        'default'  => '',
355
+        'desc_tip' => true,
356
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
357
+    );
358 358
 
359
-	$input = wp_parse_args( $overwrite, $defaults );
359
+    $input = wp_parse_args( $overwrite, $defaults );
360 360
 
361
-	return $input;
361
+    return $input;
362 362
 }
363 363
 
364 364
 /**
@@ -370,35 +370,35 @@  discard block
 block discarded – undo
370 370
  * @return array
371 371
  */
372 372
 function sd_get_opacity_input( $type = 'opacity', $overwrite = array() ) {
373
-	$options = array(
374
-		''            => __( 'Default', 'super-duper' ),
375
-		'opacity-10'  => '10%',
376
-		'opacity-15'  => '15%',
377
-		'opacity-25'  => '25%',
378
-		'opacity-35'  => '35%',
379
-		'opacity-40'  => '40%',
380
-		'opacity-50'  => '50%',
381
-		'opacity-60'  => '60%',
382
-		'opacity-65'  => '65%',
383
-		'opacity-70'  => '70%',
384
-		'opacity-75'  => '75%',
385
-		'opacity-80'  => '80%',
386
-		'opacity-90'  => '90%',
387
-		'opacity-100' => '100%',
388
-	);
389
-
390
-	$defaults = array(
391
-		'type'     => 'select',
392
-		'title'    => __( 'Opacity', 'super-duper' ),
393
-		'options'  => $options,
394
-		'default'  => '',
395
-		'desc_tip' => true,
396
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
397
-	);
398
-
399
-	$input = wp_parse_args( $overwrite, $defaults );
400
-
401
-	return $input;
373
+    $options = array(
374
+        ''            => __( 'Default', 'super-duper' ),
375
+        'opacity-10'  => '10%',
376
+        'opacity-15'  => '15%',
377
+        'opacity-25'  => '25%',
378
+        'opacity-35'  => '35%',
379
+        'opacity-40'  => '40%',
380
+        'opacity-50'  => '50%',
381
+        'opacity-60'  => '60%',
382
+        'opacity-65'  => '65%',
383
+        'opacity-70'  => '70%',
384
+        'opacity-75'  => '75%',
385
+        'opacity-80'  => '80%',
386
+        'opacity-90'  => '90%',
387
+        'opacity-100' => '100%',
388
+    );
389
+
390
+    $defaults = array(
391
+        'type'     => 'select',
392
+        'title'    => __( 'Opacity', 'super-duper' ),
393
+        'options'  => $options,
394
+        'default'  => '',
395
+        'desc_tip' => true,
396
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
397
+    );
398
+
399
+    $input = wp_parse_args( $overwrite, $defaults );
400
+
401
+    return $input;
402 402
 }
403 403
 
404 404
 /**
@@ -411,124 +411,124 @@  discard block
 block discarded – undo
411 411
  */
412 412
 function sd_get_background_inputs( $type = 'bg', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array(), $include_button_colors = false ) {
413 413
 
414
-	$color_options = $include_button_colors ? sd_aui_colors( false, true, true, true ) : sd_aui_colors();
415
-
416
-	$options = array(
417
-		           ''            => __( 'None', 'super-duper' ),
418
-		           'transparent' => __( 'Transparent', 'super-duper' ),
419
-	           ) + $color_options;
420
-
421
-	if ( false !== $overwrite_color ) {
422
-		$options['custom-color'] = __( 'Custom Color', 'super-duper' );
423
-	}
424
-
425
-	if ( false !== $overwrite_gradient ) {
426
-		$options['custom-gradient'] = __( 'Custom Gradient', 'super-duper' );
427
-	}
428
-
429
-	$defaults = array(
430
-		'type'     => 'select',
431
-		'title'    => __( 'Background Color', 'super-duper' ),
432
-		'options'  => $options,
433
-		'default'  => '',
434
-		'desc_tip' => true,
435
-		'group'    => __( 'Background', 'super-duper' ),
436
-	);
437
-
438
-	if ( $overwrite !== false ) {
439
-		$input[ $type ] = wp_parse_args( $overwrite, $defaults );
440
-	}
441
-
442
-	if ( $overwrite_color !== false ) {
443
-		$input[ $type . '_color' ] = wp_parse_args(
444
-			$overwrite_color,
445
-			array(
446
-				'type'            => 'color',
447
-				'title'           => __( 'Custom color', 'super-duper' ),
448
-				'placeholder'     => '',
449
-				'default'         => '#0073aa',
450
-				'desc_tip'        => true,
451
-				'group'           => __( 'Background', 'super-duper' ),
452
-				'element_require' => '[%' . $type . '%]=="custom-color"',
453
-			)
454
-		);
455
-	}
456
-
457
-	if ( $overwrite_gradient !== false ) {
458
-		$input[ $type . '_gradient' ] = wp_parse_args(
459
-			$overwrite_gradient,
460
-			array(
461
-				'type'            => 'gradient',
462
-				'title'           => __( 'Custom gradient', 'super-duper' ),
463
-				'placeholder'     => '',
464
-				'default'         => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
465
-				'desc_tip'        => true,
466
-				'group'           => __( 'Background', 'super-duper' ),
467
-				'element_require' => '[%' . $type . '%]=="custom-gradient"',
468
-			)
469
-		);
470
-	}
471
-
472
-	if ( $overwrite_image !== false ) {
473
-
474
-		$input[ $type . '_image_fixed' ] = array(
475
-			'type'            => 'checkbox',
476
-			'title'           => __( 'Fixed background', 'super-duper' ),
477
-			'default'         => '',
478
-			'desc_tip'        => true,
479
-			'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background', 'super-duper' ),
480
-			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
481
-
482
-		);
483
-
484
-		$input[ $type . '_image_use_featured' ] = array(
485
-			'type'            => 'checkbox',
486
-			'title'           => __( 'Use featured image', 'super-duper' ),
487
-			'default'         => '',
488
-			'desc_tip'        => true,
489
-			'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background', 'super-duper' ),
490
-			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
491
-
492
-		);
493
-
494
-		$input[ $type . '_image' ] = wp_parse_args(
495
-			$overwrite_image,
496
-			array(
497
-				'type'        => 'image',
498
-				'title'       => __( 'Custom image', 'super-duper' ),
499
-				'placeholder' => '',
500
-				'default'     => '',
501
-				'desc_tip'    => true,
502
-				'group'       => __( 'Background', 'super-duper' ),
503
-				//          'element_require' => ' ![%' . $type . '_image_use_featured%] '
504
-			)
505
-		);
506
-
507
-		$input[ $type . '_image_id' ] = wp_parse_args(
508
-			$overwrite_image,
509
-			array(
510
-				'type'        => 'hidden',
511
-				'hidden_type' => 'number',
512
-				'title'       => '',
513
-				'placeholder' => '',
514
-				'default'     => '',
515
-				'group'       => __( 'Background', 'super-duper' ),
516
-			)
517
-		);
518
-
519
-		$input[ $type . '_image_xy' ] = wp_parse_args(
520
-			$overwrite_image,
521
-			array(
522
-				'type'        => 'image_xy',
523
-				'title'       => '',
524
-				'placeholder' => '',
525
-				'default'     => '',
526
-				'group'       => __( 'Background', 'super-duper' ),
527
-			)
528
-		);
529
-	}
530
-
531
-	return $input;
414
+    $color_options = $include_button_colors ? sd_aui_colors( false, true, true, true ) : sd_aui_colors();
415
+
416
+    $options = array(
417
+                    ''            => __( 'None', 'super-duper' ),
418
+                    'transparent' => __( 'Transparent', 'super-duper' ),
419
+                ) + $color_options;
420
+
421
+    if ( false !== $overwrite_color ) {
422
+        $options['custom-color'] = __( 'Custom Color', 'super-duper' );
423
+    }
424
+
425
+    if ( false !== $overwrite_gradient ) {
426
+        $options['custom-gradient'] = __( 'Custom Gradient', 'super-duper' );
427
+    }
428
+
429
+    $defaults = array(
430
+        'type'     => 'select',
431
+        'title'    => __( 'Background Color', 'super-duper' ),
432
+        'options'  => $options,
433
+        'default'  => '',
434
+        'desc_tip' => true,
435
+        'group'    => __( 'Background', 'super-duper' ),
436
+    );
437
+
438
+    if ( $overwrite !== false ) {
439
+        $input[ $type ] = wp_parse_args( $overwrite, $defaults );
440
+    }
441
+
442
+    if ( $overwrite_color !== false ) {
443
+        $input[ $type . '_color' ] = wp_parse_args(
444
+            $overwrite_color,
445
+            array(
446
+                'type'            => 'color',
447
+                'title'           => __( 'Custom color', 'super-duper' ),
448
+                'placeholder'     => '',
449
+                'default'         => '#0073aa',
450
+                'desc_tip'        => true,
451
+                'group'           => __( 'Background', 'super-duper' ),
452
+                'element_require' => '[%' . $type . '%]=="custom-color"',
453
+            )
454
+        );
455
+    }
456
+
457
+    if ( $overwrite_gradient !== false ) {
458
+        $input[ $type . '_gradient' ] = wp_parse_args(
459
+            $overwrite_gradient,
460
+            array(
461
+                'type'            => 'gradient',
462
+                'title'           => __( 'Custom gradient', 'super-duper' ),
463
+                'placeholder'     => '',
464
+                'default'         => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
465
+                'desc_tip'        => true,
466
+                'group'           => __( 'Background', 'super-duper' ),
467
+                'element_require' => '[%' . $type . '%]=="custom-gradient"',
468
+            )
469
+        );
470
+    }
471
+
472
+    if ( $overwrite_image !== false ) {
473
+
474
+        $input[ $type . '_image_fixed' ] = array(
475
+            'type'            => 'checkbox',
476
+            'title'           => __( 'Fixed background', 'super-duper' ),
477
+            'default'         => '',
478
+            'desc_tip'        => true,
479
+            'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background', 'super-duper' ),
480
+            'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
481
+
482
+        );
483
+
484
+        $input[ $type . '_image_use_featured' ] = array(
485
+            'type'            => 'checkbox',
486
+            'title'           => __( 'Use featured image', 'super-duper' ),
487
+            'default'         => '',
488
+            'desc_tip'        => true,
489
+            'group'           => ! empty( $overwrite_image['group'] ) ? $overwrite_image['group'] : __( 'Background', 'super-duper' ),
490
+            'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )',
491
+
492
+        );
493
+
494
+        $input[ $type . '_image' ] = wp_parse_args(
495
+            $overwrite_image,
496
+            array(
497
+                'type'        => 'image',
498
+                'title'       => __( 'Custom image', 'super-duper' ),
499
+                'placeholder' => '',
500
+                'default'     => '',
501
+                'desc_tip'    => true,
502
+                'group'       => __( 'Background', 'super-duper' ),
503
+                //          'element_require' => ' ![%' . $type . '_image_use_featured%] '
504
+            )
505
+        );
506
+
507
+        $input[ $type . '_image_id' ] = wp_parse_args(
508
+            $overwrite_image,
509
+            array(
510
+                'type'        => 'hidden',
511
+                'hidden_type' => 'number',
512
+                'title'       => '',
513
+                'placeholder' => '',
514
+                'default'     => '',
515
+                'group'       => __( 'Background', 'super-duper' ),
516
+            )
517
+        );
518
+
519
+        $input[ $type . '_image_xy' ] = wp_parse_args(
520
+            $overwrite_image,
521
+            array(
522
+                'type'        => 'image_xy',
523
+                'title'       => '',
524
+                'placeholder' => '',
525
+                'default'     => '',
526
+                'group'       => __( 'Background', 'super-duper' ),
527
+            )
528
+        );
529
+    }
530
+
531
+    return $input;
532 532
 }
533 533
 
534 534
 /**
@@ -541,175 +541,175 @@  discard block
 block discarded – undo
541 541
  */
542 542
 function sd_get_shape_divider_inputs( $type = 'sd', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) {
543 543
 
544
-	$options = array(
545
-		''                      => __( 'None', 'super-duper' ),
546
-		'mountains'             => __( 'Mountains', 'super-duper' ),
547
-		'drops'                 => __( 'Drops', 'super-duper' ),
548
-		'clouds'                => __( 'Clouds', 'super-duper' ),
549
-		'zigzag'                => __( 'Zigzag', 'super-duper' ),
550
-		'pyramids'              => __( 'Pyramids', 'super-duper' ),
551
-		'triangle'              => __( 'Triangle', 'super-duper' ),
552
-		'triangle-asymmetrical' => __( 'Triangle Asymmetrical', 'super-duper' ),
553
-		'tilt'                  => __( 'Tilt', 'super-duper' ),
554
-		'opacity-tilt'          => __( 'Opacity Tilt', 'super-duper' ),
555
-		'opacity-fan'           => __( 'Opacity Fan', 'super-duper' ),
556
-		'curve'                 => __( 'Curve', 'super-duper' ),
557
-		'curve-asymmetrical'    => __( 'Curve Asymmetrical', 'super-duper' ),
558
-		'waves'                 => __( 'Waves', 'super-duper' ),
559
-		'wave-brush'            => __( 'Wave Brush', 'super-duper' ),
560
-		'waves-pattern'         => __( 'Waves Pattern', 'super-duper' ),
561
-		'arrow'                 => __( 'Arrow', 'super-duper' ),
562
-		'split'                 => __( 'Split', 'super-duper' ),
563
-		'book'                  => __( 'Book', 'super-duper' ),
564
-	);
565
-
566
-	$defaults = array(
567
-		'type'     => 'select',
568
-		'title'    => __( 'Type', 'super-duper' ),
569
-		'options'  => $options,
570
-		'default'  => '',
571
-		'desc_tip' => true,
572
-		'group'    => __( 'Shape Divider', 'super-duper' ),
573
-	);
574
-
575
-	$input[ $type ] = wp_parse_args( $overwrite, $defaults );
576
-
577
-	$input[ $type . '_notice' ] = array(
578
-		'type'            => 'notice',
579
-		'desc'            => __( 'Parent element must be position `relative`', 'super-duper' ),
580
-		'status'          => 'warning',
581
-		'group'           => __( 'Shape Divider', 'super-duper' ),
582
-		'element_require' => '[%' . $type . '%]!=""',
583
-	);
584
-
585
-	$input[ $type . '_position' ] = wp_parse_args(
586
-		$overwrite_color,
587
-		array(
588
-			'type'            => 'select',
589
-			'title'           => __( 'Position', 'super-duper' ),
590
-			'options'         => array(
591
-				'top'    => __( 'Top', 'super-duper' ),
592
-				'bottom' => __( 'Bottom', 'super-duper' ),
593
-			),
594
-			'desc_tip'        => true,
595
-			'group'           => __( 'Shape Divider', 'super-duper' ),
596
-			'element_require' => '[%' . $type . '%]!=""',
597
-		)
598
-	);
599
-
600
-	$options = array(
601
-		           ''            => __( 'None', 'super-duper' ),
602
-		           'transparent' => __( 'Transparent', 'super-duper' ),
603
-	           ) + sd_aui_colors()
604
-	           + array(
605
-		           'custom-color' => __( 'Custom Color', 'super-duper' ),
606
-	           );
607
-
608
-	$input[ $type . '_color' ] = wp_parse_args(
609
-		$overwrite_color,
610
-		array(
611
-			'type'            => 'select',
612
-			'title'           => __( 'Color', 'super-duper' ),
613
-			'options'         => $options,
614
-			'desc_tip'        => true,
615
-			'group'           => __( 'Shape Divider', 'super-duper' ),
616
-			'element_require' => '[%' . $type . '%]!=""',
617
-		)
618
-	);
619
-
620
-	$input[ $type . '_custom_color' ] = wp_parse_args(
621
-		$overwrite_color,
622
-		array(
623
-			'type'            => 'color',
624
-			'title'           => __( 'Custom color', 'super-duper' ),
625
-			'placeholder'     => '',
626
-			'default'         => '#0073aa',
627
-			'desc_tip'        => true,
628
-			'group'           => __( 'Shape Divider', 'super-duper' ),
629
-			'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""',
630
-		)
631
-	);
632
-
633
-	$input[ $type . '_width' ] = wp_parse_args(
634
-		$overwrite_gradient,
635
-		array(
636
-			'type'              => 'range',
637
-			'title'             => __( 'Width', 'super-duper' ),
638
-			'placeholder'       => '',
639
-			'default'           => '200',
640
-			'desc_tip'          => true,
641
-			'custom_attributes' => array(
642
-				'min' => 100,
643
-				'max' => 300,
644
-			),
645
-			'group'             => __( 'Shape Divider', 'super-duper' ),
646
-			'element_require'   => '[%' . $type . '%]!=""',
647
-		)
648
-	);
649
-
650
-	$input[ $type . '_height' ] = array(
651
-		'type'              => 'range',
652
-		'title'             => __( 'Height', 'super-duper' ),
653
-		'default'           => '100',
654
-		'desc_tip'          => true,
655
-		'custom_attributes' => array(
656
-			'min' => 0,
657
-			'max' => 500,
658
-		),
659
-		'group'             => __( 'Shape Divider', 'super-duper' ),
660
-		'element_require'   => '[%' . $type . '%]!=""',
661
-	);
662
-
663
-	$requires = array(
664
-		'mountains'             => array( 'flip' ),
665
-		'drops'                 => array( 'flip', 'invert' ),
666
-		'clouds'                => array( 'flip', 'invert' ),
667
-		'zigzag'                => array(),
668
-		'pyramids'              => array( 'flip', 'invert' ),
669
-		'triangle'              => array( 'invert' ),
670
-		'triangle-asymmetrical' => array( 'flip', 'invert' ),
671
-		'tilt'                  => array( 'flip' ),
672
-		'opacity-tilt'          => array( 'flip' ),
673
-		'opacity-fan'           => array(),
674
-		'curve'                 => array( 'invert' ),
675
-		'curve-asymmetrical'    => array( 'flip', 'invert' ),
676
-		'waves'                 => array( 'flip', 'invert' ),
677
-		'wave-brush'            => array( 'flip' ),
678
-		'waves-pattern'         => array( 'flip' ),
679
-		'arrow'                 => array( 'invert' ),
680
-		'split'                 => array( 'invert' ),
681
-		'book'                  => array( 'invert' ),
682
-	);
683
-
684
-	$input[ $type . '_flip' ] = array(
685
-		'type'            => 'checkbox',
686
-		'title'           => __( 'Flip', 'super-duper' ),
687
-		'default'         => '',
688
-		'desc_tip'        => true,
689
-		'group'           => __( 'Shape Divider', 'super-duper' ),
690
-		'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' ),
691
-	);
692
-
693
-	$input[ $type . '_invert' ] = array(
694
-		'type'            => 'checkbox',
695
-		'title'           => __( 'Invert', 'super-duper' ),
696
-		'default'         => '',
697
-		'desc_tip'        => true,
698
-		'group'           => __( 'Shape Divider', 'super-duper' ),
699
-		'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' ),
700
-	);
701
-
702
-	$input[ $type . '_btf' ] = array(
703
-		'type'            => 'checkbox',
704
-		'title'           => __( 'Bring to front', 'super-duper' ),
705
-		'default'         => '',
706
-		'desc_tip'        => true,
707
-		'group'           => __( 'Shape Divider', 'super-duper' ),
708
-		'element_require' => '[%' . $type . '%]!=""',
709
-
710
-	);
711
-
712
-	return $input;
544
+    $options = array(
545
+        ''                      => __( 'None', 'super-duper' ),
546
+        'mountains'             => __( 'Mountains', 'super-duper' ),
547
+        'drops'                 => __( 'Drops', 'super-duper' ),
548
+        'clouds'                => __( 'Clouds', 'super-duper' ),
549
+        'zigzag'                => __( 'Zigzag', 'super-duper' ),
550
+        'pyramids'              => __( 'Pyramids', 'super-duper' ),
551
+        'triangle'              => __( 'Triangle', 'super-duper' ),
552
+        'triangle-asymmetrical' => __( 'Triangle Asymmetrical', 'super-duper' ),
553
+        'tilt'                  => __( 'Tilt', 'super-duper' ),
554
+        'opacity-tilt'          => __( 'Opacity Tilt', 'super-duper' ),
555
+        'opacity-fan'           => __( 'Opacity Fan', 'super-duper' ),
556
+        'curve'                 => __( 'Curve', 'super-duper' ),
557
+        'curve-asymmetrical'    => __( 'Curve Asymmetrical', 'super-duper' ),
558
+        'waves'                 => __( 'Waves', 'super-duper' ),
559
+        'wave-brush'            => __( 'Wave Brush', 'super-duper' ),
560
+        'waves-pattern'         => __( 'Waves Pattern', 'super-duper' ),
561
+        'arrow'                 => __( 'Arrow', 'super-duper' ),
562
+        'split'                 => __( 'Split', 'super-duper' ),
563
+        'book'                  => __( 'Book', 'super-duper' ),
564
+    );
565
+
566
+    $defaults = array(
567
+        'type'     => 'select',
568
+        'title'    => __( 'Type', 'super-duper' ),
569
+        'options'  => $options,
570
+        'default'  => '',
571
+        'desc_tip' => true,
572
+        'group'    => __( 'Shape Divider', 'super-duper' ),
573
+    );
574
+
575
+    $input[ $type ] = wp_parse_args( $overwrite, $defaults );
576
+
577
+    $input[ $type . '_notice' ] = array(
578
+        'type'            => 'notice',
579
+        'desc'            => __( 'Parent element must be position `relative`', 'super-duper' ),
580
+        'status'          => 'warning',
581
+        'group'           => __( 'Shape Divider', 'super-duper' ),
582
+        'element_require' => '[%' . $type . '%]!=""',
583
+    );
584
+
585
+    $input[ $type . '_position' ] = wp_parse_args(
586
+        $overwrite_color,
587
+        array(
588
+            'type'            => 'select',
589
+            'title'           => __( 'Position', 'super-duper' ),
590
+            'options'         => array(
591
+                'top'    => __( 'Top', 'super-duper' ),
592
+                'bottom' => __( 'Bottom', 'super-duper' ),
593
+            ),
594
+            'desc_tip'        => true,
595
+            'group'           => __( 'Shape Divider', 'super-duper' ),
596
+            'element_require' => '[%' . $type . '%]!=""',
597
+        )
598
+    );
599
+
600
+    $options = array(
601
+                    ''            => __( 'None', 'super-duper' ),
602
+                    'transparent' => __( 'Transparent', 'super-duper' ),
603
+                ) + sd_aui_colors()
604
+               + array(
605
+                    'custom-color' => __( 'Custom Color', 'super-duper' ),
606
+                );
607
+
608
+    $input[ $type . '_color' ] = wp_parse_args(
609
+        $overwrite_color,
610
+        array(
611
+            'type'            => 'select',
612
+            'title'           => __( 'Color', 'super-duper' ),
613
+            'options'         => $options,
614
+            'desc_tip'        => true,
615
+            'group'           => __( 'Shape Divider', 'super-duper' ),
616
+            'element_require' => '[%' . $type . '%]!=""',
617
+        )
618
+    );
619
+
620
+    $input[ $type . '_custom_color' ] = wp_parse_args(
621
+        $overwrite_color,
622
+        array(
623
+            'type'            => 'color',
624
+            'title'           => __( 'Custom color', 'super-duper' ),
625
+            'placeholder'     => '',
626
+            'default'         => '#0073aa',
627
+            'desc_tip'        => true,
628
+            'group'           => __( 'Shape Divider', 'super-duper' ),
629
+            'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""',
630
+        )
631
+    );
632
+
633
+    $input[ $type . '_width' ] = wp_parse_args(
634
+        $overwrite_gradient,
635
+        array(
636
+            'type'              => 'range',
637
+            'title'             => __( 'Width', 'super-duper' ),
638
+            'placeholder'       => '',
639
+            'default'           => '200',
640
+            'desc_tip'          => true,
641
+            'custom_attributes' => array(
642
+                'min' => 100,
643
+                'max' => 300,
644
+            ),
645
+            'group'             => __( 'Shape Divider', 'super-duper' ),
646
+            'element_require'   => '[%' . $type . '%]!=""',
647
+        )
648
+    );
649
+
650
+    $input[ $type . '_height' ] = array(
651
+        'type'              => 'range',
652
+        'title'             => __( 'Height', 'super-duper' ),
653
+        'default'           => '100',
654
+        'desc_tip'          => true,
655
+        'custom_attributes' => array(
656
+            'min' => 0,
657
+            'max' => 500,
658
+        ),
659
+        'group'             => __( 'Shape Divider', 'super-duper' ),
660
+        'element_require'   => '[%' . $type . '%]!=""',
661
+    );
662
+
663
+    $requires = array(
664
+        'mountains'             => array( 'flip' ),
665
+        'drops'                 => array( 'flip', 'invert' ),
666
+        'clouds'                => array( 'flip', 'invert' ),
667
+        'zigzag'                => array(),
668
+        'pyramids'              => array( 'flip', 'invert' ),
669
+        'triangle'              => array( 'invert' ),
670
+        'triangle-asymmetrical' => array( 'flip', 'invert' ),
671
+        'tilt'                  => array( 'flip' ),
672
+        'opacity-tilt'          => array( 'flip' ),
673
+        'opacity-fan'           => array(),
674
+        'curve'                 => array( 'invert' ),
675
+        'curve-asymmetrical'    => array( 'flip', 'invert' ),
676
+        'waves'                 => array( 'flip', 'invert' ),
677
+        'wave-brush'            => array( 'flip' ),
678
+        'waves-pattern'         => array( 'flip' ),
679
+        'arrow'                 => array( 'invert' ),
680
+        'split'                 => array( 'invert' ),
681
+        'book'                  => array( 'invert' ),
682
+    );
683
+
684
+    $input[ $type . '_flip' ] = array(
685
+        'type'            => 'checkbox',
686
+        'title'           => __( 'Flip', 'super-duper' ),
687
+        'default'         => '',
688
+        'desc_tip'        => true,
689
+        'group'           => __( 'Shape Divider', 'super-duper' ),
690
+        'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' ),
691
+    );
692
+
693
+    $input[ $type . '_invert' ] = array(
694
+        'type'            => 'checkbox',
695
+        'title'           => __( 'Invert', 'super-duper' ),
696
+        'default'         => '',
697
+        'desc_tip'        => true,
698
+        'group'           => __( 'Shape Divider', 'super-duper' ),
699
+        'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' ),
700
+    );
701
+
702
+    $input[ $type . '_btf' ] = array(
703
+        'type'            => 'checkbox',
704
+        'title'           => __( 'Bring to front', 'super-duper' ),
705
+        'default'         => '',
706
+        'desc_tip'        => true,
707
+        'group'           => __( 'Shape Divider', 'super-duper' ),
708
+        'element_require' => '[%' . $type . '%]!=""',
709
+
710
+    );
711
+
712
+    return $input;
713 713
 }
714 714
 
715 715
 /**
@@ -722,22 +722,22 @@  discard block
 block discarded – undo
722 722
  * @return string
723 723
  */
724 724
 function sd_get_element_require_string( $args, $key, $type ) {
725
-	$output   = '';
726
-	$requires = array();
725
+    $output   = '';
726
+    $requires = array();
727 727
 
728
-	if ( ! empty( $args ) ) {
729
-		foreach ( $args as $t => $k ) {
730
-			if ( in_array( $key, $k ) ) {
731
-				$requires[] = '[%' . $type . '%]=="' . $t . '"';
732
-			}
733
-		}
728
+    if ( ! empty( $args ) ) {
729
+        foreach ( $args as $t => $k ) {
730
+            if ( in_array( $key, $k ) ) {
731
+                $requires[] = '[%' . $type . '%]=="' . $t . '"';
732
+            }
733
+        }
734 734
 
735
-		if ( ! empty( $requires ) ) {
736
-			$output = '(' . implode( ' || ', $requires ) . ')';
737
-		}
738
-	}
735
+        if ( ! empty( $requires ) ) {
736
+            $output = '(' . implode( ' || ', $requires ) . ')';
737
+        }
738
+    }
739 739
 
740
-	return $output;
740
+    return $output;
741 741
 }
742 742
 
743 743
 /**
@@ -749,41 +749,41 @@  discard block
 block discarded – undo
749 749
  * @return array
750 750
  */
751 751
 function sd_get_text_color_input( $type = 'text_color', $overwrite = array(), $has_custom = false ) {
752
-	$options = array(
753
-		           '' => __( 'None', 'super-duper' ),
754
-	           ) + sd_aui_colors();
752
+    $options = array(
753
+                    '' => __( 'None', 'super-duper' ),
754
+                ) + sd_aui_colors();
755 755
 
756
-	if ( $has_custom ) {
757
-		$options['custom'] = __( 'Custom color', 'super-duper' );
758
-	}
756
+    if ( $has_custom ) {
757
+        $options['custom'] = __( 'Custom color', 'super-duper' );
758
+    }
759 759
 
760
-	$defaults = array(
761
-		'type'     => 'select',
762
-		'title'    => __( 'Text color', 'super-duper' ),
763
-		'options'  => $options,
764
-		'default'  => '',
765
-		'desc_tip' => true,
766
-		'group'    => __( 'Typography', 'super-duper' ),
767
-	);
760
+    $defaults = array(
761
+        'type'     => 'select',
762
+        'title'    => __( 'Text color', 'super-duper' ),
763
+        'options'  => $options,
764
+        'default'  => '',
765
+        'desc_tip' => true,
766
+        'group'    => __( 'Typography', 'super-duper' ),
767
+    );
768 768
 
769
-	$input = wp_parse_args( $overwrite, $defaults );
769
+    $input = wp_parse_args( $overwrite, $defaults );
770 770
 
771
-	return $input;
771
+    return $input;
772 772
 }
773 773
 
774 774
 function sd_get_text_color_input_group( $type = 'text_color', $overwrite = array(), $overwrite_custom = array() ) {
775
-	$inputs = array();
775
+    $inputs = array();
776 776
 
777
-	if ( $overwrite !== false ) {
778
-		$inputs[ $type ] = sd_get_text_color_input( $type, $overwrite, true );
779
-	}
777
+    if ( $overwrite !== false ) {
778
+        $inputs[ $type ] = sd_get_text_color_input( $type, $overwrite, true );
779
+    }
780 780
 
781
-	if ( $overwrite_custom !== false ) {
782
-		$custom            = $type . '_custom';
783
-		$inputs[ $custom ] = sd_get_custom_color_input( $custom, $overwrite_custom, $type );
784
-	}
781
+    if ( $overwrite_custom !== false ) {
782
+        $custom            = $type . '_custom';
783
+        $inputs[ $custom ] = sd_get_custom_color_input( $custom, $overwrite_custom, $type );
784
+    }
785 785
 
786
-	return $inputs;
786
+    return $inputs;
787 787
 }
788 788
 
789 789
 /**
@@ -796,22 +796,22 @@  discard block
 block discarded – undo
796 796
  */
797 797
 function sd_get_custom_color_input( $type = 'color_custom', $overwrite = array(), $parent_type = '' ) {
798 798
 
799
-	$defaults = array(
800
-		'type'        => 'color',
801
-		'title'       => __( 'Custom color', 'super-duper' ),
802
-		'default'     => '',
803
-		'placeholder' => '',
804
-		'desc_tip'    => true,
805
-		'group'       => __( 'Typography', 'super-duper' ),
806
-	);
799
+    $defaults = array(
800
+        'type'        => 'color',
801
+        'title'       => __( 'Custom color', 'super-duper' ),
802
+        'default'     => '',
803
+        'placeholder' => '',
804
+        'desc_tip'    => true,
805
+        'group'       => __( 'Typography', 'super-duper' ),
806
+    );
807 807
 
808
-	if ( $parent_type ) {
809
-		$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
810
-	}
808
+    if ( $parent_type ) {
809
+        $defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
810
+    }
811 811
 
812
-	$input = wp_parse_args( $overwrite, $defaults );
812
+    $input = wp_parse_args( $overwrite, $defaults );
813 813
 
814
-	return $input;
814
+    return $input;
815 815
 }
816 816
 
817 817
 /**
@@ -824,44 +824,44 @@  discard block
 block discarded – undo
824 824
  */
825 825
 function sd_get_col_input( $type = 'col', $overwrite = array() ) {
826 826
 
827
-	$device_size = '';
828
-	if ( ! empty( $overwrite['device_type'] ) ) {
829
-		if ( $overwrite['device_type'] == 'Tablet' ) {
830
-			$device_size = '-md';
831
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
832
-			$device_size = '-lg';
833
-		}
834
-	}
835
-	$options = array(
836
-		''     => __( 'Default', 'super-duper' ),
837
-		'auto' => __( 'auto', 'super-duper' ),
838
-		'1'    => '1/12',
839
-		'2'    => '2/12',
840
-		'3'    => '3/12',
841
-		'4'    => '4/12',
842
-		'5'    => '5/12',
843
-		'6'    => '6/12',
844
-		'7'    => '7/12',
845
-		'8'    => '8/12',
846
-		'9'    => '9/12',
847
-		'10'   => '10/12',
848
-		'11'   => '11/12',
849
-		'12'   => '12/12',
850
-	);
851
-
852
-	$defaults = array(
853
-		'type'            => 'select',
854
-		'title'           => __( 'Column width', 'super-duper' ),
855
-		'options'         => $options,
856
-		'default'         => '',
857
-		'desc_tip'        => true,
858
-		'group'           => __( 'Container', 'super-duper' ),
859
-		'element_require' => '[%container%]=="col"',
860
-	);
861
-
862
-	$input = wp_parse_args( $overwrite, $defaults );
863
-
864
-	return $input;
827
+    $device_size = '';
828
+    if ( ! empty( $overwrite['device_type'] ) ) {
829
+        if ( $overwrite['device_type'] == 'Tablet' ) {
830
+            $device_size = '-md';
831
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
832
+            $device_size = '-lg';
833
+        }
834
+    }
835
+    $options = array(
836
+        ''     => __( 'Default', 'super-duper' ),
837
+        'auto' => __( 'auto', 'super-duper' ),
838
+        '1'    => '1/12',
839
+        '2'    => '2/12',
840
+        '3'    => '3/12',
841
+        '4'    => '4/12',
842
+        '5'    => '5/12',
843
+        '6'    => '6/12',
844
+        '7'    => '7/12',
845
+        '8'    => '8/12',
846
+        '9'    => '9/12',
847
+        '10'   => '10/12',
848
+        '11'   => '11/12',
849
+        '12'   => '12/12',
850
+    );
851
+
852
+    $defaults = array(
853
+        'type'            => 'select',
854
+        'title'           => __( 'Column width', 'super-duper' ),
855
+        'options'         => $options,
856
+        'default'         => '',
857
+        'desc_tip'        => true,
858
+        'group'           => __( 'Container', 'super-duper' ),
859
+        'element_require' => '[%container%]=="col"',
860
+    );
861
+
862
+    $input = wp_parse_args( $overwrite, $defaults );
863
+
864
+    return $input;
865 865
 }
866 866
 
867 867
 /**
@@ -874,37 +874,37 @@  discard block
 block discarded – undo
874 874
  */
875 875
 function sd_get_row_cols_input( $type = 'row_cols', $overwrite = array() ) {
876 876
 
877
-	$device_size = '';
878
-	if ( ! empty( $overwrite['device_type'] ) ) {
879
-		if ( $overwrite['device_type'] == 'Tablet' ) {
880
-			$device_size = '-md';
881
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
882
-			$device_size = '-lg';
883
-		}
884
-	}
885
-	$options = array(
886
-		''  => __( 'auto', 'super-duper' ),
887
-		'1' => '1',
888
-		'2' => '2',
889
-		'3' => '3',
890
-		'4' => '4',
891
-		'5' => '5',
892
-		'6' => '6',
893
-	);
894
-
895
-	$defaults = array(
896
-		'type'            => 'select',
897
-		'title'           => __( 'Row columns', 'super-duper' ),
898
-		'options'         => $options,
899
-		'default'         => '',
900
-		'desc_tip'        => true,
901
-		'group'           => __( 'Container', 'super-duper' ),
902
-		'element_require' => '[%container%]=="row"',
903
-	);
904
-
905
-	$input = wp_parse_args( $overwrite, $defaults );
906
-
907
-	return $input;
877
+    $device_size = '';
878
+    if ( ! empty( $overwrite['device_type'] ) ) {
879
+        if ( $overwrite['device_type'] == 'Tablet' ) {
880
+            $device_size = '-md';
881
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
882
+            $device_size = '-lg';
883
+        }
884
+    }
885
+    $options = array(
886
+        ''  => __( 'auto', 'super-duper' ),
887
+        '1' => '1',
888
+        '2' => '2',
889
+        '3' => '3',
890
+        '4' => '4',
891
+        '5' => '5',
892
+        '6' => '6',
893
+    );
894
+
895
+    $defaults = array(
896
+        'type'            => 'select',
897
+        'title'           => __( 'Row columns', 'super-duper' ),
898
+        'options'         => $options,
899
+        'default'         => '',
900
+        'desc_tip'        => true,
901
+        'group'           => __( 'Container', 'super-duper' ),
902
+        'element_require' => '[%container%]=="row"',
903
+    );
904
+
905
+    $input = wp_parse_args( $overwrite, $defaults );
906
+
907
+    return $input;
908 908
 }
909 909
 
910 910
 /**
@@ -917,33 +917,33 @@  discard block
 block discarded – undo
917 917
  */
918 918
 function sd_get_text_align_input( $type = 'text_align', $overwrite = array() ) {
919 919
 
920
-	$device_size = '';
921
-	if ( ! empty( $overwrite['device_type'] ) ) {
922
-		if ( $overwrite['device_type'] == 'Tablet' ) {
923
-			$device_size = '-md';
924
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
925
-			$device_size = '-lg';
926
-		}
927
-	}
928
-	$options = array(
929
-		''                                => __( 'Default', 'super-duper' ),
930
-		'text' . $device_size . '-left'   => __( 'Left', 'super-duper' ),
931
-		'text' . $device_size . '-right'  => __( 'Right', 'super-duper' ),
932
-		'text' . $device_size . '-center' => __( 'Center', 'super-duper' ),
933
-	);
934
-
935
-	$defaults = array(
936
-		'type'     => 'select',
937
-		'title'    => __( 'Text align', 'super-duper' ),
938
-		'options'  => $options,
939
-		'default'  => '',
940
-		'desc_tip' => true,
941
-		'group'    => __( 'Typography', 'super-duper' ),
942
-	);
943
-
944
-	$input = wp_parse_args( $overwrite, $defaults );
945
-
946
-	return $input;
920
+    $device_size = '';
921
+    if ( ! empty( $overwrite['device_type'] ) ) {
922
+        if ( $overwrite['device_type'] == 'Tablet' ) {
923
+            $device_size = '-md';
924
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
925
+            $device_size = '-lg';
926
+        }
927
+    }
928
+    $options = array(
929
+        ''                                => __( 'Default', 'super-duper' ),
930
+        'text' . $device_size . '-left'   => __( 'Left', 'super-duper' ),
931
+        'text' . $device_size . '-right'  => __( 'Right', 'super-duper' ),
932
+        'text' . $device_size . '-center' => __( 'Center', 'super-duper' ),
933
+    );
934
+
935
+    $defaults = array(
936
+        'type'     => 'select',
937
+        'title'    => __( 'Text align', 'super-duper' ),
938
+        'options'  => $options,
939
+        'default'  => '',
940
+        'desc_tip' => true,
941
+        'group'    => __( 'Typography', 'super-duper' ),
942
+    );
943
+
944
+    $input = wp_parse_args( $overwrite, $defaults );
945
+
946
+    return $input;
947 947
 }
948 948
 
949 949
 /**
@@ -956,39 +956,39 @@  discard block
 block discarded – undo
956 956
  */
957 957
 function sd_get_display_input( $type = 'display', $overwrite = array() ) {
958 958
 
959
-	$device_size = '';
960
-	if ( ! empty( $overwrite['device_type'] ) ) {
961
-		if ( $overwrite['device_type'] == 'Tablet' ) {
962
-			$device_size = '-md';
963
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
964
-			$device_size = '-lg';
965
-		}
966
-	}
967
-	$options = array(
968
-		''                                   => __( 'Default', 'super-duper' ),
969
-		'd' . $device_size . '-none'         => 'none',
970
-		'd' . $device_size . '-inline'       => 'inline',
971
-		'd' . $device_size . '-inline-block' => 'inline-block',
972
-		'd' . $device_size . '-block'        => 'block',
973
-		'd' . $device_size . '-table'        => 'table',
974
-		'd' . $device_size . '-table-cell'   => 'table-cell',
975
-		'd' . $device_size . '-table-row'    => 'table-row',
976
-		'd' . $device_size . '-flex'         => 'flex',
977
-		'd' . $device_size . '-inline-flex'  => 'inline-flex',
978
-	);
979
-
980
-	$defaults = array(
981
-		'type'     => 'select',
982
-		'title'    => __( 'Display', 'super-duper' ),
983
-		'options'  => $options,
984
-		'default'  => '',
985
-		'desc_tip' => true,
986
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
987
-	);
988
-
989
-	$input = wp_parse_args( $overwrite, $defaults );
990
-
991
-	return $input;
959
+    $device_size = '';
960
+    if ( ! empty( $overwrite['device_type'] ) ) {
961
+        if ( $overwrite['device_type'] == 'Tablet' ) {
962
+            $device_size = '-md';
963
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
964
+            $device_size = '-lg';
965
+        }
966
+    }
967
+    $options = array(
968
+        ''                                   => __( 'Default', 'super-duper' ),
969
+        'd' . $device_size . '-none'         => 'none',
970
+        'd' . $device_size . '-inline'       => 'inline',
971
+        'd' . $device_size . '-inline-block' => 'inline-block',
972
+        'd' . $device_size . '-block'        => 'block',
973
+        'd' . $device_size . '-table'        => 'table',
974
+        'd' . $device_size . '-table-cell'   => 'table-cell',
975
+        'd' . $device_size . '-table-row'    => 'table-row',
976
+        'd' . $device_size . '-flex'         => 'flex',
977
+        'd' . $device_size . '-inline-flex'  => 'inline-flex',
978
+    );
979
+
980
+    $defaults = array(
981
+        'type'     => 'select',
982
+        'title'    => __( 'Display', 'super-duper' ),
983
+        'options'  => $options,
984
+        'default'  => '',
985
+        'desc_tip' => true,
986
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
987
+    );
988
+
989
+    $input = wp_parse_args( $overwrite, $defaults );
990
+
991
+    return $input;
992 992
 }
993 993
 
994 994
 /**
@@ -1001,17 +1001,17 @@  discard block
 block discarded – undo
1001 1001
  */
1002 1002
 function sd_get_text_justify_input( $type = 'text_justify', $overwrite = array() ) {
1003 1003
 
1004
-	$defaults = array(
1005
-		'type'     => 'checkbox',
1006
-		'title'    => __( 'Text justify', 'super-duper' ),
1007
-		'default'  => '',
1008
-		'desc_tip' => true,
1009
-		'group'    => __( 'Typography', 'super-duper' ),
1010
-	);
1004
+    $defaults = array(
1005
+        'type'     => 'checkbox',
1006
+        'title'    => __( 'Text justify', 'super-duper' ),
1007
+        'default'  => '',
1008
+        'desc_tip' => true,
1009
+        'group'    => __( 'Typography', 'super-duper' ),
1010
+    );
1011 1011
 
1012
-	$input = wp_parse_args( $overwrite, $defaults );
1012
+    $input = wp_parse_args( $overwrite, $defaults );
1013 1013
 
1014
-	return $input;
1014
+    return $input;
1015 1015
 }
1016 1016
 
1017 1017
 /**
@@ -1024,71 +1024,71 @@  discard block
 block discarded – undo
1024 1024
  * @return array
1025 1025
  */
1026 1026
 function sd_aui_colors( $include_branding = false, $include_outlines = false, $outline_button_only_text = false, $include_translucent = false ) {
1027
-	$theme_colors = array();
1028
-
1029
-	$theme_colors['primary']   = __( 'Primary', 'super-duper' );
1030
-	$theme_colors['secondary'] = __( 'Secondary', 'super-duper' );
1031
-	$theme_colors['success']   = __( 'Success', 'super-duper' );
1032
-	$theme_colors['danger']    = __( 'Danger', 'super-duper' );
1033
-	$theme_colors['warning']   = __( 'Warning', 'super-duper' );
1034
-	$theme_colors['info']      = __( 'Info', 'super-duper' );
1035
-	$theme_colors['light']     = __( 'Light', 'super-duper' );
1036
-	$theme_colors['dark']      = __( 'Dark', 'super-duper' );
1037
-	$theme_colors['white']     = __( 'White', 'super-duper' );
1038
-	$theme_colors['purple']    = __( 'Purple', 'super-duper' );
1039
-	$theme_colors['salmon']    = __( 'Salmon', 'super-duper' );
1040
-	$theme_colors['cyan']      = __( 'Cyan', 'super-duper' );
1041
-	$theme_colors['gray']      = __( 'Gray', 'super-duper' );
1042
-	$theme_colors['muted']     = __( 'Muted', 'super-duper' );
1043
-	$theme_colors['gray-dark'] = __( 'Gray dark', 'super-duper' );
1044
-	$theme_colors['indigo']    = __( 'Indigo', 'super-duper' );
1045
-	$theme_colors['orange']    = __( 'Orange', 'super-duper' );
1046
-
1047
-	if ( $include_outlines ) {
1048
-		$button_only                       = $outline_button_only_text ? ' ' . __( '(button only)', 'super-duper' ) : '';
1049
-		$theme_colors['outline-primary']   = __( 'Primary outline', 'super-duper' ) . $button_only;
1050
-		$theme_colors['outline-secondary'] = __( 'Secondary outline', 'super-duper' ) . $button_only;
1051
-		$theme_colors['outline-success']   = __( 'Success outline', 'super-duper' ) . $button_only;
1052
-		$theme_colors['outline-danger']    = __( 'Danger outline', 'super-duper' ) . $button_only;
1053
-		$theme_colors['outline-warning']   = __( 'Warning outline', 'super-duper' ) . $button_only;
1054
-		$theme_colors['outline-info']      = __( 'Info outline', 'super-duper' ) . $button_only;
1055
-		$theme_colors['outline-light']     = __( 'Light outline', 'super-duper' ) . $button_only;
1056
-		$theme_colors['outline-dark']      = __( 'Dark outline', 'super-duper' ) . $button_only;
1057
-		$theme_colors['outline-white']     = __( 'White outline', 'super-duper' ) . $button_only;
1058
-		$theme_colors['outline-purple']    = __( 'Purple outline', 'super-duper' ) . $button_only;
1059
-		$theme_colors['outline-salmon']    = __( 'Salmon outline', 'super-duper' ) . $button_only;
1060
-		$theme_colors['outline-cyan']      = __( 'Cyan outline', 'super-duper' ) . $button_only;
1061
-		$theme_colors['outline-gray']      = __( 'Gray outline', 'super-duper' ) . $button_only;
1062
-		$theme_colors['outline-gray-dark'] = __( 'Gray dark outline', 'super-duper' ) . $button_only;
1063
-		$theme_colors['outline-indigo']    = __( 'Indigo outline', 'super-duper' ) . $button_only;
1064
-		$theme_colors['outline-orange']    = __( 'Orange outline', 'super-duper' ) . $button_only;
1065
-	}
1066
-
1067
-	if ( $include_branding ) {
1068
-		$theme_colors = $theme_colors + sd_aui_branding_colors();
1069
-	}
1070
-
1071
-	if ( $include_translucent ) {
1072
-		$button_only                           = $outline_button_only_text ? ' ' . __( '(button only)', 'super-duper' ) : '';
1073
-		$theme_colors['translucent-primary']   = __( 'Primary translucent', 'super-duper' ) . $button_only;
1074
-		$theme_colors['translucent-secondary'] = __( 'Secondary translucent', 'super-duper' ) . $button_only;
1075
-		$theme_colors['translucent-success']   = __( 'Success translucent', 'super-duper' ) . $button_only;
1076
-		$theme_colors['translucent-danger']    = __( 'Danger translucent', 'super-duper' ) . $button_only;
1077
-		$theme_colors['translucent-warning']   = __( 'Warning translucent', 'super-duper' ) . $button_only;
1078
-		$theme_colors['translucent-info']      = __( 'Info translucent', 'super-duper' ) . $button_only;
1079
-		$theme_colors['translucent-light']     = __( 'Light translucent', 'super-duper' ) . $button_only;
1080
-		$theme_colors['translucent-dark']      = __( 'Dark translucent', 'super-duper' ) . $button_only;
1081
-		$theme_colors['translucent-white']     = __( 'White translucent', 'super-duper' ) . $button_only;
1082
-		$theme_colors['translucent-purple']    = __( 'Purple translucent', 'super-duper' ) . $button_only;
1083
-		$theme_colors['translucent-salmon']    = __( 'Salmon translucent', 'super-duper' ) . $button_only;
1084
-		$theme_colors['translucent-cyan']      = __( 'Cyan translucent', 'super-duper' ) . $button_only;
1085
-		$theme_colors['translucent-gray']      = __( 'Gray translucent', 'super-duper' ) . $button_only;
1086
-		$theme_colors['translucent-gray-dark'] = __( 'Gray dark translucent', 'super-duper' ) . $button_only;
1087
-		$theme_colors['translucent-indigo']    = __( 'Indigo translucent', 'super-duper' ) . $button_only;
1088
-		$theme_colors['translucent-orange']    = __( 'Orange translucent', 'super-duper' ) . $button_only;
1089
-	}
1090
-
1091
-	return apply_filters( 'sd_aui_colors', $theme_colors, $include_outlines, $include_branding );
1027
+    $theme_colors = array();
1028
+
1029
+    $theme_colors['primary']   = __( 'Primary', 'super-duper' );
1030
+    $theme_colors['secondary'] = __( 'Secondary', 'super-duper' );
1031
+    $theme_colors['success']   = __( 'Success', 'super-duper' );
1032
+    $theme_colors['danger']    = __( 'Danger', 'super-duper' );
1033
+    $theme_colors['warning']   = __( 'Warning', 'super-duper' );
1034
+    $theme_colors['info']      = __( 'Info', 'super-duper' );
1035
+    $theme_colors['light']     = __( 'Light', 'super-duper' );
1036
+    $theme_colors['dark']      = __( 'Dark', 'super-duper' );
1037
+    $theme_colors['white']     = __( 'White', 'super-duper' );
1038
+    $theme_colors['purple']    = __( 'Purple', 'super-duper' );
1039
+    $theme_colors['salmon']    = __( 'Salmon', 'super-duper' );
1040
+    $theme_colors['cyan']      = __( 'Cyan', 'super-duper' );
1041
+    $theme_colors['gray']      = __( 'Gray', 'super-duper' );
1042
+    $theme_colors['muted']     = __( 'Muted', 'super-duper' );
1043
+    $theme_colors['gray-dark'] = __( 'Gray dark', 'super-duper' );
1044
+    $theme_colors['indigo']    = __( 'Indigo', 'super-duper' );
1045
+    $theme_colors['orange']    = __( 'Orange', 'super-duper' );
1046
+
1047
+    if ( $include_outlines ) {
1048
+        $button_only                       = $outline_button_only_text ? ' ' . __( '(button only)', 'super-duper' ) : '';
1049
+        $theme_colors['outline-primary']   = __( 'Primary outline', 'super-duper' ) . $button_only;
1050
+        $theme_colors['outline-secondary'] = __( 'Secondary outline', 'super-duper' ) . $button_only;
1051
+        $theme_colors['outline-success']   = __( 'Success outline', 'super-duper' ) . $button_only;
1052
+        $theme_colors['outline-danger']    = __( 'Danger outline', 'super-duper' ) . $button_only;
1053
+        $theme_colors['outline-warning']   = __( 'Warning outline', 'super-duper' ) . $button_only;
1054
+        $theme_colors['outline-info']      = __( 'Info outline', 'super-duper' ) . $button_only;
1055
+        $theme_colors['outline-light']     = __( 'Light outline', 'super-duper' ) . $button_only;
1056
+        $theme_colors['outline-dark']      = __( 'Dark outline', 'super-duper' ) . $button_only;
1057
+        $theme_colors['outline-white']     = __( 'White outline', 'super-duper' ) . $button_only;
1058
+        $theme_colors['outline-purple']    = __( 'Purple outline', 'super-duper' ) . $button_only;
1059
+        $theme_colors['outline-salmon']    = __( 'Salmon outline', 'super-duper' ) . $button_only;
1060
+        $theme_colors['outline-cyan']      = __( 'Cyan outline', 'super-duper' ) . $button_only;
1061
+        $theme_colors['outline-gray']      = __( 'Gray outline', 'super-duper' ) . $button_only;
1062
+        $theme_colors['outline-gray-dark'] = __( 'Gray dark outline', 'super-duper' ) . $button_only;
1063
+        $theme_colors['outline-indigo']    = __( 'Indigo outline', 'super-duper' ) . $button_only;
1064
+        $theme_colors['outline-orange']    = __( 'Orange outline', 'super-duper' ) . $button_only;
1065
+    }
1066
+
1067
+    if ( $include_branding ) {
1068
+        $theme_colors = $theme_colors + sd_aui_branding_colors();
1069
+    }
1070
+
1071
+    if ( $include_translucent ) {
1072
+        $button_only                           = $outline_button_only_text ? ' ' . __( '(button only)', 'super-duper' ) : '';
1073
+        $theme_colors['translucent-primary']   = __( 'Primary translucent', 'super-duper' ) . $button_only;
1074
+        $theme_colors['translucent-secondary'] = __( 'Secondary translucent', 'super-duper' ) . $button_only;
1075
+        $theme_colors['translucent-success']   = __( 'Success translucent', 'super-duper' ) . $button_only;
1076
+        $theme_colors['translucent-danger']    = __( 'Danger translucent', 'super-duper' ) . $button_only;
1077
+        $theme_colors['translucent-warning']   = __( 'Warning translucent', 'super-duper' ) . $button_only;
1078
+        $theme_colors['translucent-info']      = __( 'Info translucent', 'super-duper' ) . $button_only;
1079
+        $theme_colors['translucent-light']     = __( 'Light translucent', 'super-duper' ) . $button_only;
1080
+        $theme_colors['translucent-dark']      = __( 'Dark translucent', 'super-duper' ) . $button_only;
1081
+        $theme_colors['translucent-white']     = __( 'White translucent', 'super-duper' ) . $button_only;
1082
+        $theme_colors['translucent-purple']    = __( 'Purple translucent', 'super-duper' ) . $button_only;
1083
+        $theme_colors['translucent-salmon']    = __( 'Salmon translucent', 'super-duper' ) . $button_only;
1084
+        $theme_colors['translucent-cyan']      = __( 'Cyan translucent', 'super-duper' ) . $button_only;
1085
+        $theme_colors['translucent-gray']      = __( 'Gray translucent', 'super-duper' ) . $button_only;
1086
+        $theme_colors['translucent-gray-dark'] = __( 'Gray dark translucent', 'super-duper' ) . $button_only;
1087
+        $theme_colors['translucent-indigo']    = __( 'Indigo translucent', 'super-duper' ) . $button_only;
1088
+        $theme_colors['translucent-orange']    = __( 'Orange translucent', 'super-duper' ) . $button_only;
1089
+    }
1090
+
1091
+    return apply_filters( 'sd_aui_colors', $theme_colors, $include_outlines, $include_branding );
1092 1092
 }
1093 1093
 
1094 1094
 /**
@@ -1097,19 +1097,19 @@  discard block
 block discarded – undo
1097 1097
  * @return array
1098 1098
  */
1099 1099
 function sd_aui_branding_colors() {
1100
-	return array(
1101
-		'facebook'  => __( 'Facebook', 'super-duper' ),
1102
-		'twitter'   => __( 'Twitter', 'super-duper' ),
1103
-		'instagram' => __( 'Instagram', 'super-duper' ),
1104
-		'linkedin'  => __( 'Linkedin', 'super-duper' ),
1105
-		'flickr'    => __( 'Flickr', 'super-duper' ),
1106
-		'github'    => __( 'GitHub', 'super-duper' ),
1107
-		'youtube'   => __( 'YouTube', 'super-duper' ),
1108
-		'wordpress' => __( 'WordPress', 'super-duper' ),
1109
-		'google'    => __( 'Google', 'super-duper' ),
1110
-		'yahoo'     => __( 'Yahoo', 'super-duper' ),
1111
-		'vkontakte' => __( 'Vkontakte', 'super-duper' ),
1112
-	);
1100
+    return array(
1101
+        'facebook'  => __( 'Facebook', 'super-duper' ),
1102
+        'twitter'   => __( 'Twitter', 'super-duper' ),
1103
+        'instagram' => __( 'Instagram', 'super-duper' ),
1104
+        'linkedin'  => __( 'Linkedin', 'super-duper' ),
1105
+        'flickr'    => __( 'Flickr', 'super-duper' ),
1106
+        'github'    => __( 'GitHub', 'super-duper' ),
1107
+        'youtube'   => __( 'YouTube', 'super-duper' ),
1108
+        'wordpress' => __( 'WordPress', 'super-duper' ),
1109
+        'google'    => __( 'Google', 'super-duper' ),
1110
+        'yahoo'     => __( 'Yahoo', 'super-duper' ),
1111
+        'vkontakte' => __( 'Vkontakte', 'super-duper' ),
1112
+    );
1113 1113
 }
1114 1114
 
1115 1115
 
@@ -1123,38 +1123,38 @@  discard block
 block discarded – undo
1123 1123
  */
1124 1124
 function sd_get_container_class_input( $type = 'container', $overwrite = array() ) {
1125 1125
 
1126
-	$options = array(
1127
-		'container'       => __( 'container (default)', 'super-duper' ),
1128
-		'container-sm'    => 'container-sm',
1129
-		'container-md'    => 'container-md',
1130
-		'container-lg'    => 'container-lg',
1131
-		'container-xl'    => 'container-xl',
1132
-		'container-xxl'   => 'container-xxl',
1133
-		'container-fluid' => 'container-fluid',
1134
-		'row'             => 'row',
1135
-		'col'             => 'col',
1136
-		'card'            => 'card',
1137
-		'card-header'     => 'card-header',
1138
-		'card-img-top'    => 'card-img-top',
1139
-		'card-body'       => 'card-body',
1140
-		'card-footer'     => 'card-footer',
1141
-		'list-group'      => 'list-group',
1142
-		'list-group-item' => 'list-group-item',
1143
-		''                => __( 'no container class', 'super-duper' ),
1144
-	);
1145
-
1146
-	$defaults = array(
1147
-		'type'     => 'select',
1148
-		'title'    => __( 'Type', 'super-duper' ),
1149
-		'options'  => $options,
1150
-		'default'  => '',
1151
-		'desc_tip' => true,
1152
-		'group'    => __( 'Container', 'super-duper' ),
1153
-	);
1154
-
1155
-	$input = wp_parse_args( $overwrite, $defaults );
1156
-
1157
-	return $input;
1126
+    $options = array(
1127
+        'container'       => __( 'container (default)', 'super-duper' ),
1128
+        'container-sm'    => 'container-sm',
1129
+        'container-md'    => 'container-md',
1130
+        'container-lg'    => 'container-lg',
1131
+        'container-xl'    => 'container-xl',
1132
+        'container-xxl'   => 'container-xxl',
1133
+        'container-fluid' => 'container-fluid',
1134
+        'row'             => 'row',
1135
+        'col'             => 'col',
1136
+        'card'            => 'card',
1137
+        'card-header'     => 'card-header',
1138
+        'card-img-top'    => 'card-img-top',
1139
+        'card-body'       => 'card-body',
1140
+        'card-footer'     => 'card-footer',
1141
+        'list-group'      => 'list-group',
1142
+        'list-group-item' => 'list-group-item',
1143
+        ''                => __( 'no container class', 'super-duper' ),
1144
+    );
1145
+
1146
+    $defaults = array(
1147
+        'type'     => 'select',
1148
+        'title'    => __( 'Type', 'super-duper' ),
1149
+        'options'  => $options,
1150
+        'default'  => '',
1151
+        'desc_tip' => true,
1152
+        'group'    => __( 'Container', 'super-duper' ),
1153
+    );
1154
+
1155
+    $input = wp_parse_args( $overwrite, $defaults );
1156
+
1157
+    return $input;
1158 1158
 }
1159 1159
 
1160 1160
 /**
@@ -1167,30 +1167,30 @@  discard block
 block discarded – undo
1167 1167
  */
1168 1168
 function sd_get_position_class_input( $type = 'position', $overwrite = array() ) {
1169 1169
 
1170
-	$options = array(
1171
-		''                  => __( 'Default', 'super-duper' ),
1172
-		'position-static'   => 'static',
1173
-		'position-relative' => 'relative',
1174
-		'position-absolute' => 'absolute',
1175
-		'position-fixed'    => 'fixed',
1176
-		'position-sticky'   => 'sticky',
1177
-		'fixed-top'         => 'fixed-top',
1178
-		'fixed-bottom'      => 'fixed-bottom',
1179
-		'sticky-top'        => 'sticky-top',
1180
-	);
1170
+    $options = array(
1171
+        ''                  => __( 'Default', 'super-duper' ),
1172
+        'position-static'   => 'static',
1173
+        'position-relative' => 'relative',
1174
+        'position-absolute' => 'absolute',
1175
+        'position-fixed'    => 'fixed',
1176
+        'position-sticky'   => 'sticky',
1177
+        'fixed-top'         => 'fixed-top',
1178
+        'fixed-bottom'      => 'fixed-bottom',
1179
+        'sticky-top'        => 'sticky-top',
1180
+    );
1181 1181
 
1182
-	$defaults = array(
1183
-		'type'     => 'select',
1184
-		'title'    => __( 'Position', 'super-duper' ),
1185
-		'options'  => $options,
1186
-		'default'  => '',
1187
-		'desc_tip' => true,
1188
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
1189
-	);
1182
+    $defaults = array(
1183
+        'type'     => 'select',
1184
+        'title'    => __( 'Position', 'super-duper' ),
1185
+        'options'  => $options,
1186
+        'default'  => '',
1187
+        'desc_tip' => true,
1188
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
1189
+    );
1190 1190
 
1191
-	$input = wp_parse_args( $overwrite, $defaults );
1191
+    $input = wp_parse_args( $overwrite, $defaults );
1192 1192
 
1193
-	return $input;
1193
+    return $input;
1194 1194
 }
1195 1195
 
1196 1196
 /**
@@ -1201,32 +1201,32 @@  discard block
 block discarded – undo
1201 1201
  */
1202 1202
 function sd_get_absolute_position_input( $type = 'absolute_position', $overwrite = array() ) {
1203 1203
 
1204
-	$options = array(
1205
-		''              => __( 'Default', 'super-duper' ),
1206
-		'top-left'      => 'top-left',
1207
-		'top-center'    => 'top-center',
1208
-		'top-right'     => 'top-right',
1209
-		'center-left'   => 'middle-left',
1210
-		'center'        => 'center',
1211
-		'center-right'  => 'middle-right',
1212
-		'bottom-left'   => 'bottom-left',
1213
-		'bottom-center' => 'bottom-center',
1214
-		'bottom-right'  => 'bottom-right',
1215
-	);
1216
-
1217
-	$defaults = array(
1218
-		'type'            => 'select',
1219
-		'title'           => __( 'Absolute Position', 'super-duper' ),
1220
-		'options'         => $options,
1221
-		'default'         => '',
1222
-		'desc_tip'        => true,
1223
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1224
-		'element_require' => '[%position%]=="position-absolute"',
1225
-	);
1226
-
1227
-	$input = wp_parse_args( $overwrite, $defaults );
1228
-
1229
-	return $input;
1204
+    $options = array(
1205
+        ''              => __( 'Default', 'super-duper' ),
1206
+        'top-left'      => 'top-left',
1207
+        'top-center'    => 'top-center',
1208
+        'top-right'     => 'top-right',
1209
+        'center-left'   => 'middle-left',
1210
+        'center'        => 'center',
1211
+        'center-right'  => 'middle-right',
1212
+        'bottom-left'   => 'bottom-left',
1213
+        'bottom-center' => 'bottom-center',
1214
+        'bottom-right'  => 'bottom-right',
1215
+    );
1216
+
1217
+    $defaults = array(
1218
+        'type'            => 'select',
1219
+        'title'           => __( 'Absolute Position', 'super-duper' ),
1220
+        'options'         => $options,
1221
+        'default'         => '',
1222
+        'desc_tip'        => true,
1223
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1224
+        'element_require' => '[%position%]=="position-absolute"',
1225
+    );
1226
+
1227
+    $input = wp_parse_args( $overwrite, $defaults );
1228
+
1229
+    return $input;
1230 1230
 }
1231 1231
 
1232 1232
 /**
@@ -1239,38 +1239,38 @@  discard block
 block discarded – undo
1239 1239
  */
1240 1240
 function sd_get_sticky_offset_input( $type = 'top', $overwrite = array() ) {
1241 1241
 
1242
-	$defaults = array(
1243
-		'type'            => 'number',
1244
-		'title'           => __( 'Sticky offset', 'super-duper' ),
1245
-		//'desc' =>  __( 'Sticky offset', 'super-duper' ),
1246
-		'default'         => '',
1247
-		'desc_tip'        => true,
1248
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1249
-		'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"',
1250
-	);
1251
-
1252
-	// title
1253
-	if ( $type == 'top' ) {
1254
-		$defaults['title'] = __( 'Top offset', 'super-duper' );
1255
-		$defaults['icon']  = 'box-top';
1256
-		$defaults['row']   = array(
1257
-			'title' => __( 'Sticky offset', 'super-duper' ),
1258
-			'key'   => 'sticky-offset',
1259
-			'open'  => true,
1260
-			'class' => 'text-center',
1261
-		);
1262
-	} elseif ( $type == 'bottom' ) {
1263
-		$defaults['title'] = __( 'Bottom offset', 'super-duper' );
1264
-		$defaults['icon']  = 'box-bottom';
1265
-		$defaults['row']   = array(
1266
-			'key'   => 'sticky-offset',
1267
-			'close' => true,
1268
-		);
1269
-	}
1270
-
1271
-	$input = wp_parse_args( $overwrite, $defaults );
1272
-
1273
-	return $input;
1242
+    $defaults = array(
1243
+        'type'            => 'number',
1244
+        'title'           => __( 'Sticky offset', 'super-duper' ),
1245
+        //'desc' =>  __( 'Sticky offset', 'super-duper' ),
1246
+        'default'         => '',
1247
+        'desc_tip'        => true,
1248
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1249
+        'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"',
1250
+    );
1251
+
1252
+    // title
1253
+    if ( $type == 'top' ) {
1254
+        $defaults['title'] = __( 'Top offset', 'super-duper' );
1255
+        $defaults['icon']  = 'box-top';
1256
+        $defaults['row']   = array(
1257
+            'title' => __( 'Sticky offset', 'super-duper' ),
1258
+            'key'   => 'sticky-offset',
1259
+            'open'  => true,
1260
+            'class' => 'text-center',
1261
+        );
1262
+    } elseif ( $type == 'bottom' ) {
1263
+        $defaults['title'] = __( 'Bottom offset', 'super-duper' );
1264
+        $defaults['icon']  = 'box-bottom';
1265
+        $defaults['row']   = array(
1266
+            'key'   => 'sticky-offset',
1267
+            'close' => true,
1268
+        );
1269
+    }
1270
+
1271
+    $input = wp_parse_args( $overwrite, $defaults );
1272
+
1273
+    return $input;
1274 1274
 }
1275 1275
 
1276 1276
 /**
@@ -1282,61 +1282,61 @@  discard block
 block discarded – undo
1282 1282
  * @return array
1283 1283
  */
1284 1284
 function sd_get_font_size_input( $type = 'font_size', $overwrite = array(), $has_custom = false ) {
1285
-	global $aui_bs5;
1286
-
1287
-	$options[] = __( 'Inherit from parent', 'super-duper' );
1288
-	if ( $aui_bs5 ) {
1289
-		// responsive font sizes
1290
-		$options['fs-base'] = 'fs-base (body default)';
1291
-		$options['fs-6']    = 'fs-6';
1292
-		$options['fs-5']    = 'fs-5';
1293
-		$options['fs-4']    = 'fs-4';
1294
-		$options['fs-3']    = 'fs-3';
1295
-		$options['fs-2']    = 'fs-2';
1296
-		$options['fs-1']    = 'fs-1';
1297
-
1298
-		// custom
1299
-		$options['fs-lg']  = 'fs-lg';
1300
-		$options['fs-sm']  = 'fs-sm';
1301
-		$options['fs-xs']  = 'fs-xs';
1302
-		$options['fs-xxs'] = 'fs-xxs';
1303
-
1304
-	}
1305
-
1306
-	$options = $options + array(
1307
-			'h6'        => 'h6',
1308
-			'h5'        => 'h5',
1309
-			'h4'        => 'h4',
1310
-			'h3'        => 'h3',
1311
-			'h2'        => 'h2',
1312
-			'h1'        => 'h1',
1313
-			'display-1' => 'display-1',
1314
-			'display-2' => 'display-2',
1315
-			'display-3' => 'display-3',
1316
-			'display-4' => 'display-4',
1317
-		);
1318
-
1319
-	if ( $aui_bs5 ) {
1320
-		$options['display-5'] = 'display-5';
1321
-		$options['display-6'] = 'display-6';
1322
-	}
1323
-
1324
-	if ( $has_custom ) {
1325
-		$options['custom'] = __( 'Custom size', 'super-duper' );
1326
-	}
1327
-
1328
-	$defaults = array(
1329
-		'type'     => 'select',
1330
-		'title'    => __( 'Font size', 'super-duper' ),
1331
-		'options'  => $options,
1332
-		'default'  => '',
1333
-		'desc_tip' => true,
1334
-		'group'    => __( 'Typography', 'super-duper' ),
1335
-	);
1336
-
1337
-	$input = wp_parse_args( $overwrite, $defaults );
1338
-
1339
-	return $input;
1285
+    global $aui_bs5;
1286
+
1287
+    $options[] = __( 'Inherit from parent', 'super-duper' );
1288
+    if ( $aui_bs5 ) {
1289
+        // responsive font sizes
1290
+        $options['fs-base'] = 'fs-base (body default)';
1291
+        $options['fs-6']    = 'fs-6';
1292
+        $options['fs-5']    = 'fs-5';
1293
+        $options['fs-4']    = 'fs-4';
1294
+        $options['fs-3']    = 'fs-3';
1295
+        $options['fs-2']    = 'fs-2';
1296
+        $options['fs-1']    = 'fs-1';
1297
+
1298
+        // custom
1299
+        $options['fs-lg']  = 'fs-lg';
1300
+        $options['fs-sm']  = 'fs-sm';
1301
+        $options['fs-xs']  = 'fs-xs';
1302
+        $options['fs-xxs'] = 'fs-xxs';
1303
+
1304
+    }
1305
+
1306
+    $options = $options + array(
1307
+            'h6'        => 'h6',
1308
+            'h5'        => 'h5',
1309
+            'h4'        => 'h4',
1310
+            'h3'        => 'h3',
1311
+            'h2'        => 'h2',
1312
+            'h1'        => 'h1',
1313
+            'display-1' => 'display-1',
1314
+            'display-2' => 'display-2',
1315
+            'display-3' => 'display-3',
1316
+            'display-4' => 'display-4',
1317
+        );
1318
+
1319
+    if ( $aui_bs5 ) {
1320
+        $options['display-5'] = 'display-5';
1321
+        $options['display-6'] = 'display-6';
1322
+    }
1323
+
1324
+    if ( $has_custom ) {
1325
+        $options['custom'] = __( 'Custom size', 'super-duper' );
1326
+    }
1327
+
1328
+    $defaults = array(
1329
+        'type'     => 'select',
1330
+        'title'    => __( 'Font size', 'super-duper' ),
1331
+        'options'  => $options,
1332
+        'default'  => '',
1333
+        'desc_tip' => true,
1334
+        'group'    => __( 'Typography', 'super-duper' ),
1335
+    );
1336
+
1337
+    $input = wp_parse_args( $overwrite, $defaults );
1338
+
1339
+    return $input;
1340 1340
 }
1341 1341
 
1342 1342
 /**
@@ -1349,27 +1349,27 @@  discard block
 block discarded – undo
1349 1349
  */
1350 1350
 function sd_get_font_custom_size_input( $type = 'font_size_custom', $overwrite = array(), $parent_type = '' ) {
1351 1351
 
1352
-	$defaults = array(
1353
-		'type'              => 'number',
1354
-		'title'             => __( 'Font size (rem)', 'super-duper' ),
1355
-		'default'           => '',
1356
-		'placeholder'       => '1.25',
1357
-		'custom_attributes' => array(
1358
-			'step' => '0.1',
1359
-			'min'  => '0',
1360
-			'max'  => '100',
1361
-		),
1362
-		'desc_tip'          => true,
1363
-		'group'             => __( 'Typography', 'super-duper' ),
1364
-	);
1352
+    $defaults = array(
1353
+        'type'              => 'number',
1354
+        'title'             => __( 'Font size (rem)', 'super-duper' ),
1355
+        'default'           => '',
1356
+        'placeholder'       => '1.25',
1357
+        'custom_attributes' => array(
1358
+            'step' => '0.1',
1359
+            'min'  => '0',
1360
+            'max'  => '100',
1361
+        ),
1362
+        'desc_tip'          => true,
1363
+        'group'             => __( 'Typography', 'super-duper' ),
1364
+    );
1365 1365
 
1366
-	if ( $parent_type ) {
1367
-		$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
1368
-	}
1366
+    if ( $parent_type ) {
1367
+        $defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
1368
+    }
1369 1369
 
1370
-	$input = wp_parse_args( $overwrite, $defaults );
1370
+    $input = wp_parse_args( $overwrite, $defaults );
1371 1371
 
1372
-	return $input;
1372
+    return $input;
1373 1373
 }
1374 1374
 
1375 1375
 /**
@@ -1382,23 +1382,23 @@  discard block
 block discarded – undo
1382 1382
  */
1383 1383
 function sd_get_font_line_height_input( $type = 'font_line_height', $overwrite = array() ) {
1384 1384
 
1385
-	$defaults = array(
1386
-		'type'              => 'number',
1387
-		'title'             => __( 'Font Line Height', 'super-duper' ),
1388
-		'default'           => '',
1389
-		'placeholder'       => '1.75',
1390
-		'custom_attributes' => array(
1391
-			'step' => '0.1',
1392
-			'min'  => '0',
1393
-			'max'  => '100',
1394
-		),
1395
-		'desc_tip'          => true,
1396
-		'group'             => __( 'Typography', 'super-duper' ),
1397
-	);
1385
+    $defaults = array(
1386
+        'type'              => 'number',
1387
+        'title'             => __( 'Font Line Height', 'super-duper' ),
1388
+        'default'           => '',
1389
+        'placeholder'       => '1.75',
1390
+        'custom_attributes' => array(
1391
+            'step' => '0.1',
1392
+            'min'  => '0',
1393
+            'max'  => '100',
1394
+        ),
1395
+        'desc_tip'          => true,
1396
+        'group'             => __( 'Typography', 'super-duper' ),
1397
+    );
1398 1398
 
1399
-	$input = wp_parse_args( $overwrite, $defaults );
1399
+    $input = wp_parse_args( $overwrite, $defaults );
1400 1400
 
1401
-	return $input;
1401
+    return $input;
1402 1402
 }
1403 1403
 
1404 1404
 /**
@@ -1411,18 +1411,18 @@  discard block
 block discarded – undo
1411 1411
  */
1412 1412
 function sd_get_font_size_input_group( $type = 'font_size', $overwrite = array(), $overwrite_custom = array() ) {
1413 1413
 
1414
-	$inputs = array();
1414
+    $inputs = array();
1415 1415
 
1416
-	if ( $overwrite !== false ) {
1417
-		$inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true );
1418
-	}
1416
+    if ( $overwrite !== false ) {
1417
+        $inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true );
1418
+    }
1419 1419
 
1420
-	if ( $overwrite_custom !== false ) {
1421
-		$custom            = $type . '_custom';
1422
-		$inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type );
1423
-	}
1420
+    if ( $overwrite_custom !== false ) {
1421
+        $custom            = $type . '_custom';
1422
+        $inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type );
1423
+    }
1424 1424
 
1425
-	return $inputs;
1425
+    return $inputs;
1426 1426
 }
1427 1427
 
1428 1428
 /**
@@ -1435,33 +1435,33 @@  discard block
 block discarded – undo
1435 1435
  */
1436 1436
 function sd_get_font_weight_input( $type = 'font_weight', $overwrite = array() ) {
1437 1437
 
1438
-	$options = array(
1439
-		''                                => __( 'Inherit', 'super-duper' ),
1440
-		'font-weight-bold'                => 'bold',
1441
-		'font-weight-bolder'              => 'bolder',
1442
-		'font-weight-normal'              => 'normal',
1443
-		'font-weight-light'               => 'light',
1444
-		'font-weight-lighter'             => 'lighter',
1445
-		'font-italic'                     => 'italic',
1446
-		'font-weight-bold font-italic'    => 'bold italic',
1447
-		'font-weight-bolder font-italic'  => 'bolder italic',
1448
-		'font-weight-normal font-italic'  => 'normal italic',
1449
-		'font-weight-light font-italic'   => 'light italic',
1450
-		'font-weight-lighter font-italic' => 'lighter italic',
1451
-	);
1452
-
1453
-	$defaults = array(
1454
-		'type'     => 'select',
1455
-		'title'    => __( 'Appearance', 'super-duper' ),
1456
-		'options'  => $options,
1457
-		'default'  => '',
1458
-		'desc_tip' => true,
1459
-		'group'    => __( 'Typography', 'super-duper' ),
1460
-	);
1461
-
1462
-	$input = wp_parse_args( $overwrite, $defaults );
1463
-
1464
-	return $input;
1438
+    $options = array(
1439
+        ''                                => __( 'Inherit', 'super-duper' ),
1440
+        'font-weight-bold'                => 'bold',
1441
+        'font-weight-bolder'              => 'bolder',
1442
+        'font-weight-normal'              => 'normal',
1443
+        'font-weight-light'               => 'light',
1444
+        'font-weight-lighter'             => 'lighter',
1445
+        'font-italic'                     => 'italic',
1446
+        'font-weight-bold font-italic'    => 'bold italic',
1447
+        'font-weight-bolder font-italic'  => 'bolder italic',
1448
+        'font-weight-normal font-italic'  => 'normal italic',
1449
+        'font-weight-light font-italic'   => 'light italic',
1450
+        'font-weight-lighter font-italic' => 'lighter italic',
1451
+    );
1452
+
1453
+    $defaults = array(
1454
+        'type'     => 'select',
1455
+        'title'    => __( 'Appearance', 'super-duper' ),
1456
+        'options'  => $options,
1457
+        'default'  => '',
1458
+        'desc_tip' => true,
1459
+        'group'    => __( 'Typography', 'super-duper' ),
1460
+    );
1461
+
1462
+    $input = wp_parse_args( $overwrite, $defaults );
1463
+
1464
+    return $input;
1465 1465
 }
1466 1466
 
1467 1467
 /**
@@ -1474,25 +1474,25 @@  discard block
 block discarded – undo
1474 1474
  */
1475 1475
 function sd_get_font_case_input( $type = 'font_weight', $overwrite = array() ) {
1476 1476
 
1477
-	$options = array(
1478
-		''                => __( 'Default', 'super-duper' ),
1479
-		'text-lowercase'  => __( 'lowercase', 'super-duper' ),
1480
-		'text-uppercase'  => __( 'UPPERCASE', 'super-duper' ),
1481
-		'text-capitalize' => __( 'Capitalize', 'super-duper' ),
1482
-	);
1477
+    $options = array(
1478
+        ''                => __( 'Default', 'super-duper' ),
1479
+        'text-lowercase'  => __( 'lowercase', 'super-duper' ),
1480
+        'text-uppercase'  => __( 'UPPERCASE', 'super-duper' ),
1481
+        'text-capitalize' => __( 'Capitalize', 'super-duper' ),
1482
+    );
1483 1483
 
1484
-	$defaults = array(
1485
-		'type'     => 'select',
1486
-		'title'    => __( 'Letter case', 'super-duper' ),
1487
-		'options'  => $options,
1488
-		'default'  => '',
1489
-		'desc_tip' => true,
1490
-		'group'    => __( 'Typography', 'super-duper' ),
1491
-	);
1484
+    $defaults = array(
1485
+        'type'     => 'select',
1486
+        'title'    => __( 'Letter case', 'super-duper' ),
1487
+        'options'  => $options,
1488
+        'default'  => '',
1489
+        'desc_tip' => true,
1490
+        'group'    => __( 'Typography', 'super-duper' ),
1491
+    );
1492 1492
 
1493
-	$input = wp_parse_args( $overwrite, $defaults );
1493
+    $input = wp_parse_args( $overwrite, $defaults );
1494 1494
 
1495
-	return $input;
1495
+    return $input;
1496 1496
 }
1497 1497
 
1498 1498
 /**
@@ -1506,23 +1506,23 @@  discard block
 block discarded – undo
1506 1506
  */
1507 1507
 function sd_get_font_italic_input( $type = 'font_italic', $overwrite = array() ) {
1508 1508
 
1509
-	$options = array(
1510
-		''            => __( 'No', 'super-duper' ),
1511
-		'font-italic' => __( 'Yes', 'super-duper' ),
1512
-	);
1509
+    $options = array(
1510
+        ''            => __( 'No', 'super-duper' ),
1511
+        'font-italic' => __( 'Yes', 'super-duper' ),
1512
+    );
1513 1513
 
1514
-	$defaults = array(
1515
-		'type'     => 'select',
1516
-		'title'    => __( 'Font italic', 'super-duper' ),
1517
-		'options'  => $options,
1518
-		'default'  => '',
1519
-		'desc_tip' => true,
1520
-		'group'    => __( 'Typography', 'super-duper' ),
1521
-	);
1514
+    $defaults = array(
1515
+        'type'     => 'select',
1516
+        'title'    => __( 'Font italic', 'super-duper' ),
1517
+        'options'  => $options,
1518
+        'default'  => '',
1519
+        'desc_tip' => true,
1520
+        'group'    => __( 'Typography', 'super-duper' ),
1521
+    );
1522 1522
 
1523
-	$input = wp_parse_args( $overwrite, $defaults );
1523
+    $input = wp_parse_args( $overwrite, $defaults );
1524 1524
 
1525
-	return $input;
1525
+    return $input;
1526 1526
 }
1527 1527
 
1528 1528
 /**
@@ -1535,18 +1535,18 @@  discard block
 block discarded – undo
1535 1535
  */
1536 1536
 function sd_get_anchor_input( $type = 'anchor', $overwrite = array() ) {
1537 1537
 
1538
-	$defaults = array(
1539
-		'type'     => 'text',
1540
-		'title'    => __( 'HTML anchor', 'super-duper' ),
1541
-		'desc'     => __( 'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.', 'super-duper' ),
1542
-		'default'  => '',
1543
-		'desc_tip' => true,
1544
-		'group'    => __( 'Advanced', 'super-duper' ),
1545
-	);
1538
+    $defaults = array(
1539
+        'type'     => 'text',
1540
+        'title'    => __( 'HTML anchor', 'super-duper' ),
1541
+        'desc'     => __( 'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.', 'super-duper' ),
1542
+        'default'  => '',
1543
+        'desc_tip' => true,
1544
+        'group'    => __( 'Advanced', 'super-duper' ),
1545
+    );
1546 1546
 
1547
-	$input = wp_parse_args( $overwrite, $defaults );
1547
+    $input = wp_parse_args( $overwrite, $defaults );
1548 1548
 
1549
-	return $input;
1549
+    return $input;
1550 1550
 }
1551 1551
 
1552 1552
 /**
@@ -1559,18 +1559,18 @@  discard block
 block discarded – undo
1559 1559
  */
1560 1560
 function sd_get_class_input( $type = 'css_class', $overwrite = array() ) {
1561 1561
 
1562
-	$defaults = array(
1563
-		'type'     => 'text',
1564
-		'title'    => __( 'Additional CSS class(es)', 'super-duper' ),
1565
-		'desc'     => __( 'Separate multiple classes with spaces.', 'super-duper' ),
1566
-		'default'  => '',
1567
-		'desc_tip' => true,
1568
-		'group'    => __( 'Advanced', 'super-duper' ),
1569
-	);
1562
+    $defaults = array(
1563
+        'type'     => 'text',
1564
+        'title'    => __( 'Additional CSS class(es)', 'super-duper' ),
1565
+        'desc'     => __( 'Separate multiple classes with spaces.', 'super-duper' ),
1566
+        'default'  => '',
1567
+        'desc_tip' => true,
1568
+        'group'    => __( 'Advanced', 'super-duper' ),
1569
+    );
1570 1570
 
1571
-	$input = wp_parse_args( $overwrite, $defaults );
1571
+    $input = wp_parse_args( $overwrite, $defaults );
1572 1572
 
1573
-	return $input;
1573
+    return $input;
1574 1574
 }
1575 1575
 
1576 1576
 /**
@@ -1583,341 +1583,341 @@  discard block
 block discarded – undo
1583 1583
  */
1584 1584
 function sd_get_hover_animations_input( $type = 'hover_animations', $overwrite = array() ) {
1585 1585
 
1586
-	$options = array(
1587
-		''                 => __( 'none', 'super-duper' ),
1588
-		'hover-zoom'       => __( 'Zoom', 'super-duper' ),
1589
-		'hover-shadow'     => __( 'Shadow', 'super-duper' ),
1590
-		'hover-move-up'    => __( 'Move up', 'super-duper' ),
1591
-		'hover-move-down'  => __( 'Move down', 'super-duper' ),
1592
-		'hover-move-left'  => __( 'Move left', 'super-duper' ),
1593
-		'hover-move-right' => __( 'Move right', 'super-duper' ),
1594
-	);
1586
+    $options = array(
1587
+        ''                 => __( 'none', 'super-duper' ),
1588
+        'hover-zoom'       => __( 'Zoom', 'super-duper' ),
1589
+        'hover-shadow'     => __( 'Shadow', 'super-duper' ),
1590
+        'hover-move-up'    => __( 'Move up', 'super-duper' ),
1591
+        'hover-move-down'  => __( 'Move down', 'super-duper' ),
1592
+        'hover-move-left'  => __( 'Move left', 'super-duper' ),
1593
+        'hover-move-right' => __( 'Move right', 'super-duper' ),
1594
+    );
1595 1595
 
1596
-	$defaults = array(
1597
-		'type'     => 'select',
1598
-		'multiple' => true,
1599
-		'title'    => __( 'Hover Animations', 'super-duper' ),
1600
-		'options'  => $options,
1601
-		'default'  => '',
1602
-		'desc_tip' => true,
1603
-		'group'    => __( 'Hover Animations', 'super-duper' ),
1604
-	);
1596
+    $defaults = array(
1597
+        'type'     => 'select',
1598
+        'multiple' => true,
1599
+        'title'    => __( 'Hover Animations', 'super-duper' ),
1600
+        'options'  => $options,
1601
+        'default'  => '',
1602
+        'desc_tip' => true,
1603
+        'group'    => __( 'Hover Animations', 'super-duper' ),
1604
+    );
1605 1605
 
1606
-	$input = wp_parse_args( $overwrite, $defaults );
1606
+    $input = wp_parse_args( $overwrite, $defaults );
1607 1607
 
1608
-	return $input;
1608
+    return $input;
1609 1609
 }
1610 1610
 
1611 1611
 
1612 1612
 function sd_get_flex_align_items_input( $type = 'align-items', $overwrite = array() ) {
1613
-	$device_size = '';
1614
-	if ( ! empty( $overwrite['device_type'] ) ) {
1615
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1616
-			$device_size = '-md';
1617
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1618
-			$device_size = '-lg';
1619
-		}
1620
-	}
1621
-	$options = array(
1622
-		''                                         => __( 'Default', 'super-duper' ),
1623
-		'align-items' . $device_size . '-start'    => 'align-items-start',
1624
-		'align-items' . $device_size . '-end'      => 'align-items-end',
1625
-		'align-items' . $device_size . '-center'   => 'align-items-center',
1626
-		'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1627
-		'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1628
-	);
1629
-
1630
-	$defaults = array(
1631
-		'type'            => 'select',
1632
-		'title'           => __( 'Vertical Align Items', 'super-duper' ),
1633
-		'options'         => $options,
1634
-		'default'         => '',
1635
-		'desc_tip'        => true,
1636
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1637
-		'element_require' => ' ( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1638
-
1639
-	);
1640
-
1641
-	$input = wp_parse_args( $overwrite, $defaults );
1642
-
1643
-	return $input;
1613
+    $device_size = '';
1614
+    if ( ! empty( $overwrite['device_type'] ) ) {
1615
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1616
+            $device_size = '-md';
1617
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1618
+            $device_size = '-lg';
1619
+        }
1620
+    }
1621
+    $options = array(
1622
+        ''                                         => __( 'Default', 'super-duper' ),
1623
+        'align-items' . $device_size . '-start'    => 'align-items-start',
1624
+        'align-items' . $device_size . '-end'      => 'align-items-end',
1625
+        'align-items' . $device_size . '-center'   => 'align-items-center',
1626
+        'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1627
+        'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1628
+    );
1629
+
1630
+    $defaults = array(
1631
+        'type'            => 'select',
1632
+        'title'           => __( 'Vertical Align Items', 'super-duper' ),
1633
+        'options'         => $options,
1634
+        'default'         => '',
1635
+        'desc_tip'        => true,
1636
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1637
+        'element_require' => ' ( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1638
+
1639
+    );
1640
+
1641
+    $input = wp_parse_args( $overwrite, $defaults );
1642
+
1643
+    return $input;
1644 1644
 }
1645 1645
 
1646 1646
 function sd_get_flex_align_items_input_group( $type = 'flex_align_items', $overwrite = array() ) {
1647
-	$inputs = array();
1648
-	$sizes  = array(
1649
-		''    => 'Mobile',
1650
-		'_md' => 'Tablet',
1651
-		'_lg' => 'Desktop',
1652
-	);
1647
+    $inputs = array();
1648
+    $sizes  = array(
1649
+        ''    => 'Mobile',
1650
+        '_md' => 'Tablet',
1651
+        '_lg' => 'Desktop',
1652
+    );
1653 1653
 
1654
-	if ( $overwrite !== false ) {
1654
+    if ( $overwrite !== false ) {
1655 1655
 
1656
-		foreach ( $sizes as $ds => $dt ) {
1657
-			$overwrite['device_type'] = $dt;
1658
-			$inputs[ $type . $ds ]    = sd_get_flex_align_items_input( $type, $overwrite );
1659
-		}
1660
-	}
1656
+        foreach ( $sizes as $ds => $dt ) {
1657
+            $overwrite['device_type'] = $dt;
1658
+            $inputs[ $type . $ds ]    = sd_get_flex_align_items_input( $type, $overwrite );
1659
+        }
1660
+    }
1661 1661
 
1662
-	return $inputs;
1662
+    return $inputs;
1663 1663
 }
1664 1664
 
1665 1665
 function sd_get_flex_justify_content_input( $type = 'flex_justify_content', $overwrite = array() ) {
1666
-	$device_size = '';
1667
-	if ( ! empty( $overwrite['device_type'] ) ) {
1668
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1669
-			$device_size = '-md';
1670
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1671
-			$device_size = '-lg';
1672
-		}
1673
-	}
1674
-	$options = array(
1675
-		''                                            => __( 'Default', 'super-duper' ),
1676
-		'justify-content' . $device_size . '-start'   => 'justify-content-start',
1677
-		'justify-content' . $device_size . '-end'     => 'justify-content-end',
1678
-		'justify-content' . $device_size . '-center'  => 'justify-content-center',
1679
-		'justify-content' . $device_size . '-between' => 'justify-content-between',
1680
-		'justify-content' . $device_size . '-stretch' => 'justify-content-around',
1681
-	);
1682
-
1683
-	$defaults = array(
1684
-		'type'            => 'select',
1685
-		'title'           => __( 'Justify content', 'super-duper' ),
1686
-		'options'         => $options,
1687
-		'default'         => '',
1688
-		'desc_tip'        => true,
1689
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1690
-		'element_require' => '( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1691
-
1692
-	);
1693
-
1694
-	$input = wp_parse_args( $overwrite, $defaults );
1695
-
1696
-	return $input;
1666
+    $device_size = '';
1667
+    if ( ! empty( $overwrite['device_type'] ) ) {
1668
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1669
+            $device_size = '-md';
1670
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1671
+            $device_size = '-lg';
1672
+        }
1673
+    }
1674
+    $options = array(
1675
+        ''                                            => __( 'Default', 'super-duper' ),
1676
+        'justify-content' . $device_size . '-start'   => 'justify-content-start',
1677
+        'justify-content' . $device_size . '-end'     => 'justify-content-end',
1678
+        'justify-content' . $device_size . '-center'  => 'justify-content-center',
1679
+        'justify-content' . $device_size . '-between' => 'justify-content-between',
1680
+        'justify-content' . $device_size . '-stretch' => 'justify-content-around',
1681
+    );
1682
+
1683
+    $defaults = array(
1684
+        'type'            => 'select',
1685
+        'title'           => __( 'Justify content', 'super-duper' ),
1686
+        'options'         => $options,
1687
+        'default'         => '',
1688
+        'desc_tip'        => true,
1689
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1690
+        'element_require' => '( ( [%container%]=="row" ) || ( [%display%]=="d-flex" || [%display_md%]=="d-md-flex" || [%display_lg%]=="d-lg-flex" ) ) ',
1691
+
1692
+    );
1693
+
1694
+    $input = wp_parse_args( $overwrite, $defaults );
1695
+
1696
+    return $input;
1697 1697
 }
1698 1698
 
1699 1699
 function sd_get_flex_justify_content_input_group( $type = 'flex_justify_content', $overwrite = array() ) {
1700
-	$inputs = array();
1701
-	$sizes  = array(
1702
-		''    => 'Mobile',
1703
-		'_md' => 'Tablet',
1704
-		'_lg' => 'Desktop',
1705
-	);
1700
+    $inputs = array();
1701
+    $sizes  = array(
1702
+        ''    => 'Mobile',
1703
+        '_md' => 'Tablet',
1704
+        '_lg' => 'Desktop',
1705
+    );
1706 1706
 
1707
-	if ( $overwrite !== false ) {
1707
+    if ( $overwrite !== false ) {
1708 1708
 
1709
-		foreach ( $sizes as $ds => $dt ) {
1710
-			$overwrite['device_type'] = $dt;
1711
-			$inputs[ $type . $ds ]    = sd_get_flex_justify_content_input( $type, $overwrite );
1712
-		}
1713
-	}
1709
+        foreach ( $sizes as $ds => $dt ) {
1710
+            $overwrite['device_type'] = $dt;
1711
+            $inputs[ $type . $ds ]    = sd_get_flex_justify_content_input( $type, $overwrite );
1712
+        }
1713
+    }
1714 1714
 
1715
-	return $inputs;
1715
+    return $inputs;
1716 1716
 }
1717 1717
 
1718 1718
 
1719 1719
 function sd_get_flex_align_self_input( $type = 'flex_align_self', $overwrite = array() ) {
1720
-	$device_size = '';
1721
-	if ( ! empty( $overwrite['device_type'] ) ) {
1722
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1723
-			$device_size = '-md';
1724
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1725
-			$device_size = '-lg';
1726
-		}
1727
-	}
1728
-	$options = array(
1729
-		''                                         => __( 'Default', 'super-duper' ),
1730
-		'align-items' . $device_size . '-start'    => 'align-items-start',
1731
-		'align-items' . $device_size . '-end'      => 'align-items-end',
1732
-		'align-items' . $device_size . '-center'   => 'align-items-center',
1733
-		'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1734
-		'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1735
-	);
1736
-
1737
-	$defaults = array(
1738
-		'type'            => 'select',
1739
-		'title'           => __( 'Align Self', 'super-duper' ),
1740
-		'options'         => $options,
1741
-		'default'         => '',
1742
-		'desc_tip'        => true,
1743
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1744
-		'element_require' => ' [%container%]=="col" ',
1745
-
1746
-	);
1747
-
1748
-	$input = wp_parse_args( $overwrite, $defaults );
1749
-
1750
-	return $input;
1720
+    $device_size = '';
1721
+    if ( ! empty( $overwrite['device_type'] ) ) {
1722
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1723
+            $device_size = '-md';
1724
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1725
+            $device_size = '-lg';
1726
+        }
1727
+    }
1728
+    $options = array(
1729
+        ''                                         => __( 'Default', 'super-duper' ),
1730
+        'align-items' . $device_size . '-start'    => 'align-items-start',
1731
+        'align-items' . $device_size . '-end'      => 'align-items-end',
1732
+        'align-items' . $device_size . '-center'   => 'align-items-center',
1733
+        'align-items' . $device_size . '-baseline' => 'align-items-baseline',
1734
+        'align-items' . $device_size . '-stretch'  => 'align-items-stretch',
1735
+    );
1736
+
1737
+    $defaults = array(
1738
+        'type'            => 'select',
1739
+        'title'           => __( 'Align Self', 'super-duper' ),
1740
+        'options'         => $options,
1741
+        'default'         => '',
1742
+        'desc_tip'        => true,
1743
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1744
+        'element_require' => ' [%container%]=="col" ',
1745
+
1746
+    );
1747
+
1748
+    $input = wp_parse_args( $overwrite, $defaults );
1749
+
1750
+    return $input;
1751 1751
 }
1752 1752
 
1753 1753
 function sd_get_flex_align_self_input_group( $type = 'flex_align_self', $overwrite = array() ) {
1754
-	$inputs = array();
1755
-	$sizes  = array(
1756
-		''    => 'Mobile',
1757
-		'_md' => 'Tablet',
1758
-		'_lg' => 'Desktop',
1759
-	);
1754
+    $inputs = array();
1755
+    $sizes  = array(
1756
+        ''    => 'Mobile',
1757
+        '_md' => 'Tablet',
1758
+        '_lg' => 'Desktop',
1759
+    );
1760 1760
 
1761
-	if ( $overwrite !== false ) {
1761
+    if ( $overwrite !== false ) {
1762 1762
 
1763
-		foreach ( $sizes as $ds => $dt ) {
1764
-			$overwrite['device_type'] = $dt;
1765
-			$inputs[ $type . $ds ]    = sd_get_flex_align_self_input( $type, $overwrite );
1766
-		}
1767
-	}
1763
+        foreach ( $sizes as $ds => $dt ) {
1764
+            $overwrite['device_type'] = $dt;
1765
+            $inputs[ $type . $ds ]    = sd_get_flex_align_self_input( $type, $overwrite );
1766
+        }
1767
+    }
1768 1768
 
1769
-	return $inputs;
1769
+    return $inputs;
1770 1770
 }
1771 1771
 
1772 1772
 function sd_get_flex_order_input( $type = 'flex_order', $overwrite = array() ) {
1773
-	$device_size = '';
1774
-	if ( ! empty( $overwrite['device_type'] ) ) {
1775
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1776
-			$device_size = '-md';
1777
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1778
-			$device_size = '-lg';
1779
-		}
1780
-	}
1781
-	$options = array(
1782
-		'' => __( 'Default', 'super-duper' ),
1783
-	);
1784
-
1785
-	$i = 0;
1786
-	while ( $i <= 5 ) {
1787
-		$options[ 'order' . $device_size . '-' . $i ] = $i;
1788
-		$i++;
1789
-	}
1790
-
1791
-	$defaults = array(
1792
-		'type'            => 'select',
1793
-		'title'           => __( 'Flex Order', 'super-duper' ),
1794
-		'options'         => $options,
1795
-		'default'         => '',
1796
-		'desc_tip'        => true,
1797
-		'group'           => __( 'Wrapper Styles', 'super-duper' ),
1798
-		'element_require' => ' [%container%]=="col" ',
1799
-
1800
-	);
1801
-
1802
-	$input = wp_parse_args( $overwrite, $defaults );
1803
-
1804
-	return $input;
1773
+    $device_size = '';
1774
+    if ( ! empty( $overwrite['device_type'] ) ) {
1775
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1776
+            $device_size = '-md';
1777
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1778
+            $device_size = '-lg';
1779
+        }
1780
+    }
1781
+    $options = array(
1782
+        '' => __( 'Default', 'super-duper' ),
1783
+    );
1784
+
1785
+    $i = 0;
1786
+    while ( $i <= 5 ) {
1787
+        $options[ 'order' . $device_size . '-' . $i ] = $i;
1788
+        $i++;
1789
+    }
1790
+
1791
+    $defaults = array(
1792
+        'type'            => 'select',
1793
+        'title'           => __( 'Flex Order', 'super-duper' ),
1794
+        'options'         => $options,
1795
+        'default'         => '',
1796
+        'desc_tip'        => true,
1797
+        'group'           => __( 'Wrapper Styles', 'super-duper' ),
1798
+        'element_require' => ' [%container%]=="col" ',
1799
+
1800
+    );
1801
+
1802
+    $input = wp_parse_args( $overwrite, $defaults );
1803
+
1804
+    return $input;
1805 1805
 }
1806 1806
 
1807 1807
 function sd_get_flex_order_input_group( $type = 'flex_order', $overwrite = array() ) {
1808
-	$inputs = array();
1809
-	$sizes  = array(
1810
-		''    => 'Mobile',
1811
-		'_md' => 'Tablet',
1812
-		'_lg' => 'Desktop',
1813
-	);
1808
+    $inputs = array();
1809
+    $sizes  = array(
1810
+        ''    => 'Mobile',
1811
+        '_md' => 'Tablet',
1812
+        '_lg' => 'Desktop',
1813
+    );
1814 1814
 
1815
-	if ( $overwrite !== false ) {
1815
+    if ( $overwrite !== false ) {
1816 1816
 
1817
-		foreach ( $sizes as $ds => $dt ) {
1818
-			$overwrite['device_type'] = $dt;
1819
-			$inputs[ $type . $ds ]    = sd_get_flex_order_input( $type, $overwrite );
1820
-		}
1821
-	}
1817
+        foreach ( $sizes as $ds => $dt ) {
1818
+            $overwrite['device_type'] = $dt;
1819
+            $inputs[ $type . $ds ]    = sd_get_flex_order_input( $type, $overwrite );
1820
+        }
1821
+    }
1822 1822
 
1823
-	return $inputs;
1823
+    return $inputs;
1824 1824
 }
1825 1825
 
1826 1826
 function sd_get_flex_wrap_group( $type = 'flex_wrap', $overwrite = array() ) {
1827
-	$inputs = array();
1828
-	$sizes  = array(
1829
-		''    => 'Mobile',
1830
-		'_md' => 'Tablet',
1831
-		'_lg' => 'Desktop',
1832
-	);
1827
+    $inputs = array();
1828
+    $sizes  = array(
1829
+        ''    => 'Mobile',
1830
+        '_md' => 'Tablet',
1831
+        '_lg' => 'Desktop',
1832
+    );
1833 1833
 
1834
-	if ( $overwrite !== false ) {
1834
+    if ( $overwrite !== false ) {
1835 1835
 
1836
-		foreach ( $sizes as $ds => $dt ) {
1837
-			$overwrite['device_type'] = $dt;
1838
-			$inputs[ $type . $ds ]    = sd_get_flex_wrap_input( $type, $overwrite );
1839
-		}
1840
-	}
1836
+        foreach ( $sizes as $ds => $dt ) {
1837
+            $overwrite['device_type'] = $dt;
1838
+            $inputs[ $type . $ds ]    = sd_get_flex_wrap_input( $type, $overwrite );
1839
+        }
1840
+    }
1841 1841
 
1842
-	return $inputs;
1842
+    return $inputs;
1843 1843
 }
1844 1844
 
1845 1845
 function sd_get_flex_wrap_input( $type = 'flex_wrap', $overwrite = array() ) {
1846
-	$device_size = '';
1847
-	if ( ! empty( $overwrite['device_type'] ) ) {
1848
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1849
-			$device_size = '-md';
1850
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1851
-			$device_size = '-lg';
1852
-		}
1853
-	}
1854
-	$options = array(
1855
-		''                                      => __( 'Default', 'super-duper' ),
1856
-		'flex' . $device_size . '-nowrap'       => 'nowrap',
1857
-		'flex' . $device_size . '-wrap'         => 'wrap',
1858
-		'flex' . $device_size . '-wrap-reverse' => 'wrap-reverse',
1859
-	);
1860
-
1861
-	$defaults = array(
1862
-		'type'     => 'select',
1863
-		'title'    => __( 'Flex wrap', 'super-duper' ),
1864
-		'options'  => $options,
1865
-		'default'  => '',
1866
-		'desc_tip' => true,
1867
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
1868
-	);
1869
-
1870
-	$input = wp_parse_args( $overwrite, $defaults );
1871
-
1872
-	return $input;
1846
+    $device_size = '';
1847
+    if ( ! empty( $overwrite['device_type'] ) ) {
1848
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1849
+            $device_size = '-md';
1850
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1851
+            $device_size = '-lg';
1852
+        }
1853
+    }
1854
+    $options = array(
1855
+        ''                                      => __( 'Default', 'super-duper' ),
1856
+        'flex' . $device_size . '-nowrap'       => 'nowrap',
1857
+        'flex' . $device_size . '-wrap'         => 'wrap',
1858
+        'flex' . $device_size . '-wrap-reverse' => 'wrap-reverse',
1859
+    );
1860
+
1861
+    $defaults = array(
1862
+        'type'     => 'select',
1863
+        'title'    => __( 'Flex wrap', 'super-duper' ),
1864
+        'options'  => $options,
1865
+        'default'  => '',
1866
+        'desc_tip' => true,
1867
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
1868
+    );
1869
+
1870
+    $input = wp_parse_args( $overwrite, $defaults );
1871
+
1872
+    return $input;
1873 1873
 }
1874 1874
 
1875 1875
 function sd_get_float_group( $type = 'float', $overwrite = array() ) {
1876
-	$inputs = array();
1877
-	$sizes  = array(
1878
-		''    => 'Mobile',
1879
-		'_md' => 'Tablet',
1880
-		'_lg' => 'Desktop',
1881
-	);
1876
+    $inputs = array();
1877
+    $sizes  = array(
1878
+        ''    => 'Mobile',
1879
+        '_md' => 'Tablet',
1880
+        '_lg' => 'Desktop',
1881
+    );
1882 1882
 
1883
-	if ( $overwrite !== false ) {
1883
+    if ( $overwrite !== false ) {
1884 1884
 
1885
-		foreach ( $sizes as $ds => $dt ) {
1886
-			$overwrite['device_type'] = $dt;
1887
-			$inputs[ $type . $ds ]    = sd_get_float_input( $type, $overwrite );
1888
-		}
1889
-	}
1885
+        foreach ( $sizes as $ds => $dt ) {
1886
+            $overwrite['device_type'] = $dt;
1887
+            $inputs[ $type . $ds ]    = sd_get_float_input( $type, $overwrite );
1888
+        }
1889
+    }
1890 1890
 
1891
-	return $inputs;
1891
+    return $inputs;
1892 1892
 }
1893 1893
 function sd_get_float_input( $type = 'float', $overwrite = array() ) {
1894
-	$device_size = '';
1895
-	if ( ! empty( $overwrite['device_type'] ) ) {
1896
-		if ( $overwrite['device_type'] == 'Tablet' ) {
1897
-			$device_size = '-md';
1898
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
1899
-			$device_size = '-lg';
1900
-		}
1901
-	}
1902
-	$options = array(
1903
-		''                                      => __( 'Default', 'super-duper' ),
1904
-		'float' . $device_size . '-start'       => 'left',
1905
-		'float' . $device_size . '-end'         => 'right',
1906
-		'float' . $device_size . '-none' => 'none',
1907
-	);
1908
-
1909
-	$defaults = array(
1910
-		'type'     => 'select',
1911
-		'title'    => __( 'Float', 'super-duper' ),
1912
-		'options'  => $options,
1913
-		'default'  => '',
1914
-		'desc_tip' => true,
1915
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
1916
-	);
1917
-
1918
-	$input = wp_parse_args( $overwrite, $defaults );
1919
-
1920
-	return $input;
1894
+    $device_size = '';
1895
+    if ( ! empty( $overwrite['device_type'] ) ) {
1896
+        if ( $overwrite['device_type'] == 'Tablet' ) {
1897
+            $device_size = '-md';
1898
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
1899
+            $device_size = '-lg';
1900
+        }
1901
+    }
1902
+    $options = array(
1903
+        ''                                      => __( 'Default', 'super-duper' ),
1904
+        'float' . $device_size . '-start'       => 'left',
1905
+        'float' . $device_size . '-end'         => 'right',
1906
+        'float' . $device_size . '-none' => 'none',
1907
+    );
1908
+
1909
+    $defaults = array(
1910
+        'type'     => 'select',
1911
+        'title'    => __( 'Float', 'super-duper' ),
1912
+        'options'  => $options,
1913
+        'default'  => '',
1914
+        'desc_tip' => true,
1915
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
1916
+    );
1917
+
1918
+    $input = wp_parse_args( $overwrite, $defaults );
1919
+
1920
+    return $input;
1921 1921
 }
1922 1922
 
1923 1923
 /**
@@ -1928,26 +1928,26 @@  discard block
 block discarded – undo
1928 1928
  */
1929 1929
 function sd_get_zindex_input( $type = 'zindex', $overwrite = array() ) {
1930 1930
 
1931
-	$options = array(
1932
-		''          => __( 'Default', 'super-duper' ),
1933
-		'zindex-0'  => '0',
1934
-		'zindex-1'  => '1',
1935
-		'zindex-5'  => '5',
1936
-		'zindex-10' => '10',
1937
-	);
1931
+    $options = array(
1932
+        ''          => __( 'Default', 'super-duper' ),
1933
+        'zindex-0'  => '0',
1934
+        'zindex-1'  => '1',
1935
+        'zindex-5'  => '5',
1936
+        'zindex-10' => '10',
1937
+    );
1938 1938
 
1939
-	$defaults = array(
1940
-		'type'     => 'select',
1941
-		'title'    => __( 'Z-index', 'super-duper' ),
1942
-		'options'  => $options,
1943
-		'default'  => '',
1944
-		'desc_tip' => true,
1945
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
1946
-	);
1939
+    $defaults = array(
1940
+        'type'     => 'select',
1941
+        'title'    => __( 'Z-index', 'super-duper' ),
1942
+        'options'  => $options,
1943
+        'default'  => '',
1944
+        'desc_tip' => true,
1945
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
1946
+    );
1947 1947
 
1948
-	$input = wp_parse_args( $overwrite, $defaults );
1948
+    $input = wp_parse_args( $overwrite, $defaults );
1949 1949
 
1950
-	return $input;
1950
+    return $input;
1951 1951
 }
1952 1952
 
1953 1953
 /**
@@ -1958,26 +1958,26 @@  discard block
 block discarded – undo
1958 1958
  */
1959 1959
 function sd_get_overflow_input( $type = 'overflow', $overwrite = array() ) {
1960 1960
 
1961
-	$options = array(
1962
-		''                 => __( 'Default', 'super-duper' ),
1963
-		'overflow-auto'    => __( 'Auto', 'super-duper' ),
1964
-		'overflow-hidden'  => __( 'Hidden', 'super-duper' ),
1965
-		'overflow-visible' => __( 'Visible', 'super-duper' ),
1966
-		'overflow-scroll'  => __( 'Scroll', 'super-duper' ),
1967
-	);
1961
+    $options = array(
1962
+        ''                 => __( 'Default', 'super-duper' ),
1963
+        'overflow-auto'    => __( 'Auto', 'super-duper' ),
1964
+        'overflow-hidden'  => __( 'Hidden', 'super-duper' ),
1965
+        'overflow-visible' => __( 'Visible', 'super-duper' ),
1966
+        'overflow-scroll'  => __( 'Scroll', 'super-duper' ),
1967
+    );
1968 1968
 
1969
-	$defaults = array(
1970
-		'type'     => 'select',
1971
-		'title'    => __( 'Overflow', 'super-duper' ),
1972
-		'options'  => $options,
1973
-		'default'  => '',
1974
-		'desc_tip' => true,
1975
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
1976
-	);
1969
+    $defaults = array(
1970
+        'type'     => 'select',
1971
+        'title'    => __( 'Overflow', 'super-duper' ),
1972
+        'options'  => $options,
1973
+        'default'  => '',
1974
+        'desc_tip' => true,
1975
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
1976
+    );
1977 1977
 
1978
-	$input = wp_parse_args( $overwrite, $defaults );
1978
+    $input = wp_parse_args( $overwrite, $defaults );
1979 1979
 
1980
-	return $input;
1980
+    return $input;
1981 1981
 }
1982 1982
 
1983 1983
 /**
@@ -1988,19 +1988,19 @@  discard block
 block discarded – undo
1988 1988
  */
1989 1989
 function sd_get_max_height_input( $type = 'max_height', $overwrite = array() ) {
1990 1990
 
1991
-	$defaults = array(
1992
-		'type'        => 'text',
1993
-		'title'       => __( 'Max height', 'super-duper' ),
1994
-		'value'       => '',
1995
-		'default'     => '',
1996
-		'placeholder' => '',
1997
-		'desc_tip'    => true,
1998
-		'group'       => __( 'Wrapper Styles', 'super-duper' ),
1999
-	);
1991
+    $defaults = array(
1992
+        'type'        => 'text',
1993
+        'title'       => __( 'Max height', 'super-duper' ),
1994
+        'value'       => '',
1995
+        'default'     => '',
1996
+        'placeholder' => '',
1997
+        'desc_tip'    => true,
1998
+        'group'       => __( 'Wrapper Styles', 'super-duper' ),
1999
+    );
2000 2000
 
2001
-	$input = wp_parse_args( $overwrite, $defaults );
2001
+    $input = wp_parse_args( $overwrite, $defaults );
2002 2002
 
2003
-	return $input;
2003
+    return $input;
2004 2004
 }
2005 2005
 
2006 2006
 /**
@@ -2011,23 +2011,23 @@  discard block
 block discarded – undo
2011 2011
  */
2012 2012
 function sd_get_scrollbars_input( $type = 'scrollbars', $overwrite = array() ) {
2013 2013
 
2014
-	$options = array(
2015
-		''               => __( 'Default', 'super-duper' ),
2016
-		'scrollbars-ios' => __( 'IOS Style', 'super-duper' ),
2017
-	);
2014
+    $options = array(
2015
+        ''               => __( 'Default', 'super-duper' ),
2016
+        'scrollbars-ios' => __( 'IOS Style', 'super-duper' ),
2017
+    );
2018 2018
 
2019
-	$defaults = array(
2020
-		'type'     => 'select',
2021
-		'title'    => __( 'Scrollbars', 'super-duper' ),
2022
-		'options'  => $options,
2023
-		'default'  => '',
2024
-		'desc_tip' => true,
2025
-		'group'    => __( 'Wrapper Styles', 'super-duper' ),
2026
-	);
2019
+    $defaults = array(
2020
+        'type'     => 'select',
2021
+        'title'    => __( 'Scrollbars', 'super-duper' ),
2022
+        'options'  => $options,
2023
+        'default'  => '',
2024
+        'desc_tip' => true,
2025
+        'group'    => __( 'Wrapper Styles', 'super-duper' ),
2026
+    );
2027 2027
 
2028
-	$input = wp_parse_args( $overwrite, $defaults );
2028
+    $input = wp_parse_args( $overwrite, $defaults );
2029 2029
 
2030
-	return $input;
2030
+    return $input;
2031 2031
 }
2032 2032
 
2033 2033
 /**
@@ -2039,415 +2039,415 @@  discard block
 block discarded – undo
2039 2039
  * @todo find best way to use px- py- or general p-
2040 2040
  */
2041 2041
 function sd_build_aui_class( $args ) {
2042
-	global $aui_bs5;
2043
-
2044
-	$classes = array();
2045
-
2046
-	if ( $aui_bs5 ) {
2047
-		$p_ml = 'ms-';
2048
-		$p_mr = 'me-';
2049
-
2050
-		$p_pl = 'ps-';
2051
-		$p_pr = 'pe-';
2052
-	} else {
2053
-		$p_ml = 'ml-';
2054
-		$p_mr = 'mr-';
2055
-
2056
-		$p_pl = 'pl-';
2057
-		$p_pr = 'pr-';
2058
-	}
2059
-
2060
-	// margins.
2061
-	if ( isset( $args['mt'] ) && $args['mt'] !== '' ) {
2062
-		$classes[] = 'mt-' . sanitize_html_class( $args['mt'] );
2063
-		$mt        = $args['mt'];
2064
-	} else {
2065
-		$mt = null;
2066
-	}
2067
-	if ( isset( $args['mr'] ) && $args['mr'] !== '' ) {
2068
-		$classes[] = $p_mr . sanitize_html_class( $args['mr'] );
2069
-		$mr        = $args['mr'];
2070
-	} else {
2071
-		$mr = null;
2072
-	}
2073
-	if ( isset( $args['mb'] ) && $args['mb'] !== '' ) {
2074
-		$classes[] = 'mb-' . sanitize_html_class( $args['mb'] );
2075
-		$mb        = $args['mb'];
2076
-	} else {
2077
-		$mb = null;
2078
-	}
2079
-	if ( isset( $args['ml'] ) && $args['ml'] !== '' ) {
2080
-		$classes[] = $p_ml . sanitize_html_class( $args['ml'] );
2081
-		$ml        = $args['ml'];
2082
-	} else {
2083
-		$ml = null;
2084
-	}
2085
-
2086
-	// margins tablet.
2087
-	if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) {
2088
-		$classes[] = 'mt-md-' . sanitize_html_class( $args['mt_md'] );
2089
-		$mt_md     = $args['mt_md'];
2090
-	} else {
2091
-		$mt_md = null;
2092
-	}
2093
-	if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) {
2094
-		$classes[] = $p_mr . 'md-' . sanitize_html_class( $args['mr_md'] );
2095
-		$mt_md     = $args['mr_md'];
2096
-	} else {
2097
-		$mr_md = null;
2098
-	}
2099
-	if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) {
2100
-		$classes[] = 'mb-md-' . sanitize_html_class( $args['mb_md'] );
2101
-		$mt_md     = $args['mb_md'];
2102
-	} else {
2103
-		$mb_md = null;
2104
-	}
2105
-	if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) {
2106
-		$classes[] = $p_ml . 'md-' . sanitize_html_class( $args['ml_md'] );
2107
-		$mt_md     = $args['ml_md'];
2108
-	} else {
2109
-		$ml_md = null;
2110
-	}
2111
-
2112
-	// margins desktop.
2113
-	if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) {
2114
-		if ( $mt == null && $mt_md == null ) {
2115
-			$classes[] = 'mt-' . sanitize_html_class( $args['mt_lg'] );
2116
-		} else {
2117
-			$classes[] = 'mt-lg-' . sanitize_html_class( $args['mt_lg'] );
2118
-		}
2119
-	}
2120
-	if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) {
2121
-		if ( $mr == null && $mr_md == null ) {
2122
-			$classes[] = $p_mr . sanitize_html_class( $args['mr_lg'] );
2123
-		} else {
2124
-			$classes[] = $p_mr . 'lg-' . sanitize_html_class( $args['mr_lg'] );
2125
-		}
2126
-	}
2127
-	if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) {
2128
-		if ( $mb == null && $mb_md == null ) {
2129
-			$classes[] = 'mb-' . sanitize_html_class( $args['mb_lg'] );
2130
-		} else {
2131
-			$classes[] = 'mb-lg-' . sanitize_html_class( $args['mb_lg'] );
2132
-		}
2133
-	}
2134
-	if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) {
2135
-		if ( $ml == null && $ml_md == null ) {
2136
-			$classes[] = $p_ml . sanitize_html_class( $args['ml_lg'] );
2137
-		} else {
2138
-			$classes[] = $p_ml . 'lg-' . sanitize_html_class( $args['ml_lg'] );
2139
-		}
2140
-	}
2141
-
2142
-	// padding.
2143
-	if ( isset( $args['pt'] ) && $args['pt'] !== '' ) {
2144
-		$classes[] = 'pt-' . sanitize_html_class( $args['pt'] );
2145
-		$pt        = $args['pt'];
2146
-	} else {
2147
-		$pt = null;
2148
-	}
2149
-	if ( isset( $args['pr'] ) && $args['pr'] !== '' ) {
2150
-		$classes[] = $p_pr . sanitize_html_class( $args['pr'] );
2151
-		$pr        = $args['pr'];
2152
-	} else {
2153
-		$pr = null;
2154
-	}
2155
-	if ( isset( $args['pb'] ) && $args['pb'] !== '' ) {
2156
-		$classes[] = 'pb-' . sanitize_html_class( $args['pb'] );
2157
-		$pb        = $args['pb'];
2158
-	} else {
2159
-		$pb = null;
2160
-	}
2161
-	if ( isset( $args['pl'] ) && $args['pl'] !== '' ) {
2162
-		$classes[] = $p_pl . sanitize_html_class( $args['pl'] );
2163
-		$pl        = $args['pl'];
2164
-	} else {
2165
-		$pl = null;
2166
-	}
2167
-
2168
-	// padding tablet.
2169
-	if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) {
2170
-		$classes[] = 'pt-md-' . sanitize_html_class( $args['pt_md'] );
2171
-		$pt_md     = $args['pt_md'];
2172
-	} else {
2173
-		$pt_md = null;
2174
-	}
2175
-	if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) {
2176
-		$classes[] = $p_pr . 'md-' . sanitize_html_class( $args['pr_md'] );
2177
-		$pt_md     = $args['pr_md'];
2178
-	} else {
2179
-		$pr_md = null;
2180
-	}
2181
-	if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) {
2182
-		$classes[] = 'pb-md-' . sanitize_html_class( $args['pb_md'] );
2183
-		$pt_md     = $args['pb_md'];
2184
-	} else {
2185
-		$pb_md = null;
2186
-	}
2187
-	if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) {
2188
-		$classes[] = $p_pl . 'md-' . sanitize_html_class( $args['pl_md'] );
2189
-		$pt_md     = $args['pl_md'];
2190
-	} else {
2191
-		$pl_md = null;
2192
-	}
2193
-
2194
-	// padding desktop.
2195
-	if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) {
2196
-		if ( $pt == null && $pt_md == null ) {
2197
-			$classes[] = 'pt-' . sanitize_html_class( $args['pt_lg'] );
2198
-		} else {
2199
-			$classes[] = 'pt-lg-' . sanitize_html_class( $args['pt_lg'] );
2200
-		}
2201
-	}
2202
-	if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) {
2203
-		if ( $pr == null && $pr_md == null ) {
2204
-			$classes[] = $p_pr . sanitize_html_class( $args['pr_lg'] );
2205
-		} else {
2206
-			$classes[] = $p_pr . 'lg-' . sanitize_html_class( $args['pr_lg'] );
2207
-		}
2208
-	}
2209
-	if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) {
2210
-		if ( $pb == null && $pb_md == null ) {
2211
-			$classes[] = 'pb-' . sanitize_html_class( $args['pb_lg'] );
2212
-		} else {
2213
-			$classes[] = 'pb-lg-' . sanitize_html_class( $args['pb_lg'] );
2214
-		}
2215
-	}
2216
-	if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) {
2217
-		if ( $pl == null && $pl_md == null ) {
2218
-			$classes[] = $p_pl . sanitize_html_class( $args['pl_lg'] );
2219
-		} else {
2220
-			$classes[] = $p_pl . 'lg-' . sanitize_html_class( $args['pl_lg'] );
2221
-		}
2222
-	}
2223
-
2224
-	// row cols, mobile, tablet, desktop
2225
-	if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) {
2226
-		$classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols'] );
2227
-		$row_cols  = $args['row_cols'];
2228
-	} else {
2229
-		$row_cols = null;
2230
-	}
2231
-	if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) {
2232
-		$classes[]   = sanitize_html_class( 'row-cols-md-' . $args['row_cols_md'] );
2233
-		$row_cols_md = $args['row_cols_md'];
2234
-	} else {
2235
-		$row_cols_md = null;
2236
-	}
2237
-	if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) {
2238
-		if ( $row_cols == null && $row_cols_md == null ) {
2239
-			$classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols_lg'] );
2240
-		} else {
2241
-			$classes[] = sanitize_html_class( 'row-cols-lg-' . $args['row_cols_lg'] );
2242
-		}
2243
-	}
2244
-
2245
-	// columns , mobile, tablet, desktop
2246
-	if ( ! empty( $args['col'] ) && $args['col'] !== '' ) {
2247
-		$classes[] = sanitize_html_class( 'col-' . $args['col'] );
2248
-		$col       = $args['col'];
2249
-	} else {
2250
-		$col = null;
2251
-	}
2252
-	if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) {
2253
-		$classes[] = sanitize_html_class( 'col-md-' . $args['col_md'] );
2254
-		$col_md    = $args['col_md'];
2255
-	} else {
2256
-		$col_md = null;
2257
-	}
2258
-	if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) {
2259
-		if ( $col == null && $col_md == null ) {
2260
-			$classes[] = sanitize_html_class( 'col-' . $args['col_lg'] );
2261
-		} else {
2262
-			$classes[] = sanitize_html_class( 'col-lg-' . $args['col_lg'] );
2263
-		}
2264
-	}
2265
-
2266
-	// border
2267
-	if ( isset( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' || $args['border'] === 0 ) ) {
2268
-		$classes[] = 'border-0';
2269
-	} elseif ( ! empty( $args['border'] ) ) {
2270
-		$border_class = 'border';
2271
-		if ( ! empty( $args['border_type'] ) && strpos( $args['border_type'], '-0' ) === false ) {
2272
-			$border_class = '';
2273
-		}
2274
-		$classes[] = $border_class . ' border-' . sanitize_html_class( $args['border'] );
2275
-	}
2276
-
2277
-	// border radius type
2278
-	if ( ! empty( $args['rounded'] ) ) {
2279
-		$classes[] = sanitize_html_class( $args['rounded'] );
2280
-	}
2281
-
2282
-	// border radius size BS4
2283
-	if ( isset( $args['rounded_size'] ) && in_array( $args['rounded_size'], array( 'sm', 'lg' ) ) ) {
2284
-		$classes[] = 'rounded-' . sanitize_html_class( $args['rounded_size'] );
2285
-		// if we set a size then we need to remove "rounded" if set
2286
-		if ( ( $key = array_search( 'rounded', $classes ) ) !== false ) {
2287
-			unset( $classes[ $key ] );
2288
-		}
2289
-	} else {
2290
-
2291
-		// border radius size , mobile, tablet, desktop
2292
-		if ( isset( $args['rounded_size'] ) && $args['rounded_size'] !== '' ) {
2293
-			$classes[]    = sanitize_html_class( 'rounded-' . $args['rounded_size'] );
2294
-			$rounded_size = $args['rounded_size'];
2295
-		} else {
2296
-			$rounded_size = null;
2297
-		}
2298
-		if ( isset( $args['rounded_size_md'] ) && $args['rounded_size_md'] !== '' ) {
2299
-			$classes[]       = sanitize_html_class( 'rounded-md-' . $args['rounded_size_md'] );
2300
-			$rounded_size_md = $args['rounded_size_md'];
2301
-		} else {
2302
-			$rounded_size_md = null;
2303
-		}
2304
-		if ( isset( $args['rounded_size_lg'] ) && $args['rounded_size_lg'] !== '' ) {
2305
-			if ( $rounded_size == null && $rounded_size_md == null ) {
2306
-				$classes[] = sanitize_html_class( 'rounded-' . $args['rounded_size_lg'] );
2307
-			} else {
2308
-				$classes[] = sanitize_html_class( 'rounded-lg-' . $args['rounded_size_lg'] );
2309
-			}
2310
-		}
2311
-	}
2312
-
2313
-	// shadow
2314
-	//if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); }
2315
-
2316
-	// background
2317
-	if ( ! empty( $args['bg'] ) ) {
2318
-		$classes[] = 'bg-' . sanitize_html_class( $args['bg'] );
2319
-	}
2320
-
2321
-	// text_color
2322
-	if ( ! empty( $args['text_color'] ) ) {
2323
-		$classes[] = 'text-' . sanitize_html_class( $args['text_color'] );
2324
-	}
2325
-
2326
-	// text_align
2327
-	if ( ! empty( $args['text_justify'] ) ) {
2328
-		$classes[] = 'text-justify';
2329
-	} else {
2330
-		if ( ! empty( $args['text_align'] ) ) {
2331
-			$classes[]  = sanitize_html_class( $args['text_align'] );
2332
-			$text_align = $args['text_align'];
2333
-		} else {
2334
-			$text_align = null;
2335
-		}
2336
-		if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) {
2337
-			$classes[]     = sanitize_html_class( $args['text_align_md'] );
2338
-			$text_align_md = $args['text_align_md'];
2339
-		} else {
2340
-			$text_align_md = null;
2341
-		}
2342
-		if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) {
2343
-			if ( $text_align == null && $text_align_md == null ) {
2344
-				$classes[] = sanitize_html_class( str_replace( '-lg', '', $args['text_align_lg'] ) );
2345
-			} else {
2346
-				$classes[] = sanitize_html_class( $args['text_align_lg'] );
2347
-			}
2348
-		}
2349
-	}
2350
-
2351
-	// display
2352
-	if ( ! empty( $args['display'] ) ) {
2353
-		$classes[] = sanitize_html_class( $args['display'] );
2354
-		$display   = $args['display'];
2355
-	} else {
2356
-		$display = null;
2357
-	}
2358
-	if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) {
2359
-		$classes[]  = sanitize_html_class( $args['display_md'] );
2360
-		$display_md = $args['display_md'];
2361
-	} else {
2362
-		$display_md = null;
2363
-	}
2364
-	if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) {
2365
-		if ( $display == null && $display_md == null ) {
2366
-			$classes[] = sanitize_html_class( str_replace( '-lg', '', $args['display_lg'] ) );
2367
-		} else {
2368
-			$classes[] = sanitize_html_class( $args['display_lg'] );
2369
-		}
2370
-	}
2371
-
2372
-	// bgtus - background transparent until scroll
2373
-	if ( ! empty( $args['bgtus'] ) ) {
2374
-		$classes[] = sanitize_html_class( 'bg-transparent-until-scroll' );
2375
-	}
2376
-
2377
-	// cscos - change color scheme on scroll
2378
-	if ( ! empty( $args['bgtus'] ) && ! empty( $args['cscos'] ) ) {
2379
-		$classes[] = sanitize_html_class( 'color-scheme-flip-on-scroll' );
2380
-	}
2381
-
2382
-	// hover animations
2383
-	if ( ! empty( $args['hover_animations'] ) ) {
2384
-		$classes[] = sd_sanitize_html_classes( str_replace( ',', ' ', $args['hover_animations'] ) );
2385
-	}
2386
-
2387
-	// absolute_position
2388
-	if ( ! empty( $args['absolute_position'] ) ) {
2389
-		if ( 'top-left' === $args['absolute_position'] ) {
2390
-			$classes[] = 'start-0 top-0';
2391
-		} elseif ( 'top-center' === $args['absolute_position'] ) {
2392
-			$classes[] = 'start-50 top-0 translate-middle';
2393
-		} elseif ( 'top-right' === $args['absolute_position'] ) {
2394
-			$classes[] = 'end-0 top-0';
2395
-		} elseif ( 'center-left' === $args['absolute_position'] ) {
2396
-			$classes[] = 'start-0 top-50';
2397
-		} elseif ( 'center' === $args['absolute_position'] ) {
2398
-			$classes[] = 'start-50 top-50 translate-middle';
2399
-		} elseif ( 'center-right' === $args['absolute_position'] ) {
2400
-			$classes[] = 'end-0 top-50';
2401
-		} elseif ( 'bottom-left' === $args['absolute_position'] ) {
2402
-			$classes[] = 'start-0 bottom-0';
2403
-		} elseif ( 'bottom-center' === $args['absolute_position'] ) {
2404
-			$classes[] = 'start-50 bottom-0 translate-middle';
2405
-		} elseif ( 'bottom-right' === $args['absolute_position'] ) {
2406
-			$classes[] = 'end-0 bottom-0';
2407
-		}
2408
-	}
2409
-
2410
-	// build classes from build keys
2411
-	$build_keys = sd_get_class_build_keys();
2412
-	if ( ! empty( $build_keys ) ) {
2413
-		foreach ( $build_keys as $key ) {
2414
-
2415
-			if ( substr( $key, -4 ) == '-MTD' ) {
2416
-
2417
-				$k = str_replace( '-MTD', '', $key );
2418
-
2419
-				// Mobile, Tablet, Desktop
2420
-				if ( ! empty( $args[ $k ] ) && $args[ $k ] !== '' ) {
2421
-					$classes[] = sanitize_html_class( $args[ $k ] );
2422
-					$v         = $args[ $k ];
2423
-				} else {
2424
-					$v = null;
2425
-				}
2426
-				if ( ! empty( $args[ $k . '_md' ] ) && $args[ $k . '_md' ] !== '' ) {
2427
-					$classes[] = sanitize_html_class( $args[ $k . '_md' ] );
2428
-					$v_md      = $args[ $k . '_md' ];
2429
-				} else {
2430
-					$v_md = null;
2431
-				}
2432
-				if ( ! empty( $args[ $k . '_lg' ] ) && $args[ $k . '_lg' ] !== '' ) {
2433
-					if ( $v == null && $v_md == null ) {
2434
-						$classes[] = sanitize_html_class( str_replace( '-lg', '', $args[ $k . '_lg' ] ) );
2435
-					} else {
2436
-						$classes[] = sanitize_html_class( $args[ $k . '_lg' ] );
2437
-					}
2438
-				}
2439
-			} else {
2440
-				if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) {
2441
-					continue;
2442
-				}
2443
-				if ( ! empty( $args[ $key ] ) ) {
2444
-					$classes[] = sd_sanitize_html_classes( $args[ $key ] );
2445
-				}
2446
-			}
2447
-		}
2448
-	}
2449
-
2450
-	return implode( ' ', $classes );
2042
+    global $aui_bs5;
2043
+
2044
+    $classes = array();
2045
+
2046
+    if ( $aui_bs5 ) {
2047
+        $p_ml = 'ms-';
2048
+        $p_mr = 'me-';
2049
+
2050
+        $p_pl = 'ps-';
2051
+        $p_pr = 'pe-';
2052
+    } else {
2053
+        $p_ml = 'ml-';
2054
+        $p_mr = 'mr-';
2055
+
2056
+        $p_pl = 'pl-';
2057
+        $p_pr = 'pr-';
2058
+    }
2059
+
2060
+    // margins.
2061
+    if ( isset( $args['mt'] ) && $args['mt'] !== '' ) {
2062
+        $classes[] = 'mt-' . sanitize_html_class( $args['mt'] );
2063
+        $mt        = $args['mt'];
2064
+    } else {
2065
+        $mt = null;
2066
+    }
2067
+    if ( isset( $args['mr'] ) && $args['mr'] !== '' ) {
2068
+        $classes[] = $p_mr . sanitize_html_class( $args['mr'] );
2069
+        $mr        = $args['mr'];
2070
+    } else {
2071
+        $mr = null;
2072
+    }
2073
+    if ( isset( $args['mb'] ) && $args['mb'] !== '' ) {
2074
+        $classes[] = 'mb-' . sanitize_html_class( $args['mb'] );
2075
+        $mb        = $args['mb'];
2076
+    } else {
2077
+        $mb = null;
2078
+    }
2079
+    if ( isset( $args['ml'] ) && $args['ml'] !== '' ) {
2080
+        $classes[] = $p_ml . sanitize_html_class( $args['ml'] );
2081
+        $ml        = $args['ml'];
2082
+    } else {
2083
+        $ml = null;
2084
+    }
2085
+
2086
+    // margins tablet.
2087
+    if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) {
2088
+        $classes[] = 'mt-md-' . sanitize_html_class( $args['mt_md'] );
2089
+        $mt_md     = $args['mt_md'];
2090
+    } else {
2091
+        $mt_md = null;
2092
+    }
2093
+    if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) {
2094
+        $classes[] = $p_mr . 'md-' . sanitize_html_class( $args['mr_md'] );
2095
+        $mt_md     = $args['mr_md'];
2096
+    } else {
2097
+        $mr_md = null;
2098
+    }
2099
+    if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) {
2100
+        $classes[] = 'mb-md-' . sanitize_html_class( $args['mb_md'] );
2101
+        $mt_md     = $args['mb_md'];
2102
+    } else {
2103
+        $mb_md = null;
2104
+    }
2105
+    if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) {
2106
+        $classes[] = $p_ml . 'md-' . sanitize_html_class( $args['ml_md'] );
2107
+        $mt_md     = $args['ml_md'];
2108
+    } else {
2109
+        $ml_md = null;
2110
+    }
2111
+
2112
+    // margins desktop.
2113
+    if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) {
2114
+        if ( $mt == null && $mt_md == null ) {
2115
+            $classes[] = 'mt-' . sanitize_html_class( $args['mt_lg'] );
2116
+        } else {
2117
+            $classes[] = 'mt-lg-' . sanitize_html_class( $args['mt_lg'] );
2118
+        }
2119
+    }
2120
+    if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) {
2121
+        if ( $mr == null && $mr_md == null ) {
2122
+            $classes[] = $p_mr . sanitize_html_class( $args['mr_lg'] );
2123
+        } else {
2124
+            $classes[] = $p_mr . 'lg-' . sanitize_html_class( $args['mr_lg'] );
2125
+        }
2126
+    }
2127
+    if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) {
2128
+        if ( $mb == null && $mb_md == null ) {
2129
+            $classes[] = 'mb-' . sanitize_html_class( $args['mb_lg'] );
2130
+        } else {
2131
+            $classes[] = 'mb-lg-' . sanitize_html_class( $args['mb_lg'] );
2132
+        }
2133
+    }
2134
+    if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) {
2135
+        if ( $ml == null && $ml_md == null ) {
2136
+            $classes[] = $p_ml . sanitize_html_class( $args['ml_lg'] );
2137
+        } else {
2138
+            $classes[] = $p_ml . 'lg-' . sanitize_html_class( $args['ml_lg'] );
2139
+        }
2140
+    }
2141
+
2142
+    // padding.
2143
+    if ( isset( $args['pt'] ) && $args['pt'] !== '' ) {
2144
+        $classes[] = 'pt-' . sanitize_html_class( $args['pt'] );
2145
+        $pt        = $args['pt'];
2146
+    } else {
2147
+        $pt = null;
2148
+    }
2149
+    if ( isset( $args['pr'] ) && $args['pr'] !== '' ) {
2150
+        $classes[] = $p_pr . sanitize_html_class( $args['pr'] );
2151
+        $pr        = $args['pr'];
2152
+    } else {
2153
+        $pr = null;
2154
+    }
2155
+    if ( isset( $args['pb'] ) && $args['pb'] !== '' ) {
2156
+        $classes[] = 'pb-' . sanitize_html_class( $args['pb'] );
2157
+        $pb        = $args['pb'];
2158
+    } else {
2159
+        $pb = null;
2160
+    }
2161
+    if ( isset( $args['pl'] ) && $args['pl'] !== '' ) {
2162
+        $classes[] = $p_pl . sanitize_html_class( $args['pl'] );
2163
+        $pl        = $args['pl'];
2164
+    } else {
2165
+        $pl = null;
2166
+    }
2167
+
2168
+    // padding tablet.
2169
+    if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) {
2170
+        $classes[] = 'pt-md-' . sanitize_html_class( $args['pt_md'] );
2171
+        $pt_md     = $args['pt_md'];
2172
+    } else {
2173
+        $pt_md = null;
2174
+    }
2175
+    if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) {
2176
+        $classes[] = $p_pr . 'md-' . sanitize_html_class( $args['pr_md'] );
2177
+        $pt_md     = $args['pr_md'];
2178
+    } else {
2179
+        $pr_md = null;
2180
+    }
2181
+    if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) {
2182
+        $classes[] = 'pb-md-' . sanitize_html_class( $args['pb_md'] );
2183
+        $pt_md     = $args['pb_md'];
2184
+    } else {
2185
+        $pb_md = null;
2186
+    }
2187
+    if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) {
2188
+        $classes[] = $p_pl . 'md-' . sanitize_html_class( $args['pl_md'] );
2189
+        $pt_md     = $args['pl_md'];
2190
+    } else {
2191
+        $pl_md = null;
2192
+    }
2193
+
2194
+    // padding desktop.
2195
+    if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) {
2196
+        if ( $pt == null && $pt_md == null ) {
2197
+            $classes[] = 'pt-' . sanitize_html_class( $args['pt_lg'] );
2198
+        } else {
2199
+            $classes[] = 'pt-lg-' . sanitize_html_class( $args['pt_lg'] );
2200
+        }
2201
+    }
2202
+    if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) {
2203
+        if ( $pr == null && $pr_md == null ) {
2204
+            $classes[] = $p_pr . sanitize_html_class( $args['pr_lg'] );
2205
+        } else {
2206
+            $classes[] = $p_pr . 'lg-' . sanitize_html_class( $args['pr_lg'] );
2207
+        }
2208
+    }
2209
+    if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) {
2210
+        if ( $pb == null && $pb_md == null ) {
2211
+            $classes[] = 'pb-' . sanitize_html_class( $args['pb_lg'] );
2212
+        } else {
2213
+            $classes[] = 'pb-lg-' . sanitize_html_class( $args['pb_lg'] );
2214
+        }
2215
+    }
2216
+    if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) {
2217
+        if ( $pl == null && $pl_md == null ) {
2218
+            $classes[] = $p_pl . sanitize_html_class( $args['pl_lg'] );
2219
+        } else {
2220
+            $classes[] = $p_pl . 'lg-' . sanitize_html_class( $args['pl_lg'] );
2221
+        }
2222
+    }
2223
+
2224
+    // row cols, mobile, tablet, desktop
2225
+    if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) {
2226
+        $classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols'] );
2227
+        $row_cols  = $args['row_cols'];
2228
+    } else {
2229
+        $row_cols = null;
2230
+    }
2231
+    if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) {
2232
+        $classes[]   = sanitize_html_class( 'row-cols-md-' . $args['row_cols_md'] );
2233
+        $row_cols_md = $args['row_cols_md'];
2234
+    } else {
2235
+        $row_cols_md = null;
2236
+    }
2237
+    if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) {
2238
+        if ( $row_cols == null && $row_cols_md == null ) {
2239
+            $classes[] = sanitize_html_class( 'row-cols-' . $args['row_cols_lg'] );
2240
+        } else {
2241
+            $classes[] = sanitize_html_class( 'row-cols-lg-' . $args['row_cols_lg'] );
2242
+        }
2243
+    }
2244
+
2245
+    // columns , mobile, tablet, desktop
2246
+    if ( ! empty( $args['col'] ) && $args['col'] !== '' ) {
2247
+        $classes[] = sanitize_html_class( 'col-' . $args['col'] );
2248
+        $col       = $args['col'];
2249
+    } else {
2250
+        $col = null;
2251
+    }
2252
+    if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) {
2253
+        $classes[] = sanitize_html_class( 'col-md-' . $args['col_md'] );
2254
+        $col_md    = $args['col_md'];
2255
+    } else {
2256
+        $col_md = null;
2257
+    }
2258
+    if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) {
2259
+        if ( $col == null && $col_md == null ) {
2260
+            $classes[] = sanitize_html_class( 'col-' . $args['col_lg'] );
2261
+        } else {
2262
+            $classes[] = sanitize_html_class( 'col-lg-' . $args['col_lg'] );
2263
+        }
2264
+    }
2265
+
2266
+    // border
2267
+    if ( isset( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' || $args['border'] === 0 ) ) {
2268
+        $classes[] = 'border-0';
2269
+    } elseif ( ! empty( $args['border'] ) ) {
2270
+        $border_class = 'border';
2271
+        if ( ! empty( $args['border_type'] ) && strpos( $args['border_type'], '-0' ) === false ) {
2272
+            $border_class = '';
2273
+        }
2274
+        $classes[] = $border_class . ' border-' . sanitize_html_class( $args['border'] );
2275
+    }
2276
+
2277
+    // border radius type
2278
+    if ( ! empty( $args['rounded'] ) ) {
2279
+        $classes[] = sanitize_html_class( $args['rounded'] );
2280
+    }
2281
+
2282
+    // border radius size BS4
2283
+    if ( isset( $args['rounded_size'] ) && in_array( $args['rounded_size'], array( 'sm', 'lg' ) ) ) {
2284
+        $classes[] = 'rounded-' . sanitize_html_class( $args['rounded_size'] );
2285
+        // if we set a size then we need to remove "rounded" if set
2286
+        if ( ( $key = array_search( 'rounded', $classes ) ) !== false ) {
2287
+            unset( $classes[ $key ] );
2288
+        }
2289
+    } else {
2290
+
2291
+        // border radius size , mobile, tablet, desktop
2292
+        if ( isset( $args['rounded_size'] ) && $args['rounded_size'] !== '' ) {
2293
+            $classes[]    = sanitize_html_class( 'rounded-' . $args['rounded_size'] );
2294
+            $rounded_size = $args['rounded_size'];
2295
+        } else {
2296
+            $rounded_size = null;
2297
+        }
2298
+        if ( isset( $args['rounded_size_md'] ) && $args['rounded_size_md'] !== '' ) {
2299
+            $classes[]       = sanitize_html_class( 'rounded-md-' . $args['rounded_size_md'] );
2300
+            $rounded_size_md = $args['rounded_size_md'];
2301
+        } else {
2302
+            $rounded_size_md = null;
2303
+        }
2304
+        if ( isset( $args['rounded_size_lg'] ) && $args['rounded_size_lg'] !== '' ) {
2305
+            if ( $rounded_size == null && $rounded_size_md == null ) {
2306
+                $classes[] = sanitize_html_class( 'rounded-' . $args['rounded_size_lg'] );
2307
+            } else {
2308
+                $classes[] = sanitize_html_class( 'rounded-lg-' . $args['rounded_size_lg'] );
2309
+            }
2310
+        }
2311
+    }
2312
+
2313
+    // shadow
2314
+    //if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); }
2315
+
2316
+    // background
2317
+    if ( ! empty( $args['bg'] ) ) {
2318
+        $classes[] = 'bg-' . sanitize_html_class( $args['bg'] );
2319
+    }
2320
+
2321
+    // text_color
2322
+    if ( ! empty( $args['text_color'] ) ) {
2323
+        $classes[] = 'text-' . sanitize_html_class( $args['text_color'] );
2324
+    }
2325
+
2326
+    // text_align
2327
+    if ( ! empty( $args['text_justify'] ) ) {
2328
+        $classes[] = 'text-justify';
2329
+    } else {
2330
+        if ( ! empty( $args['text_align'] ) ) {
2331
+            $classes[]  = sanitize_html_class( $args['text_align'] );
2332
+            $text_align = $args['text_align'];
2333
+        } else {
2334
+            $text_align = null;
2335
+        }
2336
+        if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) {
2337
+            $classes[]     = sanitize_html_class( $args['text_align_md'] );
2338
+            $text_align_md = $args['text_align_md'];
2339
+        } else {
2340
+            $text_align_md = null;
2341
+        }
2342
+        if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) {
2343
+            if ( $text_align == null && $text_align_md == null ) {
2344
+                $classes[] = sanitize_html_class( str_replace( '-lg', '', $args['text_align_lg'] ) );
2345
+            } else {
2346
+                $classes[] = sanitize_html_class( $args['text_align_lg'] );
2347
+            }
2348
+        }
2349
+    }
2350
+
2351
+    // display
2352
+    if ( ! empty( $args['display'] ) ) {
2353
+        $classes[] = sanitize_html_class( $args['display'] );
2354
+        $display   = $args['display'];
2355
+    } else {
2356
+        $display = null;
2357
+    }
2358
+    if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) {
2359
+        $classes[]  = sanitize_html_class( $args['display_md'] );
2360
+        $display_md = $args['display_md'];
2361
+    } else {
2362
+        $display_md = null;
2363
+    }
2364
+    if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) {
2365
+        if ( $display == null && $display_md == null ) {
2366
+            $classes[] = sanitize_html_class( str_replace( '-lg', '', $args['display_lg'] ) );
2367
+        } else {
2368
+            $classes[] = sanitize_html_class( $args['display_lg'] );
2369
+        }
2370
+    }
2371
+
2372
+    // bgtus - background transparent until scroll
2373
+    if ( ! empty( $args['bgtus'] ) ) {
2374
+        $classes[] = sanitize_html_class( 'bg-transparent-until-scroll' );
2375
+    }
2376
+
2377
+    // cscos - change color scheme on scroll
2378
+    if ( ! empty( $args['bgtus'] ) && ! empty( $args['cscos'] ) ) {
2379
+        $classes[] = sanitize_html_class( 'color-scheme-flip-on-scroll' );
2380
+    }
2381
+
2382
+    // hover animations
2383
+    if ( ! empty( $args['hover_animations'] ) ) {
2384
+        $classes[] = sd_sanitize_html_classes( str_replace( ',', ' ', $args['hover_animations'] ) );
2385
+    }
2386
+
2387
+    // absolute_position
2388
+    if ( ! empty( $args['absolute_position'] ) ) {
2389
+        if ( 'top-left' === $args['absolute_position'] ) {
2390
+            $classes[] = 'start-0 top-0';
2391
+        } elseif ( 'top-center' === $args['absolute_position'] ) {
2392
+            $classes[] = 'start-50 top-0 translate-middle';
2393
+        } elseif ( 'top-right' === $args['absolute_position'] ) {
2394
+            $classes[] = 'end-0 top-0';
2395
+        } elseif ( 'center-left' === $args['absolute_position'] ) {
2396
+            $classes[] = 'start-0 top-50';
2397
+        } elseif ( 'center' === $args['absolute_position'] ) {
2398
+            $classes[] = 'start-50 top-50 translate-middle';
2399
+        } elseif ( 'center-right' === $args['absolute_position'] ) {
2400
+            $classes[] = 'end-0 top-50';
2401
+        } elseif ( 'bottom-left' === $args['absolute_position'] ) {
2402
+            $classes[] = 'start-0 bottom-0';
2403
+        } elseif ( 'bottom-center' === $args['absolute_position'] ) {
2404
+            $classes[] = 'start-50 bottom-0 translate-middle';
2405
+        } elseif ( 'bottom-right' === $args['absolute_position'] ) {
2406
+            $classes[] = 'end-0 bottom-0';
2407
+        }
2408
+    }
2409
+
2410
+    // build classes from build keys
2411
+    $build_keys = sd_get_class_build_keys();
2412
+    if ( ! empty( $build_keys ) ) {
2413
+        foreach ( $build_keys as $key ) {
2414
+
2415
+            if ( substr( $key, -4 ) == '-MTD' ) {
2416
+
2417
+                $k = str_replace( '-MTD', '', $key );
2418
+
2419
+                // Mobile, Tablet, Desktop
2420
+                if ( ! empty( $args[ $k ] ) && $args[ $k ] !== '' ) {
2421
+                    $classes[] = sanitize_html_class( $args[ $k ] );
2422
+                    $v         = $args[ $k ];
2423
+                } else {
2424
+                    $v = null;
2425
+                }
2426
+                if ( ! empty( $args[ $k . '_md' ] ) && $args[ $k . '_md' ] !== '' ) {
2427
+                    $classes[] = sanitize_html_class( $args[ $k . '_md' ] );
2428
+                    $v_md      = $args[ $k . '_md' ];
2429
+                } else {
2430
+                    $v_md = null;
2431
+                }
2432
+                if ( ! empty( $args[ $k . '_lg' ] ) && $args[ $k . '_lg' ] !== '' ) {
2433
+                    if ( $v == null && $v_md == null ) {
2434
+                        $classes[] = sanitize_html_class( str_replace( '-lg', '', $args[ $k . '_lg' ] ) );
2435
+                    } else {
2436
+                        $classes[] = sanitize_html_class( $args[ $k . '_lg' ] );
2437
+                    }
2438
+                }
2439
+            } else {
2440
+                if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) {
2441
+                    continue;
2442
+                }
2443
+                if ( ! empty( $args[ $key ] ) ) {
2444
+                    $classes[] = sd_sanitize_html_classes( $args[ $key ] );
2445
+                }
2446
+            }
2447
+        }
2448
+    }
2449
+
2450
+    return implode( ' ', $classes );
2451 2451
 }
2452 2452
 
2453 2453
 /**
@@ -2459,90 +2459,90 @@  discard block
 block discarded – undo
2459 2459
  */
2460 2460
 function sd_build_aui_styles( $args ) {
2461 2461
 
2462
-	$styles = array();
2463
-
2464
-	// background color
2465
-	if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) {
2466
-		if ( $args['bg'] == 'custom-color' ) {
2467
-			$styles['background-color'] = $args['bg_color'];
2468
-		} elseif ( $args['bg'] == 'custom-gradient' ) {
2469
-			$styles['background-image'] = $args['bg_gradient'];
2470
-
2471
-			// use background on text.
2472
-			if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) {
2473
-				$styles['background-clip']         = 'text';
2474
-				$styles['-webkit-background-clip'] = 'text';
2475
-				$styles['text-fill-color']         = 'transparent';
2476
-				$styles['-webkit-text-fill-color'] = 'transparent';
2477
-			}
2478
-		}
2479
-	}
2480
-
2481
-	if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) {
2482
-		$hasImage = true;
2483
-		if ( ! empty( $styles['background-color'] ) && $args['bg'] == 'custom-color' ) {
2484
-			$styles['background-image']      = 'url(' . $args['bg_image'] . ')';
2485
-			$styles['background-blend-mode'] = 'overlay';
2486
-		} elseif ( ! empty( $styles['background-image'] ) && $args['bg'] == 'custom-gradient' ) {
2487
-			$styles['background-image'] .= ',url(' . $args['bg_image'] . ')';
2488
-		} elseif ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) {
2489
-			// do nothing as we alreay have a preset
2490
-			$hasImage = false;
2491
-		} else {
2492
-			$styles['background-image'] = 'url(' . $args['bg_image'] . ')';
2493
-		}
2494
-
2495
-		if ( $hasImage ) {
2496
-			$styles['background-size'] = 'cover';
2497
-
2498
-			if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) {
2499
-				$styles['background-attachment'] = 'fixed';
2500
-			}
2501
-		}
2502
-
2503
-		if ( $hasImage && ! empty( $args['bg_image_xy'] ) && ! empty( $args['bg_image_xy']['x'] ) ) {
2504
-			$styles['background-position'] = ( $args['bg_image_xy']['x'] * 100 ) . '% ' . ( $args['bg_image_xy']['y'] * 100 ) . '%';
2505
-		}
2506
-	}
2507
-
2508
-	// sticky offset top
2509
-	if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) {
2510
-		$styles['top'] = absint( $args['sticky_offset_top'] );
2511
-	}
2512
-
2513
-	// sticky offset bottom
2514
-	if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) {
2515
-		$styles['bottom'] = absint( $args['sticky_offset_bottom'] );
2516
-	}
2517
-
2518
-	// font size
2519
-	if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) {
2520
-		$styles['font-size'] = (float) $args['font_size_custom'] . 'rem';
2521
-	}
2522
-
2523
-	// font color
2524
-	if ( ! empty( $args['text_color_custom'] ) && $args['text_color_custom'] !== '' ) {
2525
-		$styles['color'] = esc_attr( $args['text_color_custom'] );
2526
-	}
2527
-
2528
-	// font line height
2529
-	if ( ! empty( $args['font_line_height'] ) && $args['font_line_height'] !== '' ) {
2530
-		$styles['line-height'] = esc_attr( $args['font_line_height'] );
2531
-	}
2532
-
2533
-	// max height
2534
-	if ( ! empty( $args['max_height'] ) && $args['max_height'] !== '' ) {
2535
-		$styles['max-height'] = esc_attr( $args['max_height'] );
2536
-	}
2537
-
2538
-	$style_string = '';
2539
-	if ( ! empty( $styles ) ) {
2540
-		foreach ( $styles as $key => $val ) {
2541
-			$style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';';
2542
-		}
2543
-	}
2544
-
2545
-	return $style_string;
2462
+    $styles = array();
2463
+
2464
+    // background color
2465
+    if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) {
2466
+        if ( $args['bg'] == 'custom-color' ) {
2467
+            $styles['background-color'] = $args['bg_color'];
2468
+        } elseif ( $args['bg'] == 'custom-gradient' ) {
2469
+            $styles['background-image'] = $args['bg_gradient'];
2470
+
2471
+            // use background on text.
2472
+            if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) {
2473
+                $styles['background-clip']         = 'text';
2474
+                $styles['-webkit-background-clip'] = 'text';
2475
+                $styles['text-fill-color']         = 'transparent';
2476
+                $styles['-webkit-text-fill-color'] = 'transparent';
2477
+            }
2478
+        }
2479
+    }
2480
+
2481
+    if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) {
2482
+        $hasImage = true;
2483
+        if ( ! empty( $styles['background-color'] ) && $args['bg'] == 'custom-color' ) {
2484
+            $styles['background-image']      = 'url(' . $args['bg_image'] . ')';
2485
+            $styles['background-blend-mode'] = 'overlay';
2486
+        } elseif ( ! empty( $styles['background-image'] ) && $args['bg'] == 'custom-gradient' ) {
2487
+            $styles['background-image'] .= ',url(' . $args['bg_image'] . ')';
2488
+        } elseif ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) {
2489
+            // do nothing as we alreay have a preset
2490
+            $hasImage = false;
2491
+        } else {
2492
+            $styles['background-image'] = 'url(' . $args['bg_image'] . ')';
2493
+        }
2494
+
2495
+        if ( $hasImage ) {
2496
+            $styles['background-size'] = 'cover';
2497
+
2498
+            if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) {
2499
+                $styles['background-attachment'] = 'fixed';
2500
+            }
2501
+        }
2502
+
2503
+        if ( $hasImage && ! empty( $args['bg_image_xy'] ) && ! empty( $args['bg_image_xy']['x'] ) ) {
2504
+            $styles['background-position'] = ( $args['bg_image_xy']['x'] * 100 ) . '% ' . ( $args['bg_image_xy']['y'] * 100 ) . '%';
2505
+        }
2506
+    }
2507
+
2508
+    // sticky offset top
2509
+    if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) {
2510
+        $styles['top'] = absint( $args['sticky_offset_top'] );
2511
+    }
2512
+
2513
+    // sticky offset bottom
2514
+    if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) {
2515
+        $styles['bottom'] = absint( $args['sticky_offset_bottom'] );
2516
+    }
2517
+
2518
+    // font size
2519
+    if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) {
2520
+        $styles['font-size'] = (float) $args['font_size_custom'] . 'rem';
2521
+    }
2522
+
2523
+    // font color
2524
+    if ( ! empty( $args['text_color_custom'] ) && $args['text_color_custom'] !== '' ) {
2525
+        $styles['color'] = esc_attr( $args['text_color_custom'] );
2526
+    }
2527
+
2528
+    // font line height
2529
+    if ( ! empty( $args['font_line_height'] ) && $args['font_line_height'] !== '' ) {
2530
+        $styles['line-height'] = esc_attr( $args['font_line_height'] );
2531
+    }
2532
+
2533
+    // max height
2534
+    if ( ! empty( $args['max_height'] ) && $args['max_height'] !== '' ) {
2535
+        $styles['max-height'] = esc_attr( $args['max_height'] );
2536
+    }
2537
+
2538
+    $style_string = '';
2539
+    if ( ! empty( $styles ) ) {
2540
+        foreach ( $styles as $key => $val ) {
2541
+            $style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';';
2542
+        }
2543
+    }
2544
+
2545
+    return $style_string;
2546 2546
 
2547 2547
 }
2548 2548
 
@@ -2555,34 +2555,34 @@  discard block
 block discarded – undo
2555 2555
  * @return string
2556 2556
  */
2557 2557
 function sd_build_hover_styles( $args, $is_preview = false ) {
2558
-	$rules = '';
2559
-	// text color
2560
-	if ( ! empty( $args['styleid'] ) ) {
2561
-		$styleid = $is_preview ? 'html .editor-styles-wrapper .' . esc_attr( $args['styleid'] ) : 'html .' . esc_attr( $args['styleid'] );
2562
-
2563
-		// text
2564
-		if ( ! empty( $args['text_color_hover'] ) ) {
2565
-			$key    = 'custom' === $args['text_color_hover'] && ! empty( $args['text_color_hover_custom'] ) ? 'text_color_hover_custom' : 'text_color_hover';
2566
-			$color  = sd_get_color_from_var( $args[ $key ] );
2567
-			$rules .= $styleid . ':hover {color: ' . $color . ' !important;} ';
2568
-		}
2569
-
2570
-		// bg
2571
-		if ( ! empty( $args['bg_hover'] ) ) {
2572
-			if ( 'custom-gradient' === $args['bg_hover'] ) {
2573
-				$color  = $args['bg_hover_gradient'];
2574
-				$rules .= $styleid . ':hover {background-image: ' . $color . ' !important;} ';
2575
-				$rules .= $styleid . '.btn:hover {border-color: transparent !important;} ';
2576
-			} else {
2577
-				$key    = 'custom-color' === $args['bg_hover'] ? 'bg_hover_color' : 'bg_hover';
2578
-				$color  = sd_get_color_from_var( $args[ $key ] );
2579
-				$rules .= $styleid . ':hover {background: ' . $color . ' !important;} ';
2580
-				$rules .= $styleid . '.btn:hover {border-color: ' . $color . ' !important;} ';
2581
-			}
2582
-		}
2583
-	}
2584
-
2585
-	return $rules ? '<style>' . $rules . '</style>' : '';
2558
+    $rules = '';
2559
+    // text color
2560
+    if ( ! empty( $args['styleid'] ) ) {
2561
+        $styleid = $is_preview ? 'html .editor-styles-wrapper .' . esc_attr( $args['styleid'] ) : 'html .' . esc_attr( $args['styleid'] );
2562
+
2563
+        // text
2564
+        if ( ! empty( $args['text_color_hover'] ) ) {
2565
+            $key    = 'custom' === $args['text_color_hover'] && ! empty( $args['text_color_hover_custom'] ) ? 'text_color_hover_custom' : 'text_color_hover';
2566
+            $color  = sd_get_color_from_var( $args[ $key ] );
2567
+            $rules .= $styleid . ':hover {color: ' . $color . ' !important;} ';
2568
+        }
2569
+
2570
+        // bg
2571
+        if ( ! empty( $args['bg_hover'] ) ) {
2572
+            if ( 'custom-gradient' === $args['bg_hover'] ) {
2573
+                $color  = $args['bg_hover_gradient'];
2574
+                $rules .= $styleid . ':hover {background-image: ' . $color . ' !important;} ';
2575
+                $rules .= $styleid . '.btn:hover {border-color: transparent !important;} ';
2576
+            } else {
2577
+                $key    = 'custom-color' === $args['bg_hover'] ? 'bg_hover_color' : 'bg_hover';
2578
+                $color  = sd_get_color_from_var( $args[ $key ] );
2579
+                $rules .= $styleid . ':hover {background: ' . $color . ' !important;} ';
2580
+                $rules .= $styleid . '.btn:hover {border-color: ' . $color . ' !important;} ';
2581
+            }
2582
+        }
2583
+    }
2584
+
2585
+    return $rules ? '<style>' . $rules . '</style>' : '';
2586 2586
 }
2587 2587
 
2588 2588
 /**
@@ -2594,12 +2594,12 @@  discard block
 block discarded – undo
2594 2594
  */
2595 2595
 function sd_get_color_from_var( $var ) {
2596 2596
 
2597
-	//sanitize_hex_color() @todo this does not cover transparency
2598
-	if ( strpos( $var, '#' ) === false ) {
2599
-		$var = defined( 'BLOCKSTRAP_BLOCKS_VERSION' ) ? 'var(--wp--preset--color--' . esc_attr( $var ) . ')' : 'var(--' . esc_attr( $var ) . ')';
2600
-	}
2597
+    //sanitize_hex_color() @todo this does not cover transparency
2598
+    if ( strpos( $var, '#' ) === false ) {
2599
+        $var = defined( 'BLOCKSTRAP_BLOCKS_VERSION' ) ? 'var(--wp--preset--color--' . esc_attr( $var ) . ')' : 'var(--' . esc_attr( $var ) . ')';
2600
+    }
2601 2601
 
2602
-	return $var;
2602
+    return $var;
2603 2603
 }
2604 2604
 
2605 2605
 /**
@@ -2611,19 +2611,19 @@  discard block
 block discarded – undo
2611 2611
  * @return string
2612 2612
  */
2613 2613
 function sd_sanitize_html_classes( $classes, $sep = ' ' ) {
2614
-	$return = '';
2614
+    $return = '';
2615 2615
 
2616
-	if ( ! is_array( $classes ) ) {
2617
-		$classes = explode( $sep, $classes );
2618
-	}
2616
+    if ( ! is_array( $classes ) ) {
2617
+        $classes = explode( $sep, $classes );
2618
+    }
2619 2619
 
2620
-	if ( ! empty( $classes ) ) {
2621
-		foreach ( $classes as $class ) {
2622
-			$return .= sanitize_html_class( $class ) . ' ';
2623
-		}
2624
-	}
2620
+    if ( ! empty( $classes ) ) {
2621
+        foreach ( $classes as $class ) {
2622
+            $return .= sanitize_html_class( $class ) . ' ';
2623
+        }
2624
+    }
2625 2625
 
2626
-	return $return;
2626
+    return $return;
2627 2627
 }
2628 2628
 
2629 2629
 
@@ -2633,38 +2633,38 @@  discard block
 block discarded – undo
2633 2633
  * @return void
2634 2634
  */
2635 2635
 function sd_get_class_build_keys() {
2636
-	$keys = array(
2637
-		'container',
2638
-		'position',
2639
-		'flex_direction',
2640
-		'shadow',
2641
-		'rounded',
2642
-		'nav_style',
2643
-		'horizontal_alignment',
2644
-		'nav_fill',
2645
-		'width',
2646
-		'font_weight',
2647
-		'font_size',
2648
-		'font_case',
2649
-		'css_class',
2650
-		'flex_align_items-MTD',
2651
-		'flex_justify_content-MTD',
2652
-		'flex_align_self-MTD',
2653
-		'flex_order-MTD',
2654
-		'styleid',
2655
-		'border_opacity',
2656
-		'border_width',
2657
-		'border_type',
2658
-		'opacity',
2659
-		'zindex',
2660
-		'flex_wrap-MTD',
2661
-		'h100',
2662
-		'overflow',
2663
-		'scrollbars',
2664
-		'float-MTD'
2665
-	);
2666
-
2667
-	return apply_filters( 'sd_class_build_keys', $keys );
2636
+    $keys = array(
2637
+        'container',
2638
+        'position',
2639
+        'flex_direction',
2640
+        'shadow',
2641
+        'rounded',
2642
+        'nav_style',
2643
+        'horizontal_alignment',
2644
+        'nav_fill',
2645
+        'width',
2646
+        'font_weight',
2647
+        'font_size',
2648
+        'font_case',
2649
+        'css_class',
2650
+        'flex_align_items-MTD',
2651
+        'flex_justify_content-MTD',
2652
+        'flex_align_self-MTD',
2653
+        'flex_order-MTD',
2654
+        'styleid',
2655
+        'border_opacity',
2656
+        'border_width',
2657
+        'border_type',
2658
+        'opacity',
2659
+        'zindex',
2660
+        'flex_wrap-MTD',
2661
+        'h100',
2662
+        'overflow',
2663
+        'scrollbars',
2664
+        'float-MTD'
2665
+    );
2666
+
2667
+    return apply_filters( 'sd_class_build_keys', $keys );
2668 2668
 }
2669 2669
 
2670 2670
 /**
@@ -2676,18 +2676,18 @@  discard block
 block discarded – undo
2676 2676
  * @return array
2677 2677
  */
2678 2678
 function sd_get_visibility_conditions_input( $type = 'visibility_conditions', $overwrite = array() ) {
2679
-	$defaults = array(
2680
-		'type'         => 'visibility_conditions',
2681
-		'title'        => __( 'Block Visibility', 'super-duper' ),
2682
-		'button_title' => __( 'Set Block Visibility', 'super-duper' ),
2683
-		'default'      => '',
2684
-		'desc_tip'     => true,
2685
-		'group'        => __( 'Visibility Conditions', 'super-duper' ),
2686
-	);
2679
+    $defaults = array(
2680
+        'type'         => 'visibility_conditions',
2681
+        'title'        => __( 'Block Visibility', 'super-duper' ),
2682
+        'button_title' => __( 'Set Block Visibility', 'super-duper' ),
2683
+        'default'      => '',
2684
+        'desc_tip'     => true,
2685
+        'group'        => __( 'Visibility Conditions', 'super-duper' ),
2686
+    );
2687 2687
 
2688
-	$input = wp_parse_args( $overwrite, $defaults );
2688
+    $input = wp_parse_args( $overwrite, $defaults );
2689 2689
 
2690
-	return $input;
2690
+    return $input;
2691 2691
 }
2692 2692
 
2693 2693
 /**
@@ -2699,21 +2699,21 @@  discard block
 block discarded – undo
2699 2699
  * @return array An array of roles.
2700 2700
  */
2701 2701
 function sd_user_roles_options( $exclude = array() ) {
2702
-	$user_roles = array();
2702
+    $user_roles = array();
2703 2703
 
2704
-	if ( !function_exists('get_editable_roles') ) {
2705
-		require_once( ABSPATH . '/wp-admin/includes/user.php' );
2706
-	}
2704
+    if ( !function_exists('get_editable_roles') ) {
2705
+        require_once( ABSPATH . '/wp-admin/includes/user.php' );
2706
+    }
2707 2707
 
2708
-	$roles = get_editable_roles();
2708
+    $roles = get_editable_roles();
2709 2709
 
2710
-	foreach ( $roles as $role => $data ) {
2711
-		if ( ! ( ! empty( $exclude ) && in_array( $role, $exclude ) ) ) {
2712
-			$user_roles[ esc_attr( $role ) ] = translate_user_role( $data['name'] );
2713
-		}
2714
-	}
2710
+    foreach ( $roles as $role => $data ) {
2711
+        if ( ! ( ! empty( $exclude ) && in_array( $role, $exclude ) ) ) {
2712
+            $user_roles[ esc_attr( $role ) ] = translate_user_role( $data['name'] );
2713
+        }
2714
+    }
2715 2715
 
2716
-	return apply_filters( 'sd_user_roles_options', $user_roles );
2716
+    return apply_filters( 'sd_user_roles_options', $user_roles );
2717 2717
 }
2718 2718
 
2719 2719
 /**
@@ -2724,17 +2724,17 @@  discard block
 block discarded – undo
2724 2724
  * @return array Rule options.
2725 2725
  */
2726 2726
 function sd_visibility_rules_options() {
2727
-	$options = array(
2728
-		'logged_in'  => __( 'Logged In', 'super-duper' ),
2729
-		'logged_out' => __( 'Logged Out', 'super-duper' ),
2730
-		'user_roles' => __( 'Specific User Roles', 'super-duper' )
2731
-	);
2727
+    $options = array(
2728
+        'logged_in'  => __( 'Logged In', 'super-duper' ),
2729
+        'logged_out' => __( 'Logged Out', 'super-duper' ),
2730
+        'user_roles' => __( 'Specific User Roles', 'super-duper' )
2731
+    );
2732 2732
 
2733
-	if ( class_exists( 'GeoDirectory' ) ) {
2734
-		$options['gd_field'] = __( 'GD Field', 'super-duper' );
2735
-	}
2733
+    if ( class_exists( 'GeoDirectory' ) ) {
2734
+        $options['gd_field'] = __( 'GD Field', 'super-duper' );
2735
+    }
2736 2736
 
2737
-	return apply_filters( 'sd_visibility_rules_options', $options );
2737
+    return apply_filters( 'sd_visibility_rules_options', $options );
2738 2738
 }
2739 2739
 
2740 2740
 /**
@@ -2743,37 +2743,37 @@  discard block
 block discarded – undo
2743 2743
  * @return array
2744 2744
  */
2745 2745
 function sd_visibility_gd_field_options(){
2746
-	$fields = geodir_post_custom_fields( '', 'all', 'all', 'none' );
2746
+    $fields = geodir_post_custom_fields( '', 'all', 'all', 'none' );
2747 2747
 
2748
-	$keys = array();
2749
-	if ( ! empty( $fields ) ) {
2750
-		foreach( $fields as $field ) {
2751
-			if ( apply_filters( 'geodir_badge_field_skip_key', false, $field ) ) {
2752
-				continue;
2753
-			}
2748
+    $keys = array();
2749
+    if ( ! empty( $fields ) ) {
2750
+        foreach( $fields as $field ) {
2751
+            if ( apply_filters( 'geodir_badge_field_skip_key', false, $field ) ) {
2752
+                continue;
2753
+            }
2754 2754
 
2755
-			$keys[ $field['htmlvar_name'] ] = $field['htmlvar_name'] . ' ( ' . __( $field['admin_title'], 'geodirectory' ) . ' )';
2755
+            $keys[ $field['htmlvar_name'] ] = $field['htmlvar_name'] . ' ( ' . __( $field['admin_title'], 'geodirectory' ) . ' )';
2756 2756
 
2757
-			// Extra address fields
2758
-			if ( $field['htmlvar_name'] == 'address' && ( $address_fields = geodir_post_meta_address_fields( '' ) ) ) {
2759
-				foreach ( $address_fields as $_field => $args ) {
2760
-					if ( $_field != 'map_directions' && $_field != 'street' ) {
2761
-						$keys[ $_field ] = $_field . ' ( ' . $args['frontend_title'] . ' )';
2762
-					}
2763
-				}
2764
-			}
2765
-		}
2766
-	}
2757
+            // Extra address fields
2758
+            if ( $field['htmlvar_name'] == 'address' && ( $address_fields = geodir_post_meta_address_fields( '' ) ) ) {
2759
+                foreach ( $address_fields as $_field => $args ) {
2760
+                    if ( $_field != 'map_directions' && $_field != 'street' ) {
2761
+                        $keys[ $_field ] = $_field . ' ( ' . $args['frontend_title'] . ' )';
2762
+                    }
2763
+                }
2764
+            }
2765
+        }
2766
+    }
2767 2767
 
2768
-	$keys['post_date'] = 'post_date ( ' . __( 'post date', 'geodirectory' ) . ' )';
2769
-	$keys['post_modified'] = 'post_modified ( ' . __( 'post modified', 'geodirectory' ) . ' )';
2770
-	$keys['default_category'] = 'default_category ( ' . __( 'Default Category', 'geodirectory' ) . ' )';
2771
-	$keys['post_id'] = 'post_id ( ' . __( 'post id', 'geodirectory' ) . ' )';
2772
-	$keys['post_status'] = 'post_status ( ' . __( 'Post Status', 'geodirectory' ) . ' )';
2768
+    $keys['post_date'] = 'post_date ( ' . __( 'post date', 'geodirectory' ) . ' )';
2769
+    $keys['post_modified'] = 'post_modified ( ' . __( 'post modified', 'geodirectory' ) . ' )';
2770
+    $keys['default_category'] = 'default_category ( ' . __( 'Default Category', 'geodirectory' ) . ' )';
2771
+    $keys['post_id'] = 'post_id ( ' . __( 'post id', 'geodirectory' ) . ' )';
2772
+    $keys['post_status'] = 'post_status ( ' . __( 'Post Status', 'geodirectory' ) . ' )';
2773 2773
 
2774
-	$options = apply_filters( 'geodir_badge_field_keys', $keys );
2774
+    $options = apply_filters( 'geodir_badge_field_keys', $keys );
2775 2775
 
2776
-	return apply_filters( 'sd_visibility_gd_field_options', $options );
2776
+    return apply_filters( 'sd_visibility_gd_field_options', $options );
2777 2777
 }
2778 2778
 
2779 2779
 /**
@@ -2782,18 +2782,18 @@  discard block
 block discarded – undo
2782 2782
  * @return array
2783 2783
  */
2784 2784
 function sd_visibility_field_condition_options(){
2785
-	$options = array(
2786
-		'is_empty' => __( 'is empty', 'super-duper' ),
2787
-		'is_not_empty' => __( 'is not empty', 'super-duper' ),
2788
-		'is_equal' => __( 'is equal', 'super-duper' ),
2789
-		'is_not_equal' => __( 'is not equal', 'super-duper' ),
2790
-		'is_greater_than' => __( 'is greater than', 'super-duper' ),
2791
-		'is_less_than' => __( 'is less than', 'super-duper' ),
2792
-		'is_contains' => __( 'is contains', 'super-duper' ),
2793
-		'is_not_contains' => __( 'is not contains', 'super-duper' ),
2794
-	);
2785
+    $options = array(
2786
+        'is_empty' => __( 'is empty', 'super-duper' ),
2787
+        'is_not_empty' => __( 'is not empty', 'super-duper' ),
2788
+        'is_equal' => __( 'is equal', 'super-duper' ),
2789
+        'is_not_equal' => __( 'is not equal', 'super-duper' ),
2790
+        'is_greater_than' => __( 'is greater than', 'super-duper' ),
2791
+        'is_less_than' => __( 'is less than', 'super-duper' ),
2792
+        'is_contains' => __( 'is contains', 'super-duper' ),
2793
+        'is_not_contains' => __( 'is not contains', 'super-duper' ),
2794
+    );
2795 2795
 
2796
-	return apply_filters( 'sd_visibility_field_condition_options', $options );
2796
+    return apply_filters( 'sd_visibility_field_condition_options', $options );
2797 2797
 }
2798 2798
 
2799 2799
 /**
@@ -2804,14 +2804,14 @@  discard block
 block discarded – undo
2804 2804
  * @return array Template type options.
2805 2805
  */
2806 2806
 function sd_visibility_output_options() {
2807
-	$options = array(
2808
-		'hide'          => __( 'Hide Block', 'super-duper' ),
2809
-		'message'       => __( 'Show Custom Message', 'super-duper' ),
2810
-		'page'          => __( 'Show Page Content', 'super-duper' ),
2811
-		'template_part' => __( 'Show Template Part', 'super-duper' ),
2812
-	);
2807
+    $options = array(
2808
+        'hide'          => __( 'Hide Block', 'super-duper' ),
2809
+        'message'       => __( 'Show Custom Message', 'super-duper' ),
2810
+        'page'          => __( 'Show Page Content', 'super-duper' ),
2811
+        'template_part' => __( 'Show Template Part', 'super-duper' ),
2812
+    );
2813 2813
 
2814
-	return apply_filters( 'sd_visibility_output_options', $options );
2814
+    return apply_filters( 'sd_visibility_output_options', $options );
2815 2815
 }
2816 2816
 
2817 2817
 /**
@@ -2823,45 +2823,45 @@  discard block
 block discarded – undo
2823 2823
  * @return array Template page options.
2824 2824
  */
2825 2825
 function sd_template_page_options( $args = array() ) {
2826
-	global $sd_tmpl_page_options;
2826
+    global $sd_tmpl_page_options;
2827 2827
 
2828
-	if ( ! empty( $sd_tmpl_page_options ) ) {
2829
-		return $sd_tmpl_page_options;
2830
-	}
2828
+    if ( ! empty( $sd_tmpl_page_options ) ) {
2829
+        return $sd_tmpl_page_options;
2830
+    }
2831 2831
 
2832
-	$args = wp_parse_args( $args, array(
2833
-		'child_of'    => 0,
2834
-		'sort_column' => 'post_title',
2835
-		'sort_order'  => 'ASC'
2836
-	) );
2832
+    $args = wp_parse_args( $args, array(
2833
+        'child_of'    => 0,
2834
+        'sort_column' => 'post_title',
2835
+        'sort_order'  => 'ASC'
2836
+    ) );
2837 2837
 
2838
-	$exclude_pages = array();
2839
-	if ( $page_on_front = get_option( 'page_on_front' ) ) {
2840
-		$exclude_pages[] = $page_on_front;
2841
-	}
2838
+    $exclude_pages = array();
2839
+    if ( $page_on_front = get_option( 'page_on_front' ) ) {
2840
+        $exclude_pages[] = $page_on_front;
2841
+    }
2842 2842
 
2843
-	if ( $page_for_posts = get_option( 'page_for_posts' ) ) {
2844
-		$exclude_pages[] = $page_for_posts;
2845
-	}
2843
+    if ( $page_for_posts = get_option( 'page_for_posts' ) ) {
2844
+        $exclude_pages[] = $page_for_posts;
2845
+    }
2846 2846
 
2847
-	if ( ! empty( $exclude_pages ) ) {
2848
-		$args['exclude'] = $exclude_pages;
2849
-	}
2847
+    if ( ! empty( $exclude_pages ) ) {
2848
+        $args['exclude'] = $exclude_pages;
2849
+    }
2850 2850
 
2851
-	$pages = get_pages( $args );
2851
+    $pages = get_pages( $args );
2852 2852
 
2853
-	$options = array( '' => __( 'Select Page...', 'super-duper' ) );
2854
-	if ( ! empty( $pages ) ) {
2855
-		foreach ( $pages as $page ) {
2856
-			if ( ! empty( $page->ID ) && ! empty( $page->post_title ) ) {
2857
-				$options[ $page->ID ] = $page->post_title . ' (#' . $page->ID . ')';
2858
-			}
2859
-		}
2860
-	}
2853
+    $options = array( '' => __( 'Select Page...', 'super-duper' ) );
2854
+    if ( ! empty( $pages ) ) {
2855
+        foreach ( $pages as $page ) {
2856
+            if ( ! empty( $page->ID ) && ! empty( $page->post_title ) ) {
2857
+                $options[ $page->ID ] = $page->post_title . ' (#' . $page->ID . ')';
2858
+            }
2859
+        }
2860
+    }
2861 2861
 
2862
-	$sd_tmpl_page_options = $options;
2862
+    $sd_tmpl_page_options = $options;
2863 2863
 
2864
-	return apply_filters( 'sd_template_page_options', $options );
2864
+    return apply_filters( 'sd_template_page_options', $options );
2865 2865
 }
2866 2866
 
2867 2867
 /**
@@ -2873,25 +2873,25 @@  discard block
 block discarded – undo
2873 2873
  * @return array Template part options.
2874 2874
  */
2875 2875
 function sd_template_part_options( $args = array() ) {
2876
-	global $sd_tmpl_part_options;
2876
+    global $sd_tmpl_part_options;
2877 2877
 
2878
-	if ( ! empty( $sd_tmpl_part_options ) ) {
2879
-		return $sd_tmpl_part_options;
2880
-	}
2878
+    if ( ! empty( $sd_tmpl_part_options ) ) {
2879
+        return $sd_tmpl_part_options;
2880
+    }
2881 2881
 
2882
-	$options = array( '' => __( 'Select Template Part...', 'super-duper' ) );
2882
+    $options = array( '' => __( 'Select Template Part...', 'super-duper' ) );
2883 2883
 
2884
-	$parts = get_block_templates( array(), 'wp_template_part' );
2884
+    $parts = get_block_templates( array(), 'wp_template_part' );
2885 2885
 
2886
-	if ( ! empty( $parts ) ) {
2887
-		foreach ( $parts as $part ) {
2888
-			$options[ $part->slug ] = $part->title . ' (#' . $part->slug . ')';
2889
-		}
2890
-	}
2886
+    if ( ! empty( $parts ) ) {
2887
+        foreach ( $parts as $part ) {
2888
+            $options[ $part->slug ] = $part->title . ' (#' . $part->slug . ')';
2889
+        }
2890
+    }
2891 2891
 
2892
-	$sd_tmpl_part_options = $options;
2892
+    $sd_tmpl_part_options = $options;
2893 2893
 
2894
-	return apply_filters( 'sd_template_part_options', $options, $args );
2894
+    return apply_filters( 'sd_template_part_options', $options, $args );
2895 2895
 }
2896 2896
 
2897 2897
 /**
@@ -2903,25 +2903,25 @@  discard block
 block discarded – undo
2903 2903
  * @return array Template part object.
2904 2904
  */
2905 2905
 function sd_get_template_part_by_slug( $slug ) {
2906
-	global $bs_tmpl_part_by_slug;
2906
+    global $bs_tmpl_part_by_slug;
2907 2907
 
2908
-	if ( empty( $bs_tmpl_part_by_slug ) ) {
2909
-		$bs_tmpl_part_by_slug = array();
2910
-	}
2908
+    if ( empty( $bs_tmpl_part_by_slug ) ) {
2909
+        $bs_tmpl_part_by_slug = array();
2910
+    }
2911 2911
 
2912
-	if ( isset( $bs_tmpl_part_by_slug[ $slug ] ) ) {
2913
-		return $bs_tmpl_part_by_slug[ $slug ];
2914
-	}
2912
+    if ( isset( $bs_tmpl_part_by_slug[ $slug ] ) ) {
2913
+        return $bs_tmpl_part_by_slug[ $slug ];
2914
+    }
2915 2915
 
2916
-	$template_query = get_block_templates( array( 'slug__in' => array( $slug ) ), 'wp_template_part' );
2916
+    $template_query = get_block_templates( array( 'slug__in' => array( $slug ) ), 'wp_template_part' );
2917 2917
 
2918
-	$query_post = ! empty( $template_query ) ? $template_query[0] : array();
2918
+    $query_post = ! empty( $template_query ) ? $template_query[0] : array();
2919 2919
 
2920
-	$template_part = ! empty( $query_post ) && $query_post->status == 'publish' ? $query_post : array();
2920
+    $template_part = ! empty( $query_post ) && $query_post->status == 'publish' ? $query_post : array();
2921 2921
 
2922
-	$bs_tmpl_part_by_slug[ $slug ] = $template_part;
2922
+    $bs_tmpl_part_by_slug[ $slug ] = $template_part;
2923 2923
 
2924
-	return apply_filters( 'sd_get_template_part_by_slug', $template_part, $slug );
2924
+    return apply_filters( 'sd_get_template_part_by_slug', $template_part, $slug );
2925 2925
 }
2926 2926
 
2927 2927
 /**
@@ -2934,306 +2934,306 @@  discard block
 block discarded – undo
2934 2934
  * @param WP_Block $instance      The block instance.
2935 2935
  */
2936 2936
 function sd_render_block( $block_content, $block, $instance ) {
2937
-	// No block visibility conditions set.
2938
-	if ( empty( $block['attrs']['visibility_conditions'] ) ) {
2939
-		return $block_content;
2940
-	}
2941
-
2942
-	$attributes = json_decode( $block['attrs']['visibility_conditions'], true );
2943
-	$rules = ! empty( $attributes ) ? sd_block_parse_rules( $attributes ) : array();
2944
-
2945
-	// No rules set.
2946
-	if ( empty( $rules ) ) {
2947
-		return $block_content;
2948
-	}
2949
-
2950
-	$_block_content = $block_content;
2951
-
2952
-	if ( ! empty( $rules ) && sd_block_check_rules( $rules ) ) {
2953
-		if ( ! empty( $attributes['output']['type'] ) ) {
2954
-			switch ( $attributes['output']['type'] ) {
2955
-				case 'hide':
2956
-					$valid_type = true;
2957
-					$content = '';
2958
-
2959
-					break;
2960
-				case 'message':
2961
-					$valid_type = true;
2962
-
2963
-					if ( isset( $attributes['output']['message'] ) ) {
2964
-						$content = $attributes['output']['message'] != '' ? __( stripslashes( $attributes['output']['message'] ), 'super-duper' ) : $attributes['output']['message'];
2965
-
2966
-						if ( ! empty( $attributes['output']['message_type'] ) ) {
2967
-							$content = aui()->alert( array(
2968
-									'type'=> $attributes['output']['message_type'],
2969
-									'content'=> $content
2970
-								)
2971
-							);
2972
-						}
2973
-					}
2974
-
2975
-					break;
2976
-				case 'page':
2977
-					$valid_type = true;
2978
-
2979
-					$page_id = ! empty( $attributes['output']['page'] ) ? absint( $attributes['output']['page'] ) : 0;
2980
-					$content = sd_get_page_content( $page_id );
2981
-
2982
-					break;
2983
-				case 'template_part':
2984
-					$valid_type = true;
2985
-
2986
-					$template_part = ! empty( $attributes['output']['template_part'] ) ? $attributes['output']['template_part'] : '';
2987
-					$content = sd_get_template_part_content( $template_part );
2988
-
2989
-					break;
2990
-				default:
2991
-					$valid_type = false;
2992
-					break;
2993
-			}
2994
-
2995
-			if ( $valid_type ) {
2996
-				$block_content = '<div class="' . esc_attr( wp_get_block_default_classname( $instance->name ) ) . ' sd-block-has-rule">' . $content . '</div>';
2997
-			}
2998
-		}
2999
-	}
3000
-
3001
-	return apply_filters( 'sd_render_block_visibility_content', $block_content, $_block_content, $attributes, $block, $instance );
2937
+    // No block visibility conditions set.
2938
+    if ( empty( $block['attrs']['visibility_conditions'] ) ) {
2939
+        return $block_content;
2940
+    }
2941
+
2942
+    $attributes = json_decode( $block['attrs']['visibility_conditions'], true );
2943
+    $rules = ! empty( $attributes ) ? sd_block_parse_rules( $attributes ) : array();
2944
+
2945
+    // No rules set.
2946
+    if ( empty( $rules ) ) {
2947
+        return $block_content;
2948
+    }
2949
+
2950
+    $_block_content = $block_content;
2951
+
2952
+    if ( ! empty( $rules ) && sd_block_check_rules( $rules ) ) {
2953
+        if ( ! empty( $attributes['output']['type'] ) ) {
2954
+            switch ( $attributes['output']['type'] ) {
2955
+                case 'hide':
2956
+                    $valid_type = true;
2957
+                    $content = '';
2958
+
2959
+                    break;
2960
+                case 'message':
2961
+                    $valid_type = true;
2962
+
2963
+                    if ( isset( $attributes['output']['message'] ) ) {
2964
+                        $content = $attributes['output']['message'] != '' ? __( stripslashes( $attributes['output']['message'] ), 'super-duper' ) : $attributes['output']['message'];
2965
+
2966
+                        if ( ! empty( $attributes['output']['message_type'] ) ) {
2967
+                            $content = aui()->alert( array(
2968
+                                    'type'=> $attributes['output']['message_type'],
2969
+                                    'content'=> $content
2970
+                                )
2971
+                            );
2972
+                        }
2973
+                    }
2974
+
2975
+                    break;
2976
+                case 'page':
2977
+                    $valid_type = true;
2978
+
2979
+                    $page_id = ! empty( $attributes['output']['page'] ) ? absint( $attributes['output']['page'] ) : 0;
2980
+                    $content = sd_get_page_content( $page_id );
2981
+
2982
+                    break;
2983
+                case 'template_part':
2984
+                    $valid_type = true;
2985
+
2986
+                    $template_part = ! empty( $attributes['output']['template_part'] ) ? $attributes['output']['template_part'] : '';
2987
+                    $content = sd_get_template_part_content( $template_part );
2988
+
2989
+                    break;
2990
+                default:
2991
+                    $valid_type = false;
2992
+                    break;
2993
+            }
2994
+
2995
+            if ( $valid_type ) {
2996
+                $block_content = '<div class="' . esc_attr( wp_get_block_default_classname( $instance->name ) ) . ' sd-block-has-rule">' . $content . '</div>';
2997
+            }
2998
+        }
2999
+    }
3000
+
3001
+    return apply_filters( 'sd_render_block_visibility_content', $block_content, $_block_content, $attributes, $block, $instance );
3002 3002
 }
3003 3003
 add_filter( 'render_block', 'sd_render_block', 9, 3 );
3004 3004
 
3005 3005
 function sd_get_page_content( $page_id ) {
3006
-	$content = $page_id > 0 ? get_post_field( 'post_content', (int) $page_id ) : '';
3006
+    $content = $page_id > 0 ? get_post_field( 'post_content', (int) $page_id ) : '';
3007 3007
 
3008
-	// Maybe bypass content
3009
-	$bypass_content = apply_filters( 'sd_bypass_page_content', '', $content, $page_id );
3010
-	if ( $bypass_content ) {
3011
-		return $bypass_content;
3012
-	}
3008
+    // Maybe bypass content
3009
+    $bypass_content = apply_filters( 'sd_bypass_page_content', '', $content, $page_id );
3010
+    if ( $bypass_content ) {
3011
+        return $bypass_content;
3012
+    }
3013 3013
 
3014
-	// Run the shortcodes on the content.
3015
-	$content = do_shortcode( $content );
3014
+    // Run the shortcodes on the content.
3015
+    $content = do_shortcode( $content );
3016 3016
 
3017
-	// Run block content if its available.
3018
-	if ( function_exists( 'do_blocks' ) ) {
3019
-		$content = do_blocks( $content );
3020
-	}
3017
+    // Run block content if its available.
3018
+    if ( function_exists( 'do_blocks' ) ) {
3019
+        $content = do_blocks( $content );
3020
+    }
3021 3021
 
3022
-	return apply_filters( 'sd_get_page_content', $content, $page_id );
3022
+    return apply_filters( 'sd_get_page_content', $content, $page_id );
3023 3023
 }
3024 3024
 
3025 3025
 function sd_get_template_part_content( $template_part ) {
3026
-	$template_part_post = $template_part ? sd_get_template_part_by_slug( $template_part ) : array();
3027
-	$content = ! empty( $template_part_post ) ? $template_part_post->content : '';
3026
+    $template_part_post = $template_part ? sd_get_template_part_by_slug( $template_part ) : array();
3027
+    $content = ! empty( $template_part_post ) ? $template_part_post->content : '';
3028 3028
 
3029
-	// Maybe bypass content
3030
-	$bypass_content = apply_filters( 'sd_bypass_template_part_content', '', $content, $template_part );
3031
-	if ( $bypass_content ) {
3032
-		return $bypass_content;
3033
-	}
3029
+    // Maybe bypass content
3030
+    $bypass_content = apply_filters( 'sd_bypass_template_part_content', '', $content, $template_part );
3031
+    if ( $bypass_content ) {
3032
+        return $bypass_content;
3033
+    }
3034 3034
 
3035
-	// Run the shortcodes on the content.
3036
-	$content = do_shortcode( $content );
3035
+    // Run the shortcodes on the content.
3036
+    $content = do_shortcode( $content );
3037 3037
 
3038
-	// Run block content if its available.
3039
-	if ( function_exists( 'do_blocks' ) ) {
3040
-		$content = do_blocks( $content );
3041
-	}
3038
+    // Run block content if its available.
3039
+    if ( function_exists( 'do_blocks' ) ) {
3040
+        $content = do_blocks( $content );
3041
+    }
3042 3042
 
3043
-	return apply_filters( 'sd_get_template_part_content', $content, $template_part );
3043
+    return apply_filters( 'sd_get_template_part_content', $content, $template_part );
3044 3044
 }
3045 3045
 
3046 3046
 function sd_block_parse_rules( $attrs ) {
3047
-	$rules = array();
3047
+    $rules = array();
3048 3048
 
3049
-	if ( ! empty( $attrs ) && is_array( $attrs ) ) {
3050
-		$attrs_keys = array_keys( $attrs );
3049
+    if ( ! empty( $attrs ) && is_array( $attrs ) ) {
3050
+        $attrs_keys = array_keys( $attrs );
3051 3051
 
3052
-		for ( $i = 1; $i <= count( $attrs_keys ); $i++ ) {
3053
-			if ( ! empty( $attrs[ 'rule' . $i ] ) && is_array( $attrs[ 'rule' . $i ] ) ) {
3054
-				$rules[] = $attrs[ 'rule' . $i ];
3055
-			}
3056
-		}
3057
-	}
3052
+        for ( $i = 1; $i <= count( $attrs_keys ); $i++ ) {
3053
+            if ( ! empty( $attrs[ 'rule' . $i ] ) && is_array( $attrs[ 'rule' . $i ] ) ) {
3054
+                $rules[] = $attrs[ 'rule' . $i ];
3055
+            }
3056
+        }
3057
+    }
3058 3058
 
3059
-	return apply_filters( 'sd_block_parse_rules', $rules, $attrs );
3059
+    return apply_filters( 'sd_block_parse_rules', $rules, $attrs );
3060 3060
 }
3061 3061
 
3062 3062
 function sd_block_check_rules( $rules ) {
3063
-	if ( ! ( is_array( $rules ) && ! empty( $rules ) ) ) {
3064
-		return true;
3065
-	}
3063
+    if ( ! ( is_array( $rules ) && ! empty( $rules ) ) ) {
3064
+        return true;
3065
+    }
3066 3066
 
3067
-	foreach ( $rules as $key => $rule ) {
3068
-		$match = apply_filters( 'sd_block_check_rule', true, $rule );
3067
+    foreach ( $rules as $key => $rule ) {
3068
+        $match = apply_filters( 'sd_block_check_rule', true, $rule );
3069 3069
 
3070
-		if ( ! $match ) {
3071
-			break;
3072
-		}
3073
-	}
3070
+        if ( ! $match ) {
3071
+            break;
3072
+        }
3073
+    }
3074 3074
 
3075
-	return apply_filters( 'sd_block_check_rules', $match, $rules );
3075
+    return apply_filters( 'sd_block_check_rules', $match, $rules );
3076 3076
 }
3077 3077
 
3078 3078
 function sd_block_check_rule( $match, $rule ) {
3079
-	if ( $match && ! empty( $rule['type'] ) ) {
3080
-		switch ( $rule['type'] ) {
3081
-			case 'logged_in':
3082
-				$match = (bool) is_user_logged_in();
3079
+    if ( $match && ! empty( $rule['type'] ) ) {
3080
+        switch ( $rule['type'] ) {
3081
+            case 'logged_in':
3082
+                $match = (bool) is_user_logged_in();
3083 3083
 
3084
-				break;
3085
-			case 'logged_out':
3086
-				$match = ! is_user_logged_in();
3084
+                break;
3085
+            case 'logged_out':
3086
+                $match = ! is_user_logged_in();
3087 3087
 
3088
-				break;
3089
-			case 'user_roles':
3090
-				$match = false;
3088
+                break;
3089
+            case 'user_roles':
3090
+                $match = false;
3091 3091
 
3092
-				if ( ! empty( $rule['user_roles'] ) ) {
3093
-					$user_roles = is_scalar( $rule['user_roles'] ) ? explode( ",", $rule['user_roles'] ) : $rule['user_roles'];
3092
+                if ( ! empty( $rule['user_roles'] ) ) {
3093
+                    $user_roles = is_scalar( $rule['user_roles'] ) ? explode( ",", $rule['user_roles'] ) : $rule['user_roles'];
3094 3094
 
3095
-					if ( is_array( $user_roles ) ) {
3096
-						$user_roles = array_filter( array_map( 'trim', $user_roles ) );
3097
-					}
3095
+                    if ( is_array( $user_roles ) ) {
3096
+                        $user_roles = array_filter( array_map( 'trim', $user_roles ) );
3097
+                    }
3098 3098
 
3099
-					if ( ! empty( $user_roles ) && is_array( $user_roles ) && is_user_logged_in() && ( $current_user = wp_get_current_user() ) ) {
3100
-						$current_user_roles = $current_user->roles;
3099
+                    if ( ! empty( $user_roles ) && is_array( $user_roles ) && is_user_logged_in() && ( $current_user = wp_get_current_user() ) ) {
3100
+                        $current_user_roles = $current_user->roles;
3101 3101
 
3102
-						foreach ( $user_roles as $role ) {
3103
-							if ( in_array( $role, $current_user_roles ) ) {
3104
-								$match = true;
3105
-							}
3106
-						}
3107
-					}
3108
-				}
3102
+                        foreach ( $user_roles as $role ) {
3103
+                            if ( in_array( $role, $current_user_roles ) ) {
3104
+                                $match = true;
3105
+                            }
3106
+                        }
3107
+                    }
3108
+                }
3109 3109
 
3110
-				break;
3111
-			case 'gd_field':
3112
-				$match = sd_block_check_rule_gd_field( $rule );
3110
+                break;
3111
+            case 'gd_field':
3112
+                $match = sd_block_check_rule_gd_field( $rule );
3113 3113
 
3114
-				break;
3115
-		}
3116
-	}
3114
+                break;
3115
+        }
3116
+    }
3117 3117
 
3118
-	return $match;
3118
+    return $match;
3119 3119
 }
3120 3120
 add_filter( 'sd_block_check_rule', 'sd_block_check_rule', 10, 2 );
3121 3121
 
3122 3122
 function sd_block_check_rule_gd_field( $rule ) {
3123
-	global $gd_post;
3124
-
3125
-	$match_found = false;
3126
-
3127
-	if ( class_exists( 'GeoDirectory' ) && ! empty( $gd_post->ID ) && ! empty( $rule['field'] ) && ! empty( $rule['condition'] ) ) {
3128
-		$args['block_visibility'] = true;
3129
-		$args['key'] = $rule['field'];
3130
-		$args['condition'] = $rule['condition'];
3131
-		$args['search'] = isset( $rule['search'] ) ? $rule['search'] : '';
3132
-
3133
-		if ( $args['key'] == 'street' ) {
3134
-			$args['key'] = 'address';
3135
-		}
3136
-
3137
-		$match_field = $_match_field = $args['key'];
3138
-
3139
-		if ( $match_field == 'address' ) {
3140
-			$match_field = 'street';
3141
-		} elseif ( $match_field == 'post_images' ) {
3142
-			$match_field = 'featured_image';
3143
-		}
3144
-
3145
-		$find_post = $gd_post;
3146
-		$find_post_keys = ! empty( $find_post ) ? array_keys( (array) $find_post ) : array();
3147
-
3148
-		if ( ! empty( $find_post->ID ) && ! in_array( 'post_category', $find_post_keys ) ) {
3149
-			$find_post = geodir_get_post_info( (int) $find_post->ID );
3150
-			$find_post_keys = ! empty( $find_post ) ? array_keys( (array) $find_post ) : array();
3151
-		}
3152
-
3153
-		if ( $match_field === '' || ( ! empty( $find_post_keys ) && ( in_array( $match_field, $find_post_keys ) || in_array( $_match_field, $find_post_keys ) ) ) ) {
3154
-			$address_fields = array( 'street2', 'neighbourhood', 'city', 'region', 'country', 'zip', 'latitude', 'longitude' ); // Address fields
3155
-			$field = array();
3156
-
3157
-			if ( $match_field && ! in_array( $match_field, array( 'post_date', 'post_modified', 'default_category', 'post_id', 'post_status' ) ) && ! in_array( $match_field, $address_fields ) ) {
3158
-				$package_id = geodir_get_post_package_id( $find_post->ID, $find_post->post_type );
3159
-				$fields = geodir_post_custom_fields( $package_id, 'all', $find_post->post_type, 'none' );
3160
-
3161
-				foreach ( $fields as $field_info ) {
3162
-					if ( $match_field == $field_info['htmlvar_name'] ) {
3163
-						$field = $field_info;
3164
-						break;
3165
-					} elseif( $_match_field == $field_info['htmlvar_name'] ) {
3166
-						$field = $field_info;
3167
-						break;
3168
-					}
3169
-				}
3170
-
3171
-				if ( empty( $field ) ) {
3172
-					return false;
3173
-				}
3174
-			}
3175
-
3176
-			$search = $args['search'];
3177
-
3178
-			// Address fields.
3179
-			if ( in_array( $match_field, $address_fields ) && ( $address_fields = geodir_post_meta_address_fields( '' ) ) ) {
3180
-				if ( ! empty( $address_fields[ $match_field ] ) ) {
3181
-					$field = $address_fields[ $match_field ];
3182
-				}
3183
-			}
3184
-
3185
-			$is_date = ( ! empty( $field['type'] ) && $field['type'] == 'datepicker' ) || in_array( $match_field, array( 'post_date', 'post_modified' ) ) ? true : false;
3186
-			$is_date = apply_filters( 'geodir_post_badge_is_date', $is_date, $match_field, $field, $args, $find_post );
3187
-
3188
-			$match_value = isset($find_post->{$match_field}) ? esc_attr( trim( $find_post->{$match_field} ) ) : '';
3189
-			$match_found = $match_field === '' ? true : false;
3190
-
3191
-			if ( ! $match_found ) {
3192
-				if ( ( $match_field == 'post_date' || $match_field == 'post_modified' ) && ( empty( $args['condition'] ) || $args['condition'] == 'is_greater_than' || $args['condition'] == 'is_less_than' ) ) {
3193
-					if ( strpos( $search, '+' ) === false && strpos( $search, '-' ) === false ) {
3194
-						$search = '+' . $search;
3195
-					}
3196
-					$the_time = $match_field == 'post_modified' ? get_the_modified_date( 'Y-m-d', $find_post ) : get_the_time( 'Y-m-d', $find_post );
3197
-					$until_time = strtotime( $the_time . ' ' . $search . ' days' );
3198
-					$now_time   = strtotime( date_i18n( 'Y-m-d', current_time( 'timestamp' ) ) );
3199
-					if ( ( empty( $args['condition'] ) || $args['condition'] == 'is_less_than' ) && $until_time > $now_time ) {
3200
-						$match_found = true;
3201
-					} elseif ( $args['condition'] == 'is_greater_than' && $until_time < $now_time ) {
3202
-						$match_found = true;
3203
-					}
3204
-				} else {
3205
-					switch ( $args['condition'] ) {
3206
-						case 'is_equal':
3207
-							$match_found = (bool) ( $search != '' && $match_value == $search );
3208
-							break;
3209
-						case 'is_not_equal':
3210
-							$match_found = (bool) ( $search != '' && $match_value != $search );
3211
-							break;
3212
-						case 'is_greater_than':
3213
-							$match_found = (bool) ( $search != '' && ( is_float( $search ) || is_numeric( $search ) ) && ( is_float( $match_value ) || is_numeric( $match_value ) ) && $match_value > $search );
3214
-							break;
3215
-						case 'is_less_than':
3216
-							$match_found = (bool) ( $search != '' && ( is_float( $search ) || is_numeric( $search ) ) && ( is_float( $match_value ) || is_numeric( $match_value ) ) && $match_value < $search );
3217
-							break;
3218
-						case 'is_empty':
3219
-							$match_found = (bool) ( $match_value === '' || $match_value === false || $match_value === '0' || is_null( $match_value ) );
3220
-							break;
3221
-						case 'is_not_empty':
3222
-							$match_found = (bool) ( $match_value !== '' && $match_value !== false && $match_value !== '0' && ! is_null( $match_value ) );
3223
-							break;
3224
-						case 'is_contains':
3225
-							$match_found = (bool) ( $search != '' && stripos( $match_value, $search ) !== false );
3226
-							break;
3227
-						case 'is_not_contains':
3228
-							$match_found = (bool) ( $search != '' && stripos( $match_value, $search ) === false );
3229
-							break;
3230
-					}
3231
-				}
3232
-			}
3233
-
3234
-			$match_found = apply_filters( 'geodir_post_badge_check_match_found', $match_found, $args, $find_post );
3235
-		}
3236
-	}
3237
-
3238
-	return $match_found;
3123
+    global $gd_post;
3124
+
3125
+    $match_found = false;
3126
+
3127
+    if ( class_exists( 'GeoDirectory' ) && ! empty( $gd_post->ID ) && ! empty( $rule['field'] ) && ! empty( $rule['condition'] ) ) {
3128
+        $args['block_visibility'] = true;
3129
+        $args['key'] = $rule['field'];
3130
+        $args['condition'] = $rule['condition'];
3131
+        $args['search'] = isset( $rule['search'] ) ? $rule['search'] : '';
3132
+
3133
+        if ( $args['key'] == 'street' ) {
3134
+            $args['key'] = 'address';
3135
+        }
3136
+
3137
+        $match_field = $_match_field = $args['key'];
3138
+
3139
+        if ( $match_field == 'address' ) {
3140
+            $match_field = 'street';
3141
+        } elseif ( $match_field == 'post_images' ) {
3142
+            $match_field = 'featured_image';
3143
+        }
3144
+
3145
+        $find_post = $gd_post;
3146
+        $find_post_keys = ! empty( $find_post ) ? array_keys( (array) $find_post ) : array();
3147
+
3148
+        if ( ! empty( $find_post->ID ) && ! in_array( 'post_category', $find_post_keys ) ) {
3149
+            $find_post = geodir_get_post_info( (int) $find_post->ID );
3150
+            $find_post_keys = ! empty( $find_post ) ? array_keys( (array) $find_post ) : array();
3151
+        }
3152
+
3153
+        if ( $match_field === '' || ( ! empty( $find_post_keys ) && ( in_array( $match_field, $find_post_keys ) || in_array( $_match_field, $find_post_keys ) ) ) ) {
3154
+            $address_fields = array( 'street2', 'neighbourhood', 'city', 'region', 'country', 'zip', 'latitude', 'longitude' ); // Address fields
3155
+            $field = array();
3156
+
3157
+            if ( $match_field && ! in_array( $match_field, array( 'post_date', 'post_modified', 'default_category', 'post_id', 'post_status' ) ) && ! in_array( $match_field, $address_fields ) ) {
3158
+                $package_id = geodir_get_post_package_id( $find_post->ID, $find_post->post_type );
3159
+                $fields = geodir_post_custom_fields( $package_id, 'all', $find_post->post_type, 'none' );
3160
+
3161
+                foreach ( $fields as $field_info ) {
3162
+                    if ( $match_field == $field_info['htmlvar_name'] ) {
3163
+                        $field = $field_info;
3164
+                        break;
3165
+                    } elseif( $_match_field == $field_info['htmlvar_name'] ) {
3166
+                        $field = $field_info;
3167
+                        break;
3168
+                    }
3169
+                }
3170
+
3171
+                if ( empty( $field ) ) {
3172
+                    return false;
3173
+                }
3174
+            }
3175
+
3176
+            $search = $args['search'];
3177
+
3178
+            // Address fields.
3179
+            if ( in_array( $match_field, $address_fields ) && ( $address_fields = geodir_post_meta_address_fields( '' ) ) ) {
3180
+                if ( ! empty( $address_fields[ $match_field ] ) ) {
3181
+                    $field = $address_fields[ $match_field ];
3182
+                }
3183
+            }
3184
+
3185
+            $is_date = ( ! empty( $field['type'] ) && $field['type'] == 'datepicker' ) || in_array( $match_field, array( 'post_date', 'post_modified' ) ) ? true : false;
3186
+            $is_date = apply_filters( 'geodir_post_badge_is_date', $is_date, $match_field, $field, $args, $find_post );
3187
+
3188
+            $match_value = isset($find_post->{$match_field}) ? esc_attr( trim( $find_post->{$match_field} ) ) : '';
3189
+            $match_found = $match_field === '' ? true : false;
3190
+
3191
+            if ( ! $match_found ) {
3192
+                if ( ( $match_field == 'post_date' || $match_field == 'post_modified' ) && ( empty( $args['condition'] ) || $args['condition'] == 'is_greater_than' || $args['condition'] == 'is_less_than' ) ) {
3193
+                    if ( strpos( $search, '+' ) === false && strpos( $search, '-' ) === false ) {
3194
+                        $search = '+' . $search;
3195
+                    }
3196
+                    $the_time = $match_field == 'post_modified' ? get_the_modified_date( 'Y-m-d', $find_post ) : get_the_time( 'Y-m-d', $find_post );
3197
+                    $until_time = strtotime( $the_time . ' ' . $search . ' days' );
3198
+                    $now_time   = strtotime( date_i18n( 'Y-m-d', current_time( 'timestamp' ) ) );
3199
+                    if ( ( empty( $args['condition'] ) || $args['condition'] == 'is_less_than' ) && $until_time > $now_time ) {
3200
+                        $match_found = true;
3201
+                    } elseif ( $args['condition'] == 'is_greater_than' && $until_time < $now_time ) {
3202
+                        $match_found = true;
3203
+                    }
3204
+                } else {
3205
+                    switch ( $args['condition'] ) {
3206
+                        case 'is_equal':
3207
+                            $match_found = (bool) ( $search != '' && $match_value == $search );
3208
+                            break;
3209
+                        case 'is_not_equal':
3210
+                            $match_found = (bool) ( $search != '' && $match_value != $search );
3211
+                            break;
3212
+                        case 'is_greater_than':
3213
+                            $match_found = (bool) ( $search != '' && ( is_float( $search ) || is_numeric( $search ) ) && ( is_float( $match_value ) || is_numeric( $match_value ) ) && $match_value > $search );
3214
+                            break;
3215
+                        case 'is_less_than':
3216
+                            $match_found = (bool) ( $search != '' && ( is_float( $search ) || is_numeric( $search ) ) && ( is_float( $match_value ) || is_numeric( $match_value ) ) && $match_value < $search );
3217
+                            break;
3218
+                        case 'is_empty':
3219
+                            $match_found = (bool) ( $match_value === '' || $match_value === false || $match_value === '0' || is_null( $match_value ) );
3220
+                            break;
3221
+                        case 'is_not_empty':
3222
+                            $match_found = (bool) ( $match_value !== '' && $match_value !== false && $match_value !== '0' && ! is_null( $match_value ) );
3223
+                            break;
3224
+                        case 'is_contains':
3225
+                            $match_found = (bool) ( $search != '' && stripos( $match_value, $search ) !== false );
3226
+                            break;
3227
+                        case 'is_not_contains':
3228
+                            $match_found = (bool) ( $search != '' && stripos( $match_value, $search ) === false );
3229
+                            break;
3230
+                    }
3231
+                }
3232
+            }
3233
+
3234
+            $match_found = apply_filters( 'geodir_post_badge_check_match_found', $match_found, $args, $find_post );
3235
+        }
3236
+    }
3237
+
3238
+    return $match_found;
3239 3239
 }
Please login to merge, or discard this patch.