Passed
Push — master ( 7ebec5...2857a5 )
by Brian
12:31
created
includes/class-getpaid-invoice-notification-emails.php 1 patch
Indentation   +466 added lines, -466 removed lines patch added patch discarded remove patch
@@ -12,491 +12,491 @@
 block discarded – undo
12 12
  */
13 13
 class GetPaid_Invoice_Notification_Emails {
14 14
 
15
-	/**
16
-	 * The array of invoice email actions.
17
-	 *
18
-	 * @param array
19
-	 */
20
-	public $invoice_actions;
21
-
22
-	/**
23
-	 * Class constructor
24
-	 *
25
-	 */
26
-	public function __construct() {
27
-
28
-		$this->invoice_actions = apply_filters(
29
-			'getpaid_notification_email_invoice_triggers',
30
-			array(
31
-				'getpaid_new_invoice'                   => array( 'new_invoice', 'user_invoice' ),
32
-				'getpaid_invoice_status_wpi-cancelled'  => 'cancelled_invoice',
33
-				'getpaid_invoice_status_wpi-failed'     => 'failed_invoice',
34
-				'getpaid_invoice_status_wpi-onhold'     => 'onhold_invoice',
35
-				'getpaid_invoice_status_wpi-processing' => 'processing_invoice',
36
-				'getpaid_invoice_status_publish'        => 'completed_invoice',
37
-				'getpaid_invoice_status_wpi-renewal'    => 'completed_invoice',
38
-				'getpaid_invoice_status_wpi-refunded'   => 'refunded_invoice',
39
-				'getpaid_new_customer_note'             => 'user_note',
40
-				'getpaid_daily_maintenance'             => 'overdue',
41
-			)
42
-		);
43
-
44
-		$this->init_hooks();
45
-
46
-	}
47
-
48
-	/**
49
-	 * Registers email hooks.
50
-	 */
51
-	public function init_hooks() {
52
-
53
-		add_filter( 'getpaid_get_email_merge_tags', array( $this, 'invoice_merge_tags' ), 10, 2 );
54
-		add_filter( 'getpaid_invoice_email_recipients', array( $this, 'filter_email_recipients' ), 10, 2 );
55
-
56
-		foreach ( $this->invoice_actions as $hook => $email_type ) {
57
-			$this->init_email_type_hook( $hook, $email_type );
58
-		}
59
-	}
60
-
61
-	/**
62
-	 * Registers an email hook for an invoice action.
63
-	 *
64
-	 * @param string $hook
65
-	 * @param string|array $email_type
66
-	 */
67
-	public function init_email_type_hook( $hook, $email_type ) {
68
-
69
-		$email_type = wpinv_parse_list( $email_type );
70
-
71
-		foreach ( $email_type as $type ) {
72
-
73
-			$email = new GetPaid_Notification_Email( $type );
74
-
75
-			// Abort if it is not active.
76
-			if ( ! $email->is_active() ) {
77
-				continue;
78
-			}
79
-
80
-			if ( method_exists( $this, $type ) ) {
81
-				add_action( $hook, array( $this, $type ), 100, 2 );
82
-				continue;
83
-			}
84
-
85
-			do_action( 'getpaid_invoice_init_email_type_hook', $type, $hook );
86
-		}
87
-
88
-	}
89
-
90
-	/**
91
-	 * Filters invoice merge tags.
92
-	 *
93
-	 * @param array $merge_tags
94
-	 * @param mixed|WPInv_Invoice|WPInv_Subscription $object
95
-	 */
96
-	public function invoice_merge_tags( $merge_tags, $object ) {
97
-
98
-		if ( is_a( $object, 'WPInv_Invoice' ) ) {
99
-			return array_merge(
100
-				$merge_tags,
101
-				$this->get_invoice_merge_tags( $object )
102
-			);
103
-		}
104
-
105
-		if ( is_a( $object, 'WPInv_Subscription' ) ) {
106
-			return array_merge(
107
-				$merge_tags,
108
-				$this->get_invoice_merge_tags( $object->get_parent_payment() )
109
-			);
110
-		}
111
-
112
-		return $merge_tags;
113
-
114
-	}
115
-
116
-	/**
117
-	 * Generates invoice merge tags.
118
-	 *
119
-	 * @param WPInv_Invoice $invoice
120
-	 * @return array
121
-	 */
122
-	public function get_invoice_merge_tags( $invoice ) {
123
-
124
-		// Abort if it does not exist.
125
-		if ( ! $invoice->get_id() ) {
126
-			return array();
127
-		}
128
-
129
-		$merge_tags = array(
130
-			'{name}'                 => sanitize_text_field( $invoice->get_user_full_name() ),
131
-			'{full_name}'            => sanitize_text_field( $invoice->get_user_full_name() ),
132
-			'{first_name}'           => sanitize_text_field( $invoice->get_first_name() ),
133
-			'{last_name}'            => sanitize_text_field( $invoice->get_last_name() ),
134
-			'{email}'                => sanitize_email( $invoice->get_email() ),
135
-			'{invoice_number}'       => sanitize_text_field( $invoice->get_number() ),
136
-			'{invoice_currency}'     => sanitize_text_field( $invoice->get_currency() ),
137
-			'{invoice_total}'        => sanitize_text_field( wpinv_price( $invoice->get_total(), $invoice->get_currency() ) ),
138
-			'{invoice_link}'         => esc_url( $invoice->get_view_url() ),
139
-			'{invoice_pay_link}'     => esc_url( $invoice->get_checkout_payment_url() ),
140
-			'{invoice_receipt_link}' => esc_url( $invoice->get_receipt_url() ),
141
-			'{invoice_date}'         => getpaid_format_date_value( $invoice->get_date_created() ),
142
-			'{invoice_due_date}'     => getpaid_format_date_value( $invoice->get_due_date(), __( 'on receipt', 'invoicing' ) ),
143
-			'{invoice_quote}'        => sanitize_text_field( strtolower( $invoice->get_label() ) ),
144
-			'{invoice_label}'        => sanitize_text_field( ucfirst( $invoice->get_label() ) ),
145
-			'{invoice_description}'  => wp_kses_post( $invoice->get_description() ),
146
-			'{subscription_name}'    => wp_kses_post( $invoice->get_subscription_name() ),
147
-			'{is_was}'               => strtotime( $invoice->get_due_date() ) < current_time( 'timestamp' ) ? __( 'was', 'invoicing' ) : __( 'is', 'invoicing' ),
148
-		);
149
-
150
-		$payment_form_data = $invoice->get_meta( 'payment_form_data', true );
151
-
152
-		if ( is_array( $payment_form_data ) ) {
153
-
154
-			foreach ( $payment_form_data as $label => $value ) {
155
-
156
-				$label = preg_replace( '/[^a-z0-9]+/', '_', strtolower( $label ) );
157
-				$value = is_array( $value ) ? implode( ', ', $value ) : $value;
158
-
159
-				if ( is_scalar( $value ) ) {
160
-					$merge_tags[ "{{$label}}" ] = wp_kses_post( $value );
161
-				}
162
-			}
163
-		}
164
-
165
-		return apply_filters( 'getpaid_invoice_email_merge_tags', $merge_tags, $invoice );
166
-	}
167
-
168
-	/**
169
-	 * Helper function to send an email.
170
-	 *
171
-	 * @param WPInv_Invoice $invoice
172
-	 * @param GetPaid_Notification_Email $email
173
-	 * @param string $type
174
-	 * @param string|array $recipients
175
-	 * @param array $extra_args Extra template args.
176
-	 */
177
-	public function send_email( $invoice, $email, $type, $recipients, $extra_args = array() ) {
178
-
179
-		do_action( 'getpaid_before_send_invoice_notification', $type, $invoice, $email );
180
-
181
-		$skip = $invoice->is_free() && wpinv_get_option( 'skip_email_free_invoice' );
182
-		if ( apply_filters( 'getpaid_skip_invoice_email', $skip, $type, $invoice ) ) {
183
-			return;
184
-		}
185
-
186
-		$mailer     = new GetPaid_Notification_Email_Sender();
187
-		$merge_tags = $email->get_merge_tags();
188
-
189
-		$result = $mailer->send(
190
-			apply_filters( 'getpaid_invoice_email_recipients', wpinv_parse_list( $recipients ), $email ),
191
-			$email->add_merge_tags( $email->get_subject(), $merge_tags ),
192
-			$email->get_content( $merge_tags, $extra_args ),
193
-			$email->get_attachments()
194
-		);
195
-
196
-		// Maybe send a copy to the admin.
197
-		if ( $email->include_admin_bcc() ) {
198
-			$mailer->send(
199
-				wpinv_get_admin_email(),
200
-				$email->add_merge_tags( $email->get_subject() . __( ' - ADMIN BCC COPY', 'invoicing' ), $merge_tags ),
201
-				$email->get_content( $merge_tags ),
202
-				$email->get_attachments()
203
-			);
204
-		}
205
-
206
-		if ( $result ) {
207
-			$invoice->add_system_note(
208
-				sprintf(
209
-					// translators: %1 is the email type, %2 is the invoice recipient.
210
-					__( 'Successfully sent %1$s notification email to %2$s.', 'invoicing' ),
211
-					sanitize_key( $type ),
212
-					$email->is_admin_email() ? __( 'admin', 'invoicing' ) : __( 'the customer', 'invoicing' )
213
-				)
214
-			);
215
-		} else {
216
-			$invoice->add_system_note(
217
-				sprintf(
218
-					// translators: %1 is the email type, %2 is the invoice recipient.
219
-					__( 'Failed sending %1$s notification email to %2$s.', 'invoicing' ),
220
-					sanitize_key( $type ),
221
-					$email->is_admin_email() ? __( 'admin', 'invoicing' ) : __( 'the customer', 'invoicing' )
222
-				)
223
-			);
224
-		}
225
-
226
-		do_action( 'getpaid_after_send_invoice_notification', $type, $invoice, $email );
227
-
228
-		return $result;
229
-	}
230
-
231
-	/**
232
-	 * Also send emails to any cc users.
233
-	 *
234
-	 * @param array $recipients
235
-	 * @param GetPaid_Notification_Email $email
236
-	 */
237
-	public function filter_email_recipients( $recipients, $email ) {
238
-
239
-		if ( ! $email->is_admin_email() ) {
240
-			$cc   = $email->object->get_email_cc();
241
-			$cc_2 = get_user_meta( $email->object->get_user_id(), '_wpinv_email_cc', true );
242
-
243
-			if ( ! empty( $cc ) ) {
244
-				$cc = array_map( 'sanitize_email', wpinv_parse_list( $cc ) );
245
-				$recipients = array_filter( array_unique( array_merge( $recipients, $cc ) ) );
246
-			}
247
-
248
-			if ( ! empty( $cc_2 ) ) {
249
-				$cc_2 = array_map( 'sanitize_email', wpinv_parse_list( $cc_2 ) );
250
-				$recipients = array_filter( array_unique( array_merge( $recipients, $cc_2 ) ) );
251
-			}
252
-		}
253
-
254
-		return $recipients;
255
-
256
-	}
257
-
258
-	/**
259
-	 * Sends a new invoice notification.
260
-	 *
261
-	 * @param WPInv_Invoice $invoice
262
-	 */
263
-	public function new_invoice( $invoice ) {
264
-
265
-		// Only send this email for invoices created via the admin page.
266
-		if ( ! $invoice->is_type( 'invoice' ) || $invoice->is_paid() || $this->is_payment_form_invoice( $invoice->get_id() ) ) {
267
-			return;
268
-		}
269
-
270
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
271
-		$recipient = wpinv_get_admin_email();
272
-
273
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
274
-
275
-	}
276
-
277
-	/**
278
-	 * Sends a cancelled invoice notification.
279
-	 *
280
-	 * @param WPInv_Invoice $invoice
281
-	 */
282
-	public function cancelled_invoice( $invoice ) {
283
-
284
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
285
-		$recipient = $invoice->get_email();
286
-
287
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
288
-	}
289
-
290
-	/**
291
-	 * Sends a failed invoice notification.
292
-	 *
293
-	 * @param WPInv_Invoice $invoice
294
-	 */
295
-	public function failed_invoice( $invoice ) {
296
-
297
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
298
-		$recipient = wpinv_get_admin_email();
299
-
300
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
301
-
302
-	}
303
-
304
-	/**
305
-	 * Sends a notification whenever an invoice is put on hold.
306
-	 *
307
-	 * @param WPInv_Invoice $invoice
308
-	 */
309
-	public function onhold_invoice( $invoice ) {
310
-
311
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
312
-		$recipient = $invoice->get_email();
313
-
314
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
315
-
316
-	}
317
-
318
-	/**
319
-	 * Sends a notification whenever an invoice is marked as processing payment.
320
-	 *
321
-	 * @param WPInv_Invoice $invoice
322
-	 */
323
-	public function processing_invoice( $invoice ) {
324
-
325
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
326
-		$recipient = $invoice->get_email();
327
-
328
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
329
-
330
-	}
331
-
332
-	/**
333
-	 * Sends a notification whenever an invoice is paid.
334
-	 *
335
-	 * @param WPInv_Invoice $invoice
336
-	 */
337
-	public function completed_invoice( $invoice ) {
338
-
339
-		// (Maybe) abort if it is a renewal invoice.
340
-		if ( $invoice->is_renewal() && ! wpinv_get_option( 'email_completed_invoice_renewal_active', false ) ) {
341
-			return;
342
-		}
343
-
344
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
345
-		$recipient = $invoice->get_email();
346
-
347
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
348
-
349
-	}
15
+    /**
16
+     * The array of invoice email actions.
17
+     *
18
+     * @param array
19
+     */
20
+    public $invoice_actions;
21
+
22
+    /**
23
+     * Class constructor
24
+     *
25
+     */
26
+    public function __construct() {
27
+
28
+        $this->invoice_actions = apply_filters(
29
+            'getpaid_notification_email_invoice_triggers',
30
+            array(
31
+                'getpaid_new_invoice'                   => array( 'new_invoice', 'user_invoice' ),
32
+                'getpaid_invoice_status_wpi-cancelled'  => 'cancelled_invoice',
33
+                'getpaid_invoice_status_wpi-failed'     => 'failed_invoice',
34
+                'getpaid_invoice_status_wpi-onhold'     => 'onhold_invoice',
35
+                'getpaid_invoice_status_wpi-processing' => 'processing_invoice',
36
+                'getpaid_invoice_status_publish'        => 'completed_invoice',
37
+                'getpaid_invoice_status_wpi-renewal'    => 'completed_invoice',
38
+                'getpaid_invoice_status_wpi-refunded'   => 'refunded_invoice',
39
+                'getpaid_new_customer_note'             => 'user_note',
40
+                'getpaid_daily_maintenance'             => 'overdue',
41
+            )
42
+        );
43
+
44
+        $this->init_hooks();
45
+
46
+    }
47
+
48
+    /**
49
+     * Registers email hooks.
50
+     */
51
+    public function init_hooks() {
52
+
53
+        add_filter( 'getpaid_get_email_merge_tags', array( $this, 'invoice_merge_tags' ), 10, 2 );
54
+        add_filter( 'getpaid_invoice_email_recipients', array( $this, 'filter_email_recipients' ), 10, 2 );
55
+
56
+        foreach ( $this->invoice_actions as $hook => $email_type ) {
57
+            $this->init_email_type_hook( $hook, $email_type );
58
+        }
59
+    }
60
+
61
+    /**
62
+     * Registers an email hook for an invoice action.
63
+     *
64
+     * @param string $hook
65
+     * @param string|array $email_type
66
+     */
67
+    public function init_email_type_hook( $hook, $email_type ) {
68
+
69
+        $email_type = wpinv_parse_list( $email_type );
70
+
71
+        foreach ( $email_type as $type ) {
72
+
73
+            $email = new GetPaid_Notification_Email( $type );
74
+
75
+            // Abort if it is not active.
76
+            if ( ! $email->is_active() ) {
77
+                continue;
78
+            }
79
+
80
+            if ( method_exists( $this, $type ) ) {
81
+                add_action( $hook, array( $this, $type ), 100, 2 );
82
+                continue;
83
+            }
84
+
85
+            do_action( 'getpaid_invoice_init_email_type_hook', $type, $hook );
86
+        }
87
+
88
+    }
89
+
90
+    /**
91
+     * Filters invoice merge tags.
92
+     *
93
+     * @param array $merge_tags
94
+     * @param mixed|WPInv_Invoice|WPInv_Subscription $object
95
+     */
96
+    public function invoice_merge_tags( $merge_tags, $object ) {
97
+
98
+        if ( is_a( $object, 'WPInv_Invoice' ) ) {
99
+            return array_merge(
100
+                $merge_tags,
101
+                $this->get_invoice_merge_tags( $object )
102
+            );
103
+        }
104
+
105
+        if ( is_a( $object, 'WPInv_Subscription' ) ) {
106
+            return array_merge(
107
+                $merge_tags,
108
+                $this->get_invoice_merge_tags( $object->get_parent_payment() )
109
+            );
110
+        }
111
+
112
+        return $merge_tags;
113
+
114
+    }
115
+
116
+    /**
117
+     * Generates invoice merge tags.
118
+     *
119
+     * @param WPInv_Invoice $invoice
120
+     * @return array
121
+     */
122
+    public function get_invoice_merge_tags( $invoice ) {
123
+
124
+        // Abort if it does not exist.
125
+        if ( ! $invoice->get_id() ) {
126
+            return array();
127
+        }
128
+
129
+        $merge_tags = array(
130
+            '{name}'                 => sanitize_text_field( $invoice->get_user_full_name() ),
131
+            '{full_name}'            => sanitize_text_field( $invoice->get_user_full_name() ),
132
+            '{first_name}'           => sanitize_text_field( $invoice->get_first_name() ),
133
+            '{last_name}'            => sanitize_text_field( $invoice->get_last_name() ),
134
+            '{email}'                => sanitize_email( $invoice->get_email() ),
135
+            '{invoice_number}'       => sanitize_text_field( $invoice->get_number() ),
136
+            '{invoice_currency}'     => sanitize_text_field( $invoice->get_currency() ),
137
+            '{invoice_total}'        => sanitize_text_field( wpinv_price( $invoice->get_total(), $invoice->get_currency() ) ),
138
+            '{invoice_link}'         => esc_url( $invoice->get_view_url() ),
139
+            '{invoice_pay_link}'     => esc_url( $invoice->get_checkout_payment_url() ),
140
+            '{invoice_receipt_link}' => esc_url( $invoice->get_receipt_url() ),
141
+            '{invoice_date}'         => getpaid_format_date_value( $invoice->get_date_created() ),
142
+            '{invoice_due_date}'     => getpaid_format_date_value( $invoice->get_due_date(), __( 'on receipt', 'invoicing' ) ),
143
+            '{invoice_quote}'        => sanitize_text_field( strtolower( $invoice->get_label() ) ),
144
+            '{invoice_label}'        => sanitize_text_field( ucfirst( $invoice->get_label() ) ),
145
+            '{invoice_description}'  => wp_kses_post( $invoice->get_description() ),
146
+            '{subscription_name}'    => wp_kses_post( $invoice->get_subscription_name() ),
147
+            '{is_was}'               => strtotime( $invoice->get_due_date() ) < current_time( 'timestamp' ) ? __( 'was', 'invoicing' ) : __( 'is', 'invoicing' ),
148
+        );
149
+
150
+        $payment_form_data = $invoice->get_meta( 'payment_form_data', true );
151
+
152
+        if ( is_array( $payment_form_data ) ) {
153
+
154
+            foreach ( $payment_form_data as $label => $value ) {
155
+
156
+                $label = preg_replace( '/[^a-z0-9]+/', '_', strtolower( $label ) );
157
+                $value = is_array( $value ) ? implode( ', ', $value ) : $value;
158
+
159
+                if ( is_scalar( $value ) ) {
160
+                    $merge_tags[ "{{$label}}" ] = wp_kses_post( $value );
161
+                }
162
+            }
163
+        }
164
+
165
+        return apply_filters( 'getpaid_invoice_email_merge_tags', $merge_tags, $invoice );
166
+    }
350 167
 
351
-	/**
352
-	 * Sends a notification whenever an invoice is refunded.
353
-	 *
354
-	 * @param WPInv_Invoice $invoice
355
-	 */
356
-	public function refunded_invoice( $invoice ) {
357
-
358
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
359
-		$recipient = $invoice->get_email();
360
-
361
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
362
-
363
-	}
168
+    /**
169
+     * Helper function to send an email.
170
+     *
171
+     * @param WPInv_Invoice $invoice
172
+     * @param GetPaid_Notification_Email $email
173
+     * @param string $type
174
+     * @param string|array $recipients
175
+     * @param array $extra_args Extra template args.
176
+     */
177
+    public function send_email( $invoice, $email, $type, $recipients, $extra_args = array() ) {
364 178
 
365
-	/**
366
-	 * Notifies a user about new invoices
367
-	 *
368
-	 * @param WPInv_Invoice $invoice
369
-	 * @param bool $force
370
-	 */
371
-	public function user_invoice( $invoice, $force = false ) {
179
+        do_action( 'getpaid_before_send_invoice_notification', $type, $invoice, $email );
372 180
 
373
-		if ( ! $force && ! empty( $GLOBALS['wpinv_skip_invoice_notification'] ) ) {
374
-			return;
375
-		}
376
-
377
-		// Only send this email for invoices created via the admin page.
378
-		if ( ! $invoice->is_type( 'invoice' ) || ( empty( $force ) && $invoice->is_paid() ) || ( empty( $force ) && $this->is_payment_form_invoice( $invoice->get_id() ) ) ) {
379
-			return;
380
-		}
381
-
382
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
383
-		$recipient = $invoice->get_email();
384
-
385
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
386
-
387
-	}
388
-
389
-	/**
390
-	 * Checks if an invoice is a payment form invoice.
391
-	 *
392
-	 * @param int $invoice
393
-	 * @return bool
394
-	 */
395
-	public function is_payment_form_invoice( $invoice ) {
396
-		$created_via             = get_post_meta( $invoice, 'wpinv_created_via', true );
397
-		$is_payment_form_invoice = 'payment_form' === $created_via || 'geodirectory' === $created_via;
398
-		$is_payment_form_invoice = apply_filters( 'getpaid_invoice_notifications_is_payment_form_invoice', $is_payment_form_invoice, $invoice );
399
-		return empty( $_GET['getpaid-admin-action'] ) && $is_payment_form_invoice;
400
-	}
401
-
402
-	/**
403
-	 * Notifies admin about new invoice notes
404
-	 *
405
-	 * @param WPInv_Invoice $invoice
406
-	 * @param string $note
407
-	 */
408
-	public function user_note( $invoice, $note ) {
409
-
410
-		$email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
411
-		$recipient = $invoice->get_email();
412
-
413
-		return $this->send_email( $invoice, $email, __FUNCTION__, $recipient, array( 'customer_note' => $note ) );
414
-
415
-	}
416
-
417
-	/**
418
-	 * (Force) Sends overdue notices.
419
-	 *
420
-	 * @param WPInv_Invoice $invoice
421
-	 */
422
-	public function force_send_overdue_notice( $invoice ) {
423
-		$email = new GetPaid_Notification_Email( 'overdue', $invoice );
424
-		return $this->send_email( $invoice, $email, 'overdue', $invoice->get_email() );
425
-	}
426
-
427
-	/**
428
-	 * Sends overdue notices.
429
-	 *
430
-	 * @TODO: Create an invoices query class.
431
-	 */
432
-	public function overdue() {
433
-		global $wpdb;
434
-
435
-		$email = new GetPaid_Notification_Email( __FUNCTION__ );
436
-
437
-		// Fetch reminder days.
438
-		$reminder_days = array_unique( wp_parse_id_list( $email->get_option( 'days' ) ) );
439
-
440
-		// Abort if non is set.
441
-		if ( empty( $reminder_days ) ) {
442
-			return;
443
-		}
444
-
445
-		// Retrieve date query.
446
-		$date_query = $this->get_date_query( $reminder_days );
447
-
448
-		// Invoices table.
449
-		$table = $wpdb->prefix . 'getpaid_invoices';
450
-
451
-		// Fetch invoices.
452
-		$invoices  = $wpdb->get_col(
453
-			"SELECT posts.ID FROM $wpdb->posts as posts
181
+        $skip = $invoice->is_free() && wpinv_get_option( 'skip_email_free_invoice' );
182
+        if ( apply_filters( 'getpaid_skip_invoice_email', $skip, $type, $invoice ) ) {
183
+            return;
184
+        }
185
+
186
+        $mailer     = new GetPaid_Notification_Email_Sender();
187
+        $merge_tags = $email->get_merge_tags();
188
+
189
+        $result = $mailer->send(
190
+            apply_filters( 'getpaid_invoice_email_recipients', wpinv_parse_list( $recipients ), $email ),
191
+            $email->add_merge_tags( $email->get_subject(), $merge_tags ),
192
+            $email->get_content( $merge_tags, $extra_args ),
193
+            $email->get_attachments()
194
+        );
195
+
196
+        // Maybe send a copy to the admin.
197
+        if ( $email->include_admin_bcc() ) {
198
+            $mailer->send(
199
+                wpinv_get_admin_email(),
200
+                $email->add_merge_tags( $email->get_subject() . __( ' - ADMIN BCC COPY', 'invoicing' ), $merge_tags ),
201
+                $email->get_content( $merge_tags ),
202
+                $email->get_attachments()
203
+            );
204
+        }
205
+
206
+        if ( $result ) {
207
+            $invoice->add_system_note(
208
+                sprintf(
209
+                    // translators: %1 is the email type, %2 is the invoice recipient.
210
+                    __( 'Successfully sent %1$s notification email to %2$s.', 'invoicing' ),
211
+                    sanitize_key( $type ),
212
+                    $email->is_admin_email() ? __( 'admin', 'invoicing' ) : __( 'the customer', 'invoicing' )
213
+                )
214
+            );
215
+        } else {
216
+            $invoice->add_system_note(
217
+                sprintf(
218
+                    // translators: %1 is the email type, %2 is the invoice recipient.
219
+                    __( 'Failed sending %1$s notification email to %2$s.', 'invoicing' ),
220
+                    sanitize_key( $type ),
221
+                    $email->is_admin_email() ? __( 'admin', 'invoicing' ) : __( 'the customer', 'invoicing' )
222
+                )
223
+            );
224
+        }
225
+
226
+        do_action( 'getpaid_after_send_invoice_notification', $type, $invoice, $email );
227
+
228
+        return $result;
229
+    }
230
+
231
+    /**
232
+     * Also send emails to any cc users.
233
+     *
234
+     * @param array $recipients
235
+     * @param GetPaid_Notification_Email $email
236
+     */
237
+    public function filter_email_recipients( $recipients, $email ) {
238
+
239
+        if ( ! $email->is_admin_email() ) {
240
+            $cc   = $email->object->get_email_cc();
241
+            $cc_2 = get_user_meta( $email->object->get_user_id(), '_wpinv_email_cc', true );
242
+
243
+            if ( ! empty( $cc ) ) {
244
+                $cc = array_map( 'sanitize_email', wpinv_parse_list( $cc ) );
245
+                $recipients = array_filter( array_unique( array_merge( $recipients, $cc ) ) );
246
+            }
247
+
248
+            if ( ! empty( $cc_2 ) ) {
249
+                $cc_2 = array_map( 'sanitize_email', wpinv_parse_list( $cc_2 ) );
250
+                $recipients = array_filter( array_unique( array_merge( $recipients, $cc_2 ) ) );
251
+            }
252
+        }
253
+
254
+        return $recipients;
255
+
256
+    }
257
+
258
+    /**
259
+     * Sends a new invoice notification.
260
+     *
261
+     * @param WPInv_Invoice $invoice
262
+     */
263
+    public function new_invoice( $invoice ) {
264
+
265
+        // Only send this email for invoices created via the admin page.
266
+        if ( ! $invoice->is_type( 'invoice' ) || $invoice->is_paid() || $this->is_payment_form_invoice( $invoice->get_id() ) ) {
267
+            return;
268
+        }
269
+
270
+        $email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
271
+        $recipient = wpinv_get_admin_email();
272
+
273
+        return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
274
+
275
+    }
276
+
277
+    /**
278
+     * Sends a cancelled invoice notification.
279
+     *
280
+     * @param WPInv_Invoice $invoice
281
+     */
282
+    public function cancelled_invoice( $invoice ) {
283
+
284
+        $email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
285
+        $recipient = $invoice->get_email();
286
+
287
+        return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
288
+    }
289
+
290
+    /**
291
+     * Sends a failed invoice notification.
292
+     *
293
+     * @param WPInv_Invoice $invoice
294
+     */
295
+    public function failed_invoice( $invoice ) {
296
+
297
+        $email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
298
+        $recipient = wpinv_get_admin_email();
299
+
300
+        return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
301
+
302
+    }
303
+
304
+    /**
305
+     * Sends a notification whenever an invoice is put on hold.
306
+     *
307
+     * @param WPInv_Invoice $invoice
308
+     */
309
+    public function onhold_invoice( $invoice ) {
310
+
311
+        $email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
312
+        $recipient = $invoice->get_email();
313
+
314
+        return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
315
+
316
+    }
317
+
318
+    /**
319
+     * Sends a notification whenever an invoice is marked as processing payment.
320
+     *
321
+     * @param WPInv_Invoice $invoice
322
+     */
323
+    public function processing_invoice( $invoice ) {
324
+
325
+        $email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
326
+        $recipient = $invoice->get_email();
327
+
328
+        return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
329
+
330
+    }
331
+
332
+    /**
333
+     * Sends a notification whenever an invoice is paid.
334
+     *
335
+     * @param WPInv_Invoice $invoice
336
+     */
337
+    public function completed_invoice( $invoice ) {
338
+
339
+        // (Maybe) abort if it is a renewal invoice.
340
+        if ( $invoice->is_renewal() && ! wpinv_get_option( 'email_completed_invoice_renewal_active', false ) ) {
341
+            return;
342
+        }
343
+
344
+        $email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
345
+        $recipient = $invoice->get_email();
346
+
347
+        return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
348
+
349
+    }
350
+
351
+    /**
352
+     * Sends a notification whenever an invoice is refunded.
353
+     *
354
+     * @param WPInv_Invoice $invoice
355
+     */
356
+    public function refunded_invoice( $invoice ) {
357
+
358
+        $email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
359
+        $recipient = $invoice->get_email();
360
+
361
+        return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
362
+
363
+    }
364
+
365
+    /**
366
+     * Notifies a user about new invoices
367
+     *
368
+     * @param WPInv_Invoice $invoice
369
+     * @param bool $force
370
+     */
371
+    public function user_invoice( $invoice, $force = false ) {
372
+
373
+        if ( ! $force && ! empty( $GLOBALS['wpinv_skip_invoice_notification'] ) ) {
374
+            return;
375
+        }
376
+
377
+        // Only send this email for invoices created via the admin page.
378
+        if ( ! $invoice->is_type( 'invoice' ) || ( empty( $force ) && $invoice->is_paid() ) || ( empty( $force ) && $this->is_payment_form_invoice( $invoice->get_id() ) ) ) {
379
+            return;
380
+        }
381
+
382
+        $email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
383
+        $recipient = $invoice->get_email();
384
+
385
+        return $this->send_email( $invoice, $email, __FUNCTION__, $recipient );
386
+
387
+    }
388
+
389
+    /**
390
+     * Checks if an invoice is a payment form invoice.
391
+     *
392
+     * @param int $invoice
393
+     * @return bool
394
+     */
395
+    public function is_payment_form_invoice( $invoice ) {
396
+        $created_via             = get_post_meta( $invoice, 'wpinv_created_via', true );
397
+        $is_payment_form_invoice = 'payment_form' === $created_via || 'geodirectory' === $created_via;
398
+        $is_payment_form_invoice = apply_filters( 'getpaid_invoice_notifications_is_payment_form_invoice', $is_payment_form_invoice, $invoice );
399
+        return empty( $_GET['getpaid-admin-action'] ) && $is_payment_form_invoice;
400
+    }
401
+
402
+    /**
403
+     * Notifies admin about new invoice notes
404
+     *
405
+     * @param WPInv_Invoice $invoice
406
+     * @param string $note
407
+     */
408
+    public function user_note( $invoice, $note ) {
409
+
410
+        $email     = new GetPaid_Notification_Email( __FUNCTION__, $invoice );
411
+        $recipient = $invoice->get_email();
412
+
413
+        return $this->send_email( $invoice, $email, __FUNCTION__, $recipient, array( 'customer_note' => $note ) );
414
+
415
+    }
416
+
417
+    /**
418
+     * (Force) Sends overdue notices.
419
+     *
420
+     * @param WPInv_Invoice $invoice
421
+     */
422
+    public function force_send_overdue_notice( $invoice ) {
423
+        $email = new GetPaid_Notification_Email( 'overdue', $invoice );
424
+        return $this->send_email( $invoice, $email, 'overdue', $invoice->get_email() );
425
+    }
426
+
427
+    /**
428
+     * Sends overdue notices.
429
+     *
430
+     * @TODO: Create an invoices query class.
431
+     */
432
+    public function overdue() {
433
+        global $wpdb;
434
+
435
+        $email = new GetPaid_Notification_Email( __FUNCTION__ );
436
+
437
+        // Fetch reminder days.
438
+        $reminder_days = array_unique( wp_parse_id_list( $email->get_option( 'days' ) ) );
439
+
440
+        // Abort if non is set.
441
+        if ( empty( $reminder_days ) ) {
442
+            return;
443
+        }
444
+
445
+        // Retrieve date query.
446
+        $date_query = $this->get_date_query( $reminder_days );
447
+
448
+        // Invoices table.
449
+        $table = $wpdb->prefix . 'getpaid_invoices';
450
+
451
+        // Fetch invoices.
452
+        $invoices  = $wpdb->get_col(
453
+            "SELECT posts.ID FROM $wpdb->posts as posts
454 454
 			LEFT JOIN $table as invoices ON invoices.post_id = posts.ID
455 455
 			WHERE posts.post_type = 'wpi_invoice' AND posts.post_status = 'wpi-pending' $date_query"
456 456
         );
457 457
 
458
-		foreach ( $invoices as $invoice ) {
458
+        foreach ( $invoices as $invoice ) {
459 459
 
460
-			// Only send this email for invoices created via the admin page.
461
-			if ( ! $this->is_payment_form_invoice( $invoice ) ) {
462
-				$invoice       = new WPInv_Invoice( $invoice );
463
-				$email->object = $invoice;
460
+            // Only send this email for invoices created via the admin page.
461
+            if ( ! $this->is_payment_form_invoice( $invoice ) ) {
462
+                $invoice       = new WPInv_Invoice( $invoice );
463
+                $email->object = $invoice;
464 464
 
465
-				if ( $invoice->needs_payment() ) {
466
-					$this->send_email( $invoice, $email, __FUNCTION__, $invoice->get_email() );
467
-				}
465
+                if ( $invoice->needs_payment() ) {
466
+                    $this->send_email( $invoice, $email, __FUNCTION__, $invoice->get_email() );
467
+                }
468 468
 }
469 469
 }
470 470
 
471
-	}
471
+    }
472 472
 
473
-	/**
474
-	 * Calculates the date query for an invoices query
475
-	 *
476
-	 * @param array $reminder_days
477
-	 * @return string
478
-	 */
479
-	public function get_date_query( $reminder_days ) {
473
+    /**
474
+     * Calculates the date query for an invoices query
475
+     *
476
+     * @param array $reminder_days
477
+     * @return string
478
+     */
479
+    public function get_date_query( $reminder_days ) {
480 480
 
481
-		$date_query = array(
482
-			'relation' => 'OR',
483
-		);
481
+        $date_query = array(
482
+            'relation' => 'OR',
483
+        );
484 484
 
485
-		foreach ( $reminder_days as $days ) {
486
-			$date = date_parse( date( 'Y-m-d', strtotime( "-$days days", current_time( 'timestamp' ) ) ) );
485
+        foreach ( $reminder_days as $days ) {
486
+            $date = date_parse( date( 'Y-m-d', strtotime( "-$days days", current_time( 'timestamp' ) ) ) );
487 487
 
488
-			$date_query[] = array(
489
-				'year'  => $date['year'],
490
-				'month' => $date['month'],
491
-				'day'   => $date['day'],
492
-			);
488
+            $date_query[] = array(
489
+                'year'  => $date['year'],
490
+                'month' => $date['month'],
491
+                'day'   => $date['day'],
492
+            );
493 493
 
494
-		}
494
+        }
495 495
 
496
-		$date_query = new WP_Date_Query( $date_query, 'invoices.due_date' );
496
+        $date_query = new WP_Date_Query( $date_query, 'invoices.due_date' );
497 497
 
498
-		return $date_query->get_sql();
498
+        return $date_query->get_sql();
499 499
 
500
-	}
500
+    }
501 501
 
502 502
 }
Please login to merge, or discard this patch.
includes/admin/register-settings.php 1 patch
Indentation   +315 added lines, -315 removed lines patch added patch discarded remove patch
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
     $name       = isset( $option['name'] ) ? $option['name'] : '';
193 193
     $cb         = "wpinv_{$option['type']}_callback";
194 194
     $section    = "wpinv_settings_{$tab}_$section";
195
-	$is_wizzard = is_admin() && isset( $_GET['page'] ) && 'gp-setup' == $_GET['page'];
195
+    $is_wizzard = is_admin() && isset( $_GET['page'] ) && 'gp-setup' == $_GET['page'];
196 196
 
197
-	if ( isset( $option['desc'] ) && ( ! $is_wizzard && ! empty( $option['help-tip'] ) ) ) {
198
-		$tip   = wpinv_clean( $option['desc'] );
199
-		$name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
200
-		unset( $option['desc'] );
201
-	}
197
+    if ( isset( $option['desc'] ) && ( ! $is_wizzard && ! empty( $option['help-tip'] ) ) ) {
198
+        $tip   = wpinv_clean( $option['desc'] );
199
+        $name .= "<span class='dashicons dashicons-editor-help wpi-help-tip' title='$tip'></span>";
200
+        unset( $option['desc'] );
201
+    }
202 202
 
203 203
     // Loop through all tabs.
204 204
     add_settings_field(
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
             'faux'            => isset( $option['faux'] ) ? $option['faux'] : false,
226 226
             'onchange'        => isset( $option['onchange'] ) ? $option['onchange'] : '',
227 227
             'custom'          => isset( $option['custom'] ) ? $option['custom'] : '',
228
-			'default_content' => isset( $option['default_content'] ) ? $option['default_content'] : '',
229
-			'class'           => isset( $option['class'] ) ? $option['class'] : '',
230
-			'style'           => isset( $option['style'] ) ? $option['style'] : '',
228
+            'default_content' => isset( $option['default_content'] ) ? $option['default_content'] : '',
229
+            'class'           => isset( $option['class'] ) ? $option['class'] : '',
230
+            'style'           => isset( $option['style'] ) ? $option['style'] : '',
231 231
             'cols'            => isset( $option['cols'] ) && (int) $option['cols'] > 0 ? (int) $option['cols'] : 50,
232 232
             'rows'            => isset( $option['rows'] ) && (int) $option['rows'] > 0 ? (int) $option['rows'] : 5,
233 233
         )
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
  * @return array
242 242
  */
243 243
 function wpinv_get_registered_settings() {
244
-	return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
244
+    return array_filter( apply_filters( 'wpinv_registered_settings', wpinv_get_data( 'admin-settings' ) ) );
245 245
 }
246 246
 
247 247
 /**
@@ -260,18 +260,18 @@  discard block
 block discarded – undo
260 260
  */
261 261
 function wpinv_settings_sanitize( $input = array() ) {
262 262
 
263
-	$wpinv_options = wpinv_get_options();
264
-	$raw_referrer  = wp_get_raw_referer();
263
+    $wpinv_options = wpinv_get_options();
264
+    $raw_referrer  = wp_get_raw_referer();
265 265
 
266 266
     if ( empty( $raw_referrer ) ) {
267
-		return array_merge( $wpinv_options, $input );
267
+        return array_merge( $wpinv_options, $input );
268 268
     }
269 269
 
270 270
     wp_parse_str( $raw_referrer, $referrer );
271 271
 
272
-	if ( in_array( 'gp-setup', $referrer ) ) {
273
-		return array_merge( $wpinv_options, $input );
274
-	}
272
+    if ( in_array( 'gp-setup', $referrer ) ) {
273
+        return array_merge( $wpinv_options, $input );
274
+    }
275 275
 
276 276
     $settings = wpinv_get_registered_settings();
277 277
     $tab      = isset( $referrer['tab'] ) ? $referrer['tab'] : 'general';
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
         }
294 294
 
295 295
         // General filter
296
-		$input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
296
+        $input[ $key ] = apply_filters( 'wpinv_settings_sanitize', $input[ $key ], $key );
297 297
 
298
-		// Key specific filter.
299
-		$input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
298
+        // Key specific filter.
299
+        $input[ $key ] = apply_filters( "wpinv_settings_sanitize_$key", $input[ $key ] );
300 300
     }
301 301
 
302 302
     // Loop through the whitelist and unset any that are empty for the tab being saved
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
 
340 340
     foreach ( $new_rates as $rate ) {
341 341
 
342
-		$rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
343
-		$rate['name']    = sanitize_text_field( $rate['name'] );
344
-		$rate['state']   = sanitize_text_field( $rate['state'] );
345
-		$rate['country'] = sanitize_text_field( $rate['country'] );
346
-		$rate['global']  = empty( $rate['state'] );
347
-		$tax_rates[]     = $rate;
342
+        $rate['rate']    = wpinv_sanitize_amount( $rate['rate'] );
343
+        $rate['name']    = sanitize_text_field( $rate['name'] );
344
+        $rate['state']   = sanitize_text_field( $rate['state'] );
345
+        $rate['country'] = sanitize_text_field( $rate['country'] );
346
+        $rate['global']  = empty( $rate['state'] );
347
+        $tax_rates[]     = $rate;
348 348
 
349
-	}
349
+    }
350 350
 
351 351
     update_option( 'wpinv_tax_rates', $tax_rates );
352 352
 
@@ -359,21 +359,21 @@  discard block
 block discarded – undo
359 359
         return $input;
360 360
     }
361 361
 
362
-	if ( empty( $_POST['wpinv_tax_rules_nonce'] ) || ! wp_verify_nonce( $_POST['wpinv_tax_rules_nonce'], 'wpinv_tax_rules' ) ) {
363
-		return $input;
364
-	}
362
+    if ( empty( $_POST['wpinv_tax_rules_nonce'] ) || ! wp_verify_nonce( $_POST['wpinv_tax_rules_nonce'], 'wpinv_tax_rules' ) ) {
363
+        return $input;
364
+    }
365 365
 
366 366
     $new_rules = ! empty( $_POST['tax_rules'] ) ? wp_kses_post_deep( array_values( $_POST['tax_rules'] ) ) : array();
367 367
     $tax_rules = array();
368 368
 
369 369
     foreach ( $new_rules as $rule ) {
370 370
 
371
-		$rule['key']      = sanitize_title_with_dashes( $rule['key'] );
372
-		$rule['label']    = sanitize_text_field( $rule['label'] );
373
-		$rule['tax_base'] = sanitize_text_field( $rule['tax_base'] );
374
-		$tax_rules[]      = $rule;
371
+        $rule['key']      = sanitize_title_with_dashes( $rule['key'] );
372
+        $rule['label']    = sanitize_text_field( $rule['label'] );
373
+        $rule['tax_base'] = sanitize_text_field( $rule['tax_base'] );
374
+        $tax_rules[]      = $rule;
375 375
 
376
-	}
376
+    }
377 377
 
378 378
     update_option( 'wpinv_tax_rules', $tax_rules );
379 379
 
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
     $tabs['general']  = __( 'General', 'invoicing' );
387 387
     $tabs['gateways'] = __( 'Payment Gateways', 'invoicing' );
388 388
     $tabs['taxes']    = __( 'Taxes', 'invoicing' );
389
-	$tabs['emails']   = __( 'Emails', 'invoicing' );
389
+    $tabs['emails']   = __( 'Emails', 'invoicing' );
390 390
 
391
-	if ( count( getpaid_get_integration_settings() ) > 0 ) {
392
-		$tabs['integrations'] = __( 'Integrations', 'invoicing' );
393
-	}
391
+    if ( count( getpaid_get_integration_settings() ) > 0 ) {
392
+        $tabs['integrations'] = __( 'Integrations', 'invoicing' );
393
+    }
394 394
 
395 395
     $tabs['privacy']  = __( 'Privacy', 'invoicing' );
396 396
     $tabs['misc']     = __( 'Misc', 'invoicing' );
@@ -421,53 +421,53 @@  discard block
 block discarded – undo
421 421
         'general'      => apply_filters(
422 422
             'wpinv_settings_sections_general',
423 423
             array(
424
-				'main'             => __( 'General Settings', 'invoicing' ),
425
-				'page_section'     => __( 'Page Settings', 'invoicing' ),
426
-				'currency_section' => __( 'Currency Settings', 'invoicing' ),
427
-				'labels'           => __( 'Label Texts', 'invoicing' ),
424
+                'main'             => __( 'General Settings', 'invoicing' ),
425
+                'page_section'     => __( 'Page Settings', 'invoicing' ),
426
+                'currency_section' => __( 'Currency Settings', 'invoicing' ),
427
+                'labels'           => __( 'Label Texts', 'invoicing' ),
428 428
             )
429 429
         ),
430 430
         'gateways'     => apply_filters(
431 431
             'wpinv_settings_sections_gateways',
432 432
             array(
433
-				'main' => __( 'Gateway Settings', 'invoicing' ),
433
+                'main' => __( 'Gateway Settings', 'invoicing' ),
434 434
             )
435 435
         ),
436 436
         'taxes'        => apply_filters(
437 437
             'wpinv_settings_sections_taxes',
438 438
             array(
439
-				'main'  => __( 'Tax Settings', 'invoicing' ),
440
-				'rules' => __( 'Tax Rules', 'invoicing' ),
441
-				'rates' => __( 'Tax Rates', 'invoicing' ),
442
-				'vat'   => __( 'EU VAT Settings', 'invoicing' ),
439
+                'main'  => __( 'Tax Settings', 'invoicing' ),
440
+                'rules' => __( 'Tax Rules', 'invoicing' ),
441
+                'rates' => __( 'Tax Rates', 'invoicing' ),
442
+                'vat'   => __( 'EU VAT Settings', 'invoicing' ),
443 443
             )
444 444
         ),
445 445
         'emails'       => apply_filters(
446 446
             'wpinv_settings_sections_emails',
447 447
             array(
448
-				'main' => __( 'Email Settings', 'invoicing' ),
448
+                'main' => __( 'Email Settings', 'invoicing' ),
449 449
             )
450 450
         ),
451 451
 
452
-		'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
452
+        'integrations' => wp_list_pluck( getpaid_get_integration_settings(), 'label', 'id' ),
453 453
 
454 454
         'privacy'      => apply_filters(
455 455
             'wpinv_settings_sections_privacy',
456 456
             array(
457
-				'main' => __( 'Privacy policy', 'invoicing' ),
457
+                'main' => __( 'Privacy policy', 'invoicing' ),
458 458
             )
459 459
         ),
460 460
         'misc'         => apply_filters(
461 461
             'wpinv_settings_sections_misc',
462 462
             array(
463
-				'main'       => __( 'Miscellaneous', 'invoicing' ),
464
-				'custom-css' => __( 'Custom CSS', 'invoicing' ),
463
+                'main'       => __( 'Miscellaneous', 'invoicing' ),
464
+                'custom-css' => __( 'Custom CSS', 'invoicing' ),
465 465
             )
466 466
         ),
467 467
         'tools'        => apply_filters(
468 468
             'wpinv_settings_sections_tools',
469 469
             array(
470
-				'main' => __( 'Diagnostic Tools', 'invoicing' ),
470
+                'main' => __( 'Diagnostic Tools', 'invoicing' ),
471 471
             )
472 472
         ),
473 473
     );
@@ -478,46 +478,46 @@  discard block
 block discarded – undo
478 478
 }
479 479
 
480 480
 function wpinv_get_pages( $with_slug = false, $default_label = null ) {
481
-	$pages_options = array();
481
+    $pages_options = array();
482 482
 
483
-	if ( $default_label !== null && $default_label !== false ) {
484
-		$pages_options = array( '' => $default_label ); // Blank option
485
-	}
483
+    if ( $default_label !== null && $default_label !== false ) {
484
+        $pages_options = array( '' => $default_label ); // Blank option
485
+    }
486 486
 
487
-	$pages = get_pages();
488
-	if ( $pages ) {
489
-		foreach ( $pages as $page ) {
490
-			$title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
487
+    $pages = get_pages();
488
+    if ( $pages ) {
489
+        foreach ( $pages as $page ) {
490
+            $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title;
491 491
             $pages_options[ $page->ID ] = $title;
492
-		}
493
-	}
492
+        }
493
+    }
494 494
 
495
-	return $pages_options;
495
+    return $pages_options;
496 496
 }
497 497
 
498 498
 function wpinv_header_callback( $args ) {
499
-	if ( ! empty( $args['desc'] ) ) {
499
+    if ( ! empty( $args['desc'] ) ) {
500 500
         echo wp_kses_post( $args['desc'] );
501 501
     }
502 502
 }
503 503
 
504 504
 function wpinv_hidden_callback( $args ) {
505 505
 
506
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
507
-	$value   = wpinv_get_option( $args['id'], $std );
506
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
507
+    $value   = wpinv_get_option( $args['id'], $std );
508 508
 
509
-	if ( isset( $args['set_value'] ) ) {
510
-		$value = $args['set_value'];
511
-	}
509
+    if ( isset( $args['set_value'] ) ) {
510
+        $value = $args['set_value'];
511
+    }
512 512
 
513
-	if ( isset( $args['faux'] ) && true === $args['faux'] ) {
514
-		$args['readonly'] = true;
515
-		$name  = '';
516
-	} else {
517
-		$name = 'wpinv_settings[' . esc_attr( $args['id'] ) . ']';
518
-	}
513
+    if ( isset( $args['faux'] ) && true === $args['faux'] ) {
514
+        $args['readonly'] = true;
515
+        $name  = '';
516
+    } else {
517
+        $name = 'wpinv_settings[' . esc_attr( $args['id'] ) . ']';
518
+    }
519 519
 
520
-	echo '<input type="hidden" id="wpinv_settings[' . esc_attr( $args['id'] ) . ']" name="' . esc_attr( $name ) . '" value="' . esc_attr( stripslashes( $value ) ) . '" />';
520
+    echo '<input type="hidden" id="wpinv_settings[' . esc_attr( $args['id'] ) . ']" name="' . esc_attr( $name ) . '" value="' . esc_attr( stripslashes( $value ) ) . '" />';
521 521
 
522 522
 }
523 523
 
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
  */
527 527
 function wpinv_checkbox_callback( $args ) {
528 528
 
529
-	$std = isset( $args['std'] ) ? $args['std'] : '';
530
-	$std = wpinv_get_option( $args['id'], $std );
531
-	$id  = esc_attr( $args['id'] );
529
+    $std = isset( $args['std'] ) ? $args['std'] : '';
530
+    $std = wpinv_get_option( $args['id'], $std );
531
+    $id  = esc_attr( $args['id'] );
532 532
 
533
-	getpaid_hidden_field( "wpinv_settings[$id]", '0' );
534
-	?>
533
+    getpaid_hidden_field( "wpinv_settings[$id]", '0' );
534
+    ?>
535 535
 		<fieldset>
536 536
 			<label>
537 537
 				<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" />
@@ -543,75 +543,75 @@  discard block
 block discarded – undo
543 543
 
544 544
 function wpinv_multicheck_callback( $args ) {
545 545
 
546
-	$sanitize_id = wpinv_sanitize_key( $args['id'] );
547
-	$class = ! empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
546
+    $sanitize_id = wpinv_sanitize_key( $args['id'] );
547
+    $class = ! empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
548 548
 
549
-	if ( ! empty( $args['options'] ) ) {
549
+    if ( ! empty( $args['options'] ) ) {
550 550
 
551
-		$std     = isset( $args['std'] ) ? $args['std'] : array();
552
-		$value   = wpinv_get_option( $args['id'], $std );
551
+        $std     = isset( $args['std'] ) ? $args['std'] : array();
552
+        $value   = wpinv_get_option( $args['id'], $std );
553 553
 
554
-		echo '<div class="wpi-mcheck-rows wpi-mcheck-' . esc_attr( $sanitize_id . $class ) . '">';
554
+        echo '<div class="wpi-mcheck-rows wpi-mcheck-' . esc_attr( $sanitize_id . $class ) . '">';
555 555
         foreach ( $args['options'] as $key => $option ) :
556
-			$sanitize_key = esc_attr( wpinv_sanitize_key( $key ) );
557
-			if ( in_array( $sanitize_key, $value ) ) {
558
-				$enabled = $sanitize_key;
559
-			} else {
560
-				$enabled = null;
561
-			}
562
-			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;';
563
-			echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']">' . wp_kses_post( $option ) . '</label></div>';
564
-		endforeach;
565
-		echo '</div>';
566
-		echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
567
-	}
556
+            $sanitize_key = esc_attr( wpinv_sanitize_key( $key ) );
557
+            if ( in_array( $sanitize_key, $value ) ) {
558
+                $enabled = $sanitize_key;
559
+            } else {
560
+                $enabled = null;
561
+            }
562
+            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;';
563
+            echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . '][' . esc_attr( $sanitize_key ) . ']">' . wp_kses_post( $option ) . '</label></div>';
564
+        endforeach;
565
+        echo '</div>';
566
+        echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
567
+    }
568 568
 }
569 569
 
570 570
 function wpinv_payment_icons_callback( $args ) {
571 571
 
572 572
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
573
-	$value   = wpinv_get_option( $args['id'], false );
573
+    $value   = wpinv_get_option( $args['id'], false );
574 574
 
575
-	if ( ! empty( $args['options'] ) ) {
576
-		foreach ( $args['options'] as $key => $option ) {
575
+    if ( ! empty( $args['options'] ) ) {
576
+        foreach ( $args['options'] as $key => $option ) {
577 577
             $sanitize_key = wpinv_sanitize_key( $key );
578 578
 
579
-			if ( empty( $value ) ) {
580
-				$enabled = $option;
581
-			} else {
582
-				$enabled = null;
583
-			}
584
-
585
-			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;">';
586
-
587
-				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;';
588
-
589
-				if ( wpinv_string_is_image_url( $key ) ) {
590
-				echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
591
-				} else {
592
-				$card = strtolower( str_replace( ' ', '', $option ) );
593
-
594
-				if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
595
-					$image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
596
-					} else {
597
-					$image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
598
-					$content_dir = WP_CONTENT_DIR;
599
-
600
-					if ( function_exists( 'wp_normalize_path' ) ) {
601
-						// Replaces backslashes with forward slashes for Windows systems
602
-						$image = wp_normalize_path( $image );
603
-						$content_dir = wp_normalize_path( $content_dir );
604
-						}
605
-
606
-					$image = str_replace( $content_dir, content_url(), $image );
607
-					}
608
-
609
-				echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
610
-				}
611
-			echo wp_kses_post( $option ) . '</label>';
612
-		}
613
-		echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
614
-	}
579
+            if ( empty( $value ) ) {
580
+                $enabled = $option;
581
+            } else {
582
+                $enabled = null;
583
+            }
584
+
585
+            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;">';
586
+
587
+                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;';
588
+
589
+                if ( wpinv_string_is_image_url( $key ) ) {
590
+                echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
591
+                } else {
592
+                $card = strtolower( str_replace( ' ', '', $option ) );
593
+
594
+                if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) {
595
+                    $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' );
596
+                    } else {
597
+                    $image       = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false );
598
+                    $content_dir = WP_CONTENT_DIR;
599
+
600
+                    if ( function_exists( 'wp_normalize_path' ) ) {
601
+                        // Replaces backslashes with forward slashes for Windows systems
602
+                        $image = wp_normalize_path( $image );
603
+                        $content_dir = wp_normalize_path( $content_dir );
604
+                        }
605
+
606
+                    $image = str_replace( $content_dir, content_url(), $image );
607
+                    }
608
+
609
+                echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>';
610
+                }
611
+            echo wp_kses_post( $option ) . '</label>';
612
+        }
613
+        echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>';
614
+    }
615 615
 }
616 616
 
617 617
 /**
@@ -619,9 +619,9 @@  discard block
 block discarded – undo
619 619
  */
620 620
 function wpinv_radio_callback( $args ) {
621 621
 
622
-	$std = isset( $args['std'] ) ? $args['std'] : '';
623
-	$std = wpinv_get_option( $args['id'], $std );
624
-	?>
622
+    $std = isset( $args['std'] ) ? $args['std'] : '';
623
+    $std = wpinv_get_option( $args['id'], $std );
624
+    ?>
625 625
 		<fieldset>
626 626
 			<ul id="wpinv-settings-<?php echo esc_attr( $args['id'] ); ?>" style="margin-top: 0;">
627 627
 				<?php foreach ( $args['options'] as $key => $option ) : ?>
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 			</ul>
636 636
 		</fieldset>
637 637
 	<?php
638
-	getpaid_settings_description_callback( $args );
638
+    getpaid_settings_description_callback( $args );
639 639
 }
640 640
 
641 641
 /**
@@ -643,10 +643,10 @@  discard block
 block discarded – undo
643 643
  */
644 644
 function getpaid_settings_description_callback( $args ) {
645 645
 
646
-	if ( ! empty( $args['desc'] ) ) {
647
-		$description = $args['desc'];
648
-		echo wp_kses_post( "<p class='description'>$description</p>" );
649
-	}
646
+    if ( ! empty( $args['desc'] ) ) {
647
+        $description = $args['desc'];
648
+        echo wp_kses_post( "<p class='description'>$description</p>" );
649
+    }
650 650
 
651 651
 }
652 652
 
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
  */
656 656
 function wpinv_gateways_callback() {
657 657
 
658
-	?>
658
+    ?>
659 659
 		</td>
660 660
 	</tr>
661 661
 	<tr class="bsui">
@@ -669,26 +669,26 @@  discard block
 block discarded – undo
669 669
 
670 670
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
671 671
     $class = ! empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : '';
672
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
673
-	$value   = wpinv_get_option( $args['id'], $std );
672
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
673
+    $value   = wpinv_get_option( $args['id'], $std );
674 674
 
675
-	echo '<select name="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" class="' . esc_attr( $class ) . '" >';
675
+    echo '<select name="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"" id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" class="' . esc_attr( $class ) . '" >';
676 676
 
677
-	foreach ( $args['options'] as $key => $option ) :
677
+    foreach ( $args['options'] as $key => $option ) :
678 678
 
679
-		echo '<option value="' . esc_attr( $key ) . '" ';
679
+        echo '<option value="' . esc_attr( $key ) . '" ';
680 680
 
681
-		if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
681
+        if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) {
682 682
             selected( $key, $args['selected'] );
683 683
         } else {
684 684
             selected( $key, $value );
685 685
         }
686 686
 
687
-		echo '>' . esc_html( $option['admin_label'] ) . '</option>';
688
-	endforeach;
687
+        echo '>' . esc_html( $option['admin_label'] ) . '</option>';
688
+    endforeach;
689 689
 
690
-	echo '</select>';
691
-	echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
690
+    echo '</select>';
691
+    echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
692 692
 }
693 693
 
694 694
 /**
@@ -699,38 +699,38 @@  discard block
 block discarded – undo
699 699
  */
700 700
 function wpinv_settings_attrs_helper( $args ) {
701 701
 
702
-	$value = isset( $args['std'] ) ? $args['std'] : '';
703
-	$id    = esc_attr( $args['id'] );
704
-	$value = is_scalar( $value ) ? $value : '';
705
-
706
-	$attrs = array(
707
-		'name'     => ! empty( $args['faux'] ) ? false : "wpinv_settings[$id]",
708
-		'readonly' => ! empty( $args['faux'] ),
709
-		'value'    => ! empty( $args['faux'] ) ? $value : wpinv_get_option( $args['id'], $value ),
710
-		'id'       => 'wpinv-settings-' . $args['id'],
711
-		'style'    => $args['style'],
712
-		'class'    => $args['class'],
713
-		'placeholder' => $args['placeholder'],
714
-		'data-placeholder' => $args['placeholder'],
715
-	);
702
+    $value = isset( $args['std'] ) ? $args['std'] : '';
703
+    $id    = esc_attr( $args['id'] );
704
+    $value = is_scalar( $value ) ? $value : '';
705
+
706
+    $attrs = array(
707
+        'name'     => ! empty( $args['faux'] ) ? false : "wpinv_settings[$id]",
708
+        'readonly' => ! empty( $args['faux'] ),
709
+        'value'    => ! empty( $args['faux'] ) ? $value : wpinv_get_option( $args['id'], $value ),
710
+        'id'       => 'wpinv-settings-' . $args['id'],
711
+        'style'    => $args['style'],
712
+        'class'    => $args['class'],
713
+        'placeholder' => $args['placeholder'],
714
+        'data-placeholder' => $args['placeholder'],
715
+    );
716 716
 
717
-	if ( ! empty( $args['onchange'] ) ) {
718
-		$attrs['onchange'] = $args['onchange'];
719
-	}
717
+    if ( ! empty( $args['onchange'] ) ) {
718
+        $attrs['onchange'] = $args['onchange'];
719
+    }
720 720
 
721
-	foreach ( $attrs as $key => $value ) {
721
+    foreach ( $attrs as $key => $value ) {
722 722
 
723
-		if ( false === $value ) {
724
-			continue;
725
-		}
723
+        if ( false === $value ) {
724
+            continue;
725
+        }
726 726
 
727
-		if ( true === $value ) {
728
-			echo ' ' . esc_attr( $key );
729
-		} else {
730
-			echo ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
731
-		}
727
+        if ( true === $value ) {
728
+            echo ' ' . esc_attr( $key );
729
+        } else {
730
+            echo ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"';
731
+        }
732 732
 
733
-	}
733
+    }
734 734
 
735 735
 }
736 736
 
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
  */
740 740
 function wpinv_text_callback( $args ) {
741 741
 
742
-	?>
742
+    ?>
743 743
 		<label style="width: 100%;">
744 744
 			<input type="text" <?php wpinv_settings_attrs_helper( $args ); ?>>
745 745
 			<?php getpaid_settings_description_callback( $args ); ?>
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
  */
754 754
 function wpinv_number_callback( $args ) {
755 755
 
756
-	?>
756
+    ?>
757 757
 		<label style="width: 100%;">
758 758
 			<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 ); ?>>
759 759
 			<?php getpaid_settings_description_callback( $args ); ?>
@@ -765,34 +765,34 @@  discard block
 block discarded – undo
765 765
 function wpinv_textarea_callback( $args ) {
766 766
 
767 767
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
768
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
769
-	$value   = wpinv_get_option( $args['id'], $std );
768
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
769
+    $value   = wpinv_get_option( $args['id'], $std );
770 770
 
771 771
     $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
772 772
     $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text';
773 773
 
774
-	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>';
775
-	echo '<br /><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
774
+    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>';
775
+    echo '<br /><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
776 776
 
777 777
 }
778 778
 
779 779
 function wpinv_password_callback( $args ) {
780 780
 
781 781
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
782
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
783
-	$value   = wpinv_get_option( $args['id'], $std );
782
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
783
+    $value   = wpinv_get_option( $args['id'], $std );
784 784
 
785
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
786
-	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 ) . '"/>';
787
-	echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
785
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
786
+    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 ) . '"/>';
787
+    echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
788 788
 
789 789
 }
790 790
 
791 791
 function wpinv_missing_callback( $args ) {
792
-	printf(
793
-		esc_html__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
794
-		'<strong>' . esc_html( $args['id'] ) . '</strong>'
795
-	);
792
+    printf(
793
+        esc_html__( 'The callback function used for the %s setting is missing.', 'invoicing' ),
794
+        '<strong>' . esc_html( $args['id'] ) . '</strong>'
795
+    );
796 796
 }
797 797
 
798 798
 /**
@@ -800,13 +800,13 @@  discard block
 block discarded – undo
800 800
  */
801 801
 function wpinv_select_callback( $args ) {
802 802
 
803
-	$desc   = wp_kses_post( $args['desc'] );
804
-	$desc   = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
805
-	$value  = isset( $args['std'] ) ? $args['std'] : '';
806
-	$value  = wpinv_get_option( $args['id'], $value );
807
-	$rand   = uniqid( 'random_id' );
803
+    $desc   = wp_kses_post( $args['desc'] );
804
+    $desc   = empty( $desc ) ? '' : "<p class='description'>$desc</p>";
805
+    $value  = isset( $args['std'] ) ? $args['std'] : '';
806
+    $value  = wpinv_get_option( $args['id'], $value );
807
+    $rand   = uniqid( 'random_id' );
808 808
 
809
-	?>
809
+    ?>
810 810
 		<label style="width: 100%;">
811 811
 			<select <?php wpinv_settings_attrs_helper( $args ); ?> data-allow-clear="true">
812 812
 				<?php foreach ( $args['options'] as $option => $name ) : ?>
@@ -839,50 +839,50 @@  discard block
 block discarded – undo
839 839
 function wpinv_color_select_callback( $args ) {
840 840
 
841 841
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
842
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
843
-	$value   = wpinv_get_option( $args['id'], $std );
842
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
843
+    $value   = wpinv_get_option( $args['id'], $std );
844 844
 
845
-	echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
845
+    echo '<select id="wpinv_settings[' . esc_attr( $sanitize_id ) . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>';
846 846
 
847
-	foreach ( $args['options'] as $option => $color ) {
848
-		echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $color['label'] ) . '</option>';
849
-	}
847
+    foreach ( $args['options'] as $option => $color ) {
848
+        echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $color['label'] ) . '</option>';
849
+    }
850 850
 
851
-	echo '</select>';
852
-	echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
851
+    echo '</select>';
852
+    echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
853 853
 
854 854
 }
855 855
 
856 856
 function wpinv_rich_editor_callback( $args ) {
857
-	global $wp_version;
857
+    global $wp_version;
858 858
 
859 859
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
860 860
 
861
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
862
-	$value   = wpinv_get_option( $args['id'], $std );
861
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
862
+    $value   = wpinv_get_option( $args['id'], $std );
863 863
 
864
-	if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) {
865
-		$value = $std;
866
-	}
864
+    if ( ! empty( $args['allow_blank'] ) && empty( $value ) ) {
865
+        $value = $std;
866
+    }
867 867
 
868
-	$rows = isset( $args['size'] ) ? $args['size'] : 20;
868
+    $rows = isset( $args['size'] ) ? $args['size'] : 20;
869 869
 
870
-	echo '<div class="getpaid-settings-editor-input">';
871
-	if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
872
-		wp_editor(
870
+    echo '<div class="getpaid-settings-editor-input">';
871
+    if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
872
+        wp_editor(
873 873
             stripslashes( $value ),
874 874
             'wpinv_settings_' . esc_attr( $args['id'] ),
875 875
             array(
876
-				'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']',
877
-				'textarea_rows' => absint( $rows ),
878
-				'media_buttons' => false,
876
+                'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']',
877
+                'textarea_rows' => absint( $rows ),
878
+                'media_buttons' => false,
879 879
             )
880 880
         );
881
-	} else {
882
-		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>';
883
-	}
881
+    } else {
882
+        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>';
883
+    }
884 884
 
885
-	echo '</div><br/><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
885
+    echo '</div><br/><label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
886 886
 
887 887
 }
888 888
 
@@ -890,51 +890,51 @@  discard block
 block discarded – undo
890 890
 
891 891
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
892 892
 
893
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
894
-	$value   = wpinv_get_option( $args['id'], $std );
893
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
894
+    $value   = wpinv_get_option( $args['id'], $std );
895 895
 
896
-	$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
897
-	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 ) ) . '"/>';
898
-	echo '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . esc_attr__( 'Upload File', 'invoicing' ) . '"/></span>';
899
-	echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
896
+    $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
897
+    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 ) ) . '"/>';
898
+    echo '<span>&nbsp;<input type="button" class="wpinv_settings_upload_button button-secondary" value="' . esc_attr__( 'Upload File', 'invoicing' ) . '"/></span>';
899
+    echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
900 900
 
901 901
 }
902 902
 
903 903
 function wpinv_color_callback( $args ) {
904 904
 
905
-	$std         = isset( $args['std'] ) ? $args['std'] : '';
906
-	$value       = wpinv_get_option( $args['id'], $std );
905
+    $std         = isset( $args['std'] ) ? $args['std'] : '';
906
+    $value       = wpinv_get_option( $args['id'], $std );
907 907
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
908 908
 
909
-	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 ) . '" />';
910
-	echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
909
+    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 ) . '" />';
910
+    echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
911 911
 
912 912
 }
913 913
 
914 914
 function wpinv_country_states_callback( $args ) {
915 915
 
916
-	$std     = isset( $args['std'] ) ? $args['std'] : '';
917
-	$value   = wpinv_get_option( $args['id'], $std );
916
+    $std     = isset( $args['std'] ) ? $args['std'] : '';
917
+    $value   = wpinv_get_option( $args['id'], $std );
918 918
 
919 919
     $sanitize_id = wpinv_sanitize_key( $args['id'] );
920 920
 
921
-	if ( isset( $args['placeholder'] ) ) {
922
-		$placeholder = $args['placeholder'];
923
-	} else {
924
-		$placeholder = '';
925
-	}
921
+    if ( isset( $args['placeholder'] ) ) {
922
+        $placeholder = $args['placeholder'];
923
+    } else {
924
+        $placeholder = '';
925
+    }
926 926
 
927
-	$states = wpinv_get_country_states();
927
+    $states = wpinv_get_country_states();
928 928
 
929
-	$class = empty( $states ) ? 'wpinv-no-states' : 'wpi_select2';
930
-	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 ) . '"/>';
929
+    $class = empty( $states ) ? 'wpinv-no-states' : 'wpi_select2';
930
+    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 ) . '"/>';
931 931
 
932
-	foreach ( $states as $option => $name ) {
933
-		echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $name ) . '</option>';
934
-	}
932
+    foreach ( $states as $option => $name ) {
933
+        echo '<option value="' . esc_attr( $option ) . '" ' . selected( $option, $value ) . '>' . esc_html( $name ) . '</option>';
934
+    }
935 935
 
936
-	echo '</select>';
937
-	echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
936
+    echo '</select>';
937
+    echo '<label for="wpinv_settings[' . esc_attr( $sanitize_id ) . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>';
938 938
 
939 939
 }
940 940
 
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
  */
944 944
 function wpinv_tax_rates_callback() {
945 945
 
946
-	?>
946
+    ?>
947 947
 		</td>
948 948
 	</tr>
949 949
 	<tr class="bsui">
@@ -959,9 +959,9 @@  discard block
 block discarded – undo
959 959
  */
960 960
 function wpinv_tax_rate_callback( $tax_rate, $key ) {
961 961
 
962
-	$key                      = sanitize_key( $key );
963
-	$tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
964
-	include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
962
+    $key                      = sanitize_key( $key );
963
+    $tax_rate['reduced_rate'] = empty( $tax_rate['reduced_rate'] ) ? 0 : $tax_rate['reduced_rate'];
964
+    include plugin_dir_path( __FILE__ ) . 'views/html-tax-rate-edit.php';
965 965
 
966 966
 }
967 967
 
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
  */
971 971
 function wpinv_tax_rules_callback() {
972 972
 
973
-	?>
973
+    ?>
974 974
 		</td>
975 975
 	</tr>
976 976
 	<tr class="bsui">
@@ -1008,14 +1008,14 @@  discard block
 block discarded – undo
1008 1008
                 <td>
1009 1009
 					<a href="
1010 1010
                     <?php
1011
-						echo esc_url(
1012
-							wp_nonce_url(
1013
-								add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
1014
-								'getpaid-nonce',
1015
-								'getpaid-nonce'
1016
-							)
1017
-						);
1018
-					?>
1011
+                        echo esc_url(
1012
+                            wp_nonce_url(
1013
+                                add_query_arg( 'getpaid-admin-action', 'create_missing_pages' ),
1014
+                                'getpaid-nonce',
1015
+                                'getpaid-nonce'
1016
+                            )
1017
+                        );
1018
+                    ?>
1019 1019
                     " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a>
1020 1020
                 </td>
1021 1021
             </tr>
@@ -1027,14 +1027,14 @@  discard block
 block discarded – undo
1027 1027
                 <td>
1028 1028
 					<a href="
1029 1029
                     <?php
1030
-						echo esc_url(
1031
-							wp_nonce_url(
1032
-								add_query_arg( 'getpaid-admin-action', 'refresh_permalinks' ),
1033
-								'getpaid-nonce',
1034
-								'getpaid-nonce'
1035
-							)
1036
-						);
1037
-					?>
1030
+                        echo esc_url(
1031
+                            wp_nonce_url(
1032
+                                add_query_arg( 'getpaid-admin-action', 'refresh_permalinks' ),
1033
+                                'getpaid-nonce',
1034
+                                'getpaid-nonce'
1035
+                            )
1036
+                        );
1037
+                    ?>
1038 1038
                     " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a>
1039 1039
                 </td>
1040 1040
             </tr>
@@ -1046,14 +1046,14 @@  discard block
 block discarded – undo
1046 1046
                 <td>
1047 1047
 					<a href="
1048 1048
                     <?php
1049
-						echo esc_url(
1050
-							wp_nonce_url(
1051
-								add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
1052
-								'getpaid-nonce',
1053
-								'getpaid-nonce'
1054
-							)
1055
-						);
1056
-					?>
1049
+                        echo esc_url(
1050
+                            wp_nonce_url(
1051
+                                add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
1052
+                                'getpaid-nonce',
1053
+                                'getpaid-nonce'
1054
+                            )
1055
+                        );
1056
+                    ?>
1057 1057
                     " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a>
1058 1058
                 </td>
1059 1059
             </tr>
@@ -1065,14 +1065,14 @@  discard block
 block discarded – undo
1065 1065
                 <td>
1066 1066
 					<a href="
1067 1067
                     <?php
1068
-						echo esc_url(
1069
-							wp_nonce_url(
1070
-								add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ),
1071
-								'getpaid-nonce',
1072
-								'getpaid-nonce'
1073
-							)
1074
-						);
1075
-					?>
1068
+                        echo esc_url(
1069
+                            wp_nonce_url(
1070
+                                add_query_arg( 'getpaid-admin-action', 'migrate_old_invoices' ),
1071
+                                'getpaid-nonce',
1072
+                                'getpaid-nonce'
1073
+                            )
1074
+                        );
1075
+                    ?>
1076 1076
                     " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a>
1077 1077
                 </td>
1078 1078
             </tr>
@@ -1085,14 +1085,14 @@  discard block
 block discarded – undo
1085 1085
                 <td>
1086 1086
 					<a href="
1087 1087
                     <?php
1088
-						echo esc_url(
1089
-							wp_nonce_url(
1090
-								add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ),
1091
-								'getpaid-nonce',
1092
-								'getpaid-nonce'
1093
-							)
1094
-						);
1095
-					?>
1088
+                        echo esc_url(
1089
+                            wp_nonce_url(
1090
+                                add_query_arg( 'getpaid-admin-action', 'recalculate_discounts' ),
1091
+                                'getpaid-nonce',
1092
+                                'getpaid-nonce'
1093
+                            )
1094
+                        );
1095
+                    ?>
1096 1096
                     " class="button button-primary"><?php esc_html_e( 'Run', 'invoicing' ); ?></a>
1097 1097
                 </td>
1098 1098
             </tr>
@@ -1105,8 +1105,8 @@  discard block
 block discarded – undo
1105 1105
                 <td>
1106 1106
 					<a href="
1107 1107
                     <?php
1108
-						echo esc_url( admin_url( 'index.php?page=gp-setup' ) );
1109
-					?>
1108
+                        echo esc_url( admin_url( 'index.php?page=gp-setup' ) );
1109
+                    ?>
1110 1110
                     " class="button button-primary"><?php esc_html_e( 'Launch', 'invoicing' ); ?></a>
1111 1111
                 </td>
1112 1112
             </tr>
@@ -1120,19 +1120,19 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
 
1122 1122
 function wpinv_descriptive_text_callback( $args ) {
1123
-	echo wp_kses_post( $args['desc'] );
1123
+    echo wp_kses_post( $args['desc'] );
1124 1124
 }
1125 1125
 
1126 1126
 function wpinv_raw_html_callback( $args ) {
1127
-	echo wp_kses( $args['desc'], getpaid_allowed_html() );
1127
+    echo wp_kses( $args['desc'], getpaid_allowed_html() );
1128 1128
 }
1129 1129
 
1130 1130
 function wpinv_hook_callback( $args ) {
1131
-	do_action( 'wpinv_' . $args['id'], $args );
1131
+    do_action( 'wpinv_' . $args['id'], $args );
1132 1132
 }
1133 1133
 
1134 1134
 function wpinv_set_settings_cap() {
1135
-	return wpinv_get_capability();
1135
+    return wpinv_get_capability();
1136 1136
 }
1137 1137
 add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' );
1138 1138
 
@@ -1156,15 +1156,15 @@  discard block
 block discarded – undo
1156 1156
  */
1157 1157
 function wpinv_get_merge_tags_help_text( $subscription = false ) {
1158 1158
 
1159
-	$url  = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f';
1160
-	$link = sprintf(
1161
-		'<strong><a href="%s" target="_blank">%s</a></strong>',
1162
-		$url,
1163
-		esc_html__( 'View available merge tags.', 'wpinv-quotes' )
1164
-	);
1159
+    $url  = $subscription ? 'https://gist.github.com/picocodes/3d213982d57c34edf7a46fd3f0e8583e' : 'https://gist.github.com/picocodes/43bdc4d4bbba844534b2722e2af0b58f';
1160
+    $link = sprintf(
1161
+        '<strong><a href="%s" target="_blank">%s</a></strong>',
1162
+        $url,
1163
+        esc_html__( 'View available merge tags.', 'wpinv-quotes' )
1164
+    );
1165 1165
 
1166
-	$description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' );
1166
+    $description = esc_html__( 'The content of the email (Merge Tags and HTML are allowed).', 'invoicing' );
1167 1167
 
1168
-	return "$description $link";
1168
+    return "$description $link";
1169 1169
 
1170 1170
 }
Please login to merge, or discard this patch.
ayecode/wp-ayecode-ui/includes/components/class-aui-component-input.php 1 patch
Indentation   +1214 added lines, -1214 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! defined( 'ABSPATH' ) ) {
4
-	exit; // Exit if accessed directly
4
+    exit; // Exit if accessed directly
5 5
 }
6 6
 
7 7
 /**
@@ -11,1233 +11,1233 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class AUI_Component_Input {
13 13
 
14
-	/**
15
-	 * Build the component.
16
-	 *
17
-	 * @param array $args
18
-	 *
19
-	 * @return string The rendered component.
20
-	 */
21
-	public static function input( $args = array() ) {
22
-		$defaults = array(
23
-			'type'                     => 'text',
24
-			'name'                     => '',
25
-			'class'                    => '',
26
-			'wrap_class'               => '',
27
-			'id'                       => '',
28
-			'placeholder'              => '',
29
-			'title'                    => '',
30
-			'value'                    => '',
31
-			'required'                 => false,
32
-			'size'                     => '', // sm, lg, small, large
33
-			'clear_icon'               => '', // true will show a clear icon, can't be used with input_group_right
34
-			'label'                    => '',
35
-			'label_after'              => false,
36
-			'label_class'              => '',
37
-			'label_col'                => '2',
38
-			'label_type'               => '', // top, horizontal, empty = hidden
39
-			'label_force_left'         => false, // used to force checkbox label left when using horizontal
40
-			// sets the label type, default: hidden. Options: hidden, top, horizontal, floating
41
-			'help_text'                => '',
42
-			'validation_text'          => '',
43
-			'validation_pattern'       => '',
44
-			'no_wrap'                  => false,
45
-			'input_group_right'        => '',
46
-			'input_group_left'         => '',
47
-			'input_group_right_inside' => false,
48
-			// forces the input group inside the input
49
-			'input_group_left_inside'  => false,
50
-			// forces the input group inside the input
51
-			'step'                     => '',
52
-			'switch'                   => false,
53
-			// to show checkbox as a switch
54
-			'checked'                  => false,
55
-			// set a checkbox or radio as selected
56
-			'password_toggle'          => true,
57
-			// toggle view/hide password
58
-			'element_require'          => '',
59
-			// [%element_id%] == "1"
60
-			'extra_attributes'         => array(),
61
-			// an array of extra attributes
62
-			'wrap_attributes'          => array()
63
-		);
64
-
65
-		/**
66
-		 * Parse incoming $args into an array and merge it with $defaults
67
-		 */
68
-		$args   = wp_parse_args( $args, $defaults );
69
-		$output = '';
70
-		if ( ! empty( $args['type'] ) ) {
71
-			// hidden label option needs to be empty
72
-			$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
73
-
74
-			$type = sanitize_html_class( $args['type'] );
75
-
76
-			$help_text   = '';
77
-			$label       = '';
78
-			$label_after = $args['label_after'];
79
-			$label_args  = array(
80
-				'title'      => $args['label'],
81
-				'for'        => $args['id'],
82
-				'class'      => $args['label_class'] . " ",
83
-				'label_type' => $args['label_type'],
84
-				'label_col'  => $args['label_col']
85
-			);
86
-
87
-			// floating labels need label after
88
-			if ( $args['label_type'] == 'floating' && $type != 'checkbox' ) {
89
-				$label_after         = true;
90
-				$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
91
-			}
92
-
93
-			// size
94
-			$size = '';
95
-			if ( $args['size'] == 'lg' || $args['size'] == 'large' ) {
96
-				$size = 'lg';
97
-				$args['class'] .= ' form-control-lg';
98
-			}elseif ( $args['size'] == 'sm' || $args['size'] == 'small' ) {
99
-				$size = 'sm';
100
-				$args['class'] .= ' form-control-sm';
101
-			}
102
-
103
-			// clear function
104
-			$clear_function = 'jQuery(this).parent().parent().find(\'input\').val(\'\');';
105
-
106
-			// Some special sauce for files
107
-			if ( $type == 'file' ) {
108
-				$label_after = true; // if type file we need the label after
109
-				$args['class'] .= ' custom-file-input ';
110
-			} elseif ( $type == 'checkbox' ) {
111
-				$label_after = true; // if type file we need the label after
112
-				$args['class'] .= ' custom-control-input ';
113
-			} elseif ( $type == 'datepicker' || $type == 'timepicker' ) {
114
-				$type = 'text';
115
-				$args['class'] .= ' bg-initial '; // @todo not sure why we have this?
116
-				$clear_function .= "jQuery(this).parent().parent().find('input[name=\'" . esc_attr( $args['name'] ) . "\']').trigger('change');";
117
-
118
-				$args['extra_attributes']['data-aui-init'] = 'flatpickr';
119
-
120
-				// set a way to clear field if empty
121
-				if ( $args['input_group_right'] === '' && $args['clear_icon'] !== false ) {
122
-					$args['input_group_right_inside'] = true;
123
-					$args['clear_icon'] = true;
124
-				}
125
-
126
-				// enqueue the script
127
-				$aui_settings = AyeCode_UI_Settings::instance();
128
-				$aui_settings->enqueue_flatpickr();
129
-			} elseif ( $type == 'iconpicker' ) {
130
-				$type = 'text';
131
-				//$args['class'] .= ' aui-flatpickr bg-initial ';
14
+    /**
15
+     * Build the component.
16
+     *
17
+     * @param array $args
18
+     *
19
+     * @return string The rendered component.
20
+     */
21
+    public static function input( $args = array() ) {
22
+        $defaults = array(
23
+            'type'                     => 'text',
24
+            'name'                     => '',
25
+            'class'                    => '',
26
+            'wrap_class'               => '',
27
+            'id'                       => '',
28
+            'placeholder'              => '',
29
+            'title'                    => '',
30
+            'value'                    => '',
31
+            'required'                 => false,
32
+            'size'                     => '', // sm, lg, small, large
33
+            'clear_icon'               => '', // true will show a clear icon, can't be used with input_group_right
34
+            'label'                    => '',
35
+            'label_after'              => false,
36
+            'label_class'              => '',
37
+            'label_col'                => '2',
38
+            'label_type'               => '', // top, horizontal, empty = hidden
39
+            'label_force_left'         => false, // used to force checkbox label left when using horizontal
40
+            // sets the label type, default: hidden. Options: hidden, top, horizontal, floating
41
+            'help_text'                => '',
42
+            'validation_text'          => '',
43
+            'validation_pattern'       => '',
44
+            'no_wrap'                  => false,
45
+            'input_group_right'        => '',
46
+            'input_group_left'         => '',
47
+            'input_group_right_inside' => false,
48
+            // forces the input group inside the input
49
+            'input_group_left_inside'  => false,
50
+            // forces the input group inside the input
51
+            'step'                     => '',
52
+            'switch'                   => false,
53
+            // to show checkbox as a switch
54
+            'checked'                  => false,
55
+            // set a checkbox or radio as selected
56
+            'password_toggle'          => true,
57
+            // toggle view/hide password
58
+            'element_require'          => '',
59
+            // [%element_id%] == "1"
60
+            'extra_attributes'         => array(),
61
+            // an array of extra attributes
62
+            'wrap_attributes'          => array()
63
+        );
64
+
65
+        /**
66
+         * Parse incoming $args into an array and merge it with $defaults
67
+         */
68
+        $args   = wp_parse_args( $args, $defaults );
69
+        $output = '';
70
+        if ( ! empty( $args['type'] ) ) {
71
+            // hidden label option needs to be empty
72
+            $args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
73
+
74
+            $type = sanitize_html_class( $args['type'] );
75
+
76
+            $help_text   = '';
77
+            $label       = '';
78
+            $label_after = $args['label_after'];
79
+            $label_args  = array(
80
+                'title'      => $args['label'],
81
+                'for'        => $args['id'],
82
+                'class'      => $args['label_class'] . " ",
83
+                'label_type' => $args['label_type'],
84
+                'label_col'  => $args['label_col']
85
+            );
86
+
87
+            // floating labels need label after
88
+            if ( $args['label_type'] == 'floating' && $type != 'checkbox' ) {
89
+                $label_after         = true;
90
+                $args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
91
+            }
92
+
93
+            // size
94
+            $size = '';
95
+            if ( $args['size'] == 'lg' || $args['size'] == 'large' ) {
96
+                $size = 'lg';
97
+                $args['class'] .= ' form-control-lg';
98
+            }elseif ( $args['size'] == 'sm' || $args['size'] == 'small' ) {
99
+                $size = 'sm';
100
+                $args['class'] .= ' form-control-sm';
101
+            }
102
+
103
+            // clear function
104
+            $clear_function = 'jQuery(this).parent().parent().find(\'input\').val(\'\');';
105
+
106
+            // Some special sauce for files
107
+            if ( $type == 'file' ) {
108
+                $label_after = true; // if type file we need the label after
109
+                $args['class'] .= ' custom-file-input ';
110
+            } elseif ( $type == 'checkbox' ) {
111
+                $label_after = true; // if type file we need the label after
112
+                $args['class'] .= ' custom-control-input ';
113
+            } elseif ( $type == 'datepicker' || $type == 'timepicker' ) {
114
+                $type = 'text';
115
+                $args['class'] .= ' bg-initial '; // @todo not sure why we have this?
116
+                $clear_function .= "jQuery(this).parent().parent().find('input[name=\'" . esc_attr( $args['name'] ) . "\']').trigger('change');";
117
+
118
+                $args['extra_attributes']['data-aui-init'] = 'flatpickr';
119
+
120
+                // set a way to clear field if empty
121
+                if ( $args['input_group_right'] === '' && $args['clear_icon'] !== false ) {
122
+                    $args['input_group_right_inside'] = true;
123
+                    $args['clear_icon'] = true;
124
+                }
125
+
126
+                // enqueue the script
127
+                $aui_settings = AyeCode_UI_Settings::instance();
128
+                $aui_settings->enqueue_flatpickr();
129
+            } elseif ( $type == 'iconpicker' ) {
130
+                $type = 'text';
131
+                //$args['class'] .= ' aui-flatpickr bg-initial ';
132 132
 //				$args['class'] .= ' bg-initial ';
133 133
 
134
-				$args['extra_attributes']['data-aui-init'] = 'iconpicker';
135
-				$args['extra_attributes']['data-placement'] = 'bottomRight';
134
+                $args['extra_attributes']['data-aui-init'] = 'iconpicker';
135
+                $args['extra_attributes']['data-placement'] = 'bottomRight';
136 136
 
137
-				$args['input_group_right'] = '<span class="input-group-addon input-group-text c-pointer"></span>';
137
+                $args['input_group_right'] = '<span class="input-group-addon input-group-text c-pointer"></span>';
138 138
 //				$args['input_group_right_inside'] = true;
139
-				// enqueue the script
140
-				$aui_settings = AyeCode_UI_Settings::instance();
141
-				$aui_settings->enqueue_iconpicker();
142
-			}
143
-
144
-			if ( $type == 'checkbox' && !empty($args['name'] ) && strpos($args['name'], '[') === false ) {
145
-				$output .= '<input type="hidden" name="' . esc_attr( $args['name'] ) . '" value="0" />';
146
-			}
147
-
148
-			// allow clear icon
149
-			if ( $args['input_group_right'] === '' && $args['clear_icon'] ) {
150
-				$font_size = $size == 'sm' ? '1.3' : ( $size == 'lg' ? '1.65' : '1.5' );
151
-				$args['input_group_right_inside'] = true;
152
-				$args['input_group_right'] = '<span class="input-group-text aui-clear-input c-pointer bg-initial border-0 px-2 d-none" onclick="' . $clear_function . '"><span style="font-size: '.$font_size.'rem" aria-hidden="true" class="close">&times;</span></span>';
153
-			}
154
-
155
-			// open/type
156
-			$output .= '<input type="' . $type . '" ';
157
-
158
-			// name
159
-			if ( ! empty( $args['name'] ) ) {
160
-				$output .= ' name="' . esc_attr( $args['name'] ) . '" ';
161
-			}
162
-
163
-			// id
164
-			if ( ! empty( $args['id'] ) ) {
165
-				$output .= ' id="' . sanitize_html_class( $args['id'] ) . '" ';
166
-			}
167
-
168
-			// placeholder
169
-			if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) {
170
-				$output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" ';
171
-			}
172
-
173
-			// title
174
-			if ( ! empty( $args['title'] ) ) {
175
-				$output .= ' title="' . esc_attr( $args['title'] ) . '" ';
176
-			}
177
-
178
-			// value
179
-			if ( ! empty( $args['value'] ) ) {
180
-				$output .= AUI_Component_Helper::value( $args['value'] );
181
-			}
182
-
183
-			// checked, for radio and checkboxes
184
-			if ( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ) {
185
-				$output .= ' checked ';
186
-			}
187
-
188
-			// validation text
189
-			if ( ! empty( $args['validation_text'] ) ) {
190
-				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr( $args['validation_text'] ) . '\')" ';
191
-				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
192
-			}
193
-
194
-			// validation_pattern
195
-			if ( ! empty( $args['validation_pattern'] ) ) {
196
-				$output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" ';
197
-			}
198
-
199
-			// step (for numbers)
200
-			if ( ! empty( $args['step'] ) ) {
201
-				$output .= ' step="' . $args['step'] . '" ';
202
-			}
203
-
204
-			// required
205
-			if ( ! empty( $args['required'] ) ) {
206
-				$output .= ' required ';
207
-			}
208
-
209
-			// class
210
-			$class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
211
-			$output .= ' class="form-control ' . $class . '" ';
212
-
213
-			// data-attributes
214
-			$output .= AUI_Component_Helper::data_attributes( $args );
215
-
216
-			// extra attributes
217
-			if ( ! empty( $args['extra_attributes'] ) ) {
218
-				$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
219
-			}
220
-
221
-			// close
222
-			$output .= ' >';
223
-
224
-			// help text
225
-			if ( ! empty( $args['help_text'] ) ) {
226
-				$help_text = AUI_Component_Helper::help_text( $args['help_text'] );
227
-			}
228
-
229
-			// label
230
-			if ( ! empty( $args['label'] ) ) {
231
-				$label_base_class = '';
232
-				if ( $type == 'file' ) {
233
-					$label_base_class = ' custom-file-label';
234
-				} elseif ( $type == 'checkbox' ) {
235
-					if ( ! empty( $args['label_force_left'] ) ) {
236
-						$label_args['title'] = wp_kses_post( $args['help_text'] );
237
-						$help_text = '';
238
-						//$label_args['class'] .= ' d-inline ';
239
-						$args['wrap_class'] .= ' align-items-center ';
240
-					}else{
241
-
242
-					}
243
-
244
-					$label_base_class = ' custom-control-label';
245
-				}
246
-				$label_args['class'] .= $label_base_class;
247
-				$temp_label_args = $label_args;
248
-				if(! empty( $args['label_force_left'] )){$temp_label_args['class'] = $label_base_class." text-muted";}
249
-				$label = self::label( $temp_label_args, $type );
250
-			}
251
-
252
-
253
-
254
-
255
-			// set help text in the correct position
256
-			if ( $label_after ) {
257
-				$output .= $label . $help_text;
258
-			}
259
-
260
-			// some input types need a separate wrap
261
-			if ( $type == 'file' ) {
262
-				$output = self::wrap( array(
263
-					'content' => $output,
264
-					'class'   => 'form-group custom-file'
265
-				) );
266
-			} elseif ( $type == 'checkbox' ) {
267
-
268
-				$label_args['title'] = $args['label'];
269
-				$label_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'label' );
270
-				$label = !empty( $args['label_force_left'] ) ? self::label( $label_args, 'cb' ) : '<div class="' . $label_col . ' col-form-label"></div>';
271
-				$switch_size_class = $args['switch'] && !is_bool( $args['switch'] ) ? ' custom-switch-'.esc_attr( $args['switch'] ) : '';
272
-				$wrap_class = $args['switch'] ? 'custom-switch'.$switch_size_class : 'custom-checkbox';
273
-				if ( ! empty( $args['label_force_left'] ) ) {
274
-					$wrap_class .= ' d-flex align-content-center';
275
-					$label = str_replace("custom-control-label","", self::label( $label_args, 'cb' ) );
276
-				}
277
-				$output     = self::wrap( array(
278
-					'content' => $output,
279
-					'class'   => 'custom-control ' . $wrap_class
280
-				) );
281
-
282
-				if ( $args['label_type'] == 'horizontal' ) {
283
-					$input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
284
-					$output    = $label . '<div class="' . $input_col . '">' . $output . '</div>';
285
-				}
286
-			} elseif ( $type == 'password' && $args['password_toggle'] && ! $args['input_group_right'] ) {
287
-
288
-
289
-				// allow password field to toggle view
290
-				$args['input_group_right'] = '<span class="input-group-text c-pointer px-3" 
139
+                // enqueue the script
140
+                $aui_settings = AyeCode_UI_Settings::instance();
141
+                $aui_settings->enqueue_iconpicker();
142
+            }
143
+
144
+            if ( $type == 'checkbox' && !empty($args['name'] ) && strpos($args['name'], '[') === false ) {
145
+                $output .= '<input type="hidden" name="' . esc_attr( $args['name'] ) . '" value="0" />';
146
+            }
147
+
148
+            // allow clear icon
149
+            if ( $args['input_group_right'] === '' && $args['clear_icon'] ) {
150
+                $font_size = $size == 'sm' ? '1.3' : ( $size == 'lg' ? '1.65' : '1.5' );
151
+                $args['input_group_right_inside'] = true;
152
+                $args['input_group_right'] = '<span class="input-group-text aui-clear-input c-pointer bg-initial border-0 px-2 d-none" onclick="' . $clear_function . '"><span style="font-size: '.$font_size.'rem" aria-hidden="true" class="close">&times;</span></span>';
153
+            }
154
+
155
+            // open/type
156
+            $output .= '<input type="' . $type . '" ';
157
+
158
+            // name
159
+            if ( ! empty( $args['name'] ) ) {
160
+                $output .= ' name="' . esc_attr( $args['name'] ) . '" ';
161
+            }
162
+
163
+            // id
164
+            if ( ! empty( $args['id'] ) ) {
165
+                $output .= ' id="' . sanitize_html_class( $args['id'] ) . '" ';
166
+            }
167
+
168
+            // placeholder
169
+            if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) {
170
+                $output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" ';
171
+            }
172
+
173
+            // title
174
+            if ( ! empty( $args['title'] ) ) {
175
+                $output .= ' title="' . esc_attr( $args['title'] ) . '" ';
176
+            }
177
+
178
+            // value
179
+            if ( ! empty( $args['value'] ) ) {
180
+                $output .= AUI_Component_Helper::value( $args['value'] );
181
+            }
182
+
183
+            // checked, for radio and checkboxes
184
+            if ( ( $type == 'checkbox' || $type == 'radio' ) && $args['checked'] ) {
185
+                $output .= ' checked ';
186
+            }
187
+
188
+            // validation text
189
+            if ( ! empty( $args['validation_text'] ) ) {
190
+                $output .= ' oninvalid="setCustomValidity(\'' . esc_attr( $args['validation_text'] ) . '\')" ';
191
+                $output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
192
+            }
193
+
194
+            // validation_pattern
195
+            if ( ! empty( $args['validation_pattern'] ) ) {
196
+                $output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" ';
197
+            }
198
+
199
+            // step (for numbers)
200
+            if ( ! empty( $args['step'] ) ) {
201
+                $output .= ' step="' . $args['step'] . '" ';
202
+            }
203
+
204
+            // required
205
+            if ( ! empty( $args['required'] ) ) {
206
+                $output .= ' required ';
207
+            }
208
+
209
+            // class
210
+            $class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
211
+            $output .= ' class="form-control ' . $class . '" ';
212
+
213
+            // data-attributes
214
+            $output .= AUI_Component_Helper::data_attributes( $args );
215
+
216
+            // extra attributes
217
+            if ( ! empty( $args['extra_attributes'] ) ) {
218
+                $output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
219
+            }
220
+
221
+            // close
222
+            $output .= ' >';
223
+
224
+            // help text
225
+            if ( ! empty( $args['help_text'] ) ) {
226
+                $help_text = AUI_Component_Helper::help_text( $args['help_text'] );
227
+            }
228
+
229
+            // label
230
+            if ( ! empty( $args['label'] ) ) {
231
+                $label_base_class = '';
232
+                if ( $type == 'file' ) {
233
+                    $label_base_class = ' custom-file-label';
234
+                } elseif ( $type == 'checkbox' ) {
235
+                    if ( ! empty( $args['label_force_left'] ) ) {
236
+                        $label_args['title'] = wp_kses_post( $args['help_text'] );
237
+                        $help_text = '';
238
+                        //$label_args['class'] .= ' d-inline ';
239
+                        $args['wrap_class'] .= ' align-items-center ';
240
+                    }else{
241
+
242
+                    }
243
+
244
+                    $label_base_class = ' custom-control-label';
245
+                }
246
+                $label_args['class'] .= $label_base_class;
247
+                $temp_label_args = $label_args;
248
+                if(! empty( $args['label_force_left'] )){$temp_label_args['class'] = $label_base_class." text-muted";}
249
+                $label = self::label( $temp_label_args, $type );
250
+            }
251
+
252
+
253
+
254
+
255
+            // set help text in the correct position
256
+            if ( $label_after ) {
257
+                $output .= $label . $help_text;
258
+            }
259
+
260
+            // some input types need a separate wrap
261
+            if ( $type == 'file' ) {
262
+                $output = self::wrap( array(
263
+                    'content' => $output,
264
+                    'class'   => 'form-group custom-file'
265
+                ) );
266
+            } elseif ( $type == 'checkbox' ) {
267
+
268
+                $label_args['title'] = $args['label'];
269
+                $label_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'label' );
270
+                $label = !empty( $args['label_force_left'] ) ? self::label( $label_args, 'cb' ) : '<div class="' . $label_col . ' col-form-label"></div>';
271
+                $switch_size_class = $args['switch'] && !is_bool( $args['switch'] ) ? ' custom-switch-'.esc_attr( $args['switch'] ) : '';
272
+                $wrap_class = $args['switch'] ? 'custom-switch'.$switch_size_class : 'custom-checkbox';
273
+                if ( ! empty( $args['label_force_left'] ) ) {
274
+                    $wrap_class .= ' d-flex align-content-center';
275
+                    $label = str_replace("custom-control-label","", self::label( $label_args, 'cb' ) );
276
+                }
277
+                $output     = self::wrap( array(
278
+                    'content' => $output,
279
+                    'class'   => 'custom-control ' . $wrap_class
280
+                ) );
281
+
282
+                if ( $args['label_type'] == 'horizontal' ) {
283
+                    $input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
284
+                    $output    = $label . '<div class="' . $input_col . '">' . $output . '</div>';
285
+                }
286
+            } elseif ( $type == 'password' && $args['password_toggle'] && ! $args['input_group_right'] ) {
287
+
288
+
289
+                // allow password field to toggle view
290
+                $args['input_group_right'] = '<span class="input-group-text c-pointer px-3" 
291 291
 onclick="var $el = jQuery(this).find(\'i\');$el.toggleClass(\'fa-eye fa-eye-slash\');
292 292
 var $eli = jQuery(this).parent().parent().find(\'input\');
293 293
 if($el.hasClass(\'fa-eye\'))
294 294
 {$eli.attr(\'type\',\'text\');}
295 295
 else{$eli.attr(\'type\',\'password\');}"
296 296
 ><i class="far fa-fw fa-eye-slash"></i></span>';
297
-			}
298
-
299
-			// input group wraps
300
-			if ( $args['input_group_left'] || $args['input_group_right'] ) {
301
-				$w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
302
-				$group_size = $size == 'lg' ? ' input-group-lg' : '';
303
-				$group_size = !$group_size && $size == 'sm' ? ' input-group-sm' : $group_size;
304
-
305
-				if ( $args['input_group_left'] ) {
306
-					$output = self::wrap( array(
307
-						'content'                 => $output,
308
-						'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 . $group_size : 'input-group' . $group_size,
309
-						'input_group_left'        => $args['input_group_left'],
310
-						'input_group_left_inside' => $args['input_group_left_inside']
311
-					) );
312
-				}
313
-				if ( $args['input_group_right'] ) {
314
-					$output = self::wrap( array(
315
-						'content'                  => $output,
316
-						'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 . $group_size : 'input-group' . $group_size,
317
-						'input_group_right'        => $args['input_group_right'],
318
-						'input_group_right_inside' => $args['input_group_right_inside']
319
-					) );
320
-				}
321
-
322
-			}
323
-
324
-			if ( ! $label_after ) {
325
-				$output .= $help_text;
326
-			}
327
-
328
-
329
-			if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) {
330
-				$output = self::wrap( array(
331
-					'content' => $output,
332
-					'class'   => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' )
333
-				) );
334
-			}
335
-
336
-			if ( ! $label_after ) {
337
-				$output = $label . $output;
338
-			}
339
-
340
-			// wrap
341
-			if ( ! $args['no_wrap'] ) {
342
-				$form_group_class = $args['label_type'] == 'floating' && $type != 'checkbox' ? 'form-label-group' : 'form-group';
343
-				$wrap_class       = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
344
-				$wrap_class       = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
345
-				$output           = self::wrap( array(
346
-					'content'         => $output,
347
-					'class'           => $wrap_class,
348
-					'element_require' => $args['element_require'],
349
-					'argument_id'     => $args['id'],
350
-					'wrap_attributes' => $args['wrap_attributes'],
351
-				) );
352
-			}
353
-		}
354
-
355
-		return $output;
356
-	}
357
-
358
-	public static function label( $args = array(), $type = '' ) {
359
-		//<label for="exampleInputEmail1">Email address</label>
360
-		$defaults = array(
361
-			'title'      => 'div',
362
-			'for'        => '',
363
-			'class'      => '',
364
-			'label_type' => '', // empty = hidden, top, horizontal
365
-			'label_col'  => '',
366
-		);
367
-
368
-		/**
369
-		 * Parse incoming $args into an array and merge it with $defaults
370
-		 */
371
-		$args   = wp_parse_args( $args, $defaults );
372
-		$output = '';
373
-
374
-		if ( $args['title'] ) {
375
-
376
-			// maybe hide labels //@todo set a global option for visibility class
377
-			if ( $type == 'file' || $type == 'checkbox' || $type == 'radio' || ! empty( $args['label_type'] ) ) {
378
-				$class = $args['class'];
379
-			} else {
380
-				$class = 'sr-only ' . $args['class'];
381
-			}
382
-
383
-			// maybe horizontal
384
-			if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) {
385
-				$class .= ' ' . AUI_Component_Helper::get_column_class( $args['label_col'], 'label' ) . ' col-form-label';
386
-			}
387
-
388
-			// open
389
-			$output .= '<label ';
390
-
391
-			// for
392
-			if ( ! empty( $args['for'] ) ) {
393
-				$output .= ' for="' . esc_attr( $args['for'] ) . '" ';
394
-			}
395
-
396
-			// class
397
-			$class = $class ? AUI_Component_Helper::esc_classes( $class ) : '';
398
-			$output .= ' class="' . $class . '" ';
399
-
400
-			// close
401
-			$output .= '>';
402
-
403
-
404
-			// title, don't escape fully as can contain html
405
-			if ( ! empty( $args['title'] ) ) {
406
-				$output .= wp_kses_post( $args['title'] );
407
-			}
408
-
409
-			// close wrap
410
-			$output .= '</label>';
411
-
412
-
413
-		}
414
-
415
-
416
-		return $output;
417
-	}
418
-
419
-	/**
420
-	 * Wrap some content in a HTML wrapper.
421
-	 *
422
-	 * @param array $args
423
-	 *
424
-	 * @return string
425
-	 */
426
-	public static function wrap( $args = array() ) {
427
-		$defaults = array(
428
-			'type'                     => 'div',
429
-			'class'                    => 'form-group',
430
-			'content'                  => '',
431
-			'input_group_left'         => '',
432
-			'input_group_right'        => '',
433
-			'input_group_left_inside'  => false,
434
-			'input_group_right_inside' => false,
435
-			'element_require'          => '',
436
-			'argument_id'              => '',
437
-			'wrap_attributes'          => array()
438
-		);
439
-
440
-		/**
441
-		 * Parse incoming $args into an array and merge it with $defaults
442
-		 */
443
-		$args   = wp_parse_args( $args, $defaults );
444
-		$output = '';
445
-		if ( $args['type'] ) {
446
-
447
-			// open
448
-			$output .= '<' . sanitize_html_class( $args['type'] );
449
-
450
-			// element require
451
-			if ( ! empty( $args['element_require'] ) ) {
452
-				$output .= AUI_Component_Helper::element_require( $args['element_require'] );
453
-				$args['class'] .= " aui-conditional-field";
454
-			}
455
-
456
-			// argument_id
457
-			if ( ! empty( $args['argument_id'] ) ) {
458
-				$output .= ' data-argument="' . esc_attr( $args['argument_id'] ) . '"';
459
-			}
460
-
461
-			// class
462
-			$class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
463
-			$output .= ' class="' . $class . '" ';
464
-
465
-			// Attributes
466
-			if ( ! empty( $args['wrap_attributes'] ) ) {
467
-				$output .= AUI_Component_Helper::extra_attributes( $args['wrap_attributes'] );
468
-			}
469
-
470
-			// close wrap
471
-			$output .= ' >';
472
-
473
-
474
-			// Input group left
475
-			if ( ! empty( $args['input_group_left'] ) ) {
476
-				$position_class   = ! empty( $args['input_group_left_inside'] ) ? 'position-absolute h-100' : '';
477
-				$input_group_left = strpos( $args['input_group_left'], '<' ) !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>';
478
-				$output .= '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>';
479
-			}
480
-
481
-			// content
482
-			$output .= $args['content'];
483
-
484
-			// Input group right
485
-			if ( ! empty( $args['input_group_right'] ) ) {
486
-				$position_class    = ! empty( $args['input_group_right_inside'] ) ? 'position-absolute h-100' : '';
487
-				$input_group_right = strpos( $args['input_group_right'], '<' ) !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>';
488
-				$output .= '<div class="input-group-append ' . $position_class . '" style="top:0;right:0;">' . $input_group_right . '</div>';
489
-			}
490
-
491
-
492
-			// close wrap
493
-			$output .= '</' . sanitize_html_class( $args['type'] ) . '>';
494
-
495
-
496
-		} else {
497
-			$output = $args['content'];
498
-		}
499
-
500
-		return $output;
501
-	}
502
-
503
-	/**
504
-	 * Build the component.
505
-	 *
506
-	 * @param array $args
507
-	 *
508
-	 * @return string The rendered component.
509
-	 */
510
-	public static function textarea( $args = array() ) {
511
-		$defaults = array(
512
-			'name'               => '',
513
-			'class'              => '',
514
-			'wrap_class'         => '',
515
-			'id'                 => '',
516
-			'placeholder'        => '',
517
-			'title'              => '',
518
-			'value'              => '',
519
-			'required'           => false,
520
-			'label'              => '',
521
-			'label_after'        => false,
522
-			'label_class'        => '',
523
-			'label_type'         => '',
524
-			'label_col'          => '',
525
-			// sets the label type, default: hidden. Options: hidden, top, horizontal, floating
526
-			'input_group_right'        => '',
527
-			'input_group_left'         => '',
528
-			'input_group_right_inside' => false,
529
-			'help_text'          => '',
530
-			'validation_text'    => '',
531
-			'validation_pattern' => '',
532
-			'no_wrap'            => false,
533
-			'rows'               => '',
534
-			'wysiwyg'            => false,
535
-			'allow_tags'         => false,
536
-			// Allow HTML tags
537
-			'element_require'    => '',
538
-			// [%element_id%] == "1"
539
-			'extra_attributes'   => array(),
540
-			// an array of extra attributes
541
-			'wrap_attributes'    => array(),
542
-		);
543
-
544
-		/**
545
-		 * Parse incoming $args into an array and merge it with $defaults
546
-		 */
547
-		$args   = wp_parse_args( $args, $defaults );
548
-		$output = '';
549
-
550
-		// hidden label option needs to be empty
551
-		$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
552
-
553
-		// floating labels don't work with wysiwyg so set it as top
554
-		if ( $args['label_type'] == 'floating' && ! empty( $args['wysiwyg'] ) ) {
555
-			$args['label_type'] = 'top';
556
-		}
557
-
558
-		$label_after = $args['label_after'];
559
-
560
-		// floating labels need label after
561
-		if ( $args['label_type'] == 'floating' && empty( $args['wysiwyg'] ) ) {
562
-			$label_after         = true;
563
-			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
564
-		}
565
-
566
-		// label
567
-		if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
568
-		} elseif ( ! empty( $args['label'] ) && ! $label_after ) {
569
-			$label_args = array(
570
-				'title'      => $args['label'],
571
-				'for'        => $args['id'],
572
-				'class'      => $args['label_class'] . " ",
573
-				'label_type' => $args['label_type'],
574
-				'label_col'  => $args['label_col']
575
-			);
576
-			$output .= self::label( $label_args );
577
-		}
578
-
579
-		// maybe horizontal label
580
-		if ( $args['label_type'] == 'horizontal' ) {
581
-			$input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
582
-			$output .= '<div class="' . $input_col . '">';
583
-		}
584
-
585
-		if ( ! empty( $args['wysiwyg'] ) ) {
586
-			ob_start();
587
-			$content   = $args['value'];
588
-			$editor_id = ! empty( $args['id'] ) ? sanitize_html_class( $args['id'] ) : 'wp_editor';
589
-			$settings  = array(
590
-				'textarea_rows' => ! empty( absint( $args['rows'] ) ) ? absint( $args['rows'] ) : 4,
591
-				'quicktags'     => false,
592
-				'media_buttons' => false,
593
-				'editor_class'  => 'form-control',
594
-				'textarea_name' => ! empty( $args['name'] ) ? sanitize_html_class( $args['name'] ) : sanitize_html_class( $args['id'] ),
595
-				'teeny'         => true,
596
-			);
597
-
598
-			// maybe set settings if array
599
-			if ( is_array( $args['wysiwyg'] ) ) {
600
-				$settings = wp_parse_args( $args['wysiwyg'], $settings );
601
-			}
602
-
603
-			wp_editor( $content, $editor_id, $settings );
604
-			$output .= ob_get_clean();
605
-		} else {
606
-
607
-			// open
608
-			$output .= '<textarea ';
609
-
610
-			// name
611
-			if ( ! empty( $args['name'] ) ) {
612
-				$output .= ' name="' . esc_attr( $args['name'] ) . '" ';
613
-			}
614
-
615
-			// id
616
-			if ( ! empty( $args['id'] ) ) {
617
-				$output .= ' id="' . sanitize_html_class( $args['id'] ) . '" ';
618
-			}
619
-
620
-			// placeholder
621
-			if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) {
622
-				$output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" ';
623
-			}
624
-
625
-			// title
626
-			if ( ! empty( $args['title'] ) ) {
627
-				$output .= ' title="' . esc_attr( $args['title'] ) . '" ';
628
-			}
629
-
630
-			// validation text
631
-			if ( ! empty( $args['validation_text'] ) ) {
632
-				$output .= ' oninvalid="setCustomValidity(\'' . esc_attr( $args['validation_text'] ) . '\')" ';
633
-				$output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
634
-			}
635
-
636
-			// validation_pattern
637
-			if ( ! empty( $args['validation_pattern'] ) ) {
638
-				$output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" ';
639
-			}
640
-
641
-			// required
642
-			if ( ! empty( $args['required'] ) ) {
643
-				$output .= ' required ';
644
-			}
645
-
646
-			// rows
647
-			if ( ! empty( $args['rows'] ) ) {
648
-				$output .= ' rows="' . absint( $args['rows'] ) . '" ';
649
-			}
650
-
651
-
652
-			// class
653
-			$class = ! empty( $args['class'] ) ? $args['class'] : '';
654
-			$output .= ' class="form-control ' . $class . '" ';
655
-
656
-			// extra attributes
657
-			if ( ! empty( $args['extra_attributes'] ) ) {
658
-				$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
659
-			}
660
-
661
-			// close tag
662
-			$output .= ' >';
663
-
664
-			// value
665
-			if ( ! empty( $args['value'] ) ) {
666
-				if ( ! empty( $args['allow_tags'] ) ) {
667
-					$output .= AUI_Component_Helper::sanitize_html_field( $args['value'], $args ); // Sanitize HTML.
668
-				} else {
669
-					$output .= AUI_Component_Helper::sanitize_textarea_field( $args['value'] );
670
-				}
671
-			}
672
-
673
-			// closing tag
674
-			$output .= '</textarea>';
675
-
676
-
677
-			// input group wraps
678
-			if ( $args['input_group_left'] || $args['input_group_right'] ) {
679
-				$w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
680
-				if ( $args['input_group_left'] ) {
681
-					$output = self::wrap( array(
682
-						'content'                 => $output,
683
-						'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
684
-						'input_group_left'        => $args['input_group_left'],
685
-						'input_group_left_inside' => $args['input_group_left_inside']
686
-					) );
687
-				}
688
-				if ( $args['input_group_right'] ) {
689
-					$output = self::wrap( array(
690
-						'content'                  => $output,
691
-						'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
692
-						'input_group_right'        => $args['input_group_right'],
693
-						'input_group_right_inside' => $args['input_group_right_inside']
694
-					) );
695
-				}
696
-
697
-			}
698
-
699
-
700
-		}
701
-
702
-		if ( ! empty( $args['label'] ) && $label_after ) {
703
-			$label_args = array(
704
-				'title'      => $args['label'],
705
-				'for'        => $args['id'],
706
-				'class'      => $args['label_class'] . " ",
707
-				'label_type' => $args['label_type'],
708
-				'label_col'  => $args['label_col']
709
-			);
710
-			$output .= self::label( $label_args );
711
-		}
712
-
713
-		// help text
714
-		if ( ! empty( $args['help_text'] ) ) {
715
-			$output .= AUI_Component_Helper::help_text( $args['help_text'] );
716
-		}
717
-
718
-		// maybe horizontal label
719
-		if ( $args['label_type'] == 'horizontal' ) {
720
-			$output .= '</div>';
721
-		}
722
-
723
-
724
-		// wrap
725
-		if ( ! $args['no_wrap'] ) {
726
-			$form_group_class = $args['label_type'] == 'floating' ? 'form-label-group' : 'form-group';
727
-			$wrap_class       = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
728
-			$wrap_class       = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
729
-			$output           = self::wrap( array(
730
-				'content'         => $output,
731
-				'class'           => $wrap_class,
732
-				'element_require' => $args['element_require'],
733
-				'argument_id'     => $args['id'],
734
-				'wrap_attributes' => $args['wrap_attributes'],
735
-			) );
736
-		}
737
-
738
-
739
-		return $output;
740
-	}
741
-
742
-	/**
743
-	 * Build the component.
744
-	 *
745
-	 * @param array $args
746
-	 *
747
-	 * @return string The rendered component.
748
-	 */
749
-	public static function select( $args = array() ) {
750
-		$defaults = array(
751
-			'class'            => '',
752
-			'wrap_class'       => '',
753
-			'id'               => '',
754
-			'title'            => '',
755
-			'value'            => '',
756
-			// can be an array or a string
757
-			'required'         => false,
758
-			'label'            => '',
759
-			'label_after'      => false,
760
-			'label_type'       => '',
761
-			'label_col'        => '',
762
-			// sets the label type, default: hidden. Options: hidden, top, horizontal, floating
763
-			'label_class'      => '',
764
-			'help_text'        => '',
765
-			'placeholder'      => '',
766
-			'options'          => array(),
767
-			// array or string
768
-			'icon'             => '',
769
-			'multiple'         => false,
770
-			'select2'          => false,
771
-			'no_wrap'          => false,
772
-			'input_group_right' => '',
773
-			'input_group_left' => '',
774
-			'input_group_right_inside' => false, // forces the input group inside the input
775
-			'input_group_left_inside' => false, // forces the input group inside the input
776
-			'element_require'  => '',
777
-			// [%element_id%] == "1"
778
-			'extra_attributes' => array(),
779
-			// an array of extra attributes
780
-			'wrap_attributes'  => array(),
781
-		);
782
-
783
-		/**
784
-		 * Parse incoming $args into an array and merge it with $defaults
785
-		 */
786
-		$args   = wp_parse_args( $args, $defaults );
787
-		$output = '';
788
-
789
-		// for now lets hide floating labels
790
-		if ( $args['label_type'] == 'floating' ) {
791
-			$args['label_type'] = 'hidden';
792
-		}
793
-
794
-		// hidden label option needs to be empty
795
-		$args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
796
-
797
-
798
-		$label_after = $args['label_after'];
799
-
800
-		// floating labels need label after
801
-		if ( $args['label_type'] == 'floating' ) {
802
-			$label_after         = true;
803
-			$args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
804
-		}
805
-
806
-		// Maybe setup select2
807
-		$is_select2 = false;
808
-		if ( ! empty( $args['select2'] ) ) {
809
-			$args['class'] .= ' aui-select2';
810
-			$is_select2 = true;
811
-		} elseif ( strpos( $args['class'], 'aui-select2' ) !== false ) {
812
-			$is_select2 = true;
813
-		}
814
-
815
-		// select2 tags
816
-		if ( ! empty( $args['select2'] ) && $args['select2'] === 'tags' ) { // triple equals needed here for some reason
817
-			$args['data-tags']             = 'true';
818
-			$args['data-token-separators'] = "[',']";
819
-			$args['multiple']              = true;
820
-		}
821
-
822
-		// select2 placeholder
823
-		if ( $is_select2 && isset( $args['placeholder'] ) && '' != $args['placeholder'] && empty( $args['data-placeholder'] ) ) {
824
-			$args['data-placeholder'] = esc_attr( $args['placeholder'] );
825
-			$args['data-allow-clear'] = isset( $args['data-allow-clear'] ) ? (bool) $args['data-allow-clear'] : true;
826
-		}
827
-
828
-		// Set hidden input to save empty value for multiselect.
829
-		if ( ! empty( $args['multiple'] ) && ! empty( $args['name'] ) ) {
830
-			$output .= '<input type="hidden" ' . AUI_Component_Helper::name( $args['name'] ) . ' value="" data-ignore-rule/>';
831
-		}
832
-
833
-		// open/type
834
-		$output .= '<select ';
835
-
836
-		// style
837
-		if ( $is_select2 && !($args['input_group_left'] || $args['input_group_right'])) {
838
-			$output .= " style='width:100%;' ";
839
-		}
840
-
841
-		// element require
842
-		if ( ! empty( $args['element_require'] ) ) {
843
-			$output .= AUI_Component_Helper::element_require( $args['element_require'] );
844
-			$args['class'] .= " aui-conditional-field";
845
-		}
846
-
847
-		// class
848
-		$class = ! empty( $args['class'] ) ? $args['class'] : '';
849
-		$output .= AUI_Component_Helper::class_attr( 'custom-select ' . $class );
850
-
851
-		// name
852
-		if ( ! empty( $args['name'] ) ) {
853
-			$output .= AUI_Component_Helper::name( $args['name'], $args['multiple'] );
854
-		}
855
-
856
-		// id
857
-		if ( ! empty( $args['id'] ) ) {
858
-			$output .= AUI_Component_Helper::id( $args['id'] );
859
-		}
860
-
861
-		// title
862
-		if ( ! empty( $args['title'] ) ) {
863
-			$output .= AUI_Component_Helper::title( $args['title'] );
864
-		}
865
-
866
-		// data-attributes
867
-		$output .= AUI_Component_Helper::data_attributes( $args );
868
-
869
-		// aria-attributes
870
-		$output .= AUI_Component_Helper::aria_attributes( $args );
871
-
872
-		// extra attributes
873
-		if ( ! empty( $args['extra_attributes'] ) ) {
874
-			$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
875
-		}
876
-
877
-		// required
878
-		if ( ! empty( $args['required'] ) ) {
879
-			$output .= ' required ';
880
-		}
881
-
882
-		// multiple
883
-		if ( ! empty( $args['multiple'] ) ) {
884
-			$output .= ' multiple ';
885
-		}
886
-
887
-		// close opening tag
888
-		$output .= ' >';
889
-
890
-		// placeholder
891
-		if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] && ! $is_select2 ) {
892
-			$output .= '<option value="" disabled selected hidden>' . esc_attr( $args['placeholder'] ) . '</option>';
893
-		} elseif ( $is_select2 && ! empty( $args['placeholder'] ) ) {
894
-			$output .= "<option></option>"; // select2 needs an empty select to fill the placeholder
895
-		}
896
-
897
-		// Options
898
-		if ( ! empty( $args['options'] ) ) {
899
-
900
-			if ( ! is_array( $args['options'] ) ) {
901
-				$output .= $args['options']; // not the preferred way but an option
902
-			} else {
903
-				foreach ( $args['options'] as $val => $name ) {
904
-					$selected = '';
905
-					if ( is_array( $name ) ) {
906
-						if ( isset( $name['optgroup'] ) && ( $name['optgroup'] == 'start' || $name['optgroup'] == 'end' ) ) {
907
-							$option_label = isset( $name['label'] ) ? $name['label'] : '';
908
-
909
-							$output .= $name['optgroup'] == 'start' ? '<optgroup label="' . esc_attr( $option_label ) . '">' : '</optgroup>';
910
-						} else {
911
-							$option_label = isset( $name['label'] ) ? $name['label'] : '';
912
-							$option_value = isset( $name['value'] ) ? $name['value'] : '';
913
-							$extra_attributes = !empty($name['extra_attributes']) ? AUI_Component_Helper::extra_attributes( $name['extra_attributes'] ) : '';
914
-							if ( ! empty( $args['multiple'] ) && ! empty( $args['value'] ) && is_array( $args['value'] ) ) {
915
-								$selected = in_array( $option_value, stripslashes_deep( $args['value'] ) ) ? "selected" : "";
916
-							} elseif ( ! empty( $args['value'] ) ) {
917
-								$selected = selected( $option_value, stripslashes_deep( $args['value'] ), false );
918
-							} elseif ( empty( $args['value'] ) && $args['value'] === $option_value ) {
919
-								$selected = selected( $option_value, $args['value'], false );
920
-							}
921
-
922
-							$output .= '<option value="' . esc_attr( $option_value ) . '" ' . $selected . ' '.$extra_attributes .'>' . $option_label . '</option>';
923
-						}
924
-					} else {
925
-						if ( ! empty( $args['value'] ) ) {
926
-							if ( is_array( $args['value'] ) ) {
927
-								$selected = in_array( $val, $args['value'] ) ? 'selected="selected"' : '';
928
-							} elseif ( ! empty( $args['value'] ) ) {
929
-								$selected = selected( $args['value'], $val, false );
930
-							}
931
-						} elseif ( $args['value'] === $val ) {
932
-							$selected = selected( $args['value'], $val, false );
933
-						}
934
-						$output .= '<option value="' . esc_attr( $val ) . '" ' . $selected . '>' . esc_attr( $name ) . '</option>';
935
-					}
936
-				}
937
-			}
938
-
939
-		}
940
-
941
-		// closing tag
942
-		$output .= '</select>';
943
-
944
-		$label = '';
945
-		$help_text = '';
946
-		// label
947
-		if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
948
-		} elseif ( ! empty( $args['label'] ) && ! $label_after ) {
949
-			$label_args = array(
950
-				'title'      => $args['label'],
951
-				'for'        => $args['id'],
952
-				'class'      => $args['label_class'] . " ",
953
-				'label_type' => $args['label_type'],
954
-				'label_col'  => $args['label_col']
955
-			);
956
-			$label = self::label( $label_args );
957
-		}
958
-
959
-		// help text
960
-		if ( ! empty( $args['help_text'] ) ) {
961
-			$help_text = AUI_Component_Helper::help_text( $args['help_text'] );
962
-		}
963
-
964
-		// input group wraps
965
-		if ( $args['input_group_left'] || $args['input_group_right'] ) {
966
-			$w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
967
-			if ( $args['input_group_left'] ) {
968
-				$output = self::wrap( array(
969
-					'content'                 => $output,
970
-					'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
971
-					'input_group_left'        => $args['input_group_left'],
972
-					'input_group_left_inside' => $args['input_group_left_inside']
973
-				) );
974
-			}
975
-			if ( $args['input_group_right'] ) {
976
-				$output = self::wrap( array(
977
-					'content'                  => $output,
978
-					'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
979
-					'input_group_right'        => $args['input_group_right'],
980
-					'input_group_right_inside' => $args['input_group_right_inside']
981
-				) );
982
-			}
983
-
984
-		}
985
-
986
-		if ( ! $label_after ) {
987
-			$output .= $help_text;
988
-		}
989
-
990
-
991
-		if ( $args['label_type'] == 'horizontal' ) {
992
-			$output = self::wrap( array(
993
-				'content' => $output,
994
-				'class'   => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' )
995
-			) );
996
-		}
997
-
998
-		if ( ! $label_after ) {
999
-			$output = $label . $output;
1000
-		}
1001
-
1002
-		// maybe horizontal label
297
+            }
298
+
299
+            // input group wraps
300
+            if ( $args['input_group_left'] || $args['input_group_right'] ) {
301
+                $w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
302
+                $group_size = $size == 'lg' ? ' input-group-lg' : '';
303
+                $group_size = !$group_size && $size == 'sm' ? ' input-group-sm' : $group_size;
304
+
305
+                if ( $args['input_group_left'] ) {
306
+                    $output = self::wrap( array(
307
+                        'content'                 => $output,
308
+                        'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 . $group_size : 'input-group' . $group_size,
309
+                        'input_group_left'        => $args['input_group_left'],
310
+                        'input_group_left_inside' => $args['input_group_left_inside']
311
+                    ) );
312
+                }
313
+                if ( $args['input_group_right'] ) {
314
+                    $output = self::wrap( array(
315
+                        'content'                  => $output,
316
+                        'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 . $group_size : 'input-group' . $group_size,
317
+                        'input_group_right'        => $args['input_group_right'],
318
+                        'input_group_right_inside' => $args['input_group_right_inside']
319
+                    ) );
320
+                }
321
+
322
+            }
323
+
324
+            if ( ! $label_after ) {
325
+                $output .= $help_text;
326
+            }
327
+
328
+
329
+            if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) {
330
+                $output = self::wrap( array(
331
+                    'content' => $output,
332
+                    'class'   => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' )
333
+                ) );
334
+            }
335
+
336
+            if ( ! $label_after ) {
337
+                $output = $label . $output;
338
+            }
339
+
340
+            // wrap
341
+            if ( ! $args['no_wrap'] ) {
342
+                $form_group_class = $args['label_type'] == 'floating' && $type != 'checkbox' ? 'form-label-group' : 'form-group';
343
+                $wrap_class       = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
344
+                $wrap_class       = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
345
+                $output           = self::wrap( array(
346
+                    'content'         => $output,
347
+                    'class'           => $wrap_class,
348
+                    'element_require' => $args['element_require'],
349
+                    'argument_id'     => $args['id'],
350
+                    'wrap_attributes' => $args['wrap_attributes'],
351
+                ) );
352
+            }
353
+        }
354
+
355
+        return $output;
356
+    }
357
+
358
+    public static function label( $args = array(), $type = '' ) {
359
+        //<label for="exampleInputEmail1">Email address</label>
360
+        $defaults = array(
361
+            'title'      => 'div',
362
+            'for'        => '',
363
+            'class'      => '',
364
+            'label_type' => '', // empty = hidden, top, horizontal
365
+            'label_col'  => '',
366
+        );
367
+
368
+        /**
369
+         * Parse incoming $args into an array and merge it with $defaults
370
+         */
371
+        $args   = wp_parse_args( $args, $defaults );
372
+        $output = '';
373
+
374
+        if ( $args['title'] ) {
375
+
376
+            // maybe hide labels //@todo set a global option for visibility class
377
+            if ( $type == 'file' || $type == 'checkbox' || $type == 'radio' || ! empty( $args['label_type'] ) ) {
378
+                $class = $args['class'];
379
+            } else {
380
+                $class = 'sr-only ' . $args['class'];
381
+            }
382
+
383
+            // maybe horizontal
384
+            if ( $args['label_type'] == 'horizontal' && $type != 'checkbox' ) {
385
+                $class .= ' ' . AUI_Component_Helper::get_column_class( $args['label_col'], 'label' ) . ' col-form-label';
386
+            }
387
+
388
+            // open
389
+            $output .= '<label ';
390
+
391
+            // for
392
+            if ( ! empty( $args['for'] ) ) {
393
+                $output .= ' for="' . esc_attr( $args['for'] ) . '" ';
394
+            }
395
+
396
+            // class
397
+            $class = $class ? AUI_Component_Helper::esc_classes( $class ) : '';
398
+            $output .= ' class="' . $class . '" ';
399
+
400
+            // close
401
+            $output .= '>';
402
+
403
+
404
+            // title, don't escape fully as can contain html
405
+            if ( ! empty( $args['title'] ) ) {
406
+                $output .= wp_kses_post( $args['title'] );
407
+            }
408
+
409
+            // close wrap
410
+            $output .= '</label>';
411
+
412
+
413
+        }
414
+
415
+
416
+        return $output;
417
+    }
418
+
419
+    /**
420
+     * Wrap some content in a HTML wrapper.
421
+     *
422
+     * @param array $args
423
+     *
424
+     * @return string
425
+     */
426
+    public static function wrap( $args = array() ) {
427
+        $defaults = array(
428
+            'type'                     => 'div',
429
+            'class'                    => 'form-group',
430
+            'content'                  => '',
431
+            'input_group_left'         => '',
432
+            'input_group_right'        => '',
433
+            'input_group_left_inside'  => false,
434
+            'input_group_right_inside' => false,
435
+            'element_require'          => '',
436
+            'argument_id'              => '',
437
+            'wrap_attributes'          => array()
438
+        );
439
+
440
+        /**
441
+         * Parse incoming $args into an array and merge it with $defaults
442
+         */
443
+        $args   = wp_parse_args( $args, $defaults );
444
+        $output = '';
445
+        if ( $args['type'] ) {
446
+
447
+            // open
448
+            $output .= '<' . sanitize_html_class( $args['type'] );
449
+
450
+            // element require
451
+            if ( ! empty( $args['element_require'] ) ) {
452
+                $output .= AUI_Component_Helper::element_require( $args['element_require'] );
453
+                $args['class'] .= " aui-conditional-field";
454
+            }
455
+
456
+            // argument_id
457
+            if ( ! empty( $args['argument_id'] ) ) {
458
+                $output .= ' data-argument="' . esc_attr( $args['argument_id'] ) . '"';
459
+            }
460
+
461
+            // class
462
+            $class = ! empty( $args['class'] ) ? AUI_Component_Helper::esc_classes( $args['class'] ) : '';
463
+            $output .= ' class="' . $class . '" ';
464
+
465
+            // Attributes
466
+            if ( ! empty( $args['wrap_attributes'] ) ) {
467
+                $output .= AUI_Component_Helper::extra_attributes( $args['wrap_attributes'] );
468
+            }
469
+
470
+            // close wrap
471
+            $output .= ' >';
472
+
473
+
474
+            // Input group left
475
+            if ( ! empty( $args['input_group_left'] ) ) {
476
+                $position_class   = ! empty( $args['input_group_left_inside'] ) ? 'position-absolute h-100' : '';
477
+                $input_group_left = strpos( $args['input_group_left'], '<' ) !== false ? $args['input_group_left'] : '<span class="input-group-text">' . $args['input_group_left'] . '</span>';
478
+                $output .= '<div class="input-group-prepend ' . $position_class . '">' . $input_group_left . '</div>';
479
+            }
480
+
481
+            // content
482
+            $output .= $args['content'];
483
+
484
+            // Input group right
485
+            if ( ! empty( $args['input_group_right'] ) ) {
486
+                $position_class    = ! empty( $args['input_group_right_inside'] ) ? 'position-absolute h-100' : '';
487
+                $input_group_right = strpos( $args['input_group_right'], '<' ) !== false ? $args['input_group_right'] : '<span class="input-group-text">' . $args['input_group_right'] . '</span>';
488
+                $output .= '<div class="input-group-append ' . $position_class . '" style="top:0;right:0;">' . $input_group_right . '</div>';
489
+            }
490
+
491
+
492
+            // close wrap
493
+            $output .= '</' . sanitize_html_class( $args['type'] ) . '>';
494
+
495
+
496
+        } else {
497
+            $output = $args['content'];
498
+        }
499
+
500
+        return $output;
501
+    }
502
+
503
+    /**
504
+     * Build the component.
505
+     *
506
+     * @param array $args
507
+     *
508
+     * @return string The rendered component.
509
+     */
510
+    public static function textarea( $args = array() ) {
511
+        $defaults = array(
512
+            'name'               => '',
513
+            'class'              => '',
514
+            'wrap_class'         => '',
515
+            'id'                 => '',
516
+            'placeholder'        => '',
517
+            'title'              => '',
518
+            'value'              => '',
519
+            'required'           => false,
520
+            'label'              => '',
521
+            'label_after'        => false,
522
+            'label_class'        => '',
523
+            'label_type'         => '',
524
+            'label_col'          => '',
525
+            // sets the label type, default: hidden. Options: hidden, top, horizontal, floating
526
+            'input_group_right'        => '',
527
+            'input_group_left'         => '',
528
+            'input_group_right_inside' => false,
529
+            'help_text'          => '',
530
+            'validation_text'    => '',
531
+            'validation_pattern' => '',
532
+            'no_wrap'            => false,
533
+            'rows'               => '',
534
+            'wysiwyg'            => false,
535
+            'allow_tags'         => false,
536
+            // Allow HTML tags
537
+            'element_require'    => '',
538
+            // [%element_id%] == "1"
539
+            'extra_attributes'   => array(),
540
+            // an array of extra attributes
541
+            'wrap_attributes'    => array(),
542
+        );
543
+
544
+        /**
545
+         * Parse incoming $args into an array and merge it with $defaults
546
+         */
547
+        $args   = wp_parse_args( $args, $defaults );
548
+        $output = '';
549
+
550
+        // hidden label option needs to be empty
551
+        $args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
552
+
553
+        // floating labels don't work with wysiwyg so set it as top
554
+        if ( $args['label_type'] == 'floating' && ! empty( $args['wysiwyg'] ) ) {
555
+            $args['label_type'] = 'top';
556
+        }
557
+
558
+        $label_after = $args['label_after'];
559
+
560
+        // floating labels need label after
561
+        if ( $args['label_type'] == 'floating' && empty( $args['wysiwyg'] ) ) {
562
+            $label_after         = true;
563
+            $args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
564
+        }
565
+
566
+        // label
567
+        if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
568
+        } elseif ( ! empty( $args['label'] ) && ! $label_after ) {
569
+            $label_args = array(
570
+                'title'      => $args['label'],
571
+                'for'        => $args['id'],
572
+                'class'      => $args['label_class'] . " ",
573
+                'label_type' => $args['label_type'],
574
+                'label_col'  => $args['label_col']
575
+            );
576
+            $output .= self::label( $label_args );
577
+        }
578
+
579
+        // maybe horizontal label
580
+        if ( $args['label_type'] == 'horizontal' ) {
581
+            $input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
582
+            $output .= '<div class="' . $input_col . '">';
583
+        }
584
+
585
+        if ( ! empty( $args['wysiwyg'] ) ) {
586
+            ob_start();
587
+            $content   = $args['value'];
588
+            $editor_id = ! empty( $args['id'] ) ? sanitize_html_class( $args['id'] ) : 'wp_editor';
589
+            $settings  = array(
590
+                'textarea_rows' => ! empty( absint( $args['rows'] ) ) ? absint( $args['rows'] ) : 4,
591
+                'quicktags'     => false,
592
+                'media_buttons' => false,
593
+                'editor_class'  => 'form-control',
594
+                'textarea_name' => ! empty( $args['name'] ) ? sanitize_html_class( $args['name'] ) : sanitize_html_class( $args['id'] ),
595
+                'teeny'         => true,
596
+            );
597
+
598
+            // maybe set settings if array
599
+            if ( is_array( $args['wysiwyg'] ) ) {
600
+                $settings = wp_parse_args( $args['wysiwyg'], $settings );
601
+            }
602
+
603
+            wp_editor( $content, $editor_id, $settings );
604
+            $output .= ob_get_clean();
605
+        } else {
606
+
607
+            // open
608
+            $output .= '<textarea ';
609
+
610
+            // name
611
+            if ( ! empty( $args['name'] ) ) {
612
+                $output .= ' name="' . esc_attr( $args['name'] ) . '" ';
613
+            }
614
+
615
+            // id
616
+            if ( ! empty( $args['id'] ) ) {
617
+                $output .= ' id="' . sanitize_html_class( $args['id'] ) . '" ';
618
+            }
619
+
620
+            // placeholder
621
+            if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] ) {
622
+                $output .= ' placeholder="' . esc_attr( $args['placeholder'] ) . '" ';
623
+            }
624
+
625
+            // title
626
+            if ( ! empty( $args['title'] ) ) {
627
+                $output .= ' title="' . esc_attr( $args['title'] ) . '" ';
628
+            }
629
+
630
+            // validation text
631
+            if ( ! empty( $args['validation_text'] ) ) {
632
+                $output .= ' oninvalid="setCustomValidity(\'' . esc_attr( $args['validation_text'] ) . '\')" ';
633
+                $output .= ' onchange="try{setCustomValidity(\'\')}catch(e){}" ';
634
+            }
635
+
636
+            // validation_pattern
637
+            if ( ! empty( $args['validation_pattern'] ) ) {
638
+                $output .= ' pattern="' . esc_attr( $args['validation_pattern'] ) . '" ';
639
+            }
640
+
641
+            // required
642
+            if ( ! empty( $args['required'] ) ) {
643
+                $output .= ' required ';
644
+            }
645
+
646
+            // rows
647
+            if ( ! empty( $args['rows'] ) ) {
648
+                $output .= ' rows="' . absint( $args['rows'] ) . '" ';
649
+            }
650
+
651
+
652
+            // class
653
+            $class = ! empty( $args['class'] ) ? $args['class'] : '';
654
+            $output .= ' class="form-control ' . $class . '" ';
655
+
656
+            // extra attributes
657
+            if ( ! empty( $args['extra_attributes'] ) ) {
658
+                $output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
659
+            }
660
+
661
+            // close tag
662
+            $output .= ' >';
663
+
664
+            // value
665
+            if ( ! empty( $args['value'] ) ) {
666
+                if ( ! empty( $args['allow_tags'] ) ) {
667
+                    $output .= AUI_Component_Helper::sanitize_html_field( $args['value'], $args ); // Sanitize HTML.
668
+                } else {
669
+                    $output .= AUI_Component_Helper::sanitize_textarea_field( $args['value'] );
670
+                }
671
+            }
672
+
673
+            // closing tag
674
+            $output .= '</textarea>';
675
+
676
+
677
+            // input group wraps
678
+            if ( $args['input_group_left'] || $args['input_group_right'] ) {
679
+                $w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
680
+                if ( $args['input_group_left'] ) {
681
+                    $output = self::wrap( array(
682
+                        'content'                 => $output,
683
+                        'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
684
+                        'input_group_left'        => $args['input_group_left'],
685
+                        'input_group_left_inside' => $args['input_group_left_inside']
686
+                    ) );
687
+                }
688
+                if ( $args['input_group_right'] ) {
689
+                    $output = self::wrap( array(
690
+                        'content'                  => $output,
691
+                        'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
692
+                        'input_group_right'        => $args['input_group_right'],
693
+                        'input_group_right_inside' => $args['input_group_right_inside']
694
+                    ) );
695
+                }
696
+
697
+            }
698
+
699
+
700
+        }
701
+
702
+        if ( ! empty( $args['label'] ) && $label_after ) {
703
+            $label_args = array(
704
+                'title'      => $args['label'],
705
+                'for'        => $args['id'],
706
+                'class'      => $args['label_class'] . " ",
707
+                'label_type' => $args['label_type'],
708
+                'label_col'  => $args['label_col']
709
+            );
710
+            $output .= self::label( $label_args );
711
+        }
712
+
713
+        // help text
714
+        if ( ! empty( $args['help_text'] ) ) {
715
+            $output .= AUI_Component_Helper::help_text( $args['help_text'] );
716
+        }
717
+
718
+        // maybe horizontal label
719
+        if ( $args['label_type'] == 'horizontal' ) {
720
+            $output .= '</div>';
721
+        }
722
+
723
+
724
+        // wrap
725
+        if ( ! $args['no_wrap'] ) {
726
+            $form_group_class = $args['label_type'] == 'floating' ? 'form-label-group' : 'form-group';
727
+            $wrap_class       = $args['label_type'] == 'horizontal' ? $form_group_class . ' row' : $form_group_class;
728
+            $wrap_class       = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
729
+            $output           = self::wrap( array(
730
+                'content'         => $output,
731
+                'class'           => $wrap_class,
732
+                'element_require' => $args['element_require'],
733
+                'argument_id'     => $args['id'],
734
+                'wrap_attributes' => $args['wrap_attributes'],
735
+            ) );
736
+        }
737
+
738
+
739
+        return $output;
740
+    }
741
+
742
+    /**
743
+     * Build the component.
744
+     *
745
+     * @param array $args
746
+     *
747
+     * @return string The rendered component.
748
+     */
749
+    public static function select( $args = array() ) {
750
+        $defaults = array(
751
+            'class'            => '',
752
+            'wrap_class'       => '',
753
+            'id'               => '',
754
+            'title'            => '',
755
+            'value'            => '',
756
+            // can be an array or a string
757
+            'required'         => false,
758
+            'label'            => '',
759
+            'label_after'      => false,
760
+            'label_type'       => '',
761
+            'label_col'        => '',
762
+            // sets the label type, default: hidden. Options: hidden, top, horizontal, floating
763
+            'label_class'      => '',
764
+            'help_text'        => '',
765
+            'placeholder'      => '',
766
+            'options'          => array(),
767
+            // array or string
768
+            'icon'             => '',
769
+            'multiple'         => false,
770
+            'select2'          => false,
771
+            'no_wrap'          => false,
772
+            'input_group_right' => '',
773
+            'input_group_left' => '',
774
+            'input_group_right_inside' => false, // forces the input group inside the input
775
+            'input_group_left_inside' => false, // forces the input group inside the input
776
+            'element_require'  => '',
777
+            // [%element_id%] == "1"
778
+            'extra_attributes' => array(),
779
+            // an array of extra attributes
780
+            'wrap_attributes'  => array(),
781
+        );
782
+
783
+        /**
784
+         * Parse incoming $args into an array and merge it with $defaults
785
+         */
786
+        $args   = wp_parse_args( $args, $defaults );
787
+        $output = '';
788
+
789
+        // for now lets hide floating labels
790
+        if ( $args['label_type'] == 'floating' ) {
791
+            $args['label_type'] = 'hidden';
792
+        }
793
+
794
+        // hidden label option needs to be empty
795
+        $args['label_type'] = $args['label_type'] == 'hidden' ? '' : $args['label_type'];
796
+
797
+
798
+        $label_after = $args['label_after'];
799
+
800
+        // floating labels need label after
801
+        if ( $args['label_type'] == 'floating' ) {
802
+            $label_after         = true;
803
+            $args['placeholder'] = ' '; // set the placeholder not empty so the floating label works.
804
+        }
805
+
806
+        // Maybe setup select2
807
+        $is_select2 = false;
808
+        if ( ! empty( $args['select2'] ) ) {
809
+            $args['class'] .= ' aui-select2';
810
+            $is_select2 = true;
811
+        } elseif ( strpos( $args['class'], 'aui-select2' ) !== false ) {
812
+            $is_select2 = true;
813
+        }
814
+
815
+        // select2 tags
816
+        if ( ! empty( $args['select2'] ) && $args['select2'] === 'tags' ) { // triple equals needed here for some reason
817
+            $args['data-tags']             = 'true';
818
+            $args['data-token-separators'] = "[',']";
819
+            $args['multiple']              = true;
820
+        }
821
+
822
+        // select2 placeholder
823
+        if ( $is_select2 && isset( $args['placeholder'] ) && '' != $args['placeholder'] && empty( $args['data-placeholder'] ) ) {
824
+            $args['data-placeholder'] = esc_attr( $args['placeholder'] );
825
+            $args['data-allow-clear'] = isset( $args['data-allow-clear'] ) ? (bool) $args['data-allow-clear'] : true;
826
+        }
827
+
828
+        // Set hidden input to save empty value for multiselect.
829
+        if ( ! empty( $args['multiple'] ) && ! empty( $args['name'] ) ) {
830
+            $output .= '<input type="hidden" ' . AUI_Component_Helper::name( $args['name'] ) . ' value="" data-ignore-rule/>';
831
+        }
832
+
833
+        // open/type
834
+        $output .= '<select ';
835
+
836
+        // style
837
+        if ( $is_select2 && !($args['input_group_left'] || $args['input_group_right'])) {
838
+            $output .= " style='width:100%;' ";
839
+        }
840
+
841
+        // element require
842
+        if ( ! empty( $args['element_require'] ) ) {
843
+            $output .= AUI_Component_Helper::element_require( $args['element_require'] );
844
+            $args['class'] .= " aui-conditional-field";
845
+        }
846
+
847
+        // class
848
+        $class = ! empty( $args['class'] ) ? $args['class'] : '';
849
+        $output .= AUI_Component_Helper::class_attr( 'custom-select ' . $class );
850
+
851
+        // name
852
+        if ( ! empty( $args['name'] ) ) {
853
+            $output .= AUI_Component_Helper::name( $args['name'], $args['multiple'] );
854
+        }
855
+
856
+        // id
857
+        if ( ! empty( $args['id'] ) ) {
858
+            $output .= AUI_Component_Helper::id( $args['id'] );
859
+        }
860
+
861
+        // title
862
+        if ( ! empty( $args['title'] ) ) {
863
+            $output .= AUI_Component_Helper::title( $args['title'] );
864
+        }
865
+
866
+        // data-attributes
867
+        $output .= AUI_Component_Helper::data_attributes( $args );
868
+
869
+        // aria-attributes
870
+        $output .= AUI_Component_Helper::aria_attributes( $args );
871
+
872
+        // extra attributes
873
+        if ( ! empty( $args['extra_attributes'] ) ) {
874
+            $output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
875
+        }
876
+
877
+        // required
878
+        if ( ! empty( $args['required'] ) ) {
879
+            $output .= ' required ';
880
+        }
881
+
882
+        // multiple
883
+        if ( ! empty( $args['multiple'] ) ) {
884
+            $output .= ' multiple ';
885
+        }
886
+
887
+        // close opening tag
888
+        $output .= ' >';
889
+
890
+        // placeholder
891
+        if ( isset( $args['placeholder'] ) && '' != $args['placeholder'] && ! $is_select2 ) {
892
+            $output .= '<option value="" disabled selected hidden>' . esc_attr( $args['placeholder'] ) . '</option>';
893
+        } elseif ( $is_select2 && ! empty( $args['placeholder'] ) ) {
894
+            $output .= "<option></option>"; // select2 needs an empty select to fill the placeholder
895
+        }
896
+
897
+        // Options
898
+        if ( ! empty( $args['options'] ) ) {
899
+
900
+            if ( ! is_array( $args['options'] ) ) {
901
+                $output .= $args['options']; // not the preferred way but an option
902
+            } else {
903
+                foreach ( $args['options'] as $val => $name ) {
904
+                    $selected = '';
905
+                    if ( is_array( $name ) ) {
906
+                        if ( isset( $name['optgroup'] ) && ( $name['optgroup'] == 'start' || $name['optgroup'] == 'end' ) ) {
907
+                            $option_label = isset( $name['label'] ) ? $name['label'] : '';
908
+
909
+                            $output .= $name['optgroup'] == 'start' ? '<optgroup label="' . esc_attr( $option_label ) . '">' : '</optgroup>';
910
+                        } else {
911
+                            $option_label = isset( $name['label'] ) ? $name['label'] : '';
912
+                            $option_value = isset( $name['value'] ) ? $name['value'] : '';
913
+                            $extra_attributes = !empty($name['extra_attributes']) ? AUI_Component_Helper::extra_attributes( $name['extra_attributes'] ) : '';
914
+                            if ( ! empty( $args['multiple'] ) && ! empty( $args['value'] ) && is_array( $args['value'] ) ) {
915
+                                $selected = in_array( $option_value, stripslashes_deep( $args['value'] ) ) ? "selected" : "";
916
+                            } elseif ( ! empty( $args['value'] ) ) {
917
+                                $selected = selected( $option_value, stripslashes_deep( $args['value'] ), false );
918
+                            } elseif ( empty( $args['value'] ) && $args['value'] === $option_value ) {
919
+                                $selected = selected( $option_value, $args['value'], false );
920
+                            }
921
+
922
+                            $output .= '<option value="' . esc_attr( $option_value ) . '" ' . $selected . ' '.$extra_attributes .'>' . $option_label . '</option>';
923
+                        }
924
+                    } else {
925
+                        if ( ! empty( $args['value'] ) ) {
926
+                            if ( is_array( $args['value'] ) ) {
927
+                                $selected = in_array( $val, $args['value'] ) ? 'selected="selected"' : '';
928
+                            } elseif ( ! empty( $args['value'] ) ) {
929
+                                $selected = selected( $args['value'], $val, false );
930
+                            }
931
+                        } elseif ( $args['value'] === $val ) {
932
+                            $selected = selected( $args['value'], $val, false );
933
+                        }
934
+                        $output .= '<option value="' . esc_attr( $val ) . '" ' . $selected . '>' . esc_attr( $name ) . '</option>';
935
+                    }
936
+                }
937
+            }
938
+
939
+        }
940
+
941
+        // closing tag
942
+        $output .= '</select>';
943
+
944
+        $label = '';
945
+        $help_text = '';
946
+        // label
947
+        if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
948
+        } elseif ( ! empty( $args['label'] ) && ! $label_after ) {
949
+            $label_args = array(
950
+                'title'      => $args['label'],
951
+                'for'        => $args['id'],
952
+                'class'      => $args['label_class'] . " ",
953
+                'label_type' => $args['label_type'],
954
+                'label_col'  => $args['label_col']
955
+            );
956
+            $label = self::label( $label_args );
957
+        }
958
+
959
+        // help text
960
+        if ( ! empty( $args['help_text'] ) ) {
961
+            $help_text = AUI_Component_Helper::help_text( $args['help_text'] );
962
+        }
963
+
964
+        // input group wraps
965
+        if ( $args['input_group_left'] || $args['input_group_right'] ) {
966
+            $w100 = strpos( $args['class'], 'w-100' ) !== false ? ' w-100' : '';
967
+            if ( $args['input_group_left'] ) {
968
+                $output = self::wrap( array(
969
+                    'content'                 => $output,
970
+                    'class'                   => $args['input_group_left_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
971
+                    'input_group_left'        => $args['input_group_left'],
972
+                    'input_group_left_inside' => $args['input_group_left_inside']
973
+                ) );
974
+            }
975
+            if ( $args['input_group_right'] ) {
976
+                $output = self::wrap( array(
977
+                    'content'                  => $output,
978
+                    'class'                    => $args['input_group_right_inside'] ? 'input-group-inside position-relative' . $w100 : 'input-group',
979
+                    'input_group_right'        => $args['input_group_right'],
980
+                    'input_group_right_inside' => $args['input_group_right_inside']
981
+                ) );
982
+            }
983
+
984
+        }
985
+
986
+        if ( ! $label_after ) {
987
+            $output .= $help_text;
988
+        }
989
+
990
+
991
+        if ( $args['label_type'] == 'horizontal' ) {
992
+            $output = self::wrap( array(
993
+                'content' => $output,
994
+                'class'   => AUI_Component_Helper::get_column_class( $args['label_col'], 'input' )
995
+            ) );
996
+        }
997
+
998
+        if ( ! $label_after ) {
999
+            $output = $label . $output;
1000
+        }
1001
+
1002
+        // maybe horizontal label
1003 1003
 //		if ( $args['label_type'] == 'horizontal' ) {
1004 1004
 //			$output .= '</div>';
1005 1005
 //		}
1006 1006
 
1007 1007
 
1008
-		// wrap
1009
-		if ( ! $args['no_wrap'] ) {
1010
-			$wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
1011
-			$wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
1012
-			$output     = self::wrap( array(
1013
-				'content'         => $output,
1014
-				'class'           => $wrap_class,
1015
-				'element_require' => $args['element_require'],
1016
-				'argument_id'     => $args['id'],
1017
-				'wrap_attributes' => $args['wrap_attributes'],
1018
-			) );
1019
-		}
1020
-
1021
-
1022
-		return $output;
1023
-	}
1024
-
1025
-	/**
1026
-	 * Build the component.
1027
-	 *
1028
-	 * @param array $args
1029
-	 *
1030
-	 * @return string The rendered component.
1031
-	 */
1032
-	public static function radio( $args = array() ) {
1033
-		$defaults = array(
1034
-			'class'            => '',
1035
-			'wrap_class'       => '',
1036
-			'id'               => '',
1037
-			'title'            => '',
1038
-			'horizontal'       => false,
1039
-			// sets the lable horizontal
1040
-			'value'            => '',
1041
-			'label'            => '',
1042
-			'label_class'      => '',
1043
-			'label_type'       => '',
1044
-			'label_col'        => '',
1045
-			// sets the label type, default: hidden. Options: hidden, top, horizontal, floating
1046
-			'help_text'        => '',
1047
-			'inline'           => true,
1048
-			'required'         => false,
1049
-			'options'          => array(),
1050
-			'icon'             => '',
1051
-			'no_wrap'          => false,
1052
-			'element_require'  => '',
1053
-			// [%element_id%] == "1"
1054
-			'extra_attributes' => array(),
1055
-			// an array of extra attributes
1056
-			'wrap_attributes'  => array()
1057
-		);
1058
-
1059
-		/**
1060
-		 * Parse incoming $args into an array and merge it with $defaults
1061
-		 */
1062
-		$args = wp_parse_args( $args, $defaults );
1063
-
1064
-		// for now lets use horizontal for floating
1065
-		if ( $args['label_type'] == 'floating' ) {
1066
-			$args['label_type'] = 'horizontal';
1067
-		}
1068
-
1069
-		$label_args = array(
1070
-			'title'      => $args['label'],
1071
-			'class'      => $args['label_class'] . " pt-0 ",
1072
-			'label_type' => $args['label_type'],
1073
-			'label_col'  => $args['label_col']
1074
-		);
1075
-
1076
-		$output = '';
1077
-
1078
-
1079
-		// label before
1080
-		if ( ! empty( $args['label'] ) ) {
1081
-			$output .= self::label( $label_args, 'radio' );
1082
-		}
1083
-
1084
-		// maybe horizontal label
1085
-		if ( $args['label_type'] == 'horizontal' ) {
1086
-			$input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
1087
-			$output .= '<div class="' . $input_col . '">';
1088
-		}
1089
-
1090
-		if ( ! empty( $args['options'] ) ) {
1091
-			$count = 0;
1092
-			foreach ( $args['options'] as $value => $label ) {
1093
-				$option_args            = $args;
1094
-				$option_args['value']   = $value;
1095
-				$option_args['label']   = $label;
1096
-				$option_args['checked'] = $value == $args['value'] ? true : false;
1097
-				$output .= self::radio_option( $option_args, $count );
1098
-				$count ++;
1099
-			}
1100
-		}
1101
-
1102
-		// help text
1103
-		$help_text = ! empty( $args['help_text'] ) ? AUI_Component_Helper::help_text( $args['help_text'] ) : '';
1104
-		$output .= $help_text;
1105
-
1106
-		// maybe horizontal label
1107
-		if ( $args['label_type'] == 'horizontal' ) {
1108
-			$output .= '</div>';
1109
-		}
1110
-
1111
-		// wrap
1112
-		$wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
1113
-		$wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
1114
-		$output     = self::wrap( array(
1115
-			'content'         => $output,
1116
-			'class'           => $wrap_class,
1117
-			'element_require' => $args['element_require'],
1118
-			'argument_id'     => $args['id'],
1119
-			'wrap_attributes' => $args['wrap_attributes'],
1120
-		) );
1121
-
1122
-
1123
-		return $output;
1124
-	}
1125
-
1126
-	/**
1127
-	 * Build the component.
1128
-	 *
1129
-	 * @param array $args
1130
-	 *
1131
-	 * @return string The rendered component.
1132
-	 */
1133
-	public static function radio_option( $args = array(), $count = '' ) {
1134
-		$defaults = array(
1135
-			'class'            => '',
1136
-			'id'               => '',
1137
-			'title'            => '',
1138
-			'value'            => '',
1139
-			'required'         => false,
1140
-			'inline'           => true,
1141
-			'label'            => '',
1142
-			'options'          => array(),
1143
-			'icon'             => '',
1144
-			'no_wrap'          => false,
1145
-			'extra_attributes' => array() // an array of extra attributes
1146
-		);
1147
-
1148
-		/**
1149
-		 * Parse incoming $args into an array and merge it with $defaults
1150
-		 */
1151
-		$args = wp_parse_args( $args, $defaults );
1152
-
1153
-		$output = '';
1154
-
1155
-		// open/type
1156
-		$output .= '<input type="radio"';
1157
-
1158
-		// class
1159
-		$output .= ' class="form-check-input" ';
1160
-
1161
-		// name
1162
-		if ( ! empty( $args['name'] ) ) {
1163
-			$output .= AUI_Component_Helper::name( $args['name'] );
1164
-		}
1165
-
1166
-		// id
1167
-		if ( ! empty( $args['id'] ) ) {
1168
-			$output .= AUI_Component_Helper::id( $args['id'] . $count );
1169
-		}
1170
-
1171
-		// title
1172
-		if ( ! empty( $args['title'] ) ) {
1173
-			$output .= AUI_Component_Helper::title( $args['title'] );
1174
-		}
1175
-
1176
-		// value
1177
-		if ( isset( $args['value'] ) ) {
1178
-			$output .= AUI_Component_Helper::value( $args['value'] );
1179
-		}
1180
-
1181
-		// checked, for radio and checkboxes
1182
-		if ( $args['checked'] ) {
1183
-			$output .= ' checked ';
1184
-		}
1185
-
1186
-		// data-attributes
1187
-		$output .= AUI_Component_Helper::data_attributes( $args );
1188
-
1189
-		// aria-attributes
1190
-		$output .= AUI_Component_Helper::aria_attributes( $args );
1191
-
1192
-		// extra attributes
1193
-		if ( ! empty( $args['extra_attributes'] ) ) {
1194
-			$output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
1195
-		}
1196
-
1197
-		// required
1198
-		if ( ! empty( $args['required'] ) ) {
1199
-			$output .= ' required ';
1200
-		}
1201
-
1202
-		// close opening tag
1203
-		$output .= ' >';
1204
-
1205
-		// label
1206
-		if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
1207
-		} elseif ( ! empty( $args['label'] ) ) {
1208
-			$output .= self::label( array(
1209
-				'title' => $args['label'],
1210
-				'for'   => $args['id'] . $count,
1211
-				'class' => 'form-check-label'
1212
-			), 'radio' );
1213
-		}
1214
-
1215
-		// wrap
1216
-		if ( ! $args['no_wrap'] ) {
1217
-			$wrap_class = $args['inline'] ? 'form-check form-check-inline' : 'form-check';
1218
-
1219
-			// Unique wrap class
1220
-			$uniq_class = 'fwrap';
1221
-			if ( ! empty( $args['name'] ) ) {
1222
-				$uniq_class .= '-' . $args['name'];
1223
-			} else if ( ! empty( $args['id'] ) ) {
1224
-				$uniq_class .= '-' . $args['id'];
1225
-			}
1226
-
1227
-			if ( isset( $args['value'] ) || $args['value'] !== "" ) {
1228
-				$uniq_class .= '-' . $args['value'];
1229
-			} else {
1230
-				$uniq_class .= '-' . $count;
1231
-			}
1232
-			$wrap_class .= ' ' . sanitize_html_class( $uniq_class );
1233
-
1234
-			$output = self::wrap( array(
1235
-				'content' => $output,
1236
-				'class'   => $wrap_class
1237
-			) );
1238
-		}
1239
-
1240
-		return $output;
1241
-	}
1008
+        // wrap
1009
+        if ( ! $args['no_wrap'] ) {
1010
+            $wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
1011
+            $wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
1012
+            $output     = self::wrap( array(
1013
+                'content'         => $output,
1014
+                'class'           => $wrap_class,
1015
+                'element_require' => $args['element_require'],
1016
+                'argument_id'     => $args['id'],
1017
+                'wrap_attributes' => $args['wrap_attributes'],
1018
+            ) );
1019
+        }
1020
+
1021
+
1022
+        return $output;
1023
+    }
1024
+
1025
+    /**
1026
+     * Build the component.
1027
+     *
1028
+     * @param array $args
1029
+     *
1030
+     * @return string The rendered component.
1031
+     */
1032
+    public static function radio( $args = array() ) {
1033
+        $defaults = array(
1034
+            'class'            => '',
1035
+            'wrap_class'       => '',
1036
+            'id'               => '',
1037
+            'title'            => '',
1038
+            'horizontal'       => false,
1039
+            // sets the lable horizontal
1040
+            'value'            => '',
1041
+            'label'            => '',
1042
+            'label_class'      => '',
1043
+            'label_type'       => '',
1044
+            'label_col'        => '',
1045
+            // sets the label type, default: hidden. Options: hidden, top, horizontal, floating
1046
+            'help_text'        => '',
1047
+            'inline'           => true,
1048
+            'required'         => false,
1049
+            'options'          => array(),
1050
+            'icon'             => '',
1051
+            'no_wrap'          => false,
1052
+            'element_require'  => '',
1053
+            // [%element_id%] == "1"
1054
+            'extra_attributes' => array(),
1055
+            // an array of extra attributes
1056
+            'wrap_attributes'  => array()
1057
+        );
1058
+
1059
+        /**
1060
+         * Parse incoming $args into an array and merge it with $defaults
1061
+         */
1062
+        $args = wp_parse_args( $args, $defaults );
1063
+
1064
+        // for now lets use horizontal for floating
1065
+        if ( $args['label_type'] == 'floating' ) {
1066
+            $args['label_type'] = 'horizontal';
1067
+        }
1068
+
1069
+        $label_args = array(
1070
+            'title'      => $args['label'],
1071
+            'class'      => $args['label_class'] . " pt-0 ",
1072
+            'label_type' => $args['label_type'],
1073
+            'label_col'  => $args['label_col']
1074
+        );
1075
+
1076
+        $output = '';
1077
+
1078
+
1079
+        // label before
1080
+        if ( ! empty( $args['label'] ) ) {
1081
+            $output .= self::label( $label_args, 'radio' );
1082
+        }
1083
+
1084
+        // maybe horizontal label
1085
+        if ( $args['label_type'] == 'horizontal' ) {
1086
+            $input_col = AUI_Component_Helper::get_column_class( $args['label_col'], 'input' );
1087
+            $output .= '<div class="' . $input_col . '">';
1088
+        }
1089
+
1090
+        if ( ! empty( $args['options'] ) ) {
1091
+            $count = 0;
1092
+            foreach ( $args['options'] as $value => $label ) {
1093
+                $option_args            = $args;
1094
+                $option_args['value']   = $value;
1095
+                $option_args['label']   = $label;
1096
+                $option_args['checked'] = $value == $args['value'] ? true : false;
1097
+                $output .= self::radio_option( $option_args, $count );
1098
+                $count ++;
1099
+            }
1100
+        }
1101
+
1102
+        // help text
1103
+        $help_text = ! empty( $args['help_text'] ) ? AUI_Component_Helper::help_text( $args['help_text'] ) : '';
1104
+        $output .= $help_text;
1105
+
1106
+        // maybe horizontal label
1107
+        if ( $args['label_type'] == 'horizontal' ) {
1108
+            $output .= '</div>';
1109
+        }
1110
+
1111
+        // wrap
1112
+        $wrap_class = $args['label_type'] == 'horizontal' ? 'form-group row' : 'form-group';
1113
+        $wrap_class = ! empty( $args['wrap_class'] ) ? $wrap_class . " " . $args['wrap_class'] : $wrap_class;
1114
+        $output     = self::wrap( array(
1115
+            'content'         => $output,
1116
+            'class'           => $wrap_class,
1117
+            'element_require' => $args['element_require'],
1118
+            'argument_id'     => $args['id'],
1119
+            'wrap_attributes' => $args['wrap_attributes'],
1120
+        ) );
1121
+
1122
+
1123
+        return $output;
1124
+    }
1125
+
1126
+    /**
1127
+     * Build the component.
1128
+     *
1129
+     * @param array $args
1130
+     *
1131
+     * @return string The rendered component.
1132
+     */
1133
+    public static function radio_option( $args = array(), $count = '' ) {
1134
+        $defaults = array(
1135
+            'class'            => '',
1136
+            'id'               => '',
1137
+            'title'            => '',
1138
+            'value'            => '',
1139
+            'required'         => false,
1140
+            'inline'           => true,
1141
+            'label'            => '',
1142
+            'options'          => array(),
1143
+            'icon'             => '',
1144
+            'no_wrap'          => false,
1145
+            'extra_attributes' => array() // an array of extra attributes
1146
+        );
1147
+
1148
+        /**
1149
+         * Parse incoming $args into an array and merge it with $defaults
1150
+         */
1151
+        $args = wp_parse_args( $args, $defaults );
1152
+
1153
+        $output = '';
1154
+
1155
+        // open/type
1156
+        $output .= '<input type="radio"';
1157
+
1158
+        // class
1159
+        $output .= ' class="form-check-input" ';
1160
+
1161
+        // name
1162
+        if ( ! empty( $args['name'] ) ) {
1163
+            $output .= AUI_Component_Helper::name( $args['name'] );
1164
+        }
1165
+
1166
+        // id
1167
+        if ( ! empty( $args['id'] ) ) {
1168
+            $output .= AUI_Component_Helper::id( $args['id'] . $count );
1169
+        }
1170
+
1171
+        // title
1172
+        if ( ! empty( $args['title'] ) ) {
1173
+            $output .= AUI_Component_Helper::title( $args['title'] );
1174
+        }
1175
+
1176
+        // value
1177
+        if ( isset( $args['value'] ) ) {
1178
+            $output .= AUI_Component_Helper::value( $args['value'] );
1179
+        }
1180
+
1181
+        // checked, for radio and checkboxes
1182
+        if ( $args['checked'] ) {
1183
+            $output .= ' checked ';
1184
+        }
1185
+
1186
+        // data-attributes
1187
+        $output .= AUI_Component_Helper::data_attributes( $args );
1188
+
1189
+        // aria-attributes
1190
+        $output .= AUI_Component_Helper::aria_attributes( $args );
1191
+
1192
+        // extra attributes
1193
+        if ( ! empty( $args['extra_attributes'] ) ) {
1194
+            $output .= AUI_Component_Helper::extra_attributes( $args['extra_attributes'] );
1195
+        }
1196
+
1197
+        // required
1198
+        if ( ! empty( $args['required'] ) ) {
1199
+            $output .= ' required ';
1200
+        }
1201
+
1202
+        // close opening tag
1203
+        $output .= ' >';
1204
+
1205
+        // label
1206
+        if ( ! empty( $args['label'] ) && is_array( $args['label'] ) ) {
1207
+        } elseif ( ! empty( $args['label'] ) ) {
1208
+            $output .= self::label( array(
1209
+                'title' => $args['label'],
1210
+                'for'   => $args['id'] . $count,
1211
+                'class' => 'form-check-label'
1212
+            ), 'radio' );
1213
+        }
1214
+
1215
+        // wrap
1216
+        if ( ! $args['no_wrap'] ) {
1217
+            $wrap_class = $args['inline'] ? 'form-check form-check-inline' : 'form-check';
1218
+
1219
+            // Unique wrap class
1220
+            $uniq_class = 'fwrap';
1221
+            if ( ! empty( $args['name'] ) ) {
1222
+                $uniq_class .= '-' . $args['name'];
1223
+            } else if ( ! empty( $args['id'] ) ) {
1224
+                $uniq_class .= '-' . $args['id'];
1225
+            }
1226
+
1227
+            if ( isset( $args['value'] ) || $args['value'] !== "" ) {
1228
+                $uniq_class .= '-' . $args['value'];
1229
+            } else {
1230
+                $uniq_class .= '-' . $count;
1231
+            }
1232
+            $wrap_class .= ' ' . sanitize_html_class( $uniq_class );
1233
+
1234
+            $output = self::wrap( array(
1235
+                'content' => $output,
1236
+                'class'   => $wrap_class
1237
+            ) );
1238
+        }
1239
+
1240
+        return $output;
1241
+    }
1242 1242
 
1243 1243
 }
1244 1244
\ No newline at end of file
Please login to merge, or discard this patch.
invoicing.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
 
20 20
 // Define constants.
21 21
 if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) {
22
-	define( 'WPINV_PLUGIN_FILE', __FILE__ );
22
+    define( 'WPINV_PLUGIN_FILE', __FILE__ );
23 23
 }
24 24
 
25 25
 if ( ! defined( 'WPINV_VERSION' ) ) {
26
-	define( 'WPINV_VERSION', '2.6.16' );
26
+    define( 'WPINV_VERSION', '2.6.16' );
27 27
 }
28 28
 
29 29
 // Include the main Invoicing class.
30 30
 if ( ! class_exists( 'WPInv_Plugin', false ) ) {
31
-	require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php';
31
+    require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php';
32 32
 }
33 33
 
34 34
 /**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $GLOBALS['invoicing'] = new WPInv_Plugin();
44 44
     }
45 45
 
46
-	return $GLOBALS['invoicing'];
46
+    return $GLOBALS['invoicing'];
47 47
 }
48 48
 
49 49
 /**
Please login to merge, or discard this patch.
vendor/ayecode/wp-ayecode-ui/includes/ayecode-ui-settings.php 1 patch
Indentation   +1553 added lines, -1553 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,422 +21,422 @@  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.77';
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 = "4.5.3";
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.77';
119 39
 
120
-				add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
40
+        /**
41
+         * Class textdomain.
42
+         *
43
+         * @var string
44
+         */
45
+        public $textdomain = 'aui';
121 46
 
122
-				do_action( 'ayecode_ui_settings_loaded' );
123
-			}
47
+        /**
48
+         * Latest version of Bootstrap at time of publish published.
49
+         *
50
+         * @var string
51
+         */
52
+        public $latest = "4.5.3";
124 53
 
125
-			return self::$instance;
126
-		}
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' ) );
127 111
 
128
-		/**
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
+
120
+                add_action( 'customize_register', array( self::$instance, 'customizer_settings' ));
121
+
122
+                do_action( 'ayecode_ui_settings_loaded' );
123
+            }
124
+
125
+            return self::$instance;
126
+        }
127
+
128
+        /**
129 129
          * Add custom colors to the color selector.
130 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 ){
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
-			}
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 147
 
148
-			return $theme_colors;
149
-		}
148
+            return $theme_colors;
149
+        }
150 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
-			}
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 220
 
221
-		}
221
+        }
222 222
 
223 223
         public static function get_colors( $original = false){
224 224
 
225
-	        if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
225
+            if ( ! defined( 'AUI_PRIMARY_COLOR' ) ) {
226 226
                 return array();
227
-	        }
228
-	        if ( $original ) {
227
+            }
228
+            if ( $original ) {
229 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,
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 246
                 );
247
-	        }
247
+            }
248 248
 
249 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,
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 266
             );
267 267
         }
268 268
 
269
-		/**
270
-		 * Initiate the settings and add the required action hooks.
271
-		 */
272
-		public function init() {
273
-
274
-			// Maybe fix settings
275
-			if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
276
-				$db_settings = get_option( 'ayecode-ui-settings' );
277
-				if ( ! empty( $db_settings ) ) {
278
-					$db_settings['css_backend'] = 'compatibility';
279
-					$db_settings['js_backend'] = 'core-popper';
280
-					update_option( 'ayecode-ui-settings', $db_settings );
281
-					wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
282
-				}
283
-			}
269
+        /**
270
+         * Initiate the settings and add the required action hooks.
271
+         */
272
+        public function init() {
273
+
274
+            // Maybe fix settings
275
+            if ( ! empty( $_REQUEST['aui-fix-admin'] ) && !empty($_REQUEST['nonce']) && wp_verify_nonce( $_REQUEST['nonce'], "aui-fix-admin" ) ) {
276
+                $db_settings = get_option( 'ayecode-ui-settings' );
277
+                if ( ! empty( $db_settings ) ) {
278
+                    $db_settings['css_backend'] = 'compatibility';
279
+                    $db_settings['js_backend'] = 'core-popper';
280
+                    update_option( 'ayecode-ui-settings', $db_settings );
281
+                    wp_safe_redirect(admin_url("options-general.php?page=ayecode-ui-settings&updated=true"));
282
+                }
283
+            }
284 284
 
285
-			$this->constants();
286
-			$this->settings = $this->get_settings();
287
-			$this->url = $this->get_url();
285
+            $this->constants();
286
+            $this->settings = $this->get_settings();
287
+            $this->url = $this->get_url();
288
+
289
+            /**
290
+             * Maybe load CSS
291
+             *
292
+             * We load super early in case there is a theme version that might change the colors
293
+             */
294
+            if ( $this->settings['css'] ) {
295
+                $priority = $this->is_bs3_compat() ? 100 : 1;
296
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
297
+            }
298
+            if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
299
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
300
+            }
288 301
 
289
-			/**
290
-			 * Maybe load CSS
291
-			 *
292
-			 * We load super early in case there is a theme version that might change the colors
293
-			 */
294
-			if ( $this->settings['css'] ) {
295
-				$priority = $this->is_bs3_compat() ? 100 : 1;
296
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_style' ), $priority );
297
-			}
298
-			if ( $this->settings['css_backend'] && $this->load_admin_scripts() ) {
299
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ), 1 );
300
-			}
301
-
302
-			// maybe load JS
303
-			if ( $this->settings['js'] ) {
304
-				$priority = $this->is_bs3_compat() ? 100 : 1;
305
-				add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
306
-			}
307
-			if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
308
-				add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
309
-			}
310
-
311
-			// Maybe set the HTML font size
312
-			if ( $this->settings['html_font_size'] ) {
313
-				add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
314
-			}
315
-
316
-			// Maybe show backend style error
317
-			if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
318
-				add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
319
-			}
302
+            // maybe load JS
303
+            if ( $this->settings['js'] ) {
304
+                $priority = $this->is_bs3_compat() ? 100 : 1;
305
+                add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), $priority );
306
+            }
307
+            if ( $this->settings['js_backend'] && $this->load_admin_scripts() ) {
308
+                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 1 );
309
+            }
320 310
 
321
-		}
311
+            // Maybe set the HTML font size
312
+            if ( $this->settings['html_font_size'] ) {
313
+                add_action( 'wp_footer', array( $this, 'html_font_size' ), 10 );
314
+            }
322 315
 
323
-		/**
324
-		 * Show admin notice if backend scripts not loaded.
325
-		 */
326
-		public function show_admin_style_notice(){
327
-			$fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
328
-			$button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
329
-			$message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
330
-			echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$message.'</p></div>';
331
-		}
316
+            // Maybe show backend style error
317
+            if( $this->settings['css_backend'] != 'compatibility' || $this->settings['js_backend'] != 'core-popper' ){
318
+                add_action( 'admin_notices', array( $this, 'show_admin_style_notice' ) );
319
+            }
332 320
 
333
-		/**
334
-		 * Check if we should load the admin scripts or not.
335
-		 *
336
-		 * @return bool
337
-		 */
338
-		public function load_admin_scripts(){
339
-			$result = true;
340
-
341
-			// check if specifically disabled
342
-			if(!empty($this->settings['disable_admin'])){
343
-				$url_parts = explode("\n",$this->settings['disable_admin']);
344
-				foreach($url_parts as $part){
345
-					if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
346
-						return false; // return early, no point checking further
347
-					}
348
-				}
349
-			}
321
+        }
350 322
 
351
-			return $result;
352
-		}
323
+        /**
324
+         * Show admin notice if backend scripts not loaded.
325
+         */
326
+        public function show_admin_style_notice(){
327
+            $fix_url = admin_url("options-general.php?page=ayecode-ui-settings&aui-fix-admin=true&nonce=".wp_create_nonce('aui-fix-admin'));
328
+            $button = '<a href="'.esc_url($fix_url).'" class="button-primary">Fix Now</a>';
329
+            $message = __( '<b>Style Issue:</b> AyeCode UI is disable or set wrong.')." " .$button;
330
+            echo '<div class="notice notice-error aui-settings-error-notice"><p>'.$message.'</p></div>';
331
+        }
353 332
 
354
-		/**
355
-		 * Add a html font size to the footer.
356
-		 */
357
-		public function html_font_size(){
358
-			$this->settings = $this->get_settings();
359
-			echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
360
-		}
333
+        /**
334
+         * Check if we should load the admin scripts or not.
335
+         *
336
+         * @return bool
337
+         */
338
+        public function load_admin_scripts(){
339
+            $result = true;
340
+
341
+            // check if specifically disabled
342
+            if(!empty($this->settings['disable_admin'])){
343
+                $url_parts = explode("\n",$this->settings['disable_admin']);
344
+                foreach($url_parts as $part){
345
+                    if( strpos($_SERVER['REQUEST_URI'], trim($part)) !== false ){
346
+                        return false; // return early, no point checking further
347
+                    }
348
+                }
349
+            }
350
+
351
+            return $result;
352
+        }
353
+
354
+        /**
355
+         * Add a html font size to the footer.
356
+         */
357
+        public function html_font_size(){
358
+            $this->settings = $this->get_settings();
359
+            echo "<style>html{font-size:".absint($this->settings['html_font_size'])."px;}</style>";
360
+        }
361 361
 
362
-		/**
363
-		 * Check if the current admin screen should load scripts.
364
-		 * 
365
-		 * @return bool
366
-		 */
367
-		public function is_aui_screen(){
362
+        /**
363
+         * Check if the current admin screen should load scripts.
364
+         * 
365
+         * @return bool
366
+         */
367
+        public function is_aui_screen(){
368 368
 //			echo '###';exit;
369
-			$load = false;
370
-			// check if we should load or not
371
-			if ( is_admin() ) {
372
-				// Only enable on set pages
373
-				$aui_screens = array(
374
-					'page',
375
-					'post',
376
-					'settings_page_ayecode-ui-settings',
377
-					'appearance_page_gutenberg-widgets',
378
-					'widgets',
379
-					'ayecode-ui-settings',
380
-					'site-editor'
381
-				);
382
-				$screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
383
-
384
-				$screen = get_current_screen();
369
+            $load = false;
370
+            // check if we should load or not
371
+            if ( is_admin() ) {
372
+                // Only enable on set pages
373
+                $aui_screens = array(
374
+                    'page',
375
+                    'post',
376
+                    'settings_page_ayecode-ui-settings',
377
+                    'appearance_page_gutenberg-widgets',
378
+                    'widgets',
379
+                    'ayecode-ui-settings',
380
+                    'site-editor'
381
+                );
382
+                $screen_ids = apply_filters( 'aui_screen_ids', $aui_screens );
383
+
384
+                $screen = get_current_screen();
385 385
 
386 386
 //				echo '###'.$screen->id;
387 387
 
388
-				// check if we are on a AUI screen
389
-				if ( $screen && in_array( $screen->id, $screen_ids ) ) {
390
-					$load = true;
391
-				}
388
+                // check if we are on a AUI screen
389
+                if ( $screen && in_array( $screen->id, $screen_ids ) ) {
390
+                    $load = true;
391
+                }
392 392
 
393
-				//load for widget previews in WP 5.8
394
-				if( !empty($_REQUEST['legacy-widget-preview'])){
395
-					$load = true;
396
-				}
397
-			}
393
+                //load for widget previews in WP 5.8
394
+                if( !empty($_REQUEST['legacy-widget-preview'])){
395
+                    $load = true;
396
+                }
397
+            }
398 398
 
399
-			return apply_filters( 'aui_load_on_admin' , $load );
400
-		}
399
+            return apply_filters( 'aui_load_on_admin' , $load );
400
+        }
401 401
 
402
-		/**
402
+        /**
403 403
          * Check if the current theme is a block theme.
404 404
          *
405
-		 * @return bool
406
-		 */
407
-		public static function is_block_theme() {
408
-			if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) {
409
-				return true;
410
-			}
411
-
412
-			return false;
413
-		}
405
+         * @return bool
406
+         */
407
+        public static function is_block_theme() {
408
+            if ( function_exists( 'wp_is_block_theme' && wp_is_block_theme() ) ) {
409
+                return true;
410
+            }
414 411
 
415
-		/**
416
-		 * Adds the styles.
417
-		 */
418
-		public function enqueue_style() {
412
+            return false;
413
+        }
419 414
 
415
+        /**
416
+         * Adds the styles.
417
+         */
418
+        public function enqueue_style() {
420 419
 
421
-			if( is_admin() && !$this->is_aui_screen()){
422
-				// don't add wp-admin scripts if not requested to
423
-			}else{
424
-				$css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
425 420
 
426
-				$rtl = is_rtl() ? '-rtl' : '';
421
+            if( is_admin() && !$this->is_aui_screen()){
422
+                // don't add wp-admin scripts if not requested to
423
+            }else{
424
+                $css_setting = current_action() == 'wp_enqueue_scripts' ? 'css' : 'css_backend';
427 425
 
428
-				if($this->settings[$css_setting]){
429
-					$compatibility = $this->settings[$css_setting]=='core' ? false : true;
430
-					$url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
431
-					wp_register_style( 'ayecode-ui', $url, array(), $this->version );
432
-					wp_enqueue_style( 'ayecode-ui' );
426
+                $rtl = is_rtl() ? '-rtl' : '';
433 427
 
434
-					// flatpickr
435
-					wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->version );
428
+                if($this->settings[$css_setting]){
429
+                    $compatibility = $this->settings[$css_setting]=='core' ? false : true;
430
+                    $url = $this->settings[$css_setting]=='core' ? $this->url.'assets/css/ayecode-ui'.$rtl.'.css' : $this->url.'assets/css/ayecode-ui-compatibility'.$rtl.'.css';
431
+                    wp_register_style( 'ayecode-ui', $url, array(), $this->version );
432
+                    wp_enqueue_style( 'ayecode-ui' );
436 433
 
437
-					// fix some wp-admin issues
438
-					if(is_admin()){
439
-						$custom_css = "
434
+                    // flatpickr
435
+                    wp_register_style( 'flatpickr', $this->url.'assets/css/flatpickr.min.css', array(), $this->version );
436
+
437
+                    // fix some wp-admin issues
438
+                    if(is_admin()){
439
+                        $custom_css = "
440 440
                 body{
441 441
                     background-color: #f1f1f1;
442 442
                     font-family: -apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif;
@@ -482,35 +482,35 @@  discard block
 block discarded – undo
482 482
 				}
483 483
                 ";
484 484
 
485
-						// @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
486
-						$custom_css .= "
485
+                        // @todo, remove once fixed :: fix for this bug https://github.com/WordPress/gutenberg/issues/14377
486
+                        $custom_css .= "
487 487
 						.edit-post-sidebar input[type=color].components-text-control__input{
488 488
 						    padding: 0;
489 489
 						}
490 490
 					";
491
-						wp_add_inline_style( 'ayecode-ui', $custom_css );
492
-					}
491
+                        wp_add_inline_style( 'ayecode-ui', $custom_css );
492
+                    }
493 493
 
494
-					// custom changes
495
-					wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
494
+                    // custom changes
495
+                    wp_add_inline_style( 'ayecode-ui', self::custom_css($compatibility) );
496 496
 
497
-				}
498
-			}
497
+                }
498
+            }
499 499
 
500 500
 
501
-		}
501
+        }
502 502
 
503
-		/**
504
-		 * Get inline script used if bootstrap enqueued
505
-		 *
506
-		 * If this remains small then its best to use this than to add another JS file.
507
-		 */
508
-		public function inline_script() {
509
-			// Flatpickr calendar locale
510
-			$flatpickr_locale = self::flatpickr_locale();
511
-
512
-			ob_start();
513
-			?>
503
+        /**
504
+         * Get inline script used if bootstrap enqueued
505
+         *
506
+         * If this remains small then its best to use this than to add another JS file.
507
+         */
508
+        public function inline_script() {
509
+            // Flatpickr calendar locale
510
+            $flatpickr_locale = self::flatpickr_locale();
511
+
512
+            ob_start();
513
+            ?>
514 514
 			<script>
515 515
 				/**
516 516
 				 * An AUI bootstrap adaptation of GreedyNav.js ( by Luke Jackson ).
@@ -1479,29 +1479,29 @@  discard block
 block discarded – undo
1479 1479
 
1480 1480
 			</script>
1481 1481
 			<?php
1482
-			$output = ob_get_clean();
1482
+            $output = ob_get_clean();
1483 1483
 
1484 1484
 
1485 1485
 
1486
-			/*
1486
+            /*
1487 1487
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1488 1488
 			 */
1489
-			return str_replace( array(
1490
-				'<script>',
1491
-				'</script>'
1492
-			), '', self::minify_js($output) );
1493
-		}
1489
+            return str_replace( array(
1490
+                '<script>',
1491
+                '</script>'
1492
+            ), '', self::minify_js($output) );
1493
+        }
1494 1494
 
1495 1495
 
1496
-		/**
1497
-		 * JS to help with conflict issues with other plugins and themes using bootstrap v3.
1498
-		 *
1499
-		 * @TODO we may need this when other conflicts arrise.
1500
-		 * @return mixed
1501
-		 */
1502
-		public static function bs3_compat_js() {
1503
-			ob_start();
1504
-			?>
1496
+        /**
1497
+         * JS to help with conflict issues with other plugins and themes using bootstrap v3.
1498
+         *
1499
+         * @TODO we may need this when other conflicts arrise.
1500
+         * @return mixed
1501
+         */
1502
+        public static function bs3_compat_js() {
1503
+            ob_start();
1504
+            ?>
1505 1505
 			<script>
1506 1506
 				<?php if( defined( 'FUSION_BUILDER_VERSION' ) ){ ?>
1507 1507
 				/* With Avada builder */
@@ -1509,20 +1509,20 @@  discard block
 block discarded – undo
1509 1509
 				<?php } ?>
1510 1510
 			</script>
1511 1511
 			<?php
1512
-			return str_replace( array(
1513
-				'<script>',
1514
-				'</script>'
1515
-			), '', ob_get_clean());
1516
-		}
1512
+            return str_replace( array(
1513
+                '<script>',
1514
+                '</script>'
1515
+            ), '', ob_get_clean());
1516
+        }
1517 1517
 
1518
-		/**
1519
-		 * Get inline script used if bootstrap file browser enqueued.
1520
-		 *
1521
-		 * If this remains small then its best to use this than to add another JS file.
1522
-		 */
1523
-		public function inline_script_file_browser(){
1524
-			ob_start();
1525
-			?>
1518
+        /**
1519
+         * Get inline script used if bootstrap file browser enqueued.
1520
+         *
1521
+         * If this remains small then its best to use this than to add another JS file.
1522
+         */
1523
+        public function inline_script_file_browser(){
1524
+            ob_start();
1525
+            ?>
1526 1526
 			<script>
1527 1527
 				// run on doc ready
1528 1528
 				jQuery(document).ready(function () {
@@ -1530,224 +1530,224 @@  discard block
 block discarded – undo
1530 1530
 				});
1531 1531
 			</script>
1532 1532
 			<?php
1533
-			$output = ob_get_clean();
1533
+            $output = ob_get_clean();
1534 1534
 
1535
-			/*
1535
+            /*
1536 1536
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1537 1537
 			 */
1538
-			return str_replace( array(
1539
-				'<script>',
1540
-				'</script>'
1541
-			), '', $output );
1542
-		}
1538
+            return str_replace( array(
1539
+                '<script>',
1540
+                '</script>'
1541
+            ), '', $output );
1542
+        }
1543 1543
 
1544
-		/**
1545
-		 * Adds the Font Awesome JS.
1546
-		 */
1547
-		public function enqueue_scripts() {
1544
+        /**
1545
+         * Adds the Font Awesome JS.
1546
+         */
1547
+        public function enqueue_scripts() {
1548 1548
 
1549
-			if( is_admin() && !$this->is_aui_screen()){
1550
-				// don't add wp-admin scripts if not requested to
1551
-			}else {
1549
+            if( is_admin() && !$this->is_aui_screen()){
1550
+                // don't add wp-admin scripts if not requested to
1551
+            }else {
1552 1552
 
1553
-				$js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
1553
+                $js_setting = current_action() == 'wp_enqueue_scripts' ? 'js' : 'js_backend';
1554 1554
 
1555
-				// select2
1556
-				wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
1555
+                // select2
1556
+                wp_register_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), $this->select2_version );
1557 1557
 
1558
-				// flatpickr
1559
-				wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
1558
+                // flatpickr
1559
+                wp_register_script( 'flatpickr', $this->url . 'assets/js/flatpickr.min.js', array(), $this->version );
1560 1560
 
1561
-				// flatpickr
1562
-				wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
1561
+                // flatpickr
1562
+                wp_register_script( 'iconpicker', $this->url . 'assets/js/fa-iconpicker.min.js', array(), $this->version );
1563 1563
 				
1564
-				// Bootstrap file browser
1565
-				wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
1566
-				wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
1567
-
1568
-				$load_inline = false;
1569
-
1570
-				if ( $this->settings[ $js_setting ] == 'core-popper' ) {
1571
-					// Bootstrap bundle
1572
-					$url = $this->url . 'assets/js/bootstrap.bundle.min.js';
1573
-					wp_register_script( 'bootstrap-js-bundle', $url, array(
1574
-						'select2',
1575
-						'jquery'
1576
-					), $this->version, $this->is_bs3_compat() );
1577
-					// if in admin then add to footer for compatibility.
1578
-					is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
1579
-					$script = $this->inline_script();
1580
-					wp_add_inline_script( 'bootstrap-js-bundle', $script );
1581
-				} elseif ( $this->settings[ $js_setting ] == 'popper' ) {
1582
-					$url = $this->url . 'assets/js/popper.min.js';
1583
-					wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version );
1584
-					wp_enqueue_script( 'bootstrap-js-popper' );
1585
-					$load_inline = true;
1586
-				} else {
1587
-					$load_inline = true;
1588
-				}
1564
+                // Bootstrap file browser
1565
+                wp_register_script( 'aui-custom-file-input', $url = $this->url . 'assets/js/bs-custom-file-input.min.js', array( 'jquery' ), $this->select2_version );
1566
+                wp_add_inline_script( 'aui-custom-file-input', $this->inline_script_file_browser() );
1567
+
1568
+                $load_inline = false;
1569
+
1570
+                if ( $this->settings[ $js_setting ] == 'core-popper' ) {
1571
+                    // Bootstrap bundle
1572
+                    $url = $this->url . 'assets/js/bootstrap.bundle.min.js';
1573
+                    wp_register_script( 'bootstrap-js-bundle', $url, array(
1574
+                        'select2',
1575
+                        'jquery'
1576
+                    ), $this->version, $this->is_bs3_compat() );
1577
+                    // if in admin then add to footer for compatibility.
1578
+                    is_admin() ? wp_enqueue_script( 'bootstrap-js-bundle', '', null, null, true ) : wp_enqueue_script( 'bootstrap-js-bundle' );
1579
+                    $script = $this->inline_script();
1580
+                    wp_add_inline_script( 'bootstrap-js-bundle', $script );
1581
+                } elseif ( $this->settings[ $js_setting ] == 'popper' ) {
1582
+                    $url = $this->url . 'assets/js/popper.min.js';
1583
+                    wp_register_script( 'bootstrap-js-popper', $url, array( 'select2', 'jquery' ), $this->version );
1584
+                    wp_enqueue_script( 'bootstrap-js-popper' );
1585
+                    $load_inline = true;
1586
+                } else {
1587
+                    $load_inline = true;
1588
+                }
1589 1589
 
1590
-				// Load needed inline scripts by faking the loading of a script if the main script is not being loaded
1591
-				if ( $load_inline ) {
1592
-					wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
1593
-					wp_enqueue_script( 'bootstrap-dummy' );
1594
-					$script = $this->inline_script();
1595
-					wp_add_inline_script( 'bootstrap-dummy', $script );
1596
-				}
1597
-			}
1590
+                // Load needed inline scripts by faking the loading of a script if the main script is not being loaded
1591
+                if ( $load_inline ) {
1592
+                    wp_register_script( 'bootstrap-dummy', '', array( 'select2', 'jquery' ) );
1593
+                    wp_enqueue_script( 'bootstrap-dummy' );
1594
+                    $script = $this->inline_script();
1595
+                    wp_add_inline_script( 'bootstrap-dummy', $script );
1596
+                }
1597
+            }
1598 1598
 
1599
-		}
1599
+        }
1600 1600
 
1601
-		/**
1602
-		 * Enqueue flatpickr if called.
1603
-		 */
1604
-		public function enqueue_flatpickr(){
1605
-			wp_enqueue_style( 'flatpickr' );
1606
-			wp_enqueue_script( 'flatpickr' );
1607
-		}
1601
+        /**
1602
+         * Enqueue flatpickr if called.
1603
+         */
1604
+        public function enqueue_flatpickr(){
1605
+            wp_enqueue_style( 'flatpickr' );
1606
+            wp_enqueue_script( 'flatpickr' );
1607
+        }
1608 1608
 
1609
-		/**
1610
-		 * Enqueue iconpicker if called.
1611
-		 */
1612
-		public function enqueue_iconpicker(){
1613
-			wp_enqueue_style( 'iconpicker' );
1614
-			wp_enqueue_script( 'iconpicker' );
1615
-		}
1609
+        /**
1610
+         * Enqueue iconpicker if called.
1611
+         */
1612
+        public function enqueue_iconpicker(){
1613
+            wp_enqueue_style( 'iconpicker' );
1614
+            wp_enqueue_script( 'iconpicker' );
1615
+        }
1616 1616
 
1617
-		/**
1618
-		 * Get the url path to the current folder.
1619
-		 *
1620
-		 * @return string
1621
-		 */
1622
-		public function get_url() {
1623
-			$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1624
-			$content_url = untrailingslashit( WP_CONTENT_URL );
1625
-
1626
-			// Replace http:// to https://.
1627
-			if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1628
-				$content_url = str_replace( 'http://', 'https://', $content_url );
1629
-			}
1630
-
1631
-			// Check if we are inside a plugin
1632
-			$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1633
-			$url = str_replace( $content_dir, $content_url, $file_dir );
1634
-
1635
-			return trailingslashit( $url );
1636
-		}
1617
+        /**
1618
+         * Get the url path to the current folder.
1619
+         *
1620
+         * @return string
1621
+         */
1622
+        public function get_url() {
1623
+            $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1624
+            $content_url = untrailingslashit( WP_CONTENT_URL );
1625
+
1626
+            // Replace http:// to https://.
1627
+            if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1628
+                $content_url = str_replace( 'http://', 'https://', $content_url );
1629
+            }
1630
+
1631
+            // Check if we are inside a plugin
1632
+            $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1633
+            $url = str_replace( $content_dir, $content_url, $file_dir );
1634
+
1635
+            return trailingslashit( $url );
1636
+        }
1637 1637
 
1638
-		/**
1639
-		 * Get the url path to the current folder.
1640
-		 *
1641
-		 * @return string
1642
-		 */
1643
-		public function get_url_old() {
1638
+        /**
1639
+         * Get the url path to the current folder.
1640
+         *
1641
+         * @return string
1642
+         */
1643
+        public function get_url_old() {
1644 1644
 
1645
-			$url = '';
1646
-			// check if we are inside a plugin
1647
-			$file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
1645
+            $url = '';
1646
+            // check if we are inside a plugin
1647
+            $file_dir = str_replace( "/includes","", wp_normalize_path( dirname( __FILE__ ) ) );
1648 1648
 
1649
-			// add check in-case user has changed wp-content dir name.
1650
-			$wp_content_folder_name = basename(WP_CONTENT_DIR);
1651
-			$dir_parts = explode("/$wp_content_folder_name/",$file_dir);
1652
-			$url_parts = explode("/$wp_content_folder_name/",plugins_url());
1649
+            // add check in-case user has changed wp-content dir name.
1650
+            $wp_content_folder_name = basename(WP_CONTENT_DIR);
1651
+            $dir_parts = explode("/$wp_content_folder_name/",$file_dir);
1652
+            $url_parts = explode("/$wp_content_folder_name/",plugins_url());
1653 1653
 
1654
-			if(!empty($url_parts[0]) && !empty($dir_parts[1])){
1655
-				$url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
1656
-			}
1654
+            if(!empty($url_parts[0]) && !empty($dir_parts[1])){
1655
+                $url = trailingslashit( $url_parts[0]."/$wp_content_folder_name/".$dir_parts[1] );
1656
+            }
1657 1657
 
1658
-			return $url;
1659
-		}
1658
+            return $url;
1659
+        }
1660 1660
 
1661
-		/**
1662
-		 * Register the database settings with WordPress.
1663
-		 */
1664
-		public function register_settings() {
1665
-			register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1666
-		}
1661
+        /**
1662
+         * Register the database settings with WordPress.
1663
+         */
1664
+        public function register_settings() {
1665
+            register_setting( 'ayecode-ui-settings', 'ayecode-ui-settings' );
1666
+        }
1667 1667
 
1668
-		/**
1669
-		 * Add the WordPress settings menu item.
1670
-		 * @since 1.0.10 Calling function name direct will fail theme check so we don't.
1671
-		 */
1672
-		public function menu_item() {
1673
-			$menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1674
-			call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1675
-				$this,
1676
-				'settings_page'
1677
-			) );
1678
-		}
1668
+        /**
1669
+         * Add the WordPress settings menu item.
1670
+         * @since 1.0.10 Calling function name direct will fail theme check so we don't.
1671
+         */
1672
+        public function menu_item() {
1673
+            $menu_function = 'add' . '_' . 'options' . '_' . 'page'; // won't pass theme check if function name present in theme
1674
+            call_user_func( $menu_function, $this->name, $this->name, 'manage_options', 'ayecode-ui-settings', array(
1675
+                $this,
1676
+                'settings_page'
1677
+            ) );
1678
+        }
1679 1679
 
1680
-		/**
1681
-		 * Get a list of themes and their default JS settings.
1682
-		 *
1683
-		 * @return array
1684
-		 */
1685
-		public function theme_js_settings(){
1686
-			return array(
1687
-				'ayetheme' => 'popper',
1688
-				'listimia' => 'required',
1689
-				'listimia_backend' => 'core-popper',
1690
-				//'avada'    => 'required', // removed as we now add compatibility
1691
-			);
1692
-		}
1680
+        /**
1681
+         * Get a list of themes and their default JS settings.
1682
+         *
1683
+         * @return array
1684
+         */
1685
+        public function theme_js_settings(){
1686
+            return array(
1687
+                'ayetheme' => 'popper',
1688
+                'listimia' => 'required',
1689
+                'listimia_backend' => 'core-popper',
1690
+                //'avada'    => 'required', // removed as we now add compatibility
1691
+            );
1692
+        }
1693 1693
 
1694
-		/**
1695
-		 * Get the current Font Awesome output settings.
1696
-		 *
1697
-		 * @return array The array of settings.
1698
-		 */
1699
-		public function get_settings() {
1700
-
1701
-			$db_settings = get_option( 'ayecode-ui-settings' );
1702
-			$js_default = 'core-popper';
1703
-			$js_default_backend = $js_default;
1704
-
1705
-			// maybe set defaults (if no settings set)
1706
-			if(empty($db_settings)){
1707
-				$active_theme = strtolower( get_template() ); // active parent theme.
1708
-				$theme_js_settings = self::theme_js_settings();
1709
-				if(isset($theme_js_settings[$active_theme])){
1710
-					$js_default = $theme_js_settings[$active_theme];
1711
-					$js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1712
-				}
1713
-			}
1714
-
1715
-			$defaults = array(
1716
-				'css'       => 'compatibility', // core, compatibility
1717
-				'js'        => $js_default, // js to load, core-popper, popper
1718
-				'html_font_size'        => '16', // js to load, core-popper, popper
1719
-				'css_backend'       => 'compatibility', // core, compatibility
1720
-				'js_backend'        => $js_default_backend, // js to load, core-popper, popper
1721
-				'disable_admin'     =>  '', // URL snippets to disable loading on admin
1722
-			);
1723
-
1724
-			$settings = wp_parse_args( $db_settings, $defaults );
1725
-
1726
-			/**
1727
-			 * Filter the Bootstrap settings.
1728
-			 *
1729
-			 * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1730
-			 */
1731
-			return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1732
-		}
1694
+        /**
1695
+         * Get the current Font Awesome output settings.
1696
+         *
1697
+         * @return array The array of settings.
1698
+         */
1699
+        public function get_settings() {
1700
+
1701
+            $db_settings = get_option( 'ayecode-ui-settings' );
1702
+            $js_default = 'core-popper';
1703
+            $js_default_backend = $js_default;
1704
+
1705
+            // maybe set defaults (if no settings set)
1706
+            if(empty($db_settings)){
1707
+                $active_theme = strtolower( get_template() ); // active parent theme.
1708
+                $theme_js_settings = self::theme_js_settings();
1709
+                if(isset($theme_js_settings[$active_theme])){
1710
+                    $js_default = $theme_js_settings[$active_theme];
1711
+                    $js_default_backend = isset($theme_js_settings[$active_theme."_backend"]) ? $theme_js_settings[$active_theme."_backend"] : $js_default;
1712
+                }
1713
+            }
1714
+
1715
+            $defaults = array(
1716
+                'css'       => 'compatibility', // core, compatibility
1717
+                'js'        => $js_default, // js to load, core-popper, popper
1718
+                'html_font_size'        => '16', // js to load, core-popper, popper
1719
+                'css_backend'       => 'compatibility', // core, compatibility
1720
+                'js_backend'        => $js_default_backend, // js to load, core-popper, popper
1721
+                'disable_admin'     =>  '', // URL snippets to disable loading on admin
1722
+            );
1733 1723
 
1724
+            $settings = wp_parse_args( $db_settings, $defaults );
1734 1725
 
1735
-		/**
1736
-		 * The settings page html output.
1737
-		 */
1738
-		public function settings_page() {
1739
-			if ( ! current_user_can( 'manage_options' ) ) {
1740
-				wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1741
-			}
1742
-			?>
1726
+            /**
1727
+             * Filter the Bootstrap settings.
1728
+             *
1729
+             * @todo if we add this filer people might use it and then it defeates the purpose of this class :/
1730
+             */
1731
+            return $this->settings = apply_filters( 'ayecode-ui-settings', $settings, $db_settings, $defaults );
1732
+        }
1733
+
1734
+
1735
+        /**
1736
+         * The settings page html output.
1737
+         */
1738
+        public function settings_page() {
1739
+            if ( ! current_user_can( 'manage_options' ) ) {
1740
+                wp_die( __( 'You do not have sufficient permissions to access this page.', 'aui' ) );
1741
+            }
1742
+            ?>
1743 1743
 			<div class="wrap">
1744 1744
 				<h1><?php echo $this->name; ?></h1>
1745 1745
 				<p><?php _e("Here you can adjust settings if you are having compatibility issues.",'aui');?></p>
1746 1746
 				<form method="post" action="options.php">
1747 1747
 					<?php
1748
-					settings_fields( 'ayecode-ui-settings' );
1749
-					do_settings_sections( 'ayecode-ui-settings' );
1750
-					?>
1748
+                    settings_fields( 'ayecode-ui-settings' );
1749
+                    do_settings_sections( 'ayecode-ui-settings' );
1750
+                    ?>
1751 1751
 
1752 1752
 					<h2><?php _e( 'Frontend', 'aui' ); ?></h2>
1753 1753
 					<table class="form-table wpbs-table-settings">
@@ -1827,60 +1827,60 @@  discard block
 block discarded – undo
1827 1827
 					</table>
1828 1828
 
1829 1829
 					<?php
1830
-					submit_button();
1831
-					?>
1830
+                    submit_button();
1831
+                    ?>
1832 1832
 				</form>
1833 1833
 
1834 1834
 				<div id="wpbs-version"><?php echo $this->version; ?></div>
1835 1835
 			</div>
1836 1836
 
1837 1837
 			<?php
1838
-		}
1838
+        }
1839 1839
 
1840
-		public function customizer_settings($wp_customize){
1841
-			$wp_customize->add_section('aui_settings', array(
1842
-				'title'    => __('AyeCode UI','aui'),
1843
-				'priority' => 120,
1844
-			));
1845
-
1846
-			//  =============================
1847
-			//  = Color Picker              =
1848
-			//  =============================
1849
-			$wp_customize->add_setting('aui_options[color_primary]', array(
1850
-				'default'           => AUI_PRIMARY_COLOR,
1851
-				'sanitize_callback' => 'sanitize_hex_color',
1852
-				'capability'        => 'edit_theme_options',
1853
-				'type'              => 'option',
1854
-				'transport'         => 'refresh',
1855
-			));
1856
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1857
-				'label'    => __('Primary Color','aui'),
1858
-				'section'  => 'aui_settings',
1859
-				'settings' => 'aui_options[color_primary]',
1860
-			)));
1861
-
1862
-			$wp_customize->add_setting('aui_options[color_secondary]', array(
1863
-				'default'           => '#6c757d',
1864
-				'sanitize_callback' => 'sanitize_hex_color',
1865
-				'capability'        => 'edit_theme_options',
1866
-				'type'              => 'option',
1867
-				'transport'         => 'refresh',
1868
-			));
1869
-			$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1870
-				'label'    => __('Secondary Color','aui'),
1871
-				'section'  => 'aui_settings',
1872
-				'settings' => 'aui_options[color_secondary]',
1873
-			)));
1874
-		}
1840
+        public function customizer_settings($wp_customize){
1841
+            $wp_customize->add_section('aui_settings', array(
1842
+                'title'    => __('AyeCode UI','aui'),
1843
+                'priority' => 120,
1844
+            ));
1845
+
1846
+            //  =============================
1847
+            //  = Color Picker              =
1848
+            //  =============================
1849
+            $wp_customize->add_setting('aui_options[color_primary]', array(
1850
+                'default'           => AUI_PRIMARY_COLOR,
1851
+                'sanitize_callback' => 'sanitize_hex_color',
1852
+                'capability'        => 'edit_theme_options',
1853
+                'type'              => 'option',
1854
+                'transport'         => 'refresh',
1855
+            ));
1856
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_primary', array(
1857
+                'label'    => __('Primary Color','aui'),
1858
+                'section'  => 'aui_settings',
1859
+                'settings' => 'aui_options[color_primary]',
1860
+            )));
1861
+
1862
+            $wp_customize->add_setting('aui_options[color_secondary]', array(
1863
+                'default'           => '#6c757d',
1864
+                'sanitize_callback' => 'sanitize_hex_color',
1865
+                'capability'        => 'edit_theme_options',
1866
+                'type'              => 'option',
1867
+                'transport'         => 'refresh',
1868
+            ));
1869
+            $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'color_secondary', array(
1870
+                'label'    => __('Secondary Color','aui'),
1871
+                'section'  => 'aui_settings',
1872
+                'settings' => 'aui_options[color_secondary]',
1873
+            )));
1874
+        }
1875 1875
 
1876
-		/**
1877
-		 * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1878
-		 *
1879
-		 * @return mixed
1880
-		 */
1881
-		public static function bs3_compat_css() {
1882
-			ob_start();
1883
-			?>
1876
+        /**
1877
+         * CSS to help with conflict issues with other plugins and themes using bootstrap v3.
1878
+         *
1879
+         * @return mixed
1880
+         */
1881
+        public static function bs3_compat_css() {
1882
+            ob_start();
1883
+            ?>
1884 1884
 			<style>
1885 1885
 			/* Bootstrap 3 compatibility */
1886 1886
 			body.modal-open .modal-backdrop.show:not(.in) {opacity:0.5;}
@@ -1909,47 +1909,47 @@  discard block
 block discarded – undo
1909 1909
 			<?php } ?>
1910 1910
 			</style>
1911 1911
 			<?php
1912
-			return str_replace( array(
1913
-				'<style>',
1914
-				'</style>'
1915
-			), '', self::minify_css( ob_get_clean() ) );
1916
-		}
1912
+            return str_replace( array(
1913
+                '<style>',
1914
+                '</style>'
1915
+            ), '', self::minify_css( ob_get_clean() ) );
1916
+        }
1917 1917
 
1918 1918
 
1919
-		public static function custom_css($compatibility = true) {
1920
-			$colors = array();
1921
-			if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1919
+        public static function custom_css($compatibility = true) {
1920
+            $colors = array();
1921
+            if ( defined( 'BLOCKSTRAP_VERSION' ) ) {
1922 1922
 
1923
-				$setting = wp_get_global_settings();
1924
-				if(!empty($setting['color']['palette']['theme'])){
1925
-					foreach($setting['color']['palette']['theme'] as $color){
1926
-						$colors[$color['slug']] = esc_attr($color['color']);
1927
-					}
1928
-				}
1923
+                $setting = wp_get_global_settings();
1924
+                if(!empty($setting['color']['palette']['theme'])){
1925
+                    foreach($setting['color']['palette']['theme'] as $color){
1926
+                        $colors[$color['slug']] = esc_attr($color['color']);
1927
+                    }
1928
+                }
1929 1929
 
1930
-				if(!empty($setting['color']['palette']['custom'])){
1931
-					foreach($setting['color']['palette']['custom'] as $color){
1932
-						$colors[$color['slug']] = esc_attr($color['color']);
1933
-					}
1934
-				}
1935
-			}else{
1936
-				$settings = get_option('aui_options');
1937
-				$colors = array(
1938
-					'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1939
-					'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1940
-				);
1941
-			}
1930
+                if(!empty($setting['color']['palette']['custom'])){
1931
+                    foreach($setting['color']['palette']['custom'] as $color){
1932
+                        $colors[$color['slug']] = esc_attr($color['color']);
1933
+                    }
1934
+                }
1935
+            }else{
1936
+                $settings = get_option('aui_options');
1937
+                $colors = array(
1938
+                    'primary'   => ! empty( $settings['color_primary'] ) ? $settings['color_primary'] : AUI_PRIMARY_COLOR,
1939
+                    'secondary' => ! empty( $settings['color_secondary'] ) ? $settings['color_secondary'] : AUI_SECONDARY_COLOR
1940
+                );
1941
+            }
1942 1942
 
1943
-			ob_start();
1943
+            ob_start();
1944 1944
 
1945
-			?>
1945
+            ?>
1946 1946
 			<style>
1947 1947
 				<?php
1948 1948
 
1949
-					// BS v3 compat
1950
-					if( self::is_bs3_compat() ){
1951
-					    echo self::bs3_compat_css();
1952
-					}
1949
+                    // BS v3 compat
1950
+                    if( self::is_bs3_compat() ){
1951
+                        echo self::bs3_compat_css();
1952
+                    }
1953 1953
 
1954 1954
                     if(!empty($colors)){
1955 1955
                         $d_colors = self::get_colors(true);
@@ -1963,768 +1963,768 @@  discard block
 block discarded – undo
1963 1963
                                 echo self::css_overwrite($key,$var,$compat);
1964 1964
                             }
1965 1965
                         }
1966
-                       // exit;
1966
+                        // exit;
1967 1967
                     }
1968 1968
 
1969
-					// Set admin bar z-index lower when modal is open.
1970
-					echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1969
+                    // Set admin bar z-index lower when modal is open.
1970
+                    echo ' body.modal-open #wpadminbar{z-index:999}.embed-responsive-16by9 .fluid-width-video-wrapper{padding:0 !important;position:initial}';
1971 1971
 
1972
-					if(is_admin()){
1973
-						echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1974
-					}
1972
+                    if(is_admin()){
1973
+                        echo ' body.modal-open #adminmenuwrap{z-index:999} body.modal-open #wpadminbar{z-index:1025}';
1974
+                    }
1975 1975
                 ?>
1976 1976
 			</style>
1977 1977
 			<?php
1978 1978
 
1979 1979
 
1980
-			/*
1980
+            /*
1981 1981
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1982 1982
 			 */
1983
-			return str_replace( array(
1984
-				'<style>',
1985
-				'</style>'
1986
-			), '', self::minify_css( ob_get_clean() ) );
1987
-		}
1983
+            return str_replace( array(
1984
+                '<style>',
1985
+                '</style>'
1986
+            ), '', self::minify_css( ob_get_clean() ) );
1987
+        }
1988 1988
 
1989 1989
 
1990 1990
 
1991
-		/**
1992
-		 * Check if we should add booststrap 3 compatibility changes.
1993
-		 *
1994
-		 * @return bool
1995
-		 */
1996
-		public static function is_bs3_compat(){
1997
-			return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1998
-		}
1991
+        /**
1992
+         * Check if we should add booststrap 3 compatibility changes.
1993
+         *
1994
+         * @return bool
1995
+         */
1996
+        public static function is_bs3_compat(){
1997
+            return defined('AYECODE_UI_BS3_COMPAT') || defined('SVQ_THEME_VERSION') || defined('FUSION_BUILDER_VERSION');
1998
+        }
1999 1999
 
2000
-		/**
2000
+        /**
2001 2001
          * Build the CSS to overwrite a bootstrap color variable.
2002 2002
          *
2003
-		 * @param $type
2004
-		 * @param $color_code
2005
-		 * @param $compatibility
2006
-		 *
2007
-		 * @return string
2008
-		 */
2009
-		public static function css_overwrite($type,$color_code,$compatibility){
2003
+         * @param $type
2004
+         * @param $color_code
2005
+         * @param $compatibility
2006
+         *
2007
+         * @return string
2008
+         */
2009
+        public static function css_overwrite($type,$color_code,$compatibility){
2010 2010
 
2011 2011
             $is_var = false;
2012
-			if(!$color_code){return '';}
2013
-			if(!sanitize_hex_color($color_code)){
2014
-				$color_code = esc_attr($color_code);
2015
-				$is_var = true;
2012
+            if(!$color_code){return '';}
2013
+            if(!sanitize_hex_color($color_code)){
2014
+                $color_code = esc_attr($color_code);
2015
+                $is_var = true;
2016 2016
 //                echo '###1'.$color_code;//exit;
2017
-			}
2018
-			if(!$color_code){return '';}
2017
+            }
2018
+            if(!$color_code){return '';}
2019 2019
 
2020 2020
             if($compatibility===true || $compatibility===1){
2021
-	            $compatibility = '.bsui';
2021
+                $compatibility = '.bsui';
2022 2022
             }elseif(!$compatibility){
2023
-	            $compatibility = '';
2023
+                $compatibility = '';
2024 2024
             }else{
2025
-	            $compatibility = esc_attr($compatibility);
2025
+                $compatibility = esc_attr($compatibility);
2026 2026
             }
2027 2027
 
2028 2028
 //            echo '####'.$color_code;exit;
2029 2029
 
2030
-			$type = sanitize_html_class($type);
2030
+            $type = sanitize_html_class($type);
2031
+
2032
+            /**
2033
+             * c = color, b = background color, o = border-color, f = fill
2034
+             */
2035
+            $selectors = array(
2036
+                ".btn-{$type}"                                              => array( 'b', 'o' ),
2037
+                ".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
2038
+                ".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
2039
+                ".btn-outline-{$type}"                                      => array( 'c', 'o' ),
2040
+                ".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
2041
+                ".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
2042
+                ".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
2043
+                ".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
2044
+                ".badge-{$type}"                                            => array( 'b' ),
2045
+                ".alert-{$type}"                                            => array( 'b', 'o' ),
2046
+                ".bg-{$type}"                                               => array( 'b', 'f' ),
2047
+                ".btn-link.btn-{$type}"                                     => array( 'c' ),
2048
+            );
2031 2049
 
2032
-			/**
2033
-			 * c = color, b = background color, o = border-color, f = fill
2034
-			 */
2035
-			$selectors = array(
2036
-				".btn-{$type}"                                              => array( 'b', 'o' ),
2037
-				".btn-{$type}.disabled"                                     => array( 'b', 'o' ),
2038
-				".btn-{$type}:disabled"                                     => array( 'b', 'o' ),
2039
-				".btn-outline-{$type}"                                      => array( 'c', 'o' ),
2040
-				".btn-outline-{$type}:hover"                                => array( 'b', 'o' ),
2041
-				".btn-outline-{$type}:not(:disabled):not(.disabled).active" => array( 'b', 'o' ),
2042
-				".btn-outline-{$type}:not(:disabled):not(.disabled):active" => array( 'b', 'o' ),
2043
-				".show>.btn-outline-{$type}.dropdown-toggle"                => array( 'b', 'o' ),
2044
-				".badge-{$type}"                                            => array( 'b' ),
2045
-				".alert-{$type}"                                            => array( 'b', 'o' ),
2046
-				".bg-{$type}"                                               => array( 'b', 'f' ),
2047
-				".btn-link.btn-{$type}"                                     => array( 'c' ),
2048
-			);
2049
-
2050
-			if ( $type == 'primary' ) {
2051
-				$selectors = $selectors + array(
2052
-						'a'                                                                                                    => array( 'c' ),
2053
-						'.btn-link'                                                                                            => array( 'c' ),
2054
-						'.dropdown-item.active'                                                                                => array( 'b' ),
2055
-						'.custom-control-input:checked~.custom-control-label::before'                                          => array(
2056
-							'b',
2057
-							'o'
2058
-						),
2059
-						'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
2060
-							'b',
2061
-							'o'
2062
-						),
2063
-						'.nav-pills .nav-link.active'                                                                          => array( 'b' ),
2064
-						'.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
2065
-						'.page-link'                                                                                           => array( 'c' ),
2066
-						'.page-item.active .page-link'                                                                         => array(
2067
-							'b',
2068
-							'o'
2069
-						),
2070
-						'.progress-bar'                                                                                        => array( 'b' ),
2071
-						'.list-group-item.active'                                                                              => array(
2072
-							'b',
2073
-							'o'
2074
-						),
2075
-						'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
2050
+            if ( $type == 'primary' ) {
2051
+                $selectors = $selectors + array(
2052
+                        'a'                                                                                                    => array( 'c' ),
2053
+                        '.btn-link'                                                                                            => array( 'c' ),
2054
+                        '.dropdown-item.active'                                                                                => array( 'b' ),
2055
+                        '.custom-control-input:checked~.custom-control-label::before'                                          => array(
2056
+                            'b',
2057
+                            'o'
2058
+                        ),
2059
+                        '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before'                   => array(
2060
+                            'b',
2061
+                            'o'
2062
+                        ),
2063
+                        '.nav-pills .nav-link.active'                                                                          => array( 'b' ),
2064
+                        '.nav-pills .show>.nav-link'                                                                           => array( 'b' ),
2065
+                        '.page-link'                                                                                           => array( 'c' ),
2066
+                        '.page-item.active .page-link'                                                                         => array(
2067
+                            'b',
2068
+                            'o'
2069
+                        ),
2070
+                        '.progress-bar'                                                                                        => array( 'b' ),
2071
+                        '.list-group-item.active'                                                                              => array(
2072
+                            'b',
2073
+                            'o'
2074
+                        ),
2075
+                        '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array( 'b' ),
2076 2076
 //				    '.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
2077 2077
 //				    '.custom-range::-moz-range-thumb' => array('b'),
2078 2078
 //				    '.custom-range::-ms-thumb' => array('b'),
2079
-					);
2080
-			}
2081
-
2082
-			$important_selectors = array(
2083
-				".bg-{$type}" => array('b','f'),
2084
-				".border-{$type}" => array('o'),
2085
-				".text-{$type}" => array('c'),
2086
-			);
2087
-
2088
-			$color = array();
2089
-			$color_i = array();
2090
-			$background = array();
2091
-			$background_i = array();
2092
-			$border = array();
2093
-			$border_i = array();
2094
-			$fill = array();
2095
-			$fill_i = array();
2096
-
2097
-			$output = '';
2098
-
2099
-			// build rules into each type
2100
-			foreach($selectors as $selector => $types){
2101
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
2102
-				$types = array_combine($types,$types);
2103
-				if(isset($types['c'])){$color[] = $selector;}
2104
-				if(isset($types['b'])){$background[] = $selector;}
2105
-				if(isset($types['o'])){$border[] = $selector;}
2106
-				if(isset($types['f'])){$fill[] = $selector;}
2107
-			}
2108
-
2109
-			// build rules into each type
2110
-			foreach($important_selectors as $selector => $types){
2111
-				$selector = $compatibility ? $compatibility . " ".$selector : $selector;
2112
-				$types = array_combine($types,$types);
2113
-				if(isset($types['c'])){$color_i[] = $selector;}
2114
-				if(isset($types['b'])){$background_i[] = $selector;}
2115
-				if(isset($types['o'])){$border_i[] = $selector;}
2116
-				if(isset($types['f'])){$fill_i[] = $selector;}
2117
-			}
2118
-
2119
-			// add any color rules
2120
-			if(!empty($color)){
2121
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2122
-			}
2123
-			if(!empty($color_i)){
2124
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2125
-			}
2126
-
2127
-			// add any background color rules
2128
-			if(!empty($background)){
2129
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2130
-			}
2131
-			if(!empty($background_i)){
2132
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2133
-			}
2134
-
2135
-			// add any border color rules
2136
-			if(!empty($border)){
2137
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2138
-			}
2139
-			if(!empty($border_i)){
2140
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2141
-			}
2142
-
2143
-			// add any fill color rules
2144
-			if(!empty($fill)){
2145
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2146
-			}
2147
-			if(!empty($fill_i)){
2148
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2149
-			}
2150
-
2151
-
2152
-			$prefix = $compatibility ? $compatibility . " " : "";
2079
+                    );
2080
+            }
2081
+
2082
+            $important_selectors = array(
2083
+                ".bg-{$type}" => array('b','f'),
2084
+                ".border-{$type}" => array('o'),
2085
+                ".text-{$type}" => array('c'),
2086
+            );
2087
+
2088
+            $color = array();
2089
+            $color_i = array();
2090
+            $background = array();
2091
+            $background_i = array();
2092
+            $border = array();
2093
+            $border_i = array();
2094
+            $fill = array();
2095
+            $fill_i = array();
2096
+
2097
+            $output = '';
2098
+
2099
+            // build rules into each type
2100
+            foreach($selectors as $selector => $types){
2101
+                $selector = $compatibility ? $compatibility . " ".$selector : $selector;
2102
+                $types = array_combine($types,$types);
2103
+                if(isset($types['c'])){$color[] = $selector;}
2104
+                if(isset($types['b'])){$background[] = $selector;}
2105
+                if(isset($types['o'])){$border[] = $selector;}
2106
+                if(isset($types['f'])){$fill[] = $selector;}
2107
+            }
2108
+
2109
+            // build rules into each type
2110
+            foreach($important_selectors as $selector => $types){
2111
+                $selector = $compatibility ? $compatibility . " ".$selector : $selector;
2112
+                $types = array_combine($types,$types);
2113
+                if(isset($types['c'])){$color_i[] = $selector;}
2114
+                if(isset($types['b'])){$background_i[] = $selector;}
2115
+                if(isset($types['o'])){$border_i[] = $selector;}
2116
+                if(isset($types['f'])){$fill_i[] = $selector;}
2117
+            }
2118
+
2119
+            // add any color rules
2120
+            if(!empty($color)){
2121
+                $output .= implode(",",$color) . "{color: $color_code;} ";
2122
+            }
2123
+            if(!empty($color_i)){
2124
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2125
+            }
2126
+
2127
+            // add any background color rules
2128
+            if(!empty($background)){
2129
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
2130
+            }
2131
+            if(!empty($background_i)){
2132
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2133
+            }
2134
+
2135
+            // add any border color rules
2136
+            if(!empty($border)){
2137
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
2138
+            }
2139
+            if(!empty($border_i)){
2140
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2141
+            }
2142
+
2143
+            // add any fill color rules
2144
+            if(!empty($fill)){
2145
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
2146
+            }
2147
+            if(!empty($fill_i)){
2148
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2149
+            }
2150
+
2151
+
2152
+            $prefix = $compatibility ? $compatibility . " " : "";
2153 2153
 
2154 2154
             $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;' : '';
2155
-			// darken
2156
-			$darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
2157
-			$darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
2158
-			$darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
2155
+            // darken
2156
+            $darker_075 = $is_var ? $color_code.';filter:brightness(0.925)' : self::css_hex_lighten_darken($color_code,"-0.075");
2157
+            $darker_10 = $is_var ? $color_code.';filter:brightness(0.9)' : self::css_hex_lighten_darken($color_code,"-0.10");
2158
+            $darker_125 = $is_var ? $color_code.';filter:brightness(0.875)' : self::css_hex_lighten_darken($color_code,"-0.125");
2159 2159
 
2160
-			// lighten
2161
-			$lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
2160
+            // lighten
2161
+            $lighten_25 = $is_var ? $color_code.';filter:brightness(1.25)' :self::css_hex_lighten_darken($color_code,"0.25");
2162 2162
 
2163
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
2164
-			$op_25 = $color_code."40"; // 25% opacity
2163
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
2164
+            $op_25 = $color_code."40"; // 25% opacity
2165 2165
 
2166 2166
 
2167
-			// button states
2168
-			$output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
2169
-			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2167
+            // button states
2168
+            $output .= $is_var ? $prefix ." .btn-{$type}{{$transition }} " : '';
2169
+            $output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2170 2170
 //			$output .= $prefix ." .btn-{$type}:hover, $prefix .btn-{$type}:focus, $prefix .btn-{$type}.focus{background-color: #000;    border-color: #000;} ";
2171
-			$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;} ";
2172
-			$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.";} ";
2173
-			$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;} ";
2171
+            $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;} ";
2172
+            $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.";} ";
2173
+            $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;} ";
2174 2174
 
2175
-			if ( $type == 'primary' ) {
2176
-				// dropdown's
2177
-				$output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2175
+            if ( $type == 'primary' ) {
2176
+                // dropdown's
2177
+                $output .= $prefix . " .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2178 2178
 
2179
-				// input states
2180
-				$output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
2179
+                // input states
2180
+                $output .= $prefix . " .form-control:focus{border-color: " . $lighten_25 . ";box-shadow: 0 0 0 0.2rem $op_25;} ";
2181 2181
 
2182
-				// page link
2183
-				$output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2184
-			}
2182
+                // page link
2183
+                $output .= $prefix . " .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2184
+            }
2185 2185
 
2186
-			return $output;
2187
-		}
2186
+            return $output;
2187
+        }
2188 2188
 
2189
-		/**
2189
+        /**
2190 2190
          *
2191 2191
          * @deprecated 0.1.76 Use css_overwrite()
2192 2192
          *
2193
-		 * @param $color_code
2194
-		 * @param $compatibility
2195
-		 * @param $use_variable
2196
-		 *
2197
-		 * @return string
2198
-		 */
2199
-		public static function css_primary($color_code,$compatibility, $use_variable = false){
2193
+         * @param $color_code
2194
+         * @param $compatibility
2195
+         * @param $use_variable
2196
+         *
2197
+         * @return string
2198
+         */
2199
+        public static function css_primary($color_code,$compatibility, $use_variable = false){
2200 2200
 
2201 2201
             if(!$use_variable){
2202
-				$color_code = sanitize_hex_color($color_code);
2203
-				if(!$color_code){return '';}
2204
-			}
2202
+                $color_code = sanitize_hex_color($color_code);
2203
+                if(!$color_code){return '';}
2204
+            }
2205 2205
 
2206
-			/**
2207
-			 * c = color, b = background color, o = border-color, f = fill
2208
-			 */
2209
-			$selectors = array(
2210
-				'a' => array('c'),
2211
-				'.btn-primary' => array('b','o'),
2212
-				'.btn-primary.disabled' => array('b','o'),
2213
-				'.btn-primary:disabled' => array('b','o'),
2214
-				'.btn-outline-primary' => array('c','o'),
2215
-				'.btn-outline-primary:hover' => array('b','o'),
2216
-				'.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
2217
-				'.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
2218
-				'.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
2219
-				'.btn-link' => array('c'),
2220
-				'.dropdown-item.active' => array('b'),
2221
-				'.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
2222
-				'.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
2206
+            /**
2207
+             * c = color, b = background color, o = border-color, f = fill
2208
+             */
2209
+            $selectors = array(
2210
+                'a' => array('c'),
2211
+                '.btn-primary' => array('b','o'),
2212
+                '.btn-primary.disabled' => array('b','o'),
2213
+                '.btn-primary:disabled' => array('b','o'),
2214
+                '.btn-outline-primary' => array('c','o'),
2215
+                '.btn-outline-primary:hover' => array('b','o'),
2216
+                '.btn-outline-primary:not(:disabled):not(.disabled).active' => array('b','o'),
2217
+                '.btn-outline-primary:not(:disabled):not(.disabled):active' => array('b','o'),
2218
+                '.show>.btn-outline-primary.dropdown-toggle' => array('b','o'),
2219
+                '.btn-link' => array('c'),
2220
+                '.dropdown-item.active' => array('b'),
2221
+                '.custom-control-input:checked~.custom-control-label::before' => array('b','o'),
2222
+                '.custom-checkbox .custom-control-input:indeterminate~.custom-control-label::before' => array('b','o'),
2223 2223
 //				'.custom-range::-webkit-slider-thumb' => array('b'), // these break the inline rules...
2224 2224
 //				'.custom-range::-moz-range-thumb' => array('b'),
2225 2225
 //				'.custom-range::-ms-thumb' => array('b'),
2226
-				'.nav-pills .nav-link.active' => array('b'),
2227
-				'.nav-pills .show>.nav-link' => array('b'),
2228
-				'.page-link' => array('c'),
2229
-				'.page-item.active .page-link' => array('b','o'),
2230
-				'.badge-primary' => array('b'),
2231
-				'.alert-primary' => array('b','o'),
2232
-				'.progress-bar' => array('b'),
2233
-				'.list-group-item.active' => array('b','o'),
2234
-				'.bg-primary' => array('b','f'),
2235
-				'.btn-link.btn-primary' => array('c'),
2236
-				'.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
2237
-			);
2238
-
2239
-			$important_selectors = array(
2240
-				'.bg-primary' => array('b','f'),
2241
-				'.border-primary' => array('o'),
2242
-				'.text-primary' => array('c'),
2243
-			);
2244
-
2245
-			$color = array();
2246
-			$color_i = array();
2247
-			$background = array();
2248
-			$background_i = array();
2249
-			$border = array();
2250
-			$border_i = array();
2251
-			$fill = array();
2252
-			$fill_i = array();
2253
-
2254
-			$output = '';
2255
-
2256
-			// build rules into each type
2257
-			foreach($selectors as $selector => $types){
2258
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2259
-				$types = array_combine($types,$types);
2260
-				if(isset($types['c'])){$color[] = $selector;}
2261
-				if(isset($types['b'])){$background[] = $selector;}
2262
-				if(isset($types['o'])){$border[] = $selector;}
2263
-				if(isset($types['f'])){$fill[] = $selector;}
2264
-			}
2265
-
2266
-			// build rules into each type
2267
-			foreach($important_selectors as $selector => $types){
2268
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2269
-				$types = array_combine($types,$types);
2270
-				if(isset($types['c'])){$color_i[] = $selector;}
2271
-				if(isset($types['b'])){$background_i[] = $selector;}
2272
-				if(isset($types['o'])){$border_i[] = $selector;}
2273
-				if(isset($types['f'])){$fill_i[] = $selector;}
2274
-			}
2275
-
2276
-			// add any color rules
2277
-			if(!empty($color)){
2278
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2279
-			}
2280
-			if(!empty($color_i)){
2281
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2282
-			}
2283
-
2284
-			// add any background color rules
2285
-			if(!empty($background)){
2286
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2287
-			}
2288
-			if(!empty($background_i)){
2289
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2290
-			}
2291
-
2292
-			// add any border color rules
2293
-			if(!empty($border)){
2294
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2295
-			}
2296
-			if(!empty($border_i)){
2297
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2298
-			}
2299
-
2300
-			// add any fill color rules
2301
-			if(!empty($fill)){
2302
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2303
-			}
2304
-			if(!empty($fill_i)){
2305
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2306
-			}
2307
-
2308
-
2309
-			$prefix = $compatibility ? ".bsui " : "";
2310
-
2311
-			// darken
2312
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2313
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2314
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2315
-
2316
-			// lighten
2317
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2318
-
2319
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
2320
-			$op_25 = $color_code."40"; // 25% opacity
2321
-
2322
-
2323
-			// button states
2324
-			$output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2325
-			$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;} ";
2326
-			$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.";} ";
2327
-			$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;} ";
2328
-
2329
-
2330
-			// dropdown's
2331
-			$output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2332
-
2333
-
2334
-			// input states
2335
-			$output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
2336
-
2337
-			// page link
2338
-			$output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2339
-
2340
-			return $output;
2341
-		}
2226
+                '.nav-pills .nav-link.active' => array('b'),
2227
+                '.nav-pills .show>.nav-link' => array('b'),
2228
+                '.page-link' => array('c'),
2229
+                '.page-item.active .page-link' => array('b','o'),
2230
+                '.badge-primary' => array('b'),
2231
+                '.alert-primary' => array('b','o'),
2232
+                '.progress-bar' => array('b'),
2233
+                '.list-group-item.active' => array('b','o'),
2234
+                '.bg-primary' => array('b','f'),
2235
+                '.btn-link.btn-primary' => array('c'),
2236
+                '.select2-container .select2-results__option--highlighted.select2-results__option[aria-selected=true]' => array('b'),
2237
+            );
2342 2238
 
2343
-		/**
2239
+            $important_selectors = array(
2240
+                '.bg-primary' => array('b','f'),
2241
+                '.border-primary' => array('o'),
2242
+                '.text-primary' => array('c'),
2243
+            );
2244
+
2245
+            $color = array();
2246
+            $color_i = array();
2247
+            $background = array();
2248
+            $background_i = array();
2249
+            $border = array();
2250
+            $border_i = array();
2251
+            $fill = array();
2252
+            $fill_i = array();
2253
+
2254
+            $output = '';
2255
+
2256
+            // build rules into each type
2257
+            foreach($selectors as $selector => $types){
2258
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2259
+                $types = array_combine($types,$types);
2260
+                if(isset($types['c'])){$color[] = $selector;}
2261
+                if(isset($types['b'])){$background[] = $selector;}
2262
+                if(isset($types['o'])){$border[] = $selector;}
2263
+                if(isset($types['f'])){$fill[] = $selector;}
2264
+            }
2265
+
2266
+            // build rules into each type
2267
+            foreach($important_selectors as $selector => $types){
2268
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2269
+                $types = array_combine($types,$types);
2270
+                if(isset($types['c'])){$color_i[] = $selector;}
2271
+                if(isset($types['b'])){$background_i[] = $selector;}
2272
+                if(isset($types['o'])){$border_i[] = $selector;}
2273
+                if(isset($types['f'])){$fill_i[] = $selector;}
2274
+            }
2275
+
2276
+            // add any color rules
2277
+            if(!empty($color)){
2278
+                $output .= implode(",",$color) . "{color: $color_code;} ";
2279
+            }
2280
+            if(!empty($color_i)){
2281
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2282
+            }
2283
+
2284
+            // add any background color rules
2285
+            if(!empty($background)){
2286
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
2287
+            }
2288
+            if(!empty($background_i)){
2289
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2290
+            }
2291
+
2292
+            // add any border color rules
2293
+            if(!empty($border)){
2294
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
2295
+            }
2296
+            if(!empty($border_i)){
2297
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2298
+            }
2299
+
2300
+            // add any fill color rules
2301
+            if(!empty($fill)){
2302
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
2303
+            }
2304
+            if(!empty($fill_i)){
2305
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2306
+            }
2307
+
2308
+
2309
+            $prefix = $compatibility ? ".bsui " : "";
2310
+
2311
+            // darken
2312
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2313
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2314
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2315
+
2316
+            // lighten
2317
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2318
+
2319
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
2320
+            $op_25 = $color_code."40"; // 25% opacity
2321
+
2322
+
2323
+            // button states
2324
+            $output .= $prefix ." .btn-primary:hover, $prefix .btn-primary:focus, $prefix .btn-primary.focus{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2325
+            $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;} ";
2326
+            $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.";} ";
2327
+            $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;} ";
2328
+
2329
+
2330
+            // dropdown's
2331
+            $output .= $prefix ." .dropdown-item.active, $prefix .dropdown-item:active{background-color: $color_code;} ";
2332
+
2333
+
2334
+            // input states
2335
+            $output .= $prefix ." .form-control:focus{border-color: ".$lighten_25.";box-shadow: 0 0 0 0.2rem $op_25;} ";
2336
+
2337
+            // page link
2338
+            $output .= $prefix ." .page-link:focus{box-shadow: 0 0 0 0.2rem $op_25;} ";
2339
+
2340
+            return $output;
2341
+        }
2342
+
2343
+        /**
2344 2344
          *
2345 2345
          * @deprecated 0.1.76 Use css_overwrite()
2346 2346
          *
2347
-		 * @param $color_code
2348
-		 * @param $compatibility
2349
-		 *
2350
-		 * @return string
2351
-		 */
2352
-		public static function css_secondary($color_code,$compatibility){;
2353
-			$color_code = sanitize_hex_color($color_code);
2354
-			if(!$color_code){return '';}
2355
-			/**
2356
-			 * c = color, b = background color, o = border-color, f = fill
2357
-			 */
2358
-			$selectors = array(
2359
-				'.btn-secondary' => array('b','o'),
2360
-				'.btn-secondary.disabled' => array('b','o'),
2361
-				'.btn-secondary:disabled' => array('b','o'),
2362
-				'.btn-outline-secondary' => array('c','o'),
2363
-				'.btn-outline-secondary:hover' => array('b','o'),
2364
-				'.btn-outline-secondary.disabled' => array('c'),
2365
-				'.btn-outline-secondary:disabled' => array('c'),
2366
-				'.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
2367
-				'.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
2368
-				'.btn-outline-secondary.dropdown-toggle' => array('b','o'),
2369
-				'.badge-secondary' => array('b'),
2370
-				'.alert-secondary' => array('b','o'),
2371
-				'.btn-link.btn-secondary' => array('c'),
2372
-			);
2373
-
2374
-			$important_selectors = array(
2375
-				'.bg-secondary' => array('b','f'),
2376
-				'.border-secondary' => array('o'),
2377
-				'.text-secondary' => array('c'),
2378
-			);
2379
-
2380
-			$color = array();
2381
-			$color_i = array();
2382
-			$background = array();
2383
-			$background_i = array();
2384
-			$border = array();
2385
-			$border_i = array();
2386
-			$fill = array();
2387
-			$fill_i = array();
2388
-
2389
-			$output = '';
2390
-
2391
-			// build rules into each type
2392
-			foreach($selectors as $selector => $types){
2393
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2394
-				$types = array_combine($types,$types);
2395
-				if(isset($types['c'])){$color[] = $selector;}
2396
-				if(isset($types['b'])){$background[] = $selector;}
2397
-				if(isset($types['o'])){$border[] = $selector;}
2398
-				if(isset($types['f'])){$fill[] = $selector;}
2399
-			}
2400
-
2401
-			// build rules into each type
2402
-			foreach($important_selectors as $selector => $types){
2403
-				$selector = $compatibility ? ".bsui ".$selector : $selector;
2404
-				$types = array_combine($types,$types);
2405
-				if(isset($types['c'])){$color_i[] = $selector;}
2406
-				if(isset($types['b'])){$background_i[] = $selector;}
2407
-				if(isset($types['o'])){$border_i[] = $selector;}
2408
-				if(isset($types['f'])){$fill_i[] = $selector;}
2409
-			}
2410
-
2411
-			// add any color rules
2412
-			if(!empty($color)){
2413
-				$output .= implode(",",$color) . "{color: $color_code;} ";
2414
-			}
2415
-			if(!empty($color_i)){
2416
-				$output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2417
-			}
2418
-
2419
-			// add any background color rules
2420
-			if(!empty($background)){
2421
-				$output .= implode(",",$background) . "{background-color: $color_code;} ";
2422
-			}
2423
-			if(!empty($background_i)){
2424
-				$output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2425
-			}
2426
-
2427
-			// add any border color rules
2428
-			if(!empty($border)){
2429
-				$output .= implode(",",$border) . "{border-color: $color_code;} ";
2430
-			}
2431
-			if(!empty($border_i)){
2432
-				$output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2433
-			}
2434
-
2435
-			// add any fill color rules
2436
-			if(!empty($fill)){
2437
-				$output .= implode(",",$fill) . "{fill: $color_code;} ";
2438
-			}
2439
-			if(!empty($fill_i)){
2440
-				$output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2441
-			}
2442
-
2443
-
2444
-			$prefix = $compatibility ? ".bsui " : "";
2445
-
2446
-			// darken
2447
-			$darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2448
-			$darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2449
-			$darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2450
-
2451
-			// lighten
2452
-			$lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2453
-
2454
-			// opacity see https://css-tricks.com/8-digit-hex-codes/
2455
-			$op_25 = $color_code."40"; // 25% opacity
2456
-
2457
-
2458
-			// button states
2459
-			$output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2460
-			$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;} ";
2461
-			$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.";} ";
2462
-			$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;} ";
2463
-
2464
-
2465
-			return $output;
2466
-		}
2347
+         * @param $color_code
2348
+         * @param $compatibility
2349
+         *
2350
+         * @return string
2351
+         */
2352
+        public static function css_secondary($color_code,$compatibility){;
2353
+            $color_code = sanitize_hex_color($color_code);
2354
+            if(!$color_code){return '';}
2355
+            /**
2356
+             * c = color, b = background color, o = border-color, f = fill
2357
+             */
2358
+            $selectors = array(
2359
+                '.btn-secondary' => array('b','o'),
2360
+                '.btn-secondary.disabled' => array('b','o'),
2361
+                '.btn-secondary:disabled' => array('b','o'),
2362
+                '.btn-outline-secondary' => array('c','o'),
2363
+                '.btn-outline-secondary:hover' => array('b','o'),
2364
+                '.btn-outline-secondary.disabled' => array('c'),
2365
+                '.btn-outline-secondary:disabled' => array('c'),
2366
+                '.btn-outline-secondary:not(:disabled):not(.disabled):active' => array('b','o'),
2367
+                '.btn-outline-secondary:not(:disabled):not(.disabled).active' => array('b','o'),
2368
+                '.btn-outline-secondary.dropdown-toggle' => array('b','o'),
2369
+                '.badge-secondary' => array('b'),
2370
+                '.alert-secondary' => array('b','o'),
2371
+                '.btn-link.btn-secondary' => array('c'),
2372
+            );
2467 2373
 
2468
-		/**
2469
-		 * Increases or decreases the brightness of a color by a percentage of the current brightness.
2470
-		 *
2471
-		 * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
2472
-		 * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
2473
-		 *
2474
-		 * @return  string
2475
-		 */
2476
-		public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
2477
-			$hexCode = ltrim($hexCode, '#');
2374
+            $important_selectors = array(
2375
+                '.bg-secondary' => array('b','f'),
2376
+                '.border-secondary' => array('o'),
2377
+                '.text-secondary' => array('c'),
2378
+            );
2478 2379
 
2479
-			if (strlen($hexCode) == 3) {
2480
-				$hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
2481
-			}
2380
+            $color = array();
2381
+            $color_i = array();
2382
+            $background = array();
2383
+            $background_i = array();
2384
+            $border = array();
2385
+            $border_i = array();
2386
+            $fill = array();
2387
+            $fill_i = array();
2388
+
2389
+            $output = '';
2390
+
2391
+            // build rules into each type
2392
+            foreach($selectors as $selector => $types){
2393
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2394
+                $types = array_combine($types,$types);
2395
+                if(isset($types['c'])){$color[] = $selector;}
2396
+                if(isset($types['b'])){$background[] = $selector;}
2397
+                if(isset($types['o'])){$border[] = $selector;}
2398
+                if(isset($types['f'])){$fill[] = $selector;}
2399
+            }
2482 2400
 
2483
-			$hexCode = array_map('hexdec', str_split($hexCode, 2));
2401
+            // build rules into each type
2402
+            foreach($important_selectors as $selector => $types){
2403
+                $selector = $compatibility ? ".bsui ".$selector : $selector;
2404
+                $types = array_combine($types,$types);
2405
+                if(isset($types['c'])){$color_i[] = $selector;}
2406
+                if(isset($types['b'])){$background_i[] = $selector;}
2407
+                if(isset($types['o'])){$border_i[] = $selector;}
2408
+                if(isset($types['f'])){$fill_i[] = $selector;}
2409
+            }
2484 2410
 
2485
-			foreach ($hexCode as & $color) {
2486
-				$adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
2487
-				$adjustAmount = ceil($adjustableLimit * $adjustPercent);
2411
+            // add any color rules
2412
+            if(!empty($color)){
2413
+                $output .= implode(",",$color) . "{color: $color_code;} ";
2414
+            }
2415
+            if(!empty($color_i)){
2416
+                $output .= implode(",",$color_i) . "{color: $color_code !important;} ";
2417
+            }
2488 2418
 
2489
-				$color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
2490
-			}
2419
+            // add any background color rules
2420
+            if(!empty($background)){
2421
+                $output .= implode(",",$background) . "{background-color: $color_code;} ";
2422
+            }
2423
+            if(!empty($background_i)){
2424
+                $output .= implode(",",$background_i) . "{background-color: $color_code !important;} ";
2425
+            }
2491 2426
 
2492
-			return '#' . implode($hexCode);
2493
-		}
2427
+            // add any border color rules
2428
+            if(!empty($border)){
2429
+                $output .= implode(",",$border) . "{border-color: $color_code;} ";
2430
+            }
2431
+            if(!empty($border_i)){
2432
+                $output .= implode(",",$border_i) . "{border-color: $color_code !important;} ";
2433
+            }
2494 2434
 
2495
-		/**
2496
-		 * Check if we should display examples.
2497
-		 */
2498
-		public function maybe_show_examples(){
2499
-			if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
2500
-				echo "<head>";
2501
-				wp_head();
2502
-				echo "</head>";
2503
-				echo "<body>";
2504
-				echo $this->get_examples();
2505
-				echo "</body>";
2506
-				exit;
2507
-			}
2508
-		}
2435
+            // add any fill color rules
2436
+            if(!empty($fill)){
2437
+                $output .= implode(",",$fill) . "{fill: $color_code;} ";
2438
+            }
2439
+            if(!empty($fill_i)){
2440
+                $output .= implode(",",$fill_i) . "{fill: $color_code !important;} ";
2441
+            }
2509 2442
 
2510
-		/**
2511
-		 * Get developer examples.
2512
-		 *
2513
-		 * @return string
2514
-		 */
2515
-		public function get_examples(){
2516
-			$output = '';
2517
-
2518
-
2519
-			// open form
2520
-			$output .= "<form class='p-5 m-5 border rounded'>";
2521
-
2522
-			// input example
2523
-			$output .= aui()->input(array(
2524
-				'type'  =>  'text',
2525
-				'id'    =>  'text-example',
2526
-				'name'    =>  'text-example',
2527
-				'placeholder'   => 'text placeholder',
2528
-				'title'   => 'Text input example',
2529
-				'value' =>  '',
2530
-				'required'  => false,
2531
-				'help_text' => 'help text',
2532
-				'label' => 'Text input example label'
2533
-			));
2534
-
2535
-			// input example
2536
-			$output .= aui()->input(array(
2537
-				'type'  =>  'url',
2538
-				'id'    =>  'text-example2',
2539
-				'name'    =>  'text-example',
2540
-				'placeholder'   => 'url placeholder',
2541
-				'title'   => 'Text input example',
2542
-				'value' =>  '',
2543
-				'required'  => false,
2544
-				'help_text' => 'help text',
2545
-				'label' => 'Text input example label'
2546
-			));
2547
-
2548
-			// checkbox example
2549
-			$output .= aui()->input(array(
2550
-				'type'  =>  'checkbox',
2551
-				'id'    =>  'checkbox-example',
2552
-				'name'    =>  'checkbox-example',
2553
-				'placeholder'   => 'checkbox-example',
2554
-				'title'   => 'Checkbox example',
2555
-				'value' =>  '1',
2556
-				'checked'   => true,
2557
-				'required'  => false,
2558
-				'help_text' => 'help text',
2559
-				'label' => 'Checkbox checked'
2560
-			));
2561
-
2562
-			// checkbox example
2563
-			$output .= aui()->input(array(
2564
-				'type'  =>  'checkbox',
2565
-				'id'    =>  'checkbox-example2',
2566
-				'name'    =>  'checkbox-example2',
2567
-				'placeholder'   => 'checkbox-example',
2568
-				'title'   => 'Checkbox example',
2569
-				'value' =>  '1',
2570
-				'checked'   => false,
2571
-				'required'  => false,
2572
-				'help_text' => 'help text',
2573
-				'label' => 'Checkbox un-checked'
2574
-			));
2575
-
2576
-			// switch example
2577
-			$output .= aui()->input(array(
2578
-				'type'  =>  'checkbox',
2579
-				'id'    =>  'switch-example',
2580
-				'name'    =>  'switch-example',
2581
-				'placeholder'   => 'checkbox-example',
2582
-				'title'   => 'Switch example',
2583
-				'value' =>  '1',
2584
-				'checked'   => true,
2585
-				'switch'    => true,
2586
-				'required'  => false,
2587
-				'help_text' => 'help text',
2588
-				'label' => 'Switch on'
2589
-			));
2590
-
2591
-			// switch example
2592
-			$output .= aui()->input(array(
2593
-				'type'  =>  'checkbox',
2594
-				'id'    =>  'switch-example2',
2595
-				'name'    =>  'switch-example2',
2596
-				'placeholder'   => 'checkbox-example',
2597
-				'title'   => 'Switch example',
2598
-				'value' =>  '1',
2599
-				'checked'   => false,
2600
-				'switch'    => true,
2601
-				'required'  => false,
2602
-				'help_text' => 'help text',
2603
-				'label' => 'Switch off'
2604
-			));
2605
-
2606
-			// close form
2607
-			$output .= "</form>";
2608
-
2609
-			return $output;
2610
-		}
2611 2443
 
2612
-		/**
2613
-		 * Calendar params.
2614
-		 *
2615
-		 * @since 0.1.44
2616
-		 *
2617
-		 * @return array Calendar params.
2618
-		 */
2619
-		public static function calendar_params() {
2620
-			$params = array(
2621
-				'month_long_1' => __( 'January', 'aui' ),
2622
-				'month_long_2' => __( 'February', 'aui' ),
2623
-				'month_long_3' => __( 'March', 'aui' ),
2624
-				'month_long_4' => __( 'April', 'aui' ),
2625
-				'month_long_5' => __( 'May', 'aui' ),
2626
-				'month_long_6' => __( 'June', 'aui' ),
2627
-				'month_long_7' => __( 'July', 'aui' ),
2628
-				'month_long_8' => __( 'August', 'aui' ),
2629
-				'month_long_9' => __( 'September', 'aui' ),
2630
-				'month_long_10' => __( 'October', 'aui' ),
2631
-				'month_long_11' => __( 'November', 'aui' ),
2632
-				'month_long_12' => __( 'December', 'aui' ),
2633
-				'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2634
-				'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2635
-				'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2636
-				'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2637
-				'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2638
-				'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2639
-				'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2640
-				'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2641
-				'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2642
-				'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2643
-				'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2644
-				'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2645
-				'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2646
-				'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2647
-				'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2648
-				'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2649
-				'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2650
-				'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2651
-				'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2652
-				'day_s2_1' => __( 'Su', 'aui' ),
2653
-				'day_s2_2' => __( 'Mo', 'aui' ),
2654
-				'day_s2_3' => __( 'Tu', 'aui' ),
2655
-				'day_s2_4' => __( 'We', 'aui' ),
2656
-				'day_s2_5' => __( 'Th', 'aui' ),
2657
-				'day_s2_6' => __( 'Fr', 'aui' ),
2658
-				'day_s2_7' => __( 'Sa', 'aui' ),
2659
-				'day_s3_1' => __( 'Sun', 'aui' ),
2660
-				'day_s3_2' => __( 'Mon', 'aui' ),
2661
-				'day_s3_3' => __( 'Tue', 'aui' ),
2662
-				'day_s3_4' => __( 'Wed', 'aui' ),
2663
-				'day_s3_5' => __( 'Thu', 'aui' ),
2664
-				'day_s3_6' => __( 'Fri', 'aui' ),
2665
-				'day_s3_7' => __( 'Sat', 'aui' ),
2666
-				'day_s5_1' => __( 'Sunday', 'aui' ),
2667
-				'day_s5_2' => __( 'Monday', 'aui' ),
2668
-				'day_s5_3' => __( 'Tuesday', 'aui' ),
2669
-				'day_s5_4' => __( 'Wednesday', 'aui' ),
2670
-				'day_s5_5' => __( 'Thursday', 'aui' ),
2671
-				'day_s5_6' => __( 'Friday', 'aui' ),
2672
-				'day_s5_7' => __( 'Saturday', 'aui' ),
2673
-				'am_lower' => __( 'am', 'aui' ),
2674
-				'pm_lower' => __( 'pm', 'aui' ),
2675
-				'am_upper' => __( 'AM', 'aui' ),
2676
-				'pm_upper' => __( 'PM', 'aui' ),
2677
-				'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2678
-				'time_24hr' => false,
2679
-				'year' => __( 'Year', 'aui' ),
2680
-				'hour' => __( 'Hour', 'aui' ),
2681
-				'minute' => __( 'Minute', 'aui' ),
2682
-				'weekAbbreviation' => __( 'Wk', 'aui' ),
2683
-				'rangeSeparator' => __( ' to ', 'aui' ),
2684
-				'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2685
-				'toggleTitle' => __( 'Click to toggle', 'aui' )
2686
-			);
2687
-
2688
-			return apply_filters( 'ayecode_ui_calendar_params', $params );
2689
-		}
2444
+            $prefix = $compatibility ? ".bsui " : "";
2690 2445
 
2691
-		/**
2692
-		 * Flatpickr calendar localize.
2693
-		 *
2694
-		 * @since 0.1.44
2695
-		 *
2696
-		 * @return string Calendar locale.
2697
-		 */
2698
-		public static function flatpickr_locale() {
2699
-			$params = self::calendar_params();
2700
-
2701
-			if ( is_string( $params ) ) {
2702
-				$params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2703
-			} else {
2704
-				foreach ( (array) $params as $key => $value ) {
2705
-					if ( ! is_scalar( $value ) ) {
2706
-						continue;
2707
-					}
2446
+            // darken
2447
+            $darker_075 = self::css_hex_lighten_darken($color_code,"-0.075");
2448
+            $darker_10 = self::css_hex_lighten_darken($color_code,"-0.10");
2449
+            $darker_125 = self::css_hex_lighten_darken($color_code,"-0.125");
2708 2450
 
2709
-					$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2710
-				}
2711
-			}
2451
+            // lighten
2452
+            $lighten_25 = self::css_hex_lighten_darken($color_code,"0.25");
2453
+
2454
+            // opacity see https://css-tricks.com/8-digit-hex-codes/
2455
+            $op_25 = $color_code."40"; // 25% opacity
2456
+
2457
+
2458
+            // button states
2459
+            $output .= $prefix ." .btn-secondary:hover{background-color: ".$darker_075.";    border-color: ".$darker_10.";} ";
2460
+            $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;} ";
2461
+            $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.";} ";
2462
+            $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;} ";
2463
+
2464
+
2465
+            return $output;
2466
+        }
2467
+
2468
+        /**
2469
+         * Increases or decreases the brightness of a color by a percentage of the current brightness.
2470
+         *
2471
+         * @param   string  $hexCode        Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
2472
+         * @param   float   $adjustPercent  A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
2473
+         *
2474
+         * @return  string
2475
+         */
2476
+        public static function css_hex_lighten_darken($hexCode, $adjustPercent) {
2477
+            $hexCode = ltrim($hexCode, '#');
2478
+
2479
+            if (strlen($hexCode) == 3) {
2480
+                $hexCode = $hexCode[0] . $hexCode[0] . $hexCode[1] . $hexCode[1] . $hexCode[2] . $hexCode[2];
2481
+            }
2482
+
2483
+            $hexCode = array_map('hexdec', str_split($hexCode, 2));
2484
+
2485
+            foreach ($hexCode as & $color) {
2486
+                $adjustableLimit = $adjustPercent < 0 ? $color : 255 - $color;
2487
+                $adjustAmount = ceil($adjustableLimit * $adjustPercent);
2488
+
2489
+                $color = str_pad(dechex($color + $adjustAmount), 2, '0', STR_PAD_LEFT);
2490
+            }
2491
+
2492
+            return '#' . implode($hexCode);
2493
+        }
2494
+
2495
+        /**
2496
+         * Check if we should display examples.
2497
+         */
2498
+        public function maybe_show_examples(){
2499
+            if(current_user_can('manage_options') && isset($_REQUEST['preview-aui'])){
2500
+                echo "<head>";
2501
+                wp_head();
2502
+                echo "</head>";
2503
+                echo "<body>";
2504
+                echo $this->get_examples();
2505
+                echo "</body>";
2506
+                exit;
2507
+            }
2508
+        }
2509
+
2510
+        /**
2511
+         * Get developer examples.
2512
+         *
2513
+         * @return string
2514
+         */
2515
+        public function get_examples(){
2516
+            $output = '';
2517
+
2518
+
2519
+            // open form
2520
+            $output .= "<form class='p-5 m-5 border rounded'>";
2521
+
2522
+            // input example
2523
+            $output .= aui()->input(array(
2524
+                'type'  =>  'text',
2525
+                'id'    =>  'text-example',
2526
+                'name'    =>  'text-example',
2527
+                'placeholder'   => 'text placeholder',
2528
+                'title'   => 'Text input example',
2529
+                'value' =>  '',
2530
+                'required'  => false,
2531
+                'help_text' => 'help text',
2532
+                'label' => 'Text input example label'
2533
+            ));
2534
+
2535
+            // input example
2536
+            $output .= aui()->input(array(
2537
+                'type'  =>  'url',
2538
+                'id'    =>  'text-example2',
2539
+                'name'    =>  'text-example',
2540
+                'placeholder'   => 'url placeholder',
2541
+                'title'   => 'Text input example',
2542
+                'value' =>  '',
2543
+                'required'  => false,
2544
+                'help_text' => 'help text',
2545
+                'label' => 'Text input example label'
2546
+            ));
2547
+
2548
+            // checkbox example
2549
+            $output .= aui()->input(array(
2550
+                'type'  =>  'checkbox',
2551
+                'id'    =>  'checkbox-example',
2552
+                'name'    =>  'checkbox-example',
2553
+                'placeholder'   => 'checkbox-example',
2554
+                'title'   => 'Checkbox example',
2555
+                'value' =>  '1',
2556
+                'checked'   => true,
2557
+                'required'  => false,
2558
+                'help_text' => 'help text',
2559
+                'label' => 'Checkbox checked'
2560
+            ));
2561
+
2562
+            // checkbox example
2563
+            $output .= aui()->input(array(
2564
+                'type'  =>  'checkbox',
2565
+                'id'    =>  'checkbox-example2',
2566
+                'name'    =>  'checkbox-example2',
2567
+                'placeholder'   => 'checkbox-example',
2568
+                'title'   => 'Checkbox example',
2569
+                'value' =>  '1',
2570
+                'checked'   => false,
2571
+                'required'  => false,
2572
+                'help_text' => 'help text',
2573
+                'label' => 'Checkbox un-checked'
2574
+            ));
2575
+
2576
+            // switch example
2577
+            $output .= aui()->input(array(
2578
+                'type'  =>  'checkbox',
2579
+                'id'    =>  'switch-example',
2580
+                'name'    =>  'switch-example',
2581
+                'placeholder'   => 'checkbox-example',
2582
+                'title'   => 'Switch example',
2583
+                'value' =>  '1',
2584
+                'checked'   => true,
2585
+                'switch'    => true,
2586
+                'required'  => false,
2587
+                'help_text' => 'help text',
2588
+                'label' => 'Switch on'
2589
+            ));
2590
+
2591
+            // switch example
2592
+            $output .= aui()->input(array(
2593
+                'type'  =>  'checkbox',
2594
+                'id'    =>  'switch-example2',
2595
+                'name'    =>  'switch-example2',
2596
+                'placeholder'   => 'checkbox-example',
2597
+                'title'   => 'Switch example',
2598
+                'value' =>  '1',
2599
+                'checked'   => false,
2600
+                'switch'    => true,
2601
+                'required'  => false,
2602
+                'help_text' => 'help text',
2603
+                'label' => 'Switch off'
2604
+            ));
2605
+
2606
+            // close form
2607
+            $output .= "</form>";
2608
+
2609
+            return $output;
2610
+        }
2611
+
2612
+        /**
2613
+         * Calendar params.
2614
+         *
2615
+         * @since 0.1.44
2616
+         *
2617
+         * @return array Calendar params.
2618
+         */
2619
+        public static function calendar_params() {
2620
+            $params = array(
2621
+                'month_long_1' => __( 'January', 'aui' ),
2622
+                'month_long_2' => __( 'February', 'aui' ),
2623
+                'month_long_3' => __( 'March', 'aui' ),
2624
+                'month_long_4' => __( 'April', 'aui' ),
2625
+                'month_long_5' => __( 'May', 'aui' ),
2626
+                'month_long_6' => __( 'June', 'aui' ),
2627
+                'month_long_7' => __( 'July', 'aui' ),
2628
+                'month_long_8' => __( 'August', 'aui' ),
2629
+                'month_long_9' => __( 'September', 'aui' ),
2630
+                'month_long_10' => __( 'October', 'aui' ),
2631
+                'month_long_11' => __( 'November', 'aui' ),
2632
+                'month_long_12' => __( 'December', 'aui' ),
2633
+                'month_s_1' => _x( 'Jan', 'January abbreviation', 'aui' ),
2634
+                'month_s_2' => _x( 'Feb', 'February abbreviation', 'aui' ),
2635
+                'month_s_3' => _x( 'Mar', 'March abbreviation', 'aui' ),
2636
+                'month_s_4' => _x( 'Apr', 'April abbreviation', 'aui' ),
2637
+                'month_s_5' => _x( 'May', 'May abbreviation', 'aui' ),
2638
+                'month_s_6' => _x( 'Jun', 'June abbreviation', 'aui' ),
2639
+                'month_s_7' => _x( 'Jul', 'July abbreviation', 'aui' ),
2640
+                'month_s_8' => _x( 'Aug', 'August abbreviation', 'aui' ),
2641
+                'month_s_9' => _x( 'Sep', 'September abbreviation', 'aui' ),
2642
+                'month_s_10' => _x( 'Oct', 'October abbreviation', 'aui' ),
2643
+                'month_s_11' => _x( 'Nov', 'November abbreviation', 'aui' ),
2644
+                'month_s_12' => _x( 'Dec', 'December abbreviation', 'aui' ),
2645
+                'day_s1_1' => _x( 'S', 'Sunday initial', 'aui' ),
2646
+                'day_s1_2' => _x( 'M', 'Monday initial', 'aui' ),
2647
+                'day_s1_3' => _x( 'T', 'Tuesday initial', 'aui' ),
2648
+                'day_s1_4' => _x( 'W', 'Wednesday initial', 'aui' ),
2649
+                'day_s1_5' => _x( 'T', 'Friday initial', 'aui' ),
2650
+                'day_s1_6' => _x( 'F', 'Thursday initial', 'aui' ),
2651
+                'day_s1_7' => _x( 'S', 'Saturday initial', 'aui' ),
2652
+                'day_s2_1' => __( 'Su', 'aui' ),
2653
+                'day_s2_2' => __( 'Mo', 'aui' ),
2654
+                'day_s2_3' => __( 'Tu', 'aui' ),
2655
+                'day_s2_4' => __( 'We', 'aui' ),
2656
+                'day_s2_5' => __( 'Th', 'aui' ),
2657
+                'day_s2_6' => __( 'Fr', 'aui' ),
2658
+                'day_s2_7' => __( 'Sa', 'aui' ),
2659
+                'day_s3_1' => __( 'Sun', 'aui' ),
2660
+                'day_s3_2' => __( 'Mon', 'aui' ),
2661
+                'day_s3_3' => __( 'Tue', 'aui' ),
2662
+                'day_s3_4' => __( 'Wed', 'aui' ),
2663
+                'day_s3_5' => __( 'Thu', 'aui' ),
2664
+                'day_s3_6' => __( 'Fri', 'aui' ),
2665
+                'day_s3_7' => __( 'Sat', 'aui' ),
2666
+                'day_s5_1' => __( 'Sunday', 'aui' ),
2667
+                'day_s5_2' => __( 'Monday', 'aui' ),
2668
+                'day_s5_3' => __( 'Tuesday', 'aui' ),
2669
+                'day_s5_4' => __( 'Wednesday', 'aui' ),
2670
+                'day_s5_5' => __( 'Thursday', 'aui' ),
2671
+                'day_s5_6' => __( 'Friday', 'aui' ),
2672
+                'day_s5_7' => __( 'Saturday', 'aui' ),
2673
+                'am_lower' => __( 'am', 'aui' ),
2674
+                'pm_lower' => __( 'pm', 'aui' ),
2675
+                'am_upper' => __( 'AM', 'aui' ),
2676
+                'pm_upper' => __( 'PM', 'aui' ),
2677
+                'firstDayOfWeek' => (int) get_option( 'start_of_week' ),
2678
+                'time_24hr' => false,
2679
+                'year' => __( 'Year', 'aui' ),
2680
+                'hour' => __( 'Hour', 'aui' ),
2681
+                'minute' => __( 'Minute', 'aui' ),
2682
+                'weekAbbreviation' => __( 'Wk', 'aui' ),
2683
+                'rangeSeparator' => __( ' to ', 'aui' ),
2684
+                'scrollTitle' => __( 'Scroll to increment', 'aui' ),
2685
+                'toggleTitle' => __( 'Click to toggle', 'aui' )
2686
+            );
2687
+
2688
+            return apply_filters( 'ayecode_ui_calendar_params', $params );
2689
+        }
2690
+
2691
+        /**
2692
+         * Flatpickr calendar localize.
2693
+         *
2694
+         * @since 0.1.44
2695
+         *
2696
+         * @return string Calendar locale.
2697
+         */
2698
+        public static function flatpickr_locale() {
2699
+            $params = self::calendar_params();
2700
+
2701
+            if ( is_string( $params ) ) {
2702
+                $params = html_entity_decode( $params, ENT_QUOTES, 'UTF-8' );
2703
+            } else {
2704
+                foreach ( (array) $params as $key => $value ) {
2705
+                    if ( ! is_scalar( $value ) ) {
2706
+                        continue;
2707
+                    }
2708
+
2709
+                    $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2710
+                }
2711
+            }
2712 2712
 
2713
-			$day_s3 = array();
2714
-			$day_s5 = array();
2713
+            $day_s3 = array();
2714
+            $day_s5 = array();
2715 2715
 
2716
-			for ( $i = 1; $i <= 7; $i ++ ) {
2717
-				$day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2718
-				$day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2719
-			}
2716
+            for ( $i = 1; $i <= 7; $i ++ ) {
2717
+                $day_s3[] = addslashes( $params[ 'day_s3_' . $i ] );
2718
+                $day_s5[] = addslashes( $params[ 'day_s3_' . $i ] );
2719
+            }
2720 2720
 
2721
-			$month_s = array();
2722
-			$month_long = array();
2721
+            $month_s = array();
2722
+            $month_long = array();
2723 2723
 
2724
-			for ( $i = 1; $i <= 12; $i ++ ) {
2725
-				$month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2726
-				$month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2727
-			}
2724
+            for ( $i = 1; $i <= 12; $i ++ ) {
2725
+                $month_s[] = addslashes( $params[ 'month_s_' . $i ] );
2726
+                $month_long[] = addslashes( $params[ 'month_long_' . $i ] );
2727
+            }
2728 2728
 
2729 2729
 ob_start();
2730 2730
 if ( 0 ) { ?><script><?php } ?>
@@ -2766,189 +2766,189 @@  discard block
 block discarded – undo
2766 2766
 }
2767 2767
 <?php if ( 0 ) { ?></script><?php } ?>
2768 2768
 <?php
2769
-			$locale = ob_get_clean();
2769
+            $locale = ob_get_clean();
2770 2770
 
2771
-			return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2772
-		}
2771
+            return apply_filters( 'ayecode_ui_flatpickr_locale', trim( $locale ) );
2772
+        }
2773 2773
 
2774
-		/**
2775
-		 * Select2 JS params.
2776
-		 *
2777
-		 * @since 0.1.44
2778
-		 *
2779
-		 * @return array Select2 JS params.
2780
-		 */
2781
-		public static function select2_params() {
2782
-			$params = array(
2783
-				'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2784
-				'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2785
-				'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2786
-				'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2787
-				'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2788
-				'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2789
-				'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2790
-				'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2791
-				'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2792
-				'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2793
-				'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2794
-			);
2795
-
2796
-			return apply_filters( 'ayecode_ui_select2_params', $params );
2797
-		}
2774
+        /**
2775
+         * Select2 JS params.
2776
+         *
2777
+         * @since 0.1.44
2778
+         *
2779
+         * @return array Select2 JS params.
2780
+         */
2781
+        public static function select2_params() {
2782
+            $params = array(
2783
+                'i18n_select_state_text'    => esc_attr__( 'Select an option&hellip;', 'aui' ),
2784
+                'i18n_no_matches'           => _x( 'No matches found', 'enhanced select', 'aui' ),
2785
+                'i18n_ajax_error'           => _x( 'Loading failed', 'enhanced select', 'aui' ),
2786
+                'i18n_input_too_short_1'    => _x( 'Please enter 1 or more characters', 'enhanced select', 'aui' ),
2787
+                'i18n_input_too_short_n'    => _x( 'Please enter %item% or more characters', 'enhanced select', 'aui' ),
2788
+                'i18n_input_too_long_1'     => _x( 'Please delete 1 character', 'enhanced select', 'aui' ),
2789
+                'i18n_input_too_long_n'     => _x( 'Please delete %item% characters', 'enhanced select', 'aui' ),
2790
+                'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'aui' ),
2791
+                'i18n_selection_too_long_n' => _x( 'You can only select %item% items', 'enhanced select', 'aui' ),
2792
+                'i18n_load_more'            => _x( 'Loading more results&hellip;', 'enhanced select', 'aui' ),
2793
+                'i18n_searching'            => _x( 'Searching&hellip;', 'enhanced select', 'aui' )
2794
+            );
2798 2795
 
2799
-		/**
2800
-		 * Select2 JS localize.
2801
-		 *
2802
-		 * @since 0.1.44
2803
-		 *
2804
-		 * @return string Select2 JS locale.
2805
-		 */
2806
-		public static function select2_locale() {
2807
-			$params = self::select2_params();
2808
-
2809
-			foreach ( (array) $params as $key => $value ) {
2810
-				if ( ! is_scalar( $value ) ) {
2811
-					continue;
2812
-				}
2796
+            return apply_filters( 'ayecode_ui_select2_params', $params );
2797
+        }
2813 2798
 
2814
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2815
-			}
2799
+        /**
2800
+         * Select2 JS localize.
2801
+         *
2802
+         * @since 0.1.44
2803
+         *
2804
+         * @return string Select2 JS locale.
2805
+         */
2806
+        public static function select2_locale() {
2807
+            $params = self::select2_params();
2808
+
2809
+            foreach ( (array) $params as $key => $value ) {
2810
+                if ( ! is_scalar( $value ) ) {
2811
+                    continue;
2812
+                }
2816 2813
 
2817
-			$locale = json_encode( $params );
2814
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2815
+            }
2818 2816
 
2819
-			return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2820
-		}
2817
+            $locale = json_encode( $params );
2821 2818
 
2822
-		/**
2823
-		 * Time ago JS localize.
2824
-		 *
2825
-		 * @since 0.1.47
2826
-		 *
2827
-		 * @return string Time ago JS locale.
2828
-		 */
2829
-		public static function timeago_locale() {
2830
-			$params = array(
2831
-				'prefix_ago' => '',
2832
-				'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2833
-				'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2834
-				'suffix_after' => '',
2835
-				'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2836
-				'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2837
-				'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2838
-				'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2839
-				'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2840
-				'day' => _x( 'a day', 'time ago', 'aui' ),
2841
-				'days' => _x( '%d days', 'time ago', 'aui' ),
2842
-				'month' => _x( 'about a month', 'time ago', 'aui' ),
2843
-				'months' => _x( '%d months', 'time ago', 'aui' ),
2844
-				'year' => _x( 'about a year', 'time ago', 'aui' ),
2845
-				'years' => _x( '%d years', 'time ago', 'aui' ),
2846
-			);
2847
-
2848
-			$params = apply_filters( 'ayecode_ui_timeago_params', $params );
2849
-
2850
-			foreach ( (array) $params as $key => $value ) {
2851
-				if ( ! is_scalar( $value ) ) {
2852
-					continue;
2853
-				}
2819
+            return apply_filters( 'ayecode_ui_select2_locale', trim( $locale ) );
2820
+        }
2854 2821
 
2855
-				$params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2856
-			}
2822
+        /**
2823
+         * Time ago JS localize.
2824
+         *
2825
+         * @since 0.1.47
2826
+         *
2827
+         * @return string Time ago JS locale.
2828
+         */
2829
+        public static function timeago_locale() {
2830
+            $params = array(
2831
+                'prefix_ago' => '',
2832
+                'suffix_ago' => ' ' . _x( 'ago', 'time ago', 'aui' ),
2833
+                'prefix_after' => _x( 'after', 'time ago', 'aui' ) . ' ',
2834
+                'suffix_after' => '',
2835
+                'seconds' => _x( 'less than a minute', 'time ago', 'aui' ),
2836
+                'minute' => _x( 'about a minute', 'time ago', 'aui' ),
2837
+                'minutes' => _x( '%d minutes', 'time ago', 'aui' ),
2838
+                'hour' => _x( 'about an hour', 'time ago', 'aui' ),
2839
+                'hours' => _x( 'about %d hours', 'time ago', 'aui' ),
2840
+                'day' => _x( 'a day', 'time ago', 'aui' ),
2841
+                'days' => _x( '%d days', 'time ago', 'aui' ),
2842
+                'month' => _x( 'about a month', 'time ago', 'aui' ),
2843
+                'months' => _x( '%d months', 'time ago', 'aui' ),
2844
+                'year' => _x( 'about a year', 'time ago', 'aui' ),
2845
+                'years' => _x( '%d years', 'time ago', 'aui' ),
2846
+            );
2857 2847
 
2858
-			$locale = json_encode( $params );
2848
+            $params = apply_filters( 'ayecode_ui_timeago_params', $params );
2859 2849
 
2860
-			return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2861
-		}
2850
+            foreach ( (array) $params as $key => $value ) {
2851
+                if ( ! is_scalar( $value ) ) {
2852
+                    continue;
2853
+                }
2862 2854
 
2863
-		/**
2864
-		 * JavaScript Minifier
2865
-		 *
2866
-		 * @param $input
2867
-		 *
2868
-		 * @return mixed
2869
-		 */
2870
-		public static function minify_js($input) {
2871
-			if(trim($input) === "") return $input;
2872
-			return preg_replace(
2873
-				array(
2874
-					// Remove comment(s)
2875
-					'#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2876
-					// Remove white-space(s) outside the string and regex
2877
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2878
-					// Remove the last semicolon
2879
-					'#;+\}#',
2880
-					// Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2881
-					'#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2882
-					// --ibid. From `foo['bar']` to `foo.bar`
2883
-					'#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2884
-				),
2885
-				array(
2886
-					'$1',
2887
-					'$1$2',
2888
-					'}',
2889
-					'$1$3',
2890
-					'$1.$3'
2891
-				),
2892
-				$input);
2893
-		}
2855
+                $params[ $key ] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8' );
2856
+            }
2894 2857
 
2895
-		/**
2896
-		 * Minify CSS
2897
-		 *
2898
-		 * @param $input
2899
-		 *
2900
-		 * @return mixed
2901
-		 */
2902
-		public static function minify_css($input) {
2903
-			if(trim($input) === "") return $input;
2904
-			return preg_replace(
2905
-				array(
2906
-					// Remove comment(s)
2907
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2908
-					// Remove unused white-space(s)
2909
-					'#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2910
-					// Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2911
-					'#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2912
-					// Replace `:0 0 0 0` with `:0`
2913
-					'#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2914
-					// Replace `background-position:0` with `background-position:0 0`
2915
-					'#(background-position):0(?=[;\}])#si',
2916
-					// Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2917
-					'#(?<=[\s:,\-])0+\.(\d+)#s',
2918
-					// Minify string value
2919
-					'#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2920
-					'#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2921
-					// Minify HEX color code
2922
-					'#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2923
-					// Replace `(border|outline):none` with `(border|outline):0`
2924
-					'#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2925
-					// Remove empty selector(s)
2926
-					'#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2927
-				),
2928
-				array(
2929
-					'$1',
2930
-					'$1$2$3$4$5$6$7',
2931
-					'$1',
2932
-					':0',
2933
-					'$1:0 0',
2934
-					'.$1',
2935
-					'$1$3',
2936
-					'$1$2$4$5',
2937
-					'$1$2$3',
2938
-					'$1:0',
2939
-					'$1$2'
2940
-				),
2941
-				$input);
2942
-		}
2858
+            $locale = json_encode( $params );
2859
+
2860
+            return apply_filters( 'ayecode_ui_timeago_locale', trim( $locale ) );
2861
+        }
2943 2862
 
2944
-		/**
2945
-		 * Get the conditional fields JavaScript.
2946
-		 *
2947
-		 * @return mixed
2948
-		 */
2949
-		public function conditional_fields_js() {
2950
-			ob_start();
2951
-			?>
2863
+        /**
2864
+         * JavaScript Minifier
2865
+         *
2866
+         * @param $input
2867
+         *
2868
+         * @return mixed
2869
+         */
2870
+        public static function minify_js($input) {
2871
+            if(trim($input) === "") return $input;
2872
+            return preg_replace(
2873
+                array(
2874
+                    // Remove comment(s)
2875
+                    '#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
2876
+                    // Remove white-space(s) outside the string and regex
2877
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
2878
+                    // Remove the last semicolon
2879
+                    '#;+\}#',
2880
+                    // Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
2881
+                    '#([\{,])([\'])(\d+|[a-z_][a-z0-9_]*)\2(?=\:)#i',
2882
+                    // --ibid. From `foo['bar']` to `foo.bar`
2883
+                    '#([a-z0-9_\)\]])\[([\'"])([a-z_][a-z0-9_]*)\2\]#i'
2884
+                ),
2885
+                array(
2886
+                    '$1',
2887
+                    '$1$2',
2888
+                    '}',
2889
+                    '$1$3',
2890
+                    '$1.$3'
2891
+                ),
2892
+                $input);
2893
+        }
2894
+
2895
+        /**
2896
+         * Minify CSS
2897
+         *
2898
+         * @param $input
2899
+         *
2900
+         * @return mixed
2901
+         */
2902
+        public static function minify_css($input) {
2903
+            if(trim($input) === "") return $input;
2904
+            return preg_replace(
2905
+                array(
2906
+                    // Remove comment(s)
2907
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
2908
+                    // Remove unused white-space(s)
2909
+                    '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~]|\s(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
2910
+                    // Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
2911
+                    '#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
2912
+                    // Replace `:0 0 0 0` with `:0`
2913
+                    '#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
2914
+                    // Replace `background-position:0` with `background-position:0 0`
2915
+                    '#(background-position):0(?=[;\}])#si',
2916
+                    // Replace `0.6` with `.6`, but only when preceded by `:`, `,`, `-` or a white-space
2917
+                    '#(?<=[\s:,\-])0+\.(\d+)#s',
2918
+                    // Minify string value
2919
+                    '#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][a-z0-9\-_]*?)\2(?=[\s\{\}\];,])#si',
2920
+                    '#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
2921
+                    // Minify HEX color code
2922
+                    '#(?<=[\s:,\-]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
2923
+                    // Replace `(border|outline):none` with `(border|outline):0`
2924
+                    '#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
2925
+                    // Remove empty selector(s)
2926
+                    '#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s'
2927
+                ),
2928
+                array(
2929
+                    '$1',
2930
+                    '$1$2$3$4$5$6$7',
2931
+                    '$1',
2932
+                    ':0',
2933
+                    '$1:0 0',
2934
+                    '.$1',
2935
+                    '$1$3',
2936
+                    '$1$2$4$5',
2937
+                    '$1$2$3',
2938
+                    '$1:0',
2939
+                    '$1$2'
2940
+                ),
2941
+                $input);
2942
+        }
2943
+
2944
+        /**
2945
+         * Get the conditional fields JavaScript.
2946
+         *
2947
+         * @return mixed
2948
+         */
2949
+        public function conditional_fields_js() {
2950
+            ob_start();
2951
+            ?>
2952 2952
 <script>
2953 2953
 /**
2954 2954
  * Conditional Fields
@@ -3451,14 +3451,14 @@  discard block
 block discarded – undo
3451 3451
 <?php do_action( 'aui_conditional_fields_js', $this ); ?>
3452 3452
 </script>
3453 3453
 			<?php
3454
-			$output = ob_get_clean();
3454
+            $output = ob_get_clean();
3455 3455
 
3456
-			return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
3457
-		}
3458
-	}
3456
+            return str_replace( array( '<script>', '</script>' ), '', self::minify_js( $output ) );
3457
+        }
3458
+    }
3459 3459
 
3460
-	/**
3461
-	 * Run the class if found.
3462
-	 */
3463
-	AyeCode_UI_Settings::instance();
3460
+    /**
3461
+     * Run the class if found.
3462
+     */
3463
+    AyeCode_UI_Settings::instance();
3464 3464
 }
3465 3465
\ 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.77";
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.77";
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-super-duper/wp-super-duper.php 1 patch
Indentation   +1986 added lines, -1986 removed lines patch added patch discarded remove patch
@@ -1,59 +1,59 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined( 'ABSPATH' ) ) {
3
-	exit;
3
+    exit;
4 4
 }
5 5
 
6 6
 if ( ! class_exists( 'WP_Super_Duper' ) ) {
7 7
 
8 8
 
9
-	/**
10
-	 * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
11
-	 *
12
-	 * Should not be called direct but extended instead.
13
-	 *
14
-	 * Class WP_Super_Duper
15
-	 * @since 1.0.16 change log moved to file change-log.txt - CHANGED
16
-	 * @ver 1.1.1
17
-	 */
18
-	class WP_Super_Duper extends WP_Widget {
19
-
20
-		public $version = "1.1.1";
21
-		public $font_awesome_icon_version = "5.11.2";
22
-		public $block_code;
23
-		public $options;
24
-		public $base_id;
25
-		public $settings_hash;
26
-		public $arguments = array();
27
-		public $instance = array();
28
-		private $class_name;
29
-
30
-		/**
31
-		 * The relative url to the current folder.
32
-		 *
33
-		 * @var string
34
-		 */
35
-		public $url = '';
36
-
37
-		/**
38
-		 * Take the array options and use them to build.
39
-		 */
40
-		public function __construct( $options ) {
41
-			global $sd_widgets;
42
-
43
-			$sd_widgets[ $options['base_id'] ] = array(
44
-				'name'       => $options['name'],
45
-				'class_name' => $options['class_name'],
46
-				'output_types' => !empty($options['output_types']) ? $options['output_types'] : array()
47
-			);
48
-			$this->base_id                     = $options['base_id'];
49
-			// lets filter the options before we do anything
50
-			$options       = apply_filters( "wp_super_duper_options", $options );
51
-			$options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
52
-			$options       = $this->add_name_from_key( $options );
53
-			$this->options = $options;
54
-
55
-			$this->base_id   = $options['base_id'];
56
-			$this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
9
+    /**
10
+     * A Class to be able to create a Widget, Shortcode or Block to be able to output content for WordPress.
11
+     *
12
+     * Should not be called direct but extended instead.
13
+     *
14
+     * Class WP_Super_Duper
15
+     * @since 1.0.16 change log moved to file change-log.txt - CHANGED
16
+     * @ver 1.1.1
17
+     */
18
+    class WP_Super_Duper extends WP_Widget {
19
+
20
+        public $version = "1.1.1";
21
+        public $font_awesome_icon_version = "5.11.2";
22
+        public $block_code;
23
+        public $options;
24
+        public $base_id;
25
+        public $settings_hash;
26
+        public $arguments = array();
27
+        public $instance = array();
28
+        private $class_name;
29
+
30
+        /**
31
+         * The relative url to the current folder.
32
+         *
33
+         * @var string
34
+         */
35
+        public $url = '';
36
+
37
+        /**
38
+         * Take the array options and use them to build.
39
+         */
40
+        public function __construct( $options ) {
41
+            global $sd_widgets;
42
+
43
+            $sd_widgets[ $options['base_id'] ] = array(
44
+                'name'       => $options['name'],
45
+                'class_name' => $options['class_name'],
46
+                'output_types' => !empty($options['output_types']) ? $options['output_types'] : array()
47
+            );
48
+            $this->base_id                     = $options['base_id'];
49
+            // lets filter the options before we do anything
50
+            $options       = apply_filters( "wp_super_duper_options", $options );
51
+            $options       = apply_filters( "wp_super_duper_options_{$this->base_id}", $options );
52
+            $options       = $this->add_name_from_key( $options );
53
+            $this->options = $options;
54
+
55
+            $this->base_id   = $options['base_id'];
56
+            $this->arguments = isset( $options['arguments'] ) ? $options['arguments'] : array();
57 57
 
58 58
             // nested blocks can't work as a widget
59 59
             if(!empty($this->options['nested-block'])){
@@ -64,234 +64,234 @@  discard block
 block discarded – undo
64 64
                 }
65 65
             }
66 66
 
67
-			// init parent
68
-			if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
67
+            // init parent
68
+            if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
69 69
                 parent::__construct( $options['base_id'], $options['name'], $options['widget_ops'] );
70
-			}
70
+            }
71 71
 
72 72
 
73
-			if ( isset( $options['class_name'] ) ) {
74
-				// register widget
75
-				$this->class_name = $options['class_name'];
73
+            if ( isset( $options['class_name'] ) ) {
74
+                // register widget
75
+                $this->class_name = $options['class_name'];
76 76
 
77
-				// register shortcode, this needs to be done even for blocks and widgets
77
+                // register shortcode, this needs to be done even for blocks and widgets
78 78
                 $this->register_shortcode();
79 79
 
80 80
 
81
-				// Fusion Builder (avada) support
82
-				if ( function_exists( 'fusion_builder_map' ) ) {
83
-					add_action( 'init', array( $this, 'register_fusion_element' ) );
84
-				}
81
+                // Fusion Builder (avada) support
82
+                if ( function_exists( 'fusion_builder_map' ) ) {
83
+                    add_action( 'init', array( $this, 'register_fusion_element' ) );
84
+                }
85 85
 
86
-				// register block
87
-				if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){
88
-				    add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
86
+                // register block
87
+                if(empty($this->options['output_types']) || in_array('block',$this->options['output_types'])){
88
+                    add_action( 'admin_enqueue_scripts', array( $this, 'register_block' ) );
89 89
                 }
90
-			}
90
+            }
91 91
 
92
-			// add the CSS and JS we need ONCE
93
-			global $sd_widget_scripts;
92
+            // add the CSS and JS we need ONCE
93
+            global $sd_widget_scripts;
94 94
 
95
-			if ( ! $sd_widget_scripts ) {
96
-				wp_add_inline_script( 'admin-widgets', $this->widget_js() );
97
-				wp_add_inline_script( 'customize-controls', $this->widget_js() );
98
-				wp_add_inline_style( 'widgets', $this->widget_css() );
95
+            if ( ! $sd_widget_scripts ) {
96
+                wp_add_inline_script( 'admin-widgets', $this->widget_js() );
97
+                wp_add_inline_script( 'customize-controls', $this->widget_js() );
98
+                wp_add_inline_style( 'widgets', $this->widget_css() );
99 99
 
100
-				// maybe add elementor editor styles
101
-				add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
100
+                // maybe add elementor editor styles
101
+                add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'elementor_editor_styles' ) );
102 102
 
103
-				$sd_widget_scripts = true;
103
+                $sd_widget_scripts = true;
104 104
 
105
-				// add shortcode insert button once
106
-				add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
107
-				// generatepress theme sections compatibility
108
-				if ( function_exists( 'generate_sections_sections_metabox' ) ) {
109
-					add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
110
-				}
111
-				/* Load script on Divi theme builder page */
112
-				if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) {
113
-					add_thickbox();
114
-					add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
115
-				}
105
+                // add shortcode insert button once
106
+                add_action( 'media_buttons', array( $this, 'shortcode_insert_button' ) );
107
+                // generatepress theme sections compatibility
108
+                if ( function_exists( 'generate_sections_sections_metabox' ) ) {
109
+                    add_action( 'generate_sections_metabox', array( $this, 'shortcode_insert_button_script' ) );
110
+                }
111
+                /* Load script on Divi theme builder page */
112
+                if ( function_exists( 'et_builder_is_tb_admin_screen' ) && et_builder_is_tb_admin_screen() ) {
113
+                    add_thickbox();
114
+                    add_action( 'admin_footer', array( $this, 'shortcode_insert_button_script' ) );
115
+                }
116 116
 
117
-				if ( $this->is_preview() ) {
118
-					add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
119
-					// this makes the insert button work for elementor
120
-					add_action( 'elementor/editor/after_enqueue_scripts', array(
121
-						$this,
122
-						'shortcode_insert_button_script'
123
-					) ); // for elementor
124
-				}
125
-				// this makes the insert button work for cornerstone
126
-				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
117
+                if ( $this->is_preview() ) {
118
+                    add_action( 'wp_footer', array( $this, 'shortcode_insert_button_script' ) );
119
+                    // this makes the insert button work for elementor
120
+                    add_action( 'elementor/editor/after_enqueue_scripts', array(
121
+                        $this,
122
+                        'shortcode_insert_button_script'
123
+                    ) ); // for elementor
124
+                }
125
+                // this makes the insert button work for cornerstone
126
+                add_action( 'wp_print_footer_scripts', array( __CLASS__, 'maybe_cornerstone_builder' ) );
127 127
 
128
-				add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
129
-				add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
128
+                add_action( 'wp_ajax_super_duper_get_widget_settings', array( __CLASS__, 'get_widget_settings' ) );
129
+                add_action( 'wp_ajax_super_duper_get_picker', array( __CLASS__, 'get_picker' ) );
130 130
 
131
-				// add generator text to admin head
132
-				add_action( 'admin_head', array( $this, 'generator' ) );
133
-			}
131
+                // add generator text to admin head
132
+                add_action( 'admin_head', array( $this, 'generator' ) );
133
+            }
134 134
 
135
-			do_action( 'wp_super_duper_widget_init', $options, $this );
136
-		}
135
+            do_action( 'wp_super_duper_widget_init', $options, $this );
136
+        }
137 137
 
138 138
         /**
139 139
          * The register widget function
140 140
          * @return void
141 141
          */
142
-		public function _register() {
142
+        public function _register() {
143 143
             if(empty($this->options['output_types']) || in_array('widget',$this->options['output_types'])){
144 144
                 parent::_register();
145
-			}
146
-		}
145
+            }
146
+        }
147 147
 
148
-		/**
149
-		 * Add our widget CSS to elementor editor.
150
-		 */
151
-		public function elementor_editor_styles() {
152
-			wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
153
-		}
148
+        /**
149
+         * Add our widget CSS to elementor editor.
150
+         */
151
+        public function elementor_editor_styles() {
152
+            wp_add_inline_style( 'elementor-editor', $this->widget_css( false ) );
153
+        }
154 154
 
155
-		public function register_fusion_element() {
155
+        public function register_fusion_element() {
156 156
 
157
-			$options = $this->options;
157
+            $options = $this->options;
158 158
 
159
-			if ( $this->base_id ) {
159
+            if ( $this->base_id ) {
160 160
 
161
-				$params = $this->get_fusion_params();
161
+                $params = $this->get_fusion_params();
162 162
 
163
-				$args = array(
164
-					'name'            => $options['name'],
165
-					'shortcode'       => $this->base_id,
166
-					'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
167
-					'allow_generator' => true,
168
-				);
163
+                $args = array(
164
+                    'name'            => $options['name'],
165
+                    'shortcode'       => $this->base_id,
166
+                    'icon'            => $options['block-icon'] ? $options['block-icon'] : 'far fa-square',
167
+                    'allow_generator' => true,
168
+                );
169 169
 
170
-				if ( ! empty( $params ) ) {
171
-					$args['params'] = $params;
172
-				}
170
+                if ( ! empty( $params ) ) {
171
+                    $args['params'] = $params;
172
+                }
173 173
 
174
-				fusion_builder_map( $args );
175
-			}
174
+                fusion_builder_map( $args );
175
+            }
176 176
 
177
-		}
177
+        }
178 178
 
179
-		public function get_fusion_params() {
180
-			$params    = array();
181
-			$arguments = $this->get_arguments();
182
-
183
-			if ( ! empty( $arguments ) ) {
184
-				foreach ( $arguments as $key => $val ) {
185
-					$param = array();
186
-					// type
187
-					$param['type'] = str_replace(
188
-						array(
189
-							"text",
190
-							"number",
191
-							"email",
192
-							"color",
193
-							"checkbox"
194
-						),
195
-						array(
196
-							"textfield",
197
-							"textfield",
198
-							"textfield",
199
-							"colorpicker",
200
-							"select",
201
-
202
-						),
203
-						$val['type'] );
204
-
205
-					// multiselect
206
-					if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
207
-						$param['type']     = 'multiple_select';
208
-						$param['multiple'] = true;
209
-					}
179
+        public function get_fusion_params() {
180
+            $params    = array();
181
+            $arguments = $this->get_arguments();
182
+
183
+            if ( ! empty( $arguments ) ) {
184
+                foreach ( $arguments as $key => $val ) {
185
+                    $param = array();
186
+                    // type
187
+                    $param['type'] = str_replace(
188
+                        array(
189
+                            "text",
190
+                            "number",
191
+                            "email",
192
+                            "color",
193
+                            "checkbox"
194
+                        ),
195
+                        array(
196
+                            "textfield",
197
+                            "textfield",
198
+                            "textfield",
199
+                            "colorpicker",
200
+                            "select",
210 201
 
211
-					// heading
212
-					$param['heading'] = $val['title'];
202
+                        ),
203
+                        $val['type'] );
213 204
 
214
-					// description
215
-					$param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
205
+                    // multiselect
206
+                    if ( $val['type'] == 'multiselect' || ( ( $param['type'] == 'select' || $val['type'] == 'select' ) && ! empty( $val['multiple'] ) ) ) {
207
+                        $param['type']     = 'multiple_select';
208
+                        $param['multiple'] = true;
209
+                    }
216 210
 
217
-					// param_name
218
-					$param['param_name'] = $key;
211
+                    // heading
212
+                    $param['heading'] = $val['title'];
219 213
 
220
-					// Default
221
-					$param['default'] = isset( $val['default'] ) ? $val['default'] : '';
214
+                    // description
215
+                    $param['description'] = isset( $val['desc'] ) ? $val['desc'] : '';
222 216
 
223
-					// Group
224
-					if ( isset( $val['group'] ) ) {
225
-						$param['group'] = $val['group'];
226
-					}
217
+                    // param_name
218
+                    $param['param_name'] = $key;
227 219
 
228
-					// value
229
-					if ( $val['type'] == 'checkbox' ) {
230
-						if ( isset( $val['default'] ) && $val['default'] == '0' ) {
231
-							unset( $param['default'] );
232
-						}
233
-						$param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
234
-					} elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
235
-						$param['value'] = isset( $val['options'] ) ? $val['options'] : array();
236
-					} else {
237
-						$param['value'] = isset( $val['default'] ) ? $val['default'] : '';
238
-					}
220
+                    // Default
221
+                    $param['default'] = isset( $val['default'] ) ? $val['default'] : '';
239 222
 
240
-					// setup the param
241
-					$params[] = $param;
223
+                    // Group
224
+                    if ( isset( $val['group'] ) ) {
225
+                        $param['group'] = $val['group'];
226
+                    }
242 227
 
243
-				}
244
-			}
228
+                    // value
229
+                    if ( $val['type'] == 'checkbox' ) {
230
+                        if ( isset( $val['default'] ) && $val['default'] == '0' ) {
231
+                            unset( $param['default'] );
232
+                        }
233
+                        $param['value'] = array( '' => __( "No" ), '1' => __( "Yes" ) );
234
+                    } elseif ( $param['type'] == 'select' || $param['type'] == 'multiple_select' ) {
235
+                        $param['value'] = isset( $val['options'] ) ? $val['options'] : array();
236
+                    } else {
237
+                        $param['value'] = isset( $val['default'] ) ? $val['default'] : '';
238
+                    }
245 239
 
240
+                    // setup the param
241
+                    $params[] = $param;
246 242
 
247
-			return $params;
248
-		}
243
+                }
244
+            }
249 245
 
250
-		/**
251
-		 * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
252
-		 */
253
-		public static function maybe_cornerstone_builder() {
254
-			if ( did_action( 'cornerstone_before_boot_app' ) ) {
255
-				self::shortcode_insert_button_script();
256
-			}
257
-		}
258 246
 
259
-		/**
260
-		 * A function to ge the shortcode builder picker html.
261
-		 *
262
-		 * @param string $editor_id
263
-		 *
264
-		 * @return string
265
-		 */
266
-		public static function get_picker( $editor_id = '' ) {
267
-
268
-			ob_start();
269
-			if ( isset( $_POST['editor_id'] ) ) {
270
-				$editor_id = esc_attr( $_POST['editor_id'] );
271
-			} elseif ( isset( $_REQUEST['et_fb'] ) ) {
272
-				$editor_id = 'main_content_content_vb_tiny_mce';
273
-			}
247
+            return $params;
248
+        }
249
+
250
+        /**
251
+         * Maybe insert the shortcode inserter button in the footer if we are in the cornerstone builder
252
+         */
253
+        public static function maybe_cornerstone_builder() {
254
+            if ( did_action( 'cornerstone_before_boot_app' ) ) {
255
+                self::shortcode_insert_button_script();
256
+            }
257
+        }
258
+
259
+        /**
260
+         * A function to ge the shortcode builder picker html.
261
+         *
262
+         * @param string $editor_id
263
+         *
264
+         * @return string
265
+         */
266
+        public static function get_picker( $editor_id = '' ) {
267
+
268
+            ob_start();
269
+            if ( isset( $_POST['editor_id'] ) ) {
270
+                $editor_id = esc_attr( $_POST['editor_id'] );
271
+            } elseif ( isset( $_REQUEST['et_fb'] ) ) {
272
+                $editor_id = 'main_content_content_vb_tiny_mce';
273
+            }
274 274
 
275
-			global $sd_widgets;
275
+            global $sd_widgets;
276 276
 
277 277
 //			print_r($sd_widgets);exit;
278
-			?>
278
+            ?>
279 279
 
280 280
 			<div class="sd-shortcode-left-wrap">
281 281
 				<?php
282
-				ksort( $sd_widgets );
283
-				//				print_r($sd_widgets);exit;
284
-				if ( ! empty( $sd_widgets ) ) {
285
-					echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
286
-					echo "<option>" . __( 'Select shortcode' ) . "</option>";
287
-					foreach ( $sd_widgets as $shortcode => $class ) {
288
-						if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
289
-						echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
290
-					}
291
-					echo "</select>";
282
+                ksort( $sd_widgets );
283
+                //				print_r($sd_widgets);exit;
284
+                if ( ! empty( $sd_widgets ) ) {
285
+                    echo '<select class="widefat" onchange="sd_get_shortcode_options(this);">';
286
+                    echo "<option>" . __( 'Select shortcode' ) . "</option>";
287
+                    foreach ( $sd_widgets as $shortcode => $class ) {
288
+                        if(!empty($class['output_types']) && !in_array('shortcode', $class['output_types'])){ continue; }
289
+                        echo "<option value='" . esc_attr( $shortcode ) . "'>" . esc_attr( $shortcode ) . " (" . esc_attr( $class['name'] ) . ")</option>";
290
+                    }
291
+                    echo "</select>";
292 292
 
293
-				}
294
-				?>
293
+                }
294
+                ?>
295 295
 				<div class="sd-shortcode-settings"></div>
296 296
 
297 297
 			</div>
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 					<?php if ( $editor_id != '' ) { ?>
303 303
 						<button class="button sd-insert-shortcode-button"
304 304
 						        onclick="sd_insert_shortcode(<?php if ( ! empty( $editor_id ) ) {
305
-							        echo "'" . $editor_id . "'";
306
-						        } ?>)"><?php _e( 'Insert shortcode' ); ?></button>
305
+                                    echo "'" . $editor_id . "'";
306
+                                } ?>)"><?php _e( 'Insert shortcode' ); ?></button>
307 307
 					<?php } ?>
308 308
 					<button class="button"
309 309
 					        onclick="sd_copy_to_clipboard()"><?php _e( 'Copy shortcode' ); ?></button>
@@ -311,135 +311,135 @@  discard block
 block discarded – undo
311 311
 			</div>
312 312
 			<?php
313 313
 
314
-			$html = ob_get_clean();
314
+            $html = ob_get_clean();
315 315
 
316
-			if ( wp_doing_ajax() ) {
317
-				echo $html;
318
-				$should_die = true;
316
+            if ( wp_doing_ajax() ) {
317
+                echo $html;
318
+                $should_die = true;
319 319
 
320
-				// some builder get the editor via ajax so we should not die on those occasions
321
-				$dont_die = array(
322
-					'parent_tag',// WP Bakery
323
-					'avia_request' // enfold
324
-				);
320
+                // some builder get the editor via ajax so we should not die on those occasions
321
+                $dont_die = array(
322
+                    'parent_tag',// WP Bakery
323
+                    'avia_request' // enfold
324
+                );
325 325
 
326
-				foreach ( $dont_die as $request ) {
327
-					if ( isset( $_REQUEST[ $request ] ) ) {
328
-						$should_die = false;
329
-					}
330
-				}
326
+                foreach ( $dont_die as $request ) {
327
+                    if ( isset( $_REQUEST[ $request ] ) ) {
328
+                        $should_die = false;
329
+                    }
330
+                }
331 331
 
332
-				if ( $should_die ) {
333
-					wp_die();
334
-				}
332
+                if ( $should_die ) {
333
+                    wp_die();
334
+                }
335 335
 
336
-			} else {
337
-				return $html;
338
-			}
336
+            } else {
337
+                return $html;
338
+            }
339 339
 
340
-			return '';
340
+            return '';
341 341
 
342
-		}
342
+        }
343 343
 
344
-		/**
345
-		 * Output the version in the admin header.
346
-		 */
347
-		public function generator() {
348
-			echo '<meta name="generator" content="WP Super Duper v' . $this->version . '" />';
349
-		}
344
+        /**
345
+         * Output the version in the admin header.
346
+         */
347
+        public function generator() {
348
+            echo '<meta name="generator" content="WP Super Duper v' . $this->version . '" />';
349
+        }
350 350
 
351
-		/**
352
-		 * Get widget settings.
353
-		 *
354
-		 * @since 1.0.0
355
-		 */
356
-		public static function get_widget_settings() {
357
-			global $sd_widgets;
358
-
359
-			$shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
360
-			if ( ! $shortcode ) {
361
-				wp_die();
362
-			}
363
-			$widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
364
-			if ( ! $widget_args ) {
365
-				wp_die();
366
-			}
367
-			$class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
368
-			if ( ! $class_name ) {
369
-				wp_die();
370
-			}
351
+        /**
352
+         * Get widget settings.
353
+         *
354
+         * @since 1.0.0
355
+         */
356
+        public static function get_widget_settings() {
357
+            global $sd_widgets;
358
+
359
+            $shortcode = isset( $_REQUEST['shortcode'] ) && $_REQUEST['shortcode'] ? sanitize_title_with_dashes( $_REQUEST['shortcode'] ) : '';
360
+            if ( ! $shortcode ) {
361
+                wp_die();
362
+            }
363
+            $widget_args = isset( $sd_widgets[ $shortcode ] ) ? $sd_widgets[ $shortcode ] : '';
364
+            if ( ! $widget_args ) {
365
+                wp_die();
366
+            }
367
+            $class_name = isset( $widget_args['class_name'] ) && $widget_args['class_name'] ? $widget_args['class_name'] : '';
368
+            if ( ! $class_name ) {
369
+                wp_die();
370
+            }
371 371
 
372
-			// invoke an instance method
373
-			$widget = new $class_name;
372
+            // invoke an instance method
373
+            $widget = new $class_name;
374 374
 
375
-			ob_start();
376
-			$widget->form( array() );
377
-			$form = ob_get_clean();
378
-			echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
379
-			echo "<style>" . $widget->widget_css() . "</style>";
380
-			echo "<script>" . $widget->widget_js() . "</script>";
381
-			?>
375
+            ob_start();
376
+            $widget->form( array() );
377
+            $form = ob_get_clean();
378
+            echo "<form id='$shortcode'>" . $form . "<div class=\"widget-control-save\"></div></form>";
379
+            echo "<style>" . $widget->widget_css() . "</style>";
380
+            echo "<script>" . $widget->widget_js() . "</script>";
381
+            ?>
382 382
 			<?php
383
-			wp_die();
384
-		}
383
+            wp_die();
384
+        }
385 385
 
386
-		/**
387
-		 * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
388
-		 *
389
-		 * @param string $editor_id Optional. Shortcode editor id. Default null.
390
-		 * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
391
-		 *
392
-		 *@since 1.0.0
393
-		 *
394
-		 */
395
-		public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
396
-			global $sd_widgets, $shortcode_insert_button_once;
397
-			if ( $shortcode_insert_button_once ) {
398
-				return;
399
-			}
400
-			add_thickbox();
386
+        /**
387
+         * Insert shortcode builder button to classic editor (not inside Gutenberg, not needed).
388
+         *
389
+         * @param string $editor_id Optional. Shortcode editor id. Default null.
390
+         * @param string $insert_shortcode_function Optional. Insert shortcode function. Default null.
391
+         *
392
+         *@since 1.0.0
393
+         *
394
+         */
395
+        public static function shortcode_insert_button( $editor_id = '', $insert_shortcode_function = '' ) {
396
+            global $sd_widgets, $shortcode_insert_button_once;
397
+            if ( $shortcode_insert_button_once ) {
398
+                return;
399
+            }
400
+            add_thickbox();
401 401
 
402 402
 
403
-			/**
404
-			 * Cornerstone makes us play dirty tricks :/
405
-			 * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed.
406
-			 */
407
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
408
-				echo '<span id="insert-media-button">';
409
-			}
403
+            /**
404
+             * Cornerstone makes us play dirty tricks :/
405
+             * All media_buttons are removed via JS unless they are two specific id's so we wrap our content in this ID so it is not removed.
406
+             */
407
+            if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
408
+                echo '<span id="insert-media-button">';
409
+            }
410 410
 
411
-			echo self::shortcode_button( 'this', 'true' );
411
+            echo self::shortcode_button( 'this', 'true' );
412 412
 
413
-			// see opening note
414
-			if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
415
-				echo '</span>'; // end #insert-media-button
416
-			}
413
+            // see opening note
414
+            if ( function_exists( 'cornerstone_plugin_init' ) && ! is_admin() ) {
415
+                echo '</span>'; // end #insert-media-button
416
+            }
417 417
 
418
-			// Add separate script for generatepress theme sections
419
-			if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
420
-			} else {
421
-				self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
422
-			}
418
+            // Add separate script for generatepress theme sections
419
+            if ( function_exists( 'generate_sections_sections_metabox' ) && did_action( 'generate_sections_metabox' ) ) {
420
+            } else {
421
+                self::shortcode_insert_button_script( $editor_id, $insert_shortcode_function );
422
+            }
423 423
 
424
-			$shortcode_insert_button_once = true;
425
-		}
424
+            $shortcode_insert_button_once = true;
425
+        }
426 426
 
427
-		/**
428
-		 * Gets the shortcode insert button html.
429
-		 *
430
-		 * @param string $id
431
-		 * @param string $search_for_id
432
-		 *
433
-		 * @return mixed
434
-		 */
435
-		public static function shortcode_button( $id = '', $search_for_id = '' ) {
436
-			ob_start();
437
-			?>
427
+        /**
428
+         * Gets the shortcode insert button html.
429
+         *
430
+         * @param string $id
431
+         * @param string $search_for_id
432
+         *
433
+         * @return mixed
434
+         */
435
+        public static function shortcode_button( $id = '', $search_for_id = '' ) {
436
+            ob_start();
437
+            ?>
438 438
 			<span class="sd-lable-shortcode-inserter">
439 439
 				<a onclick="sd_ajax_get_picker(<?php echo $id;
440
-				if ( $search_for_id ) {
441
-					echo "," . $search_for_id;
442
-				} ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
440
+                if ( $search_for_id ) {
441
+                    echo "," . $search_for_id;
442
+                } ?>);" href="#TB_inline?width=100%&height=550&inlineId=super-duper-content-ajaxed"
443 443
 				   class="thickbox button super-duper-content-open" title="Add Shortcode">
444 444
 					<span style="vertical-align: middle;line-height: 18px;font-size: 20px;"
445 445
 					      class="dashicons dashicons-screenoptions"></span>
@@ -450,21 +450,21 @@  discard block
 block discarded – undo
450 450
 			</span>
451 451
 
452 452
 			<?php
453
-			$html = ob_get_clean();
453
+            $html = ob_get_clean();
454 454
 
455
-			// remove line breaks so we can use it in js
456
-			return preg_replace( "/\r|\n/", "", trim( $html ) );
457
-		}
455
+            // remove line breaks so we can use it in js
456
+            return preg_replace( "/\r|\n/", "", trim( $html ) );
457
+        }
458 458
 
459
-		/**
460
-		 * Makes SD work with the siteOrigin page builder.
461
-		 *
462
-		 * @return mixed
463
-		 *@since 1.0.6
464
-		 */
465
-		public static function siteorigin_js() {
466
-			ob_start();
467
-			?>
459
+        /**
460
+         * Makes SD work with the siteOrigin page builder.
461
+         *
462
+         * @return mixed
463
+         *@since 1.0.6
464
+         */
465
+        public static function siteorigin_js() {
466
+            ob_start();
467
+            ?>
468 468
 			<script>
469 469
 				/**
470 470
 				 * Check a form to see what items should be shown or hidden.
@@ -540,29 +540,29 @@  discard block
 block discarded – undo
540 540
 				});
541 541
 			</script>
542 542
 			<?php
543
-			$output = ob_get_clean();
543
+            $output = ob_get_clean();
544 544
 
545
-			/*
545
+            /*
546 546
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
547 547
 			 */
548 548
 
549
-			return str_replace( array(
550
-				'<script>',
551
-				'</script>'
552
-			), '', $output );
553
-		}
549
+            return str_replace( array(
550
+                '<script>',
551
+                '</script>'
552
+            ), '', $output );
553
+        }
554 554
 
555
-		/**
556
-		 * Output the JS and CSS for the shortcode insert button.
557
-		 *
558
-		 * @param string $editor_id
559
-		 * @param string $insert_shortcode_function
560
-		 *
561
-		 *@since 1.0.6
562
-		 *
563
-		 */
564
-		public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
565
-			?>
555
+        /**
556
+         * Output the JS and CSS for the shortcode insert button.
557
+         *
558
+         * @param string $editor_id
559
+         * @param string $insert_shortcode_function
560
+         *
561
+         *@since 1.0.6
562
+         *
563
+         */
564
+        public static function shortcode_insert_button_script( $editor_id = '', $insert_shortcode_function = '' ) {
565
+            ?>
566 566
 			<style>
567 567
 				.sd-shortcode-left-wrap {
568 568
 					float: left;
@@ -690,35 +690,35 @@  discard block
 block discarded – undo
690 690
 				<?php } ?>
691 691
 			</style>
692 692
 			<?php
693
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
694
-				echo "<script>" . self::siteorigin_js() . "</script>";
695
-			}
696
-			?>
693
+            if ( class_exists( 'SiteOrigin_Panels' ) ) {
694
+                echo "<script>" . self::siteorigin_js() . "</script>";
695
+            }
696
+            ?>
697 697
 			<script>
698 698
 				<?php
699
-				if(! empty( $insert_shortcode_function )){
700
-					echo $insert_shortcode_function;
701
-				}else{
702
-
703
-				/**
704
-				 * Function for super duper insert shortcode.
705
-				 *
706
-				 * @since 1.0.0
707
-				 */
708
-				?>
699
+                if(! empty( $insert_shortcode_function )){
700
+                    echo $insert_shortcode_function;
701
+                }else{
702
+
703
+                /**
704
+                 * Function for super duper insert shortcode.
705
+                 *
706
+                 * @since 1.0.0
707
+                 */
708
+                ?>
709 709
 				function sd_insert_shortcode($editor_id) {
710 710
 					$shortcode = jQuery('#TB_ajaxContent #sd-shortcode-output').val();
711 711
 					if ($shortcode) {
712 712
 						if (!$editor_id) {
713 713
 							<?php
714
-							if ( isset( $_REQUEST['et_fb'] ) ) {
715
-								echo '$editor_id = "#main_content_content_vb_tiny_mce";';
716
-							} elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
717
-								echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
718
-							} else {
719
-								echo '$editor_id = "#wp-content-editor-container textarea";';
720
-							}
721
-							?>
714
+                            if ( isset( $_REQUEST['et_fb'] ) ) {
715
+                                echo '$editor_id = "#main_content_content_vb_tiny_mce";';
716
+                            } elseif ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) {
717
+                                echo '$editor_id = "#elementor-controls .wp-editor-container textarea";';
718
+                            } else {
719
+                                echo '$editor_id = "#wp-content-editor-container textarea";';
720
+                            }
721
+                            ?>
722 722
 						} else {
723 723
 							$editor_id = '#' + $editor_id;
724 724
 						}
@@ -1045,18 +1045,18 @@  discard block
 block discarded – undo
1045 1045
 
1046 1046
 			</script>
1047 1047
 			<?php
1048
-		}
1048
+        }
1049 1049
 
1050
-		/**
1051
-		 * Gets some CSS for the widgets screen.
1052
-		 *
1053
-		 * @param bool $advanced If we should include advanced CSS.
1054
-		 *
1055
-		 * @return mixed
1056
-		 */
1057
-		public function widget_css( $advanced = true ) {
1058
-			ob_start();
1059
-			?>
1050
+        /**
1051
+         * Gets some CSS for the widgets screen.
1052
+         *
1053
+         * @param bool $advanced If we should include advanced CSS.
1054
+         *
1055
+         * @return mixed
1056
+         */
1057
+        public function widget_css( $advanced = true ) {
1058
+            ob_start();
1059
+            ?>
1060 1060
 			<style>
1061 1061
 				<?php if( $advanced ){ ?>
1062 1062
 				.sd-advanced-setting {
@@ -1094,26 +1094,26 @@  discard block
 block discarded – undo
1094 1094
 				}
1095 1095
 			</style>
1096 1096
 			<?php
1097
-			$output = ob_get_clean();
1097
+            $output = ob_get_clean();
1098 1098
 
1099
-			/*
1099
+            /*
1100 1100
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1101 1101
 			 */
1102 1102
 
1103
-			return str_replace( array(
1104
-				'<style>',
1105
-				'</style>'
1106
-			), '', $output );
1107
-		}
1103
+            return str_replace( array(
1104
+                '<style>',
1105
+                '</style>'
1106
+            ), '', $output );
1107
+        }
1108 1108
 
1109
-		/**
1110
-		 * Gets some JS for the widgets screen.
1111
-		 *
1112
-		 * @return mixed
1113
-		 */
1114
-		public function widget_js() {
1115
-			ob_start();
1116
-			?>
1109
+        /**
1110
+         * Gets some JS for the widgets screen.
1111
+         *
1112
+         * @return mixed
1113
+         */
1114
+        public function widget_js() {
1115
+            ob_start();
1116
+            ?>
1117 1117
 			<script>
1118 1118
 
1119 1119
 				/**
@@ -1268,471 +1268,471 @@  discard block
 block discarded – undo
1268 1268
 				<?php do_action( 'wp_super_duper_widget_js', $this ); ?>
1269 1269
 			</script>
1270 1270
 			<?php
1271
-			$output = ob_get_clean();
1271
+            $output = ob_get_clean();
1272 1272
 
1273
-			/*
1273
+            /*
1274 1274
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
1275 1275
 			 */
1276 1276
 
1277
-			return str_replace( array(
1278
-				'<script>',
1279
-				'</script>'
1280
-			), '', $output );
1281
-		}
1277
+            return str_replace( array(
1278
+                '<script>',
1279
+                '</script>'
1280
+            ), '', $output );
1281
+        }
1282 1282
 
1283 1283
 
1284
-		/**
1285
-		 * Set the name from the argument key.
1286
-		 *
1287
-		 * @param $options
1288
-		 *
1289
-		 * @return mixed
1290
-		 */
1291
-		private function add_name_from_key( $options, $arguments = false ) {
1292
-			if ( ! empty( $options['arguments'] ) ) {
1293
-				foreach ( $options['arguments'] as $key => $val ) {
1294
-					$options['arguments'][ $key ]['name'] = $key;
1295
-				}
1296
-			} elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1297
-				foreach ( $options as $key => $val ) {
1298
-					$options[ $key ]['name'] = $key;
1299
-				}
1300
-			}
1284
+        /**
1285
+         * Set the name from the argument key.
1286
+         *
1287
+         * @param $options
1288
+         *
1289
+         * @return mixed
1290
+         */
1291
+        private function add_name_from_key( $options, $arguments = false ) {
1292
+            if ( ! empty( $options['arguments'] ) ) {
1293
+                foreach ( $options['arguments'] as $key => $val ) {
1294
+                    $options['arguments'][ $key ]['name'] = $key;
1295
+                }
1296
+            } elseif ( $arguments && is_array( $options ) && ! empty( $options ) ) {
1297
+                foreach ( $options as $key => $val ) {
1298
+                    $options[ $key ]['name'] = $key;
1299
+                }
1300
+            }
1301 1301
 
1302
-			return $options;
1303
-		}
1302
+            return $options;
1303
+        }
1304 1304
 
1305
-		/**
1306
-		 * Register the parent shortcode.
1307
-		 *
1308
-		 * @since 1.0.0
1309
-		 */
1310
-		public function register_shortcode() {
1311
-			add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1312
-			add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1313
-		}
1305
+        /**
1306
+         * Register the parent shortcode.
1307
+         *
1308
+         * @since 1.0.0
1309
+         */
1310
+        public function register_shortcode() {
1311
+            add_shortcode( $this->base_id, array( $this, 'shortcode_output' ) );
1312
+            add_action( 'wp_ajax_super_duper_output_shortcode', array( $this, 'render_shortcode' ) );
1313
+        }
1314 1314
 
1315
-		/**
1316
-		 * Render the shortcode via ajax so we can return it to Gutenberg.
1317
-		 *
1318
-		 * @since 1.0.0
1319
-		 */
1320
-		public function render_shortcode() {
1321
-			check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1322
-			if ( ! current_user_can( 'manage_options' ) ) {
1323
-				wp_die();
1324
-			}
1315
+        /**
1316
+         * Render the shortcode via ajax so we can return it to Gutenberg.
1317
+         *
1318
+         * @since 1.0.0
1319
+         */
1320
+        public function render_shortcode() {
1321
+            check_ajax_referer( 'super_duper_output_shortcode', '_ajax_nonce', true );
1322
+            if ( ! current_user_can( 'manage_options' ) ) {
1323
+                wp_die();
1324
+            }
1325 1325
 
1326
-			// we might need the $post value here so lets set it.
1327
-			if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1328
-				$post_obj = get_post( absint( $_POST['post_id'] ) );
1329
-				if ( ! empty( $post_obj ) && empty( $post ) ) {
1330
-					global $post;
1331
-					$post = $post_obj;
1332
-				}
1333
-			}
1326
+            // we might need the $post value here so lets set it.
1327
+            if ( isset( $_POST['post_id'] ) && $_POST['post_id'] ) {
1328
+                $post_obj = get_post( absint( $_POST['post_id'] ) );
1329
+                if ( ! empty( $post_obj ) && empty( $post ) ) {
1330
+                    global $post;
1331
+                    $post = $post_obj;
1332
+                }
1333
+            }
1334 1334
 
1335
-			if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1336
-				$is_preview = $this->is_preview();
1337
-				$shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1338
-				$attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1339
-				$attributes       = '';
1340
-				if ( ! empty( $attributes_array ) ) {
1341
-					foreach ( $attributes_array as $key => $value ) {
1342
-						if ( is_array( $value ) ) {
1343
-							$value = implode( ",", $value );
1344
-						}
1335
+            if ( isset( $_POST['shortcode'] ) && $_POST['shortcode'] ) {
1336
+                $is_preview = $this->is_preview();
1337
+                $shortcode_name   = sanitize_title_with_dashes( $_POST['shortcode'] );
1338
+                $attributes_array = isset( $_POST['attributes'] ) && $_POST['attributes'] ? $_POST['attributes'] : array();
1339
+                $attributes       = '';
1340
+                if ( ! empty( $attributes_array ) ) {
1341
+                    foreach ( $attributes_array as $key => $value ) {
1342
+                        if ( is_array( $value ) ) {
1343
+                            $value = implode( ",", $value );
1344
+                        }
1345 1345
 
1346
-						if ( ! empty( $value ) ) {
1347
-							$value = wp_unslash( $value );
1346
+                        if ( ! empty( $value ) ) {
1347
+                            $value = wp_unslash( $value );
1348 1348
 
1349
-							// Encode [ and ].
1350
-							if ( $is_preview ) {
1351
-								$value = $this->encode_shortcodes( $value );
1352
-							}
1353
-						}
1354
-						$attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . esc_attr( $value ) . "' ";
1355
-					}
1356
-				}
1349
+                            // Encode [ and ].
1350
+                            if ( $is_preview ) {
1351
+                                $value = $this->encode_shortcodes( $value );
1352
+                            }
1353
+                        }
1354
+                        $attributes .= " " . sanitize_title_with_dashes( $key ) . "='" . esc_attr( $value ) . "' ";
1355
+                    }
1356
+                }
1357 1357
 
1358
-				$shortcode = "[" . $shortcode_name . " " . $attributes . "]";
1358
+                $shortcode = "[" . $shortcode_name . " " . $attributes . "]";
1359 1359
 
1360
-				$content = do_shortcode( $shortcode );
1360
+                $content = do_shortcode( $shortcode );
1361 1361
 
1362
-				// Decode [ and ].
1363
-				if ( ! empty( $content ) && $is_preview ) {
1364
-					$content = $this->decode_shortcodes( $content );
1365
-				}
1362
+                // Decode [ and ].
1363
+                if ( ! empty( $content ) && $is_preview ) {
1364
+                    $content = $this->decode_shortcodes( $content );
1365
+                }
1366 1366
 
1367
-				echo $content;
1368
-			}
1369
-			wp_die();
1370
-		}
1367
+                echo $content;
1368
+            }
1369
+            wp_die();
1370
+        }
1371 1371
 
1372
-		/**
1373
-		 * Output the shortcode.
1374
-		 *
1375
-		 * @param array $args
1376
-		 * @param string $content
1377
-		 *
1378
-		 * @return string
1379
-		 */
1380
-		public function shortcode_output( $args = array(), $content = '' ) {
1381
-			$_instance = $args;
1382
-
1383
-			$args = $this->argument_values( $args );
1384
-
1385
-			// add extra argument so we know its a output to gutenberg
1386
-			//$args
1387
-			$args = $this->string_to_bool( $args );
1388
-
1389
-			// if we have a enclosed shortcode we add it to the special `html` argument
1390
-			if ( ! empty( $content ) ) {
1391
-				$args['html'] = $content;
1392
-			}
1372
+        /**
1373
+         * Output the shortcode.
1374
+         *
1375
+         * @param array $args
1376
+         * @param string $content
1377
+         *
1378
+         * @return string
1379
+         */
1380
+        public function shortcode_output( $args = array(), $content = '' ) {
1381
+            $_instance = $args;
1393 1382
 
1394
-			if ( ! $this->is_preview() ) {
1395
-				/**
1396
-				 * Filters the settings for a particular widget args.
1397
-				 *
1398
-				 * @param array          $args      The current widget instance's settings.
1399
-				 * @param WP_Super_Duper $widget    The current widget settings.
1400
-				 * @param array          $_instance An array of default widget arguments.
1401
-				 *
1402
-				 *@since 1.0.28
1403
-				 *
1404
-				 */
1405
-				$args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1383
+            $args = $this->argument_values( $args );
1406 1384
 
1407
-				if ( ! is_array( $args ) ) {
1408
-					return $args;
1409
-				}
1410
-			}
1385
+            // add extra argument so we know its a output to gutenberg
1386
+            //$args
1387
+            $args = $this->string_to_bool( $args );
1411 1388
 
1412
-			$class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1413
-			$class .= " sdel-".$this->get_instance_hash();
1389
+            // if we have a enclosed shortcode we add it to the special `html` argument
1390
+            if ( ! empty( $content ) ) {
1391
+                $args['html'] = $content;
1392
+            }
1414 1393
 
1415
-			$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1416
-			$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1394
+            if ( ! $this->is_preview() ) {
1395
+                /**
1396
+                 * Filters the settings for a particular widget args.
1397
+                 *
1398
+                 * @param array          $args      The current widget instance's settings.
1399
+                 * @param WP_Super_Duper $widget    The current widget settings.
1400
+                 * @param array          $_instance An array of default widget arguments.
1401
+                 *
1402
+                 *@since 1.0.28
1403
+                 *
1404
+                 */
1405
+                $args = apply_filters( 'wp_super_duper_widget_display_callback', $args, $this, $_instance );
1406
+
1407
+                if ( ! is_array( $args ) ) {
1408
+                    return $args;
1409
+                }
1410
+            }
1417 1411
 
1418
-			$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1419
-			$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1412
+            $class = isset( $this->options['widget_ops']['classname'] ) ? esc_attr( $this->options['widget_ops']['classname'] ) : '';
1413
+            $class .= " sdel-".$this->get_instance_hash();
1420 1414
 
1421
-			$shortcode_args = array();
1422
-			$output         = '';
1423
-			$no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1424
-			if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1425
-				$no_wrap = true;
1426
-			}
1427
-			$main_content = $this->output( $args, $shortcode_args, $content );
1428
-			if ( $main_content && ! $no_wrap ) {
1429
-				// wrap the shortcode in a div with the same class as the widget
1430
-				$output .= '<div class="' . $class . '" ' . $attrs . '>';
1431
-				if ( ! empty( $args['title'] ) ) {
1432
-					// if its a shortcode and there is a title try to grab the title wrappers
1433
-					$shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1434
-					if ( empty( $instance ) ) {
1435
-						global $wp_registered_sidebars;
1436
-						if ( ! empty( $wp_registered_sidebars ) ) {
1437
-							foreach ( $wp_registered_sidebars as $sidebar ) {
1438
-								if ( ! empty( $sidebar['before_title'] ) ) {
1439
-									$shortcode_args['before_title'] = $sidebar['before_title'];
1440
-									$shortcode_args['after_title']  = $sidebar['after_title'];
1441
-									break;
1442
-								}
1443
-							}
1444
-						}
1445
-					}
1446
-					$output .= $this->output_title( $shortcode_args, $args );
1447
-				}
1448
-				$output .= $main_content;
1449
-				$output .= '</div>';
1450
-			} elseif ( $main_content && $no_wrap ) {
1451
-				$output .= $main_content;
1452
-			}
1415
+            $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
1416
+            $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
1453 1417
 
1454
-			// if preview show a placeholder if empty
1455
-			if ( $this->is_preview() && $output == '' ) {
1456
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1457
-			}
1418
+            $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
1419
+            $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
1458 1420
 
1459
-			return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1460
-		}
1421
+            $shortcode_args = array();
1422
+            $output         = '';
1423
+            $no_wrap        = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
1424
+            if ( isset( $args['no_wrap'] ) && $args['no_wrap'] ) {
1425
+                $no_wrap = true;
1426
+            }
1427
+            $main_content = $this->output( $args, $shortcode_args, $content );
1428
+            if ( $main_content && ! $no_wrap ) {
1429
+                // wrap the shortcode in a div with the same class as the widget
1430
+                $output .= '<div class="' . $class . '" ' . $attrs . '>';
1431
+                if ( ! empty( $args['title'] ) ) {
1432
+                    // if its a shortcode and there is a title try to grab the title wrappers
1433
+                    $shortcode_args = array( 'before_title' => '', 'after_title' => '' );
1434
+                    if ( empty( $instance ) ) {
1435
+                        global $wp_registered_sidebars;
1436
+                        if ( ! empty( $wp_registered_sidebars ) ) {
1437
+                            foreach ( $wp_registered_sidebars as $sidebar ) {
1438
+                                if ( ! empty( $sidebar['before_title'] ) ) {
1439
+                                    $shortcode_args['before_title'] = $sidebar['before_title'];
1440
+                                    $shortcode_args['after_title']  = $sidebar['after_title'];
1441
+                                    break;
1442
+                                }
1443
+                            }
1444
+                        }
1445
+                    }
1446
+                    $output .= $this->output_title( $shortcode_args, $args );
1447
+                }
1448
+                $output .= $main_content;
1449
+                $output .= '</div>';
1450
+            } elseif ( $main_content && $no_wrap ) {
1451
+                $output .= $main_content;
1452
+            }
1461 1453
 
1462
-		/**
1463
-		 * Placeholder text to show if output is empty and we are on a preview/builder page.
1464
-		 *
1465
-		 * @param string $name
1466
-		 *
1467
-		 * @return string
1468
-		 */
1469
-		public function preview_placeholder_text( $name = '' ) {
1470
-			return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
1471
-		}
1454
+            // if preview show a placeholder if empty
1455
+            if ( $this->is_preview() && $output == '' ) {
1456
+                $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
1457
+            }
1472 1458
 
1473
-		/**
1474
-		 * Sometimes booleans values can be turned to strings, so we fix that.
1475
-		 *
1476
-		 * @param $options
1477
-		 *
1478
-		 * @return mixed
1479
-		 */
1480
-		public function string_to_bool( $options ) {
1481
-			// convert bool strings to booleans
1482
-			foreach ( $options as $key => $val ) {
1483
-				if ( $val == 'false' ) {
1484
-					$options[ $key ] = false;
1485
-				} elseif ( $val == 'true' ) {
1486
-					$options[ $key ] = true;
1487
-				}
1488
-			}
1459
+            return apply_filters( 'wp_super_duper_widget_output', $output, $args, $shortcode_args, $this );
1460
+        }
1489 1461
 
1490
-			return $options;
1491
-		}
1462
+        /**
1463
+         * Placeholder text to show if output is empty and we are on a preview/builder page.
1464
+         *
1465
+         * @param string $name
1466
+         *
1467
+         * @return string
1468
+         */
1469
+        public function preview_placeholder_text( $name = '' ) {
1470
+            return "<div style='background:#0185ba33;padding: 10px;border: 4px #ccc dashed;'>" . sprintf( __( 'Placeholder for: %s' ), $name ) . "</div>";
1471
+        }
1492 1472
 
1493
-		/**
1494
-		 * Get the argument values that are also filterable.
1495
-		 *
1496
-		 * @param $instance
1497
-		 *
1498
-		 * @return array
1499
-		 *@since 1.0.12 Don't set checkbox default value if the value is empty.
1500
-		 *
1501
-		 */
1502
-		public function argument_values( $instance ) {
1503
-			$argument_values = array();
1504
-
1505
-			// set widget instance
1506
-			$this->instance = $instance;
1507
-
1508
-			if ( empty( $this->arguments ) ) {
1509
-				$this->arguments = $this->get_arguments();
1510
-			}
1473
+        /**
1474
+         * Sometimes booleans values can be turned to strings, so we fix that.
1475
+         *
1476
+         * @param $options
1477
+         *
1478
+         * @return mixed
1479
+         */
1480
+        public function string_to_bool( $options ) {
1481
+            // convert bool strings to booleans
1482
+            foreach ( $options as $key => $val ) {
1483
+                if ( $val == 'false' ) {
1484
+                    $options[ $key ] = false;
1485
+                } elseif ( $val == 'true' ) {
1486
+                    $options[ $key ] = true;
1487
+                }
1488
+            }
1511 1489
 
1512
-			if ( ! empty( $this->arguments ) ) {
1513
-				foreach ( $this->arguments as $key => $args ) {
1514
-					// set the input name from the key
1515
-					$args['name'] = $key;
1516
-					//
1517
-					$argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1518
-					if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1519
-						// don't set default for an empty checkbox
1520
-					} elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1521
-						$argument_values[ $key ] = $args['default'];
1522
-					}
1523
-				}
1524
-			}
1490
+            return $options;
1491
+        }
1525 1492
 
1526
-			return $argument_values;
1527
-		}
1493
+        /**
1494
+         * Get the argument values that are also filterable.
1495
+         *
1496
+         * @param $instance
1497
+         *
1498
+         * @return array
1499
+         *@since 1.0.12 Don't set checkbox default value if the value is empty.
1500
+         *
1501
+         */
1502
+        public function argument_values( $instance ) {
1503
+            $argument_values = array();
1528 1504
 
1529
-		/**
1530
-		 * Set arguments in super duper.
1531
-		 *
1532
-		 * @return array Set arguments.
1533
-		 *@since 1.0.0
1534
-		 *
1535
-		 */
1536
-		public function set_arguments() {
1537
-			return $this->arguments;
1538
-		}
1505
+            // set widget instance
1506
+            $this->instance = $instance;
1539 1507
 
1540
-		/**
1541
-		 * Get arguments in super duper.
1542
-		 *
1543
-		 * @return array Get arguments.
1544
-		 *@since 1.0.0
1545
-		 *
1546
-		 */
1547
-		public function get_arguments() {
1548
-			if ( empty( $this->arguments ) ) {
1549
-				$this->arguments = $this->set_arguments();
1550
-			}
1508
+            if ( empty( $this->arguments ) ) {
1509
+                $this->arguments = $this->get_arguments();
1510
+            }
1551 1511
 
1552
-			$this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1553
-			$this->arguments = $this->add_name_from_key( $this->arguments, true );
1512
+            if ( ! empty( $this->arguments ) ) {
1513
+                foreach ( $this->arguments as $key => $args ) {
1514
+                    // set the input name from the key
1515
+                    $args['name'] = $key;
1516
+                    //
1517
+                    $argument_values[ $key ] = isset( $instance[ $key ] ) ? $instance[ $key ] : '';
1518
+                    if ( $args['type'] == 'checkbox' && $argument_values[ $key ] == '' ) {
1519
+                        // don't set default for an empty checkbox
1520
+                    } elseif ( $argument_values[ $key ] == '' && isset( $args['default'] ) ) {
1521
+                        $argument_values[ $key ] = $args['default'];
1522
+                    }
1523
+                }
1524
+            }
1554 1525
 
1555
-			return $this->arguments;
1556
-		}
1526
+            return $argument_values;
1527
+        }
1557 1528
 
1558
-		/**
1559
-		 * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
1560
-		 *
1561
-		 * @param array $args
1562
-		 * @param array $widget_args
1563
-		 * @param string $content
1564
-		 */
1565
-		public function output( $args = array(), $widget_args = array(), $content = '' ) {
1529
+        /**
1530
+         * Set arguments in super duper.
1531
+         *
1532
+         * @return array Set arguments.
1533
+         *@since 1.0.0
1534
+         *
1535
+         */
1536
+        public function set_arguments() {
1537
+            return $this->arguments;
1538
+        }
1566 1539
 
1567
-		}
1540
+        /**
1541
+         * Get arguments in super duper.
1542
+         *
1543
+         * @return array Get arguments.
1544
+         *@since 1.0.0
1545
+         *
1546
+         */
1547
+        public function get_arguments() {
1548
+            if ( empty( $this->arguments ) ) {
1549
+                $this->arguments = $this->set_arguments();
1550
+            }
1568 1551
 
1569
-		/**
1570
-		 * Add the dynamic block code inline when the wp-block in enqueued.
1571
-		 */
1572
-		public function register_block() {
1573
-			wp_add_inline_script( 'wp-blocks', $this->block() );
1574
-			if ( class_exists( 'SiteOrigin_Panels' ) ) {
1575
-				wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1576
-			}
1577
-		}
1552
+            $this->arguments = apply_filters( 'wp_super_duper_arguments', $this->arguments, $this->options, $this->instance );
1553
+            $this->arguments = $this->add_name_from_key( $this->arguments, true );
1578 1554
 
1579
-		/**
1580
-		 * Check if we need to show advanced options.
1581
-		 *
1582
-		 * @return bool
1583
-		 */
1584
-		public function block_show_advanced() {
1585
-
1586
-			$show      = false;
1587
-			$arguments = $this->get_arguments();
1588
-
1589
-			if ( ! empty( $arguments ) ) {
1590
-				foreach ( $arguments as $argument ) {
1591
-					if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1592
-						$show = true;
1593
-						break; // no need to continue if we know we have it
1594
-					}
1595
-				}
1596
-			}
1555
+            return $this->arguments;
1556
+        }
1597 1557
 
1598
-			return $show;
1599
-		}
1558
+        /**
1559
+         * This is the main output class for all 3 items, widget, shortcode and block, it is extended in the calling class.
1560
+         *
1561
+         * @param array $args
1562
+         * @param array $widget_args
1563
+         * @param string $content
1564
+         */
1565
+        public function output( $args = array(), $widget_args = array(), $content = '' ) {
1600 1566
 
1601
-		/**
1602
-		 * Get the url path to the current folder.
1603
-		 *
1604
-		 * @return string
1605
-		 */
1606
-		public function get_url() {
1607
-			$url = $this->url;
1608
-
1609
-			if ( ! $url ) {
1610
-				$content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1611
-				$content_url = untrailingslashit( WP_CONTENT_URL );
1612
-
1613
-				// Replace http:// to https://.
1614
-				if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1615
-					$content_url = str_replace( 'http://', 'https://', $content_url );
1616
-				}
1567
+        }
1617 1568
 
1618
-				// Check if we are inside a plugin
1619
-				$file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1620
-				$url = str_replace( $content_dir, $content_url, $file_dir );
1621
-				$url = trailingslashit( $url );
1622
-				$this->url = $url;
1623
-			}
1569
+        /**
1570
+         * Add the dynamic block code inline when the wp-block in enqueued.
1571
+         */
1572
+        public function register_block() {
1573
+            wp_add_inline_script( 'wp-blocks', $this->block() );
1574
+            if ( class_exists( 'SiteOrigin_Panels' ) ) {
1575
+                wp_add_inline_script( 'wp-blocks', $this->siteorigin_js() );
1576
+            }
1577
+        }
1624 1578
 
1625
-			return $url;
1626
-		}
1579
+        /**
1580
+         * Check if we need to show advanced options.
1581
+         *
1582
+         * @return bool
1583
+         */
1584
+        public function block_show_advanced() {
1627 1585
 
1628
-		/**
1629
-		 * Get the url path to the current folder.
1630
-		 *
1631
-		 * @return string
1632
-		 */
1633
-		public function get_url_old() {
1586
+            $show      = false;
1587
+            $arguments = $this->get_arguments();
1634 1588
 
1635
-			$url = $this->url;
1589
+            if ( ! empty( $arguments ) ) {
1590
+                foreach ( $arguments as $argument ) {
1591
+                    if ( isset( $argument['advanced'] ) && $argument['advanced'] ) {
1592
+                        $show = true;
1593
+                        break; // no need to continue if we know we have it
1594
+                    }
1595
+                }
1596
+            }
1636 1597
 
1637
-			if ( ! $url ) {
1638
-				// check if we are inside a plugin
1639
-				$file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1598
+            return $show;
1599
+        }
1640 1600
 
1641
-				$dir_parts = explode( "/wp-content/", $file_dir );
1642
-				$url_parts = explode( "/wp-content/", plugins_url() );
1601
+        /**
1602
+         * Get the url path to the current folder.
1603
+         *
1604
+         * @return string
1605
+         */
1606
+        public function get_url() {
1607
+            $url = $this->url;
1643 1608
 
1644
-				if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1645
-					$url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1646
-					$this->url = $url;
1647
-				}
1648
-			}
1609
+            if ( ! $url ) {
1610
+                $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
1611
+                $content_url = untrailingslashit( WP_CONTENT_URL );
1649 1612
 
1613
+                // Replace http:// to https://.
1614
+                if ( strpos( $content_url, 'http://' ) === 0 && strpos( plugins_url(), 'https://' ) === 0 ) {
1615
+                    $content_url = str_replace( 'http://', 'https://', $content_url );
1616
+                }
1650 1617
 
1651
-			return $url;
1652
-		}
1618
+                // Check if we are inside a plugin
1619
+                $file_dir = str_replace( "/includes", "", wp_normalize_path( dirname( __FILE__ ) ) );
1620
+                $url = str_replace( $content_dir, $content_url, $file_dir );
1621
+                $url = trailingslashit( $url );
1622
+                $this->url = $url;
1623
+            }
1653 1624
 
1654
-		/**
1655
-		 * Generate the block icon.
1656
-		 *
1657
-		 * Enables the use of Font Awesome icons.
1658
-		 *
1659
-		 * @note xlink:href is actually deprecated but href is not supported by all so we use both.
1660
-		 *
1661
-		 * @param $icon
1662
-		 *
1663
-		 * @return string
1664
-		 *@since 1.1.0
1665
-		 */
1666
-		public function get_block_icon( $icon ) {
1667
-
1668
-			// check if we have a Font Awesome icon
1669
-			$fa_type = '';
1670
-			if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1671
-				$fa_type = 'solid';
1672
-			} elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1673
-				$fa_type = 'regular';
1674
-			} elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1675
-				$fa_type = 'brands';
1676
-			} else {
1677
-				$icon = "'" . $icon . "'";
1678
-			}
1625
+            return $url;
1626
+        }
1679 1627
 
1680
-			// set the icon if we found one
1681
-			if ( $fa_type ) {
1682
-				$fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1683
-				$icon    = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))";
1684
-			}
1628
+        /**
1629
+         * Get the url path to the current folder.
1630
+         *
1631
+         * @return string
1632
+         */
1633
+        public function get_url_old() {
1685 1634
 
1686
-			return $icon;
1687
-		}
1635
+            $url = $this->url;
1636
+
1637
+            if ( ! $url ) {
1638
+                // check if we are inside a plugin
1639
+                $file_dir = str_replace( "/includes", "", dirname( __FILE__ ) );
1640
+
1641
+                $dir_parts = explode( "/wp-content/", $file_dir );
1642
+                $url_parts = explode( "/wp-content/", plugins_url() );
1643
+
1644
+                if ( ! empty( $url_parts[0] ) && ! empty( $dir_parts[1] ) ) {
1645
+                    $url       = trailingslashit( $url_parts[0] . "/wp-content/" . $dir_parts[1] );
1646
+                    $this->url = $url;
1647
+                }
1648
+            }
1649
+
1650
+
1651
+            return $url;
1652
+        }
1653
+
1654
+        /**
1655
+         * Generate the block icon.
1656
+         *
1657
+         * Enables the use of Font Awesome icons.
1658
+         *
1659
+         * @note xlink:href is actually deprecated but href is not supported by all so we use both.
1660
+         *
1661
+         * @param $icon
1662
+         *
1663
+         * @return string
1664
+         *@since 1.1.0
1665
+         */
1666
+        public function get_block_icon( $icon ) {
1667
+
1668
+            // check if we have a Font Awesome icon
1669
+            $fa_type = '';
1670
+            if ( substr( $icon, 0, 7 ) === "fas fa-" ) {
1671
+                $fa_type = 'solid';
1672
+            } elseif ( substr( $icon, 0, 7 ) === "far fa-" ) {
1673
+                $fa_type = 'regular';
1674
+            } elseif ( substr( $icon, 0, 7 ) === "fab fa-" ) {
1675
+                $fa_type = 'brands';
1676
+            } else {
1677
+                $icon = "'" . $icon . "'";
1678
+            }
1688 1679
 
1689
-		public function group_arguments( $arguments ) {
1680
+            // set the icon if we found one
1681
+            if ( $fa_type ) {
1682
+                $fa_icon = str_replace( array( "fas fa-", "far fa-", "fab fa-" ), "", $icon );
1683
+                $icon    = "el('svg',{width: 20, height: 20, viewBox: '0 0 20 20'},el('use', {'xlink:href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "','href': '" . $this->get_url() . "icons/" . $fa_type . ".svg#" . $fa_icon . "'}))";
1684
+            }
1685
+
1686
+            return $icon;
1687
+        }
1688
+
1689
+        public function group_arguments( $arguments ) {
1690 1690
 //			echo '###';print_r($arguments);
1691
-			if ( ! empty( $arguments ) ) {
1692
-				$temp_arguments = array();
1693
-				$general        = __( "General" );
1694
-				$add_sections   = false;
1695
-				foreach ( $arguments as $key => $args ) {
1696
-					if ( isset( $args['group'] ) ) {
1697
-						$temp_arguments[ $args['group'] ][ $key ] = $args;
1698
-						$add_sections                             = true;
1699
-					} else {
1700
-						$temp_arguments[ $general ][ $key ] = $args;
1701
-					}
1702
-				}
1691
+            if ( ! empty( $arguments ) ) {
1692
+                $temp_arguments = array();
1693
+                $general        = __( "General" );
1694
+                $add_sections   = false;
1695
+                foreach ( $arguments as $key => $args ) {
1696
+                    if ( isset( $args['group'] ) ) {
1697
+                        $temp_arguments[ $args['group'] ][ $key ] = $args;
1698
+                        $add_sections                             = true;
1699
+                    } else {
1700
+                        $temp_arguments[ $general ][ $key ] = $args;
1701
+                    }
1702
+                }
1703 1703
 
1704
-				// only add sections if more than one
1705
-				if ( $add_sections ) {
1706
-					$arguments = $temp_arguments;
1707
-				}
1708
-			}
1704
+                // only add sections if more than one
1705
+                if ( $add_sections ) {
1706
+                    $arguments = $temp_arguments;
1707
+                }
1708
+            }
1709 1709
 
1710 1710
 //			echo '###';print_r($arguments);
1711
-			return $arguments;
1712
-		}
1711
+            return $arguments;
1712
+        }
1713 1713
 
1714 1714
 
1715
-		/**
1716
-		 * Output the JS for building the dynamic Guntenberg block.
1717
-		 *
1718
-		 * @return mixed
1719
-		 *@since 1.0.9 Save numbers as numbers and not strings.
1720
-		 * @since 1.1.0 Font Awesome classes can be used for icons.
1721
-		 * @since 1.0.4 Added block_wrap property which will set the block wrapping output element ie: div, span, p or empty for no wrap.
1722
-		 */
1723
-		public function block() {
1715
+        /**
1716
+         * Output the JS for building the dynamic Guntenberg block.
1717
+         *
1718
+         * @return mixed
1719
+         *@since 1.0.9 Save numbers as numbers and not strings.
1720
+         * @since 1.1.0 Font Awesome classes can be used for icons.
1721
+         * @since 1.0.4 Added block_wrap property which will set the block wrapping output element ie: div, span, p or empty for no wrap.
1722
+         */
1723
+        public function block() {
1724 1724
             global $sd_is_js_functions_loaded;
1725 1725
 
1726
-			ob_start();
1726
+            ob_start();
1727 1727
 
1728
-			$show_advanced = $this->block_show_advanced();
1728
+            $show_advanced = $this->block_show_advanced();
1729 1729
 
1730 1730
 
1731
-			?>
1731
+            ?>
1732 1732
 			<script>
1733 1733
 
1734 1734
 			<?php
1735
-			if(!$sd_is_js_functions_loaded){
1735
+            if(!$sd_is_js_functions_loaded){
1736 1736
                 $sd_is_js_functions_loaded = true;
1737 1737
             ?>
1738 1738
 
@@ -2078,10 +2078,10 @@  discard block
 block discarded – undo
2078 2078
 
2079 2079
             }
2080 2080
 
2081
-			if(method_exists($this,'block_global_js')){
2082
-					echo $this->block_global_js();
2083
-			}
2084
-			?>
2081
+            if(method_exists($this,'block_global_js')){
2082
+                    echo $this->block_global_js();
2083
+            }
2084
+            ?>
2085 2085
 
2086 2086
 jQuery(function() {
2087 2087
 
@@ -2131,14 +2131,14 @@  discard block
 block discarded – undo
2131 2131
 						icon: <?php echo $this->get_block_icon( $this->options['block-icon'] );?>,//'<?php echo isset( $this->options['block-icon'] ) ? esc_attr( $this->options['block-icon'] ) : 'shield-alt';?>', // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
2132 2132
 						supports: {
2133 2133
 							<?php
2134
-							if ( isset( $this->options['block-supports'] ) ) {
2135
-								echo $this->array_to_attributes( $this->options['block-supports'] );
2136
-							}
2137
-							?>
2134
+                            if ( isset( $this->options['block-supports'] ) ) {
2135
+                                echo $this->array_to_attributes( $this->options['block-supports'] );
2136
+                            }
2137
+                            ?>
2138 2138
 						},
2139 2139
 						<?php
2140
-						if ( isset( $this->options['block-label'] ) ) {
2141
-						?>
2140
+                        if ( isset( $this->options['block-label'] ) ) {
2141
+                        ?>
2142 2142
 						__experimentalLabel( attributes, { context } ) {
2143 2143
                             return <?php echo $this->options['block-label']; ?>;
2144 2144
                         },
@@ -2147,7 +2147,7 @@  discard block
 block discarded – undo
2147 2147
                         ?>
2148 2148
 						category: '<?php echo isset( $this->options['block-category'] ) ? esc_attr( $this->options['block-category'] ) : 'common';?>', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
2149 2149
 						<?php if ( isset( $this->options['block-keywords'] ) ) {
2150
-						echo "keywords : " . $this->options['block-keywords'] . ",";
2150
+                        echo "keywords : " . $this->options['block-keywords'] . ",";
2151 2151
 
2152 2152
 //						// block hover preview.
2153 2153
 //						$example_args = array();
@@ -2172,86 +2172,86 @@  discard block
 block discarded – undo
2172 2172
 
2173 2173
                         }
2174 2174
 
2175
-						// maybe set no_wrap
2176
-						$no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2177
-						if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2178
-							$no_wrap = true;
2179
-						}
2180
-						if ( $no_wrap ) {
2181
-							$this->options['block-wrap'] = '';
2182
-						}
2175
+                        // maybe set no_wrap
2176
+                        $no_wrap = isset( $this->options['no_wrap'] ) && $this->options['no_wrap'] ? true : false;
2177
+                        if ( isset( $this->arguments['no_wrap'] ) && $this->arguments['no_wrap'] ) {
2178
+                            $no_wrap = true;
2179
+                        }
2180
+                        if ( $no_wrap ) {
2181
+                            $this->options['block-wrap'] = '';
2182
+                        }
2183 2183
 
2184
-						// maybe load the drag/drop functions.
2185
-						$img_drag_drop = false;
2184
+                        // maybe load the drag/drop functions.
2185
+                        $img_drag_drop = false;
2186 2186
 
2187
-						$show_alignment = false;
2188
-						// align feature
2189
-						/*echo "supports: {";
2187
+                        $show_alignment = false;
2188
+                        // align feature
2189
+                        /*echo "supports: {";
2190 2190
 						echo "	align: true,";
2191 2191
 						echo "  html: false";
2192 2192
 						echo "},";*/
2193 2193
 
2194
-						if ( ! empty( $this->arguments ) ) {
2195
-							echo "attributes : {";
2194
+                        if ( ! empty( $this->arguments ) ) {
2195
+                            echo "attributes : {";
2196 2196
 
2197
-							if ( $show_advanced ) {
2198
-								echo "show_advanced: {";
2199
-								echo "	type: 'boolean',";
2200
-								echo "  default: false,";
2201
-								echo "},";
2202
-							}
2197
+                            if ( $show_advanced ) {
2198
+                                echo "show_advanced: {";
2199
+                                echo "	type: 'boolean',";
2200
+                                echo "  default: false,";
2201
+                                echo "},";
2202
+                            }
2203 2203
 
2204
-							// block wrap element
2205
-							if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2206
-								echo "block_wrap: {";
2207
-								echo "	type: 'string',";
2208
-								echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
2209
-								echo "},";
2210
-							}
2204
+                            // block wrap element
2205
+                            if ( ! empty( $this->options['block-wrap'] ) ) { //@todo we should validate this?
2206
+                                echo "block_wrap: {";
2207
+                                echo "	type: 'string',";
2208
+                                echo "  default: '" . esc_attr( $this->options['block-wrap'] ) . "',";
2209
+                                echo "},";
2210
+                            }
2211 2211
 
2212 2212
 
2213 2213
 
2214
-							foreach ( $this->arguments as $key => $args ) {
2214
+                            foreach ( $this->arguments as $key => $args ) {
2215 2215
 
2216
-								if( $args['type'] == 'image' ||  $args['type'] == 'images' ){
2217
-									$img_drag_drop = true;
2218
-								}
2216
+                                if( $args['type'] == 'image' ||  $args['type'] == 'images' ){
2217
+                                    $img_drag_drop = true;
2218
+                                }
2219 2219
 
2220
-								// set if we should show alignment
2221
-								if ( $key == 'alignment' ) {
2222
-									$show_alignment = true;
2223
-								}
2220
+                                // set if we should show alignment
2221
+                                if ( $key == 'alignment' ) {
2222
+                                    $show_alignment = true;
2223
+                                }
2224 2224
 
2225
-								$extra = '';
2225
+                                $extra = '';
2226 2226
 
2227
-								if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2228
-									continue;
2229
-								}
2230
-								elseif ( $args['type'] == 'checkbox' ) {
2231
-									$type    = 'boolean';
2232
-									$default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
2233
-								} elseif ( $args['type'] == 'number' ) {
2234
-									$type    = 'number';
2235
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2236
-								} elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2237
-									$type = 'array';
2238
-									if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2239
-										$default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
2240
-									} else {
2241
-										$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2242
-									}
2243
-								} elseif ( $args['type'] == 'tagselect' ) {
2244
-									$type    = 'array';
2245
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2246
-								} elseif ( $args['type'] == 'multiselect' ) {
2247
-									$type    = 'array';
2248
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2249
-								} elseif ( $args['type'] == 'image_xy' ) {
2250
-									$type    = 'object';
2251
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2252
-								} elseif ( $args['type'] == 'image' ) {
2253
-									$type    = 'string';
2254
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2227
+                                if ( $args['type'] == 'notice' ||  $args['type'] == 'tab' ) {
2228
+                                    continue;
2229
+                                }
2230
+                                elseif ( $args['type'] == 'checkbox' ) {
2231
+                                    $type    = 'boolean';
2232
+                                    $default = isset( $args['default'] ) && $args['default'] ? 'true' : 'false';
2233
+                                } elseif ( $args['type'] == 'number' ) {
2234
+                                    $type    = 'number';
2235
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2236
+                                } elseif ( $args['type'] == 'select' && ! empty( $args['multiple'] ) ) {
2237
+                                    $type = 'array';
2238
+                                    if ( isset( $args['default'] ) && is_array( $args['default'] ) ) {
2239
+                                        $default = ! empty( $args['default'] ) ? "['" . implode( "','", $args['default'] ) . "']" : "[]";
2240
+                                    } else {
2241
+                                        $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2242
+                                    }
2243
+                                } elseif ( $args['type'] == 'tagselect' ) {
2244
+                                    $type    = 'array';
2245
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2246
+                                } elseif ( $args['type'] == 'multiselect' ) {
2247
+                                    $type    = 'array';
2248
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2249
+                                } elseif ( $args['type'] == 'image_xy' ) {
2250
+                                    $type    = 'object';
2251
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2252
+                                } elseif ( $args['type'] == 'image' ) {
2253
+                                    $type    = 'string';
2254
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2255 2255
 
2256 2256
                                     // add a field for ID
2257 2257
 //                                    echo $key . "_id : {";
@@ -2261,25 +2261,25 @@  discard block
 block discarded – undo
2261 2261
 //                                    echo "type : 'object',";
2262 2262
 //                                    echo "},";
2263 2263
 
2264
-								} else {
2265
-									$type    = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string';
2266
-									$default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2264
+                                } else {
2265
+                                    $type    = !empty($args['hidden_type']) ? esc_attr($args['hidden_type']) : 'string';
2266
+                                    $default = isset( $args['default'] ) ? "'" . $args['default'] . "'" : "''";
2267 2267
 
2268
-								}
2269
-								echo $key . " : {";
2270
-								echo "type : '$type',";
2271
-								echo "default : $default,";
2272
-								echo "},";
2273
-							}
2268
+                                }
2269
+                                echo $key . " : {";
2270
+                                echo "type : '$type',";
2271
+                                echo "default : $default,";
2272
+                                echo "},";
2273
+                            }
2274 2274
 
2275
-							echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
2276
-							echo "className: { type: 'string', default: '' },";
2275
+                            echo "content : {type : 'string',default: 'Please select the attributes in the block settings'},";
2276
+                            echo "className: { type: 'string', default: '' },";
2277 2277
 
2278
-							echo "},";
2278
+                            echo "},";
2279 2279
 
2280
-						}
2280
+                        }
2281 2281
 
2282
-						?>
2282
+                        ?>
2283 2283
 
2284 2284
 						// The "edit" property must be a valid function.
2285 2285
 						edit: function (props) {
@@ -2379,9 +2379,9 @@  discard block
 block discarded – undo
2379 2379
 
2380 2380
 							var $value = '';
2381 2381
 							<?php
2382
-							// if we have a post_type and a category then link them
2383
-							if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2384
-							?>
2382
+                            // if we have a post_type and a category then link them
2383
+                            if( isset($this->arguments['post_type']) && isset($this->arguments['category']) && !empty($this->arguments['category']['post_type_linked']) ){
2384
+                            ?>
2385 2385
 							if(typeof(prev_attributes[props.clientId]) != 'undefined' ){
2386 2386
 								$pt = props.attributes.post_type;
2387 2387
 								if(post_type_rest_slugs.length){
@@ -2472,8 +2472,8 @@  discard block
 block discarded – undo
2472 2472
 										'attributes': props.attributes,
2473 2473
 										'block_parent_name': parentBlocks.length ? parentBlocks[parentBlocks.length - 1].name : '',
2474 2474
 										'post_id': <?php global $post; if ( isset( $post->ID ) ) {
2475
-										echo $post->ID;
2476
-									}else{echo '0';}?>,
2475
+                                        echo $post->ID;
2476
+                                    }else{echo '0';}?>,
2477 2477
 										'_ajax_nonce': '<?php echo wp_create_nonce( 'super_duper_output_shortcode' );?>'
2478 2478
 									};
2479 2479
 
@@ -2550,10 +2550,10 @@  discard block
 block discarded – undo
2550 2550
 
2551 2551
 									<?php
2552 2552
 
2553
-									if(! empty( $this->arguments )){
2553
+                                    if(! empty( $this->arguments )){
2554 2554
 
2555
-									if ( $show_advanced ) {
2556
-									?>
2555
+                                    if ( $show_advanced ) {
2556
+                                    ?>
2557 2557
 									el('div', {
2558 2558
 											style: {'padding-left': '16px','padding-right': '16px'}
2559 2559
 										},
@@ -2571,146 +2571,146 @@  discard block
 block discarded – undo
2571 2571
 									,
2572 2572
 									<?php
2573 2573
 
2574
-									}
2574
+                                    }
2575 2575
 
2576
-								//	print_r( $this->arguments);
2576
+                                //	print_r( $this->arguments);
2577 2577
 
2578
-									//echo '####';
2578
+                                    //echo '####';
2579 2579
 
2580
-									$arguments = $this->group_arguments( $this->arguments );
2580
+                                    $arguments = $this->group_arguments( $this->arguments );
2581 2581
 //print_r($arguments ); exit;
2582
-									// Do we have sections?
2583
-									$has_sections = $arguments == $this->arguments ? false : true;
2582
+                                    // Do we have sections?
2583
+                                    $has_sections = $arguments == $this->arguments ? false : true;
2584 2584
 
2585 2585
 
2586
-									if($has_sections){
2587
-									$panel_count = 0;
2588
-									$open_tab = '';
2586
+                                    if($has_sections){
2587
+                                    $panel_count = 0;
2588
+                                    $open_tab = '';
2589 2589
 
2590
-									$open_tab_groups = array();
2591
-									$used_tabs = array();
2592
-									foreach($arguments as $key => $args){
2590
+                                    $open_tab_groups = array();
2591
+                                    $used_tabs = array();
2592
+                                    foreach($arguments as $key => $args){
2593 2593
 
2594
-										$close_tab = false;
2595
-										$close_tabs = false;
2594
+                                        $close_tab = false;
2595
+                                        $close_tabs = false;
2596 2596
 
2597
-										 if(!empty($this->options['block_group_tabs'])) {
2598
-											foreach($this->options['block_group_tabs'] as $tab_name => $tab_args){
2599
-												if(in_array($key,$tab_args['groups'])){
2597
+                                            if(!empty($this->options['block_group_tabs'])) {
2598
+                                            foreach($this->options['block_group_tabs'] as $tab_name => $tab_args){
2599
+                                                if(in_array($key,$tab_args['groups'])){
2600 2600
 
2601
-													$open_tab_groups[] = $key;
2601
+                                                    $open_tab_groups[] = $key;
2602 2602
 
2603
-													if($open_tab != $tab_name){
2604
-														$tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
2605
-														$tab_args['tab']['open'] = true;
2603
+                                                    if($open_tab != $tab_name){
2604
+                                                        $tab_args['tab']['tabs_open'] = $open_tab == '' ? true : false;
2605
+                                                        $tab_args['tab']['open'] = true;
2606 2606
 
2607
-														$this->block_tab_start( '', $tab_args );
2607
+                                                        $this->block_tab_start( '', $tab_args );
2608 2608
 //														echo '###open'.$tab_name;print_r($tab_args);
2609
-														$open_tab = $tab_name;
2610
-														$used_tabs[] = $tab_name;
2611
-													}
2609
+                                                        $open_tab = $tab_name;
2610
+                                                        $used_tabs[] = $tab_name;
2611
+                                                    }
2612 2612
 
2613
-													if($open_tab_groups == $tab_args['groups']){
2614
-														//$open_tab = '';
2615
-														$close_tab = true;
2616
-														$open_tab_groups = array();
2613
+                                                    if($open_tab_groups == $tab_args['groups']){
2614
+                                                        //$open_tab = '';
2615
+                                                        $close_tab = true;
2616
+                                                        $open_tab_groups = array();
2617 2617
 
2618 2618
 //													print_r(array_keys($this->options['block_group_tabs']));echo '####';print_r($used_tabs);
2619
-													if($used_tabs == array_keys($this->options['block_group_tabs'])){
2619
+                                                    if($used_tabs == array_keys($this->options['block_group_tabs'])){
2620 2620
 //														echo '@@@';
2621
-															$close_tabs = true;
2622
-														}
2623
-													}
2621
+                                                            $close_tabs = true;
2622
+                                                        }
2623
+                                                    }
2624 2624
 
2625
-												}
2626
-											}
2627
-										}
2625
+                                                }
2626
+                                            }
2627
+                                        }
2628 2628
 
2629 2629
 //
2630 2630
 
2631
-									//	print_r($arguments);exit;
2631
+                                    //	print_r($arguments);exit;
2632 2632
 
2633
-										?>
2633
+                                        ?>
2634 2634
 										el(wp.components.PanelBody, {
2635 2635
 												title: '<?php esc_attr_e( $key ); ?>',
2636 2636
 												initialOpen: <?php if ( $panel_count ) {
2637
-												echo "false";
2638
-											} else {
2639
-												echo "true";
2640
-											}?>
2637
+                                                echo "false";
2638
+                                            } else {
2639
+                                                echo "true";
2640
+                                            }?>
2641 2641
 											},
2642 2642
 											<?php
2643 2643
 
2644 2644
 
2645 2645
 
2646
-											foreach ( $args as $k => $a ) {
2646
+                                            foreach ( $args as $k => $a ) {
2647 2647
 
2648
-												$this->block_tab_start( $k, $a );
2649
-												$this->block_row_start( $k, $a );
2650
-												$this->build_block_arguments( $k, $a );
2651
-												$this->block_row_end( $k, $a );
2652
-												$this->block_tab_end( $k, $a );
2653
-											}
2654
-											?>
2648
+                                                $this->block_tab_start( $k, $a );
2649
+                                                $this->block_row_start( $k, $a );
2650
+                                                $this->build_block_arguments( $k, $a );
2651
+                                                $this->block_row_end( $k, $a );
2652
+                                                $this->block_tab_end( $k, $a );
2653
+                                            }
2654
+                                            ?>
2655 2655
 										),
2656 2656
 										<?php
2657
-										$panel_count ++;
2657
+                                        $panel_count ++;
2658 2658
 
2659 2659
 
2660
-										if($close_tab || $close_tabs){
2661
-											$tab_args = array(
2662
-												'tab'	=> array(
2663
-													'tabs_close' => $close_tabs,
2664
-												'close' => true,
2665
-												)
2660
+                                        if($close_tab || $close_tabs){
2661
+                                            $tab_args = array(
2662
+                                                'tab'	=> array(
2663
+                                                    'tabs_close' => $close_tabs,
2664
+                                                'close' => true,
2665
+                                                )
2666 2666
 
2667
-											);
2668
-											$this->block_tab_end( '', $tab_args );
2667
+                                            );
2668
+                                            $this->block_tab_end( '', $tab_args );
2669 2669
 //											echo '###close'; print_r($tab_args);
2670
-											$panel_count = 0;
2671
-										}
2670
+                                            $panel_count = 0;
2671
+                                        }
2672 2672
 //
2673 2673
 
2674
-									}
2675
-									}else {
2676
-									?>
2674
+                                    }
2675
+                                    }else {
2676
+                                    ?>
2677 2677
 									el(wp.components.PanelBody, {
2678 2678
 											title: '<?php esc_attr_e( "Settings" ); ?>',
2679 2679
 											initialOpen: true
2680 2680
 										},
2681 2681
 										<?php
2682
-										foreach ( $this->arguments as $key => $args ) {
2683
-											$this->block_row_start( $key, $args );
2684
-											$this->build_block_arguments( $key, $args );
2685
-											$this->block_row_end( $key, $args );
2686
-										}
2687
-										?>
2682
+                                        foreach ( $this->arguments as $key => $args ) {
2683
+                                            $this->block_row_start( $key, $args );
2684
+                                            $this->build_block_arguments( $key, $args );
2685
+                                            $this->block_row_end( $key, $args );
2686
+                                        }
2687
+                                        ?>
2688 2688
 									),
2689 2689
 									<?php
2690
-									}
2690
+                                    }
2691 2691
 
2692
-									}
2693
-									?>
2692
+                                    }
2693
+                                    ?>
2694 2694
 
2695 2695
 								),
2696 2696
 
2697 2697
 								<?php
2698
-								// If the user sets block-output array then build it
2699
-								if ( ! empty( $this->options['block-output'] ) ) {
2700
-								$this->block_element( $this->options['block-output'] );
2701
-							}elseif(!empty($this->options['block-edit-return'])){
2702
-                                   echo $this->options['block-edit-return'];
2703
-							}else{
2704
-								// if no block-output is set then we try and get the shortcode html output via ajax.
2705
-								?>
2698
+                                // If the user sets block-output array then build it
2699
+                                if ( ! empty( $this->options['block-output'] ) ) {
2700
+                                $this->block_element( $this->options['block-output'] );
2701
+                            }elseif(!empty($this->options['block-edit-return'])){
2702
+                                    echo $this->options['block-edit-return'];
2703
+                            }else{
2704
+                                // if no block-output is set then we try and get the shortcode html output via ajax.
2705
+                                ?>
2706 2706
 								el('div', wp.blockEditor.useBlockProps({
2707 2707
 									dangerouslySetInnerHTML: {__html: onChangeContent()},
2708 2708
 									className: props.className,
2709 2709
 									style: {'minHeight': '30px'}
2710 2710
 								}))
2711 2711
 								<?php
2712
-								}
2713
-								?>
2712
+                                }
2713
+                                ?>
2714 2714
 							]; // end return
2715 2715
 
2716 2716
 							<?php
@@ -2729,11 +2729,11 @@  discard block
 block discarded – undo
2729 2729
 							$html = '';
2730 2730
 							<?php
2731 2731
 
2732
-							if(! empty( $this->arguments )){
2732
+                            if(! empty( $this->arguments )){
2733 2733
 
2734
-							foreach($this->arguments as $key => $args){
2735
-                               // if($args['type']=='tabs'){continue;}
2736
-							?>
2734
+                            foreach($this->arguments as $key => $args){
2735
+                                // if($args['type']=='tabs'){continue;}
2736
+                            ?>
2737 2737
 							if (attr.hasOwnProperty("<?php echo esc_attr( $key );?>")) {
2738 2738
 								if ('<?php echo esc_attr( $key );?>' == 'html') {
2739 2739
 									$html = attr.<?php echo esc_attr( $key );?>;
@@ -2744,10 +2744,10 @@  discard block
 block discarded – undo
2744 2744
 								}
2745 2745
 							}
2746 2746
 							<?php
2747
-							}
2748
-							}
2747
+                            }
2748
+                            }
2749 2749
 
2750
-							?>
2750
+                            ?>
2751 2751
 							content += "]";
2752 2752
 
2753 2753
                             <?php
@@ -2794,7 +2794,7 @@  discard block
 block discarded – undo
2794 2794
 //                               $this->block_element( $this->options['block-output'], true );
2795 2795
 //                               echo ";";
2796 2796
 
2797
-                               ?>
2797
+                                ?>
2798 2798
                               return el(
2799 2799
                                    '',
2800 2800
                                    {},
@@ -2804,9 +2804,9 @@  discard block
 block discarded – undo
2804 2804
                                );
2805 2805
                                 <?php
2806 2806
 
2807
-							}elseif(!empty($this->options['block-save-return'])){
2808
-                                   echo 'return ' . $this->options['block-save-return'];
2809
-							}elseif(!empty($this->options['nested-block'])){
2807
+                            }elseif(!empty($this->options['block-save-return'])){
2808
+                                    echo 'return ' . $this->options['block-save-return'];
2809
+                            }elseif(!empty($this->options['nested-block'])){
2810 2810
                                 ?>
2811 2811
                               return el(
2812 2812
                                    '',
@@ -2816,22 +2816,22 @@  discard block
 block discarded – undo
2816 2816
                                    el('', {dangerouslySetInnerHTML: {__html: "[/<?php echo $this->options['base_id'];?>]"}})
2817 2817
                                );
2818 2818
                                 <?php
2819
-							}elseif(!empty( $this->options['block-save-return'] ) ){
2819
+                            }elseif(!empty( $this->options['block-save-return'] ) ){
2820 2820
                                 echo "return ". $this->options['block-edit-return'].";";
2821
-							}elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2822
-							?>
2821
+                            }elseif(isset( $this->options['block-wrap'] ) && $this->options['block-wrap'] == ''){
2822
+                            ?>
2823 2823
 							return content;
2824 2824
 							<?php
2825
-							}else{
2826
-							?>
2825
+                            }else{
2826
+                            ?>
2827 2827
 							var block_wrap = 'div';
2828 2828
 							if (attr.hasOwnProperty("block_wrap")) {
2829 2829
 								block_wrap = attr.block_wrap;
2830 2830
 							}
2831 2831
 							return el(block_wrap, wp.blockEditor.useBlockProps.save( {dangerouslySetInnerHTML: {__html: content}, className: align} ));
2832 2832
 							<?php
2833
-							}
2834
-							?>
2833
+                            }
2834
+                            ?>
2835 2835
 
2836 2836
 
2837 2837
 						}
@@ -2845,29 +2845,29 @@  discard block
 block discarded – undo
2845 2845
                 });
2846 2846
 			</script>
2847 2847
 			<?php
2848
-			$output = ob_get_clean();
2848
+            $output = ob_get_clean();
2849 2849
 
2850
-			/*
2850
+            /*
2851 2851
 			 * We only add the <script> tags for code highlighting, so we strip them from the output.
2852 2852
 			 */
2853 2853
 
2854
-			return str_replace( array(
2855
-				'<script>',
2856
-				'</script>'
2857
-			), '', $output );
2858
-		}
2854
+            return str_replace( array(
2855
+                '<script>',
2856
+                '</script>'
2857
+            ), '', $output );
2858
+        }
2859 2859
 
2860 2860
 
2861 2861
 
2862
-		public function block_row_start($key, $args){
2862
+        public function block_row_start($key, $args){
2863 2863
 
2864
-			// check for row
2865
-			if(!empty($args['row'])){
2864
+            // check for row
2865
+            if(!empty($args['row'])){
2866 2866
 
2867
-				if(!empty($args['row']['open'])){
2867
+                if(!empty($args['row']['open'])){
2868 2868
 
2869
-				// element require
2870
-				$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2869
+                // element require
2870
+                $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
2871 2871
                 $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
2872 2872
                 $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
2873 2873
                 $device_type_icon = '';
@@ -2878,10 +2878,10 @@  discard block
 block discarded – undo
2878 2878
                 }elseif($device_type=='Mobile'){
2879 2879
                     $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;"></span>';
2880 2880
                 }
2881
-				echo $element_require;
2881
+                echo $element_require;
2882 2882
                 echo $device_type_require;
2883 2883
 
2884
-					if(false){?><script><?php }?>
2884
+                    if(false){?><script><?php }?>
2885 2885
 						el('div', {
2886 2886
 								className: 'bsui components-base-control',
2887 2887
 							},
@@ -2919,51 +2919,51 @@  discard block
 block discarded – undo
2919 2919
 									},
2920 2920
 
2921 2921
 					<?php
2922
-					if(false){?></script><?php }
2923
-				}elseif(!empty($args['row']['close'])){
2924
-					if(false){?><script><?php }?>
2922
+                    if(false){?></script><?php }
2923
+                }elseif(!empty($args['row']['close'])){
2924
+                    if(false){?><script><?php }?>
2925 2925
 						el(
2926 2926
 							'div',
2927 2927
 							{
2928 2928
 								className: 'col pl-0',
2929 2929
 							},
2930 2930
 					<?php
2931
-					if(false){?></script><?php }
2932
-				}else{
2933
-					if(false){?><script><?php }?>
2931
+                    if(false){?></script><?php }
2932
+                }else{
2933
+                    if(false){?><script><?php }?>
2934 2934
 						el(
2935 2935
 							'div',
2936 2936
 							{
2937 2937
 								className: 'col pl-0 pr-2',
2938 2938
 							},
2939 2939
 					<?php
2940
-					if(false){?></script><?php }
2941
-				}
2940
+                    if(false){?></script><?php }
2941
+                }
2942 2942
 
2943
-			}
2943
+            }
2944 2944
 
2945
-		}
2945
+        }
2946 2946
 
2947
-		public function block_row_end($key, $args){
2947
+        public function block_row_end($key, $args){
2948 2948
 
2949
-			if(!empty($args['row'])){
2950
-				// maybe close
2951
-				if(!empty($args['row']['close'])){
2952
-					echo "))";
2953
-				}
2949
+            if(!empty($args['row'])){
2950
+                // maybe close
2951
+                if(!empty($args['row']['close'])){
2952
+                    echo "))";
2953
+                }
2954 2954
 
2955
-				echo "),";
2956
-			}
2957
-		}
2955
+                echo "),";
2956
+            }
2957
+        }
2958 2958
 
2959
-		public function block_tab_start($key, $args){
2959
+        public function block_tab_start($key, $args){
2960 2960
 
2961
-			// check for row
2962
-			if(!empty($args['tab'])){
2961
+            // check for row
2962
+            if(!empty($args['tab'])){
2963 2963
 
2964
-				if(!empty($args['tab']['tabs_open'])){
2964
+                if(!empty($args['tab']['tabs_open'])){
2965 2965
 
2966
-					if(false){?><script><?php }?>
2966
+                    if(false){?><script><?php }?>
2967 2967
 
2968 2968
 el('div',{className: 'bsui'},
2969 2969
 
@@ -2976,12 +2976,12 @@  discard block
 block discarded – undo
2976 2976
 										tabs: [
2977 2977
 
2978 2978
 					<?php
2979
-					if(false){?></script><?php }
2980
-				}
2979
+                    if(false){?></script><?php }
2980
+                }
2981 2981
 
2982
-				if(!empty($args['tab']['open'])){
2982
+                if(!empty($args['tab']['open'])){
2983 2983
 
2984
-					if(false){?><script><?php }?>
2984
+                    if(false){?><script><?php }?>
2985 2985
 							{
2986 2986
 												name: '<?php echo addslashes( esc_attr( $args['tab']['key']) ); ?>',
2987 2987
 												title: el('div', {dangerouslySetInnerHTML: {__html: '<?php echo addslashes( esc_attr( $args['tab']['title']) ); ?>'}}),
@@ -2990,23 +2990,23 @@  discard block
 block discarded – undo
2990 2990
 									className: 'components-base-control__help mb-0',
2991 2991
 									dangerouslySetInnerHTML: {__html:'<?php echo addslashes( $args['tab']['desc'] ); ?>'}
2992 2992
 								}),<?php }
2993
-					if(false){?></script><?php }
2994
-				}
2993
+                    if(false){?></script><?php }
2994
+                }
2995 2995
 
2996
-			}
2996
+            }
2997 2997
 
2998
-		}
2998
+        }
2999 2999
 
3000
-		public function block_tab_end($key, $args){
3000
+        public function block_tab_end($key, $args){
3001 3001
 
3002
-			if(!empty($args['tab'])){
3003
-				// maybe close
3004
-				if(!empty($args['tab']['close'])){
3005
-					echo ")}, /* tab close */";
3006
-				}
3002
+            if(!empty($args['tab'])){
3003
+                // maybe close
3004
+                if(!empty($args['tab']['close'])){
3005
+                    echo ")}, /* tab close */";
3006
+                }
3007 3007
 
3008
-				if(!empty($args['tab']['tabs_close'])){
3009
-					if(false){?><script><?php }?>
3008
+                if(!empty($args['tab']['tabs_close'])){
3009
+                    if(false){?><script><?php }?>
3010 3010
 							],
3011 3011
 									},
3012 3012
 									( tab ) => {
@@ -3016,21 +3016,21 @@  discard block
 block discarded – undo
3016 3016
 								}
3017 3017
 								)), /* tabs close */
3018 3018
 					<?php if(false){ ?></script><?php }
3019
-				}
3020
-			}
3021
-		}
3019
+                }
3020
+            }
3021
+        }
3022 3022
 
3023
-		public function build_block_arguments( $key, $args ) {
3024
-			$custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3025
-			$options           = '';
3026
-			$extra             = '';
3027
-			$require           = '';
3023
+        public function build_block_arguments( $key, $args ) {
3024
+            $custom_attributes = ! empty( $args['custom_attributes'] ) ? $this->array_to_attributes( $args['custom_attributes'] ) : '';
3025
+            $options           = '';
3026
+            $extra             = '';
3027
+            $require           = '';
3028 3028
             $inside_elements   = '';
3029 3029
 
3030
-			// `content` is a protected and special argument
3031
-			if ( $key == 'content' ) {
3032
-				return;
3033
-			}
3030
+            // `content` is a protected and special argument
3031
+            if ( $key == 'content' ) {
3032
+                return;
3033
+            }
3034 3034
 
3035 3035
             $device_type = ! empty( $args['device_type'] ) ? esc_attr($args['device_type']) : '';
3036 3036
             $device_type_require = ! empty( $args['device_type'] ) ? " deviceType == '" . esc_attr($device_type) . "' && " : '';
@@ -3043,51 +3043,51 @@  discard block
 block discarded – undo
3043 3043
                 $device_type_icon = '<span class="dashicons dashicons-smartphone" style="font-size: 18px;" onclick="sd_show_view_options(this);"></span>';
3044 3044
             }
3045 3045
 
3046
-			// icon
3047
-			$icon = '';
3048
-			if( !empty( $args['icon'] ) ){
3049
-				$icon .= "el('div', {";
3050
-									$icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3051
-									$icon .= "className: 'text-center',";
3052
-									$icon .= "title: '".addslashes( $args['title'] )."',";
3053
-								$icon .= "}),";
3054
-
3055
-				// blank title as its added to the icon.
3056
-				$args['title'] = '';
3057
-			}
3046
+            // icon
3047
+            $icon = '';
3048
+            if( !empty( $args['icon'] ) ){
3049
+                $icon .= "el('div', {";
3050
+                                    $icon .= "dangerouslySetInnerHTML: {__html: '".self::get_widget_icon( esc_attr($args['icon']))."'},";
3051
+                                    $icon .= "className: 'text-center',";
3052
+                                    $icon .= "title: '".addslashes( $args['title'] )."',";
3053
+                                $icon .= "}),";
3054
+
3055
+                // blank title as its added to the icon.
3056
+                $args['title'] = '';
3057
+            }
3058 3058
 
3059
-			// require advanced
3060
-			$require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3059
+            // require advanced
3060
+            $require_advanced = ! empty( $args['advanced'] ) ? "props.attributes.show_advanced && " : "";
3061 3061
 
3062
-			// element require
3063
-			$element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3062
+            // element require
3063
+            $element_require = ! empty( $args['element_require'] ) ? $this->block_props_replace( $args['element_require'], true ) . " && " : "";
3064 3064
 
3065 3065
 
3066
-			$onchange  = "props.setAttributes({ $key: $key } )";
3067
-			$onchangecomplete  = "";
3068
-			$value     = "props.attributes.$key";
3069
-			$text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3070
-			if ( in_array( $args['type'], $text_type ) ) {
3071
-				$type = 'TextControl';
3072
-				// Save numbers as numbers and not strings
3073
-				if ( $args['type'] == 'number' ) {
3074
-					$onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3075
-				}
3076
-			}else if ( $args['type'] == 'styleid' ) {
3077
-				$type = 'TextControl';
3078
-				$args['type'] == 'text';
3079
-				// Save numbers as numbers and not strings
3080
-				$value     = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'";
3081
-			}else if ( $args['type'] == 'notice' ) {
3082
-
3083
-				$notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3084
-				$notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3085
-
3086
-				$notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),";
3087
-				echo $notice_message ? $element_require . $notice : '';
3088
-				return;
3089
-			}
3090
-			/*
3066
+            $onchange  = "props.setAttributes({ $key: $key } )";
3067
+            $onchangecomplete  = "";
3068
+            $value     = "props.attributes.$key";
3069
+            $text_type = array( 'text', 'password', 'number', 'email', 'tel', 'url', 'colorx','range' );
3070
+            if ( in_array( $args['type'], $text_type ) ) {
3071
+                $type = 'TextControl';
3072
+                // Save numbers as numbers and not strings
3073
+                if ( $args['type'] == 'number' ) {
3074
+                    $onchange = "props.setAttributes({ $key: $key ? Number($key) : '' } )";
3075
+                }
3076
+            }else if ( $args['type'] == 'styleid' ) {
3077
+                $type = 'TextControl';
3078
+                $args['type'] == 'text';
3079
+                // Save numbers as numbers and not strings
3080
+                $value     = "props.attributes.$key ? props.attributes.$key : 'aaabbbccc'";
3081
+            }else if ( $args['type'] == 'notice' ) {
3082
+
3083
+                $notice_message = !empty($args['desc']) ? addslashes($args['desc']) : '';
3084
+                $notice_status = !empty($args['status']) ? esc_attr($args['status']) : 'info';
3085
+
3086
+                $notice = "el('div',{className:'bsui'},el(wp.components.Notice, {status: '$notice_status',isDismissible: false,className: 'm-0 pr-0 mb-3'},el('div',{dangerouslySetInnerHTML: {__html: '$notice_message'}}))),";
3087
+                echo $notice_message ? $element_require . $notice : '';
3088
+                return;
3089
+            }
3090
+            /*
3091 3091
 			 * https://www.wptricks.com/question/set-current-tab-on-a-gutenberg-tabpanel-component-from-outside-that-component/ es5 layout
3092 3092
 						elseif($args['type']=='tabs'){
3093 3093
 							?>
@@ -3140,23 +3140,23 @@  discard block
 block discarded – undo
3140 3140
 							return;
3141 3141
 						}
3142 3142
 */
3143
-			elseif ( $args['type'] == 'color' ) {
3144
-				$type = 'ColorPicker';
3145
-				$onchange = "";
3146
-				$extra = "color: $value,";
3147
-				if(!empty($args['disable_alpha'])){
3148
-					$extra .= "disableAlpha: true,";
3149
-				}
3150
-				$onchangecomplete = "onChangeComplete: function($key) {
3143
+            elseif ( $args['type'] == 'color' ) {
3144
+                $type = 'ColorPicker';
3145
+                $onchange = "";
3146
+                $extra = "color: $value,";
3147
+                if(!empty($args['disable_alpha'])){
3148
+                    $extra .= "disableAlpha: true,";
3149
+                }
3150
+                $onchangecomplete = "onChangeComplete: function($key) {
3151 3151
 				value =  $key.rgb.a && $key.rgb.a < 1 ? \"rgba(\"+$key.rgb.r+\",\"+$key.rgb.g+\",\"+$key.rgb.b+\",\"+$key.rgb.a+\")\" : $key.hex;
3152 3152
                         props.setAttributes({
3153 3153
                             $key: value
3154 3154
                         });
3155 3155
                     },";
3156
-			}elseif ( $args['type'] == 'gradient' ) {
3157
-				$type = 'GradientPicker';
3156
+            }elseif ( $args['type'] == 'gradient' ) {
3157
+                $type = 'GradientPicker';
3158 3158
 
3159
-			}elseif ( $args['type'] == 'image' ) {
3159
+            }elseif ( $args['type'] == 'image' ) {
3160 3160
 //                print_r($args);
3161 3161
 
3162 3162
                 $img_preview = isset($args['focalpoint']) && !$args['focalpoint'] ? " props.attributes.$key && el('img', { src: props.attributes.$key,style: {maxWidth:'100%',background: '#ccc'}})," : " ( props.attributes.$key ||  props.attributes.{$key}_use_featured ) && el(wp.components.FocalPointPicker,{
@@ -3181,15 +3181,15 @@  discard block
 block discarded – undo
3181 3181
 
3182 3182
 
3183 3183
                 $value = '""';
3184
-				$type = 'MediaUpload';
3184
+                $type = 'MediaUpload';
3185 3185
                 $extra .= "onSelect: function(media){
3186 3186
                       return props.setAttributes({
3187 3187
                           $key: media.url,
3188 3188
                           {$key}_id: media.id
3189 3189
                         });
3190 3190
                       },";
3191
-                   $extra .= "type: 'image',";
3192
-                   $extra .= "render: function (obj) {
3191
+                    $extra .= "type: 'image',";
3192
+                    $extra .= "render: function (obj) {
3193 3193
                         return el( 'div',{},
3194 3194
                         ( !props.attributes.$key && !props.attributes.{$key}_use_featured ) && el( wp.components.Button, {
3195 3195
                           className: 'components-button components-circular-option-picker__clear is-primary is-smallx',
@@ -3218,8 +3218,8 @@  discard block
 block discarded – undo
3218 3218
                 $onchange = "";
3219 3219
 
3220 3220
                 //$inside_elements = ",el('div',{},'file upload')";
3221
-			}elseif ( $args['type'] == 'images' ) {
3222
-				//                print_r($args);
3221
+            }elseif ( $args['type'] == 'images' ) {
3222
+                //                print_r($args);
3223 3223
 
3224 3224
                 $img_preview = "props.attributes.$key && (function() {
3225 3225
 
@@ -3248,7 +3248,7 @@  discard block
 block discarded – undo
3248 3248
 
3249 3249
 
3250 3250
                 $value = '""';
3251
-				$type = 'MediaUpload';
3251
+                $type = 'MediaUpload';
3252 3252
                 $extra .= "onSelect: function(media){
3253 3253
 
3254 3254
                 let slim_images = props.attributes.$key ? JSON.parse('['+props.attributes.$key+']') : [];
@@ -3262,9 +3262,9 @@  discard block
 block discarded – undo
3262 3262
                           $key: JSON.stringify(slim_images).replace('[','').replace(']',''),
3263 3263
                         });
3264 3264
                       },";
3265
-                   $extra .= "type: 'image',";
3266
-                   $extra .= "multiple: true,";
3267
-                   $extra .= "render: function (obj) {
3265
+                    $extra .= "type: 'image',";
3266
+                    $extra .= "multiple: true,";
3267
+                    $extra .= "render: function (obj) {
3268 3268
 
3269 3269
                    // init the sort
3270 3270
 				enableDragSort('sd-sortable');
@@ -3303,34 +3303,34 @@  discard block
 block discarded – undo
3303 3303
                 $onchange = "";
3304 3304
 
3305 3305
                 //$inside_elements = ",el('div',{},'file upload')";
3306
-			}
3307
-			elseif ( $args['type'] == 'checkbox' ) {
3308
-				$type = 'CheckboxControl';
3309
-				$extra .= "checked: props.attributes.$key,";
3310
-				$onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3311
-			} elseif ( $args['type'] == 'textarea' ) {
3312
-				$type = 'TextareaControl';
3313
-			} elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3314
-				$type = 'SelectControl';
3315
-
3316
-				if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3317
-					$options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3318
-				}elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3319
-					$options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3320
-				}else {
3321
-
3322
-					if ( ! empty( $args['options'] ) ) {
3323
-						$options .= "options: [";
3324
-						foreach ( $args['options'] as $option_val => $option_label ) {
3325
-							$options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
3326
-						}
3327
-						$options .= "],";
3328
-					}
3329
-				}
3330
-				if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3331
-					$extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px"}, ';
3332
-				}
3333
-			} elseif ( $args['type'] == 'tagselect' ) {
3306
+            }
3307
+            elseif ( $args['type'] == 'checkbox' ) {
3308
+                $type = 'CheckboxControl';
3309
+                $extra .= "checked: props.attributes.$key,";
3310
+                $onchange = "props.setAttributes({ $key: ! props.attributes.$key } )";
3311
+            } elseif ( $args['type'] == 'textarea' ) {
3312
+                $type = 'TextareaControl';
3313
+            } elseif ( $args['type'] == 'select' || $args['type'] == 'multiselect' ) {
3314
+                $type = 'SelectControl';
3315
+
3316
+                if($args['name'] == 'category' && !empty($args['post_type_linked'])){
3317
+                    $options .= "options: taxonomies_".str_replace("-","_", $this->id).",";
3318
+                }elseif($args['name'] == 'sort_by' && !empty($args['post_type_linked'])){
3319
+                    $options .= "options: sort_by_".str_replace("-","_", $this->id).",";
3320
+                }else {
3321
+
3322
+                    if ( ! empty( $args['options'] ) ) {
3323
+                        $options .= "options: [";
3324
+                        foreach ( $args['options'] as $option_val => $option_label ) {
3325
+                            $options .= "{ value: '" . esc_attr( $option_val ) . "', label: '" . addslashes( $option_label ) . "' },";
3326
+                        }
3327
+                        $options .= "],";
3328
+                    }
3329
+                }
3330
+                if ( isset( $args['multiple'] ) && $args['multiple'] ) { //@todo multiselect does not work at the moment: https://github.com/WordPress/gutenberg/issues/5550
3331
+                    $extra .= ' multiple:true,style:{height:"auto",paddingRight:"8px"}, ';
3332
+                }
3333
+            } elseif ( $args['type'] == 'tagselect' ) {
3334 3334
 //				$type = 'FormTokenField';
3335 3335
 //
3336 3336
 //				if ( ! empty( $args['options'] ) ) {
@@ -3365,39 +3365,39 @@  discard block
 block discarded – undo
3365 3365
 //				$value     = "[]";
3366 3366
 //				$extra .= ' __experimentalExpandOnFocus: true,';
3367 3367
 
3368
-			} elseif ( $args['type'] == 'alignment' ) {
3369
-				$type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3370
-			}elseif ( $args['type'] == 'margins' ) {
3368
+            } elseif ( $args['type'] == 'alignment' ) {
3369
+                $type = 'AlignmentToolbar'; // @todo this does not seem to work but cant find a example
3370
+            }elseif ( $args['type'] == 'margins' ) {
3371 3371
 
3372
-			} else {
3373
-				return;// if we have not implemented the control then don't break the JS.
3374
-			}
3372
+            } else {
3373
+                return;// if we have not implemented the control then don't break the JS.
3374
+            }
3375 3375
 
3376 3376
 
3377 3377
 
3378
-			// color input does not show the labels so we add them
3379
-			if($args['type']=='color'){
3380
-				// add show only if advanced
3381
-				echo $require_advanced;
3382
-				// add setting require if defined
3383
-				echo $element_require;
3384
-				echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
3385
-			}
3378
+            // color input does not show the labels so we add them
3379
+            if($args['type']=='color'){
3380
+                // add show only if advanced
3381
+                echo $require_advanced;
3382
+                // add setting require if defined
3383
+                echo $element_require;
3384
+                echo "el('div', {style: {'marginBottom': '8px'}}, '".addslashes( $args['title'] )."'),";
3385
+            }
3386 3386
 
3387
-			// add show only if advanced
3388
-			echo $require_advanced;
3389
-			// add setting require if defined
3390
-			echo $element_require;
3387
+            // add show only if advanced
3388
+            echo $require_advanced;
3389
+            // add setting require if defined
3390
+            echo $element_require;
3391 3391
             echo $device_type_require;
3392 3392
 
3393
-			// icon
3394
-			echo $icon;
3395
-			?>
3393
+            // icon
3394
+            echo $icon;
3395
+            ?>
3396 3396
 			el( <?php echo $args['type'] == 'image' || $args['type'] == 'images' ? $type  : "wp.components.".$type; ?>, {
3397 3397
 			label: <?php
3398
-			if(empty($args['title'])){
3398
+            if(empty($args['title'])){
3399 3399
                 echo "''";
3400
-			}elseif(empty($args['row']) && !empty($args['device_type'])){
3400
+            }elseif(empty($args['row']) && !empty($args['device_type'])){
3401 3401
                 ?>el('label', {
3402 3402
 									className: 'components-base-control__label',
3403 3403
 									style: {width:"100%"}
@@ -3412,22 +3412,22 @@  discard block
 block discarded – undo
3412 3412
 
3413 3413
 							)<?php
3414 3414
 
3415
-			}else{
3416
-                 ?>'<?php echo addslashes( $args['title'] ); ?>'<?php
3415
+            }else{
3416
+                    ?>'<?php echo addslashes( $args['title'] ); ?>'<?php
3417 3417
 
3418
-			}
3418
+            }
3419 3419
 
3420
-			?>,
3420
+            ?>,
3421 3421
 			help: <?php if ( isset( $args['desc'] ) ) {
3422
-				echo "el('span',{dangerouslySetInnerHTML: {__html: '".wp_kses_post( addslashes($args['desc']) )."'}})";
3423
-			}else{ echo "''"; } ?>,
3422
+                echo "el('span',{dangerouslySetInnerHTML: {__html: '".wp_kses_post( addslashes($args['desc']) )."'}})";
3423
+            }else{ echo "''"; } ?>,
3424 3424
 			value: <?php echo $value; ?>,
3425 3425
 			<?php if ( $type == 'TextControl' && $args['type'] != 'text' ) {
3426
-				echo "type: '" . addslashes( $args['type'] ) . "',";
3427
-			} ?>
3426
+                echo "type: '" . addslashes( $args['type'] ) . "',";
3427
+            } ?>
3428 3428
 			<?php if ( ! empty( $args['placeholder'] ) ) {
3429
-				echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
3430
-			} ?>
3429
+                echo "placeholder: '" . addslashes( $args['placeholder'] ) . "',";
3430
+            } ?>
3431 3431
 			<?php echo $options; ?>
3432 3432
 			<?php echo $extra; ?>
3433 3433
 			<?php echo $custom_attributes; ?>
@@ -3442,67 +3442,67 @@  discard block
 block discarded – undo
3442 3442
 			<?php
3443 3443
 
3444 3444
 
3445
-		}
3445
+        }
3446 3446
 
3447
-		/**
3448
-		 * Convert an array of attributes to block string.
3449
-		 *
3450
-		 * @param $custom_attributes
3451
-		 *
3452
-		 * @return string
3453
-		 *@todo there is prob a faster way to do this, also we could add some validation here.
3454
-		 *
3455
-		 */
3456
-		public function array_to_attributes( $custom_attributes, $html = false ) {
3457
-			$attributes = '';
3458
-			if ( ! empty( $custom_attributes ) ) {
3459
-
3460
-				foreach ( $custom_attributes as $key => $val ) {
3461
-					if(is_array($val)){
3462
-						$attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
3463
-					}else{
3464
-						$attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
3465
-					}
3466
-				}
3447
+        /**
3448
+         * Convert an array of attributes to block string.
3449
+         *
3450
+         * @param $custom_attributes
3451
+         *
3452
+         * @return string
3453
+         *@todo there is prob a faster way to do this, also we could add some validation here.
3454
+         *
3455
+         */
3456
+        public function array_to_attributes( $custom_attributes, $html = false ) {
3457
+            $attributes = '';
3458
+            if ( ! empty( $custom_attributes ) ) {
3467 3459
 
3468
-			}
3460
+                foreach ( $custom_attributes as $key => $val ) {
3461
+                    if(is_array($val)){
3462
+                        $attributes .= $key.': {'.$this->array_to_attributes( $val, $html ).'},';
3463
+                    }else{
3464
+                        $attributes .= $html ?  " $key='$val' " : "'$key': '$val',";
3465
+                    }
3466
+                }
3469 3467
 
3470
-			return $attributes;
3471
-		}
3468
+            }
3469
+
3470
+            return $attributes;
3471
+        }
3472 3472
 
3473 3473
 
3474 3474
 
3475
-		/**
3476
-		 * A self looping function to create the output for JS block elements.
3477
-		 *
3478
-		 * This is what is output in the WP Editor visual view.
3479
-		 *
3480
-		 * @param $args
3481
-		 */
3482
-		public function block_element( $args, $save = false ) {
3475
+        /**
3476
+         * A self looping function to create the output for JS block elements.
3477
+         *
3478
+         * This is what is output in the WP Editor visual view.
3479
+         *
3480
+         * @param $args
3481
+         */
3482
+        public function block_element( $args, $save = false ) {
3483 3483
 
3484 3484
 
3485
-			if ( ! empty( $args ) ) {
3486
-				foreach ( $args as $element => $new_args ) {
3485
+            if ( ! empty( $args ) ) {
3486
+                foreach ( $args as $element => $new_args ) {
3487 3487
 
3488
-					if ( is_array( $new_args ) ) { // its an element
3488
+                    if ( is_array( $new_args ) ) { // its an element
3489 3489
 
3490 3490
 
3491
-						if ( isset( $new_args['element'] ) ) {
3491
+                        if ( isset( $new_args['element'] ) ) {
3492 3492
 
3493
-							if ( isset( $new_args['element_require'] ) ) {
3494
-								echo str_replace( array(
3495
-										"'+",
3496
-										"+'"
3497
-									), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
3498
-								unset( $new_args['element_require'] );
3499
-							}
3493
+                            if ( isset( $new_args['element_require'] ) ) {
3494
+                                echo str_replace( array(
3495
+                                        "'+",
3496
+                                        "+'"
3497
+                                    ), '', $this->block_props_replace( $new_args['element_require'] ) ) . " &&  ";
3498
+                                unset( $new_args['element_require'] );
3499
+                            }
3500 3500
 
3501 3501
                             if($new_args['element']=='InnerBlocks'){
3502 3502
                                 echo "\n el( InnerBlocks, {";
3503 3503
                             }elseif($new_args['element']=='innerBlocksProps'){
3504 3504
                                 $element = isset($new_args['inner_element']) ? esc_attr($new_args['inner_element']) : 'div';
3505
-                              //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
3505
+                                //  echo "\n el( 'section', wp.blockEditor.useInnerBlocksProps( blockProps, {";
3506 3506
 //                                echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
3507 3507
                                 echo $save ? "\n el( '$element', wp.blockEditor.useInnerBlocksProps.save( " : "\n el( '$element', wp.blockEditor.useInnerBlocksProps( ";
3508 3508
                                 echo $save ? "wp.blockEditor.useBlockProps.save( {" : "wp.blockEditor.useBlockProps( {";
@@ -3512,74 +3512,74 @@  discard block
 block discarded – undo
3512 3512
                                 echo !empty($new_args['innerBlocksProps']) && !$save ? $this->block_element( $new_args['innerBlocksProps'],$save ) : '';
3513 3513
                             //    echo '###';
3514 3514
 
3515
-                              //  echo '###';
3515
+                                //  echo '###';
3516 3516
                             }elseif($new_args['element']=='BlocksProps'){
3517 3517
 
3518
-								if ( isset($new_args['if_inner_element']) ) {
3519
-									$element = $new_args['if_inner_element'];
3520
-								}else {
3521
-									$element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
3522
-								}
3518
+                                if ( isset($new_args['if_inner_element']) ) {
3519
+                                    $element = $new_args['if_inner_element'];
3520
+                                }else {
3521
+                                    $element = isset($new_args['inner_element']) ? "'".esc_attr($new_args['inner_element'])."'" : "'div'";
3522
+                                }
3523 3523
 
3524
-								unset($new_args['inner_element']);
3524
+                                unset($new_args['inner_element']);
3525 3525
                                 echo $save ? "\n el( $element, wp.blockEditor.useBlockProps.save( {" : "\n el( $element, wp.blockEditor.useBlockProps( {";
3526 3526
                                 echo !empty($new_args['blockProps']) ? $this->block_element( $new_args['blockProps'],$save ) : '';
3527 3527
 
3528 3528
 
3529
-                               // echo "} ),";
3529
+                                // echo "} ),";
3530 3530
 
3531 3531
                             }else{
3532 3532
                                 echo "\n el( '" . $new_args['element'] . "', {";
3533 3533
                             }
3534 3534
 
3535 3535
 
3536
-							// get the attributes
3537
-							foreach ( $new_args as $new_key => $new_value ) {
3536
+                            // get the attributes
3537
+                            foreach ( $new_args as $new_key => $new_value ) {
3538 3538
 
3539 3539
 
3540
-								if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
3541
-									// do nothing
3542
-								} else {
3543
-									echo $this->block_element( array( $new_key => $new_value ),$save );
3544
-								}
3545
-							}
3540
+                                if ( $new_key == 'element' || $new_key == 'content'|| $new_key == 'if_content' || $new_key == 'element_require' || $new_key == 'element_repeat' || is_array( $new_value ) ) {
3541
+                                    // do nothing
3542
+                                } else {
3543
+                                    echo $this->block_element( array( $new_key => $new_value ),$save );
3544
+                                }
3545
+                            }
3546 3546
 
3547
-							echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
3547
+                            echo $new_args['element']=='BlocksProps' ? '} ),' : "},";// end attributes
3548 3548
 
3549
-							// get the content
3550
-							$first_item = 0;
3551
-							foreach ( $new_args as $new_key => $new_value ) {
3552
-								if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
3549
+                            // get the content
3550
+                            $first_item = 0;
3551
+                            foreach ( $new_args as $new_key => $new_value ) {
3552
+                                if ( $new_key === 'content' || $new_key === 'if_content' || is_array( $new_value ) ) {
3553 3553
 
3554
-									if ( $new_key === 'content' ) {
3555
-										echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
3556
-									}else if ( $new_key === 'if_content' ) {
3557
-										echo  $this->block_props_replace(  $new_value  );
3558
-									}
3554
+                                    if ( $new_key === 'content' ) {
3555
+                                        echo "'" . $this->block_props_replace( wp_slash( $new_value ) ) . "'";
3556
+                                    }else if ( $new_key === 'if_content' ) {
3557
+                                        echo  $this->block_props_replace(  $new_value  );
3558
+                                    }
3559 3559
 
3560
-									if ( is_array( $new_value ) ) {
3560
+                                    if ( is_array( $new_value ) ) {
3561 3561
 
3562
-										if ( isset( $new_value['element_require'] ) ) {
3563
-											echo str_replace( array(
3564
-													"'+",
3565
-													"+'"
3566
-												), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
3567
-											unset( $new_value['element_require'] );
3568
-										}
3562
+                                        if ( isset( $new_value['element_require'] ) ) {
3563
+                                            echo str_replace( array(
3564
+                                                    "'+",
3565
+                                                    "+'"
3566
+                                                ), '', $this->block_props_replace( $new_value['element_require'] ) ) . " &&  ";
3567
+                                            unset( $new_value['element_require'] );
3568
+                                        }
3569 3569
 
3570
-										if ( isset( $new_value['element_repeat'] ) ) {
3571
-											$x = 1;
3572
-											while ( $x <= absint( $new_value['element_repeat'] ) ) {
3573
-												$this->block_element( array( '' => $new_value ),$save );
3574
-												$x ++;
3575
-											}
3576
-										} else {
3577
-											$this->block_element( array( '' => $new_value ),$save );
3578
-										}
3579
-									}
3580
-									$first_item ++;
3581
-								}
3582
-							}
3570
+                                        if ( isset( $new_value['element_repeat'] ) ) {
3571
+                                            $x = 1;
3572
+                                            while ( $x <= absint( $new_value['element_repeat'] ) ) {
3573
+                                                $this->block_element( array( '' => $new_value ),$save );
3574
+                                                $x ++;
3575
+                                            }
3576
+                                        } else {
3577
+                                            $this->block_element( array( '' => $new_value ),$save );
3578
+                                        }
3579
+                                    }
3580
+                                    $first_item ++;
3581
+                                }
3582
+                            }
3583 3583
 
3584 3584
                             if($new_args['element']=='innerBlocksProps' || $new_args['element']=='xBlocksProps'){
3585 3585
                                 echo "))";// end content
@@ -3588,517 +3588,517 @@  discard block
 block discarded – undo
3588 3588
                             }
3589 3589
 
3590 3590
 
3591
-							echo ", \n";
3591
+                            echo ", \n";
3592 3592
 
3593
-						}
3594
-					} else {
3593
+                        }
3594
+                    } else {
3595 3595
 
3596
-						if ( substr( $element, 0, 3 ) === "if_" ) {
3597
-							$extra = '';
3598
-							if( strpos($new_args, '[%WrapClass%]') !== false ){
3599
-								$new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
3600
-								$new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
3601
-							}
3602
-							echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
3603
-						} elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
3596
+                        if ( substr( $element, 0, 3 ) === "if_" ) {
3597
+                            $extra = '';
3598
+                            if( strpos($new_args, '[%WrapClass%]') !== false ){
3599
+                                $new_args = str_replace('[%WrapClass%]"','" + sd_build_aui_class(props.attributes)',$new_args);
3600
+                                $new_args = str_replace('[%WrapClass%]','+ sd_build_aui_class(props.attributes)',$new_args);
3601
+                            }
3602
+                            echo str_replace( "if_", "", $element ) . ": " . $this->block_props_replace( $new_args, true ) . ",";
3603
+                        } elseif ( $element == 'style' &&  strpos($new_args, '[%WrapStyle%]') !== false ) {
3604 3604
                             $new_args = str_replace('[%WrapStyle%]','',$new_args);
3605 3605
                             echo $element . ": {..." . $this->block_props_replace( $new_args ) . " , ...sd_build_aui_styles(props.attributes) },";
3606 3606
 //                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3607
-						} elseif ( $element == 'style' ) {
3608
-							echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3609
-						} elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
3607
+                        } elseif ( $element == 'style' ) {
3608
+                            echo $element . ": " . $this->block_props_replace( $new_args ) . ",";
3609
+                        } elseif ( ( $element == 'class' || $element == 'className'  ) &&  strpos($new_args, '[%WrapClass%]') !== false ) {
3610 3610
                             $new_args = str_replace('[%WrapClass%]','',$new_args);
3611 3611
                             echo $element . ": '" . $this->block_props_replace( $new_args ) . "' + sd_build_aui_class(props.attributes),";
3612
-						} elseif ( $element == 'template' && $new_args ) {
3613
-							echo $element . ": $new_args,";
3614
-						} else {
3615
-							echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
3616
-						}
3612
+                        } elseif ( $element == 'template' && $new_args ) {
3613
+                            echo $element . ": $new_args,";
3614
+                        } else {
3615
+                            echo $element . ": '" . $this->block_props_replace( $new_args ) . "',";
3616
+                        }
3617 3617
 
3618
-					}
3619
-				}
3620
-			}
3621
-		}
3618
+                    }
3619
+                }
3620
+            }
3621
+        }
3622 3622
 
3623
-		/**
3624
-		 * Replace block attributes placeholders with the proper naming.
3625
-		 *
3626
-		 * @param $string
3627
-		 *
3628
-		 * @return mixed
3629
-		 */
3630
-		public function block_props_replace( $string, $no_wrap = false ) {
3631
-
3632
-			if ( $no_wrap ) {
3633
-				$string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
3634
-			} else {
3635
-				$string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
3636
-			}
3623
+        /**
3624
+         * Replace block attributes placeholders with the proper naming.
3625
+         *
3626
+         * @param $string
3627
+         *
3628
+         * @return mixed
3629
+         */
3630
+        public function block_props_replace( $string, $no_wrap = false ) {
3637 3631
 
3638
-			return $string;
3639
-		}
3632
+            if ( $no_wrap ) {
3633
+                $string = str_replace( array( "[%", "%]" ), array( "props.attributes.", "" ), $string );
3634
+            } else {
3635
+                $string = str_replace( array( "[%", "%]" ), array( "'+props.attributes.", "+'" ), $string );
3636
+            }
3640 3637
 
3641
-		/**
3642
-		 * Outputs the content of the widget
3643
-		 *
3644
-		 * @param array $args
3645
-		 * @param array $instance
3646
-		 */
3647
-		public function widget( $args, $instance ) {
3648
-
3649
-			// get the filtered values
3650
-			$argument_values = $this->argument_values( $instance );
3651
-			$argument_values = $this->string_to_bool( $argument_values );
3652
-			$output          = $this->output( $argument_values, $args );
3653
-
3654
-			$no_wrap = false;
3655
-			if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
3656
-				$no_wrap = true;
3657
-			}
3638
+            return $string;
3639
+        }
3658 3640
 
3659
-			ob_start();
3660
-			if ( $output && ! $no_wrap ) {
3641
+        /**
3642
+         * Outputs the content of the widget
3643
+         *
3644
+         * @param array $args
3645
+         * @param array $instance
3646
+         */
3647
+        public function widget( $args, $instance ) {
3661 3648
 
3662
-				$class_original = $this->options['widget_ops']['classname'];
3663
-				$class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
3649
+            // get the filtered values
3650
+            $argument_values = $this->argument_values( $instance );
3651
+            $argument_values = $this->string_to_bool( $argument_values );
3652
+            $output          = $this->output( $argument_values, $args );
3664 3653
 
3665
-				// Before widget
3666
-				$before_widget = $args['before_widget'];
3667
-				$before_widget = str_replace($class_original,$class,$before_widget);
3668
-				$before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
3669
-				$before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
3654
+            $no_wrap = false;
3655
+            if ( isset( $argument_values['no_wrap'] ) && $argument_values['no_wrap'] ) {
3656
+                $no_wrap = true;
3657
+            }
3670 3658
 
3671
-				// After widget
3672
-				$after_widget = $args['after_widget'];
3673
-				$after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
3674
-				$after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
3659
+            ob_start();
3660
+            if ( $output && ! $no_wrap ) {
3675 3661
 
3676
-				echo $before_widget;
3677
-				// elementor strips the widget wrapping div so we check for and add it back if needed
3678
-				if ( $this->is_elementor_widget_output() ) {
3679
-					// Filter class & attrs for elementor widget output.
3680
-					$class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
3681
-					$class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
3662
+                $class_original = $this->options['widget_ops']['classname'];
3663
+                $class = $this->options['widget_ops']['classname']." sdel-".$this->get_instance_hash();
3682 3664
 
3683
-					$attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
3684
-					$attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
3665
+                // Before widget
3666
+                $before_widget = $args['before_widget'];
3667
+                $before_widget = str_replace($class_original,$class,$before_widget);
3668
+                $before_widget = apply_filters( 'wp_super_duper_before_widget', $before_widget, $args, $instance, $this );
3669
+                $before_widget = apply_filters( 'wp_super_duper_before_widget_' . $this->base_id, $before_widget, $args, $instance, $this );
3685 3670
 
3686
-					echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
3687
-				}
3688
-				echo $this->output_title( $args, $instance );
3689
-				echo $output;
3690
-				if ( $this->is_elementor_widget_output() ) {
3691
-					echo "</span>";
3692
-				}
3693
-				echo $after_widget;
3694
-			} elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
3695
-				$output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
3696
-				echo $output;
3697
-			} elseif ( $output && $no_wrap ) {
3698
-				echo $output;
3699
-			}
3700
-			$output = ob_get_clean();
3671
+                // After widget
3672
+                $after_widget = $args['after_widget'];
3673
+                $after_widget = apply_filters( 'wp_super_duper_after_widget', $after_widget, $args, $instance, $this );
3674
+                $after_widget = apply_filters( 'wp_super_duper_after_widget_' . $this->base_id, $after_widget, $args, $instance, $this );
3701 3675
 
3702
-			$output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
3676
+                echo $before_widget;
3677
+                // elementor strips the widget wrapping div so we check for and add it back if needed
3678
+                if ( $this->is_elementor_widget_output() ) {
3679
+                    // Filter class & attrs for elementor widget output.
3680
+                    $class = apply_filters( 'wp_super_duper_div_classname', $class, $args, $this );
3681
+                    $class = apply_filters( 'wp_super_duper_div_classname_' . $this->base_id, $class, $args, $this );
3703 3682
 
3704
-			echo $output;
3705
-		}
3683
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs', '', $args, $this );
3684
+                    $attrs = apply_filters( 'wp_super_duper_div_attrs_' . $this->base_id, '', $args, $this );
3706 3685
 
3707
-		/**
3708
-		 * Tests if the current output is inside a elementor container.
3709
-		 *
3710
-		 * @return bool
3711
-		 *@since 1.0.4
3712
-		 */
3713
-		public function is_elementor_widget_output() {
3714
-			$result = false;
3715
-			if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
3716
-				$result = true;
3717
-			}
3686
+                    echo "<span class='" . esc_attr( $class  ) . "' " . $attrs . ">";
3687
+                }
3688
+                echo $this->output_title( $args, $instance );
3689
+                echo $output;
3690
+                if ( $this->is_elementor_widget_output() ) {
3691
+                    echo "</span>";
3692
+                }
3693
+                echo $after_widget;
3694
+            } elseif ( $this->is_preview() && $output == '' ) {// if preview show a placeholder if empty
3695
+                $output = $this->preview_placeholder_text( "{{" . $this->base_id . "}}" );
3696
+                echo $output;
3697
+            } elseif ( $output && $no_wrap ) {
3698
+                echo $output;
3699
+            }
3700
+            $output = ob_get_clean();
3718 3701
 
3719
-			return $result;
3720
-		}
3702
+            $output = apply_filters( 'wp_super_duper_widget_output', $output, $instance, $args, $this );
3721 3703
 
3722
-		/**
3723
-		 * Tests if the current output is inside a elementor preview.
3724
-		 *
3725
-		 * @return bool
3726
-		 *@since 1.0.4
3727
-		 */
3728
-		public function is_elementor_preview() {
3729
-			$result = false;
3730
-			if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
3731
-				$result = true;
3732
-			}
3704
+            echo $output;
3705
+        }
3733 3706
 
3734
-			return $result;
3735
-		}
3707
+        /**
3708
+         * Tests if the current output is inside a elementor container.
3709
+         *
3710
+         * @return bool
3711
+         *@since 1.0.4
3712
+         */
3713
+        public function is_elementor_widget_output() {
3714
+            $result = false;
3715
+            if ( defined( 'ELEMENTOR_VERSION' ) && isset( $this->number ) && $this->number == 'REPLACE_TO_ID' ) {
3716
+                $result = true;
3717
+            }
3736 3718
 
3737
-		/**
3738
-		 * Tests if the current output is inside a Divi preview.
3739
-		 *
3740
-		 * @return bool
3741
-		 *@since 1.0.6
3742
-		 */
3743
-		public function is_divi_preview() {
3744
-			$result = false;
3745
-			if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
3746
-				$result = true;
3747
-			}
3719
+            return $result;
3720
+        }
3748 3721
 
3749
-			return $result;
3750
-		}
3722
+        /**
3723
+         * Tests if the current output is inside a elementor preview.
3724
+         *
3725
+         * @return bool
3726
+         *@since 1.0.4
3727
+         */
3728
+        public function is_elementor_preview() {
3729
+            $result = false;
3730
+            if ( isset( $_REQUEST['elementor-preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) || ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor_ajax' ) ) {
3731
+                $result = true;
3732
+            }
3751 3733
 
3752
-		/**
3753
-		 * Tests if the current output is inside a Beaver builder preview.
3754
-		 *
3755
-		 * @return bool
3756
-		 *@since 1.0.6
3757
-		 */
3758
-		public function is_beaver_preview() {
3759
-			$result = false;
3760
-			if ( isset( $_REQUEST['fl_builder'] ) ) {
3761
-				$result = true;
3762
-			}
3734
+            return $result;
3735
+        }
3763 3736
 
3764
-			return $result;
3765
-		}
3737
+        /**
3738
+         * Tests if the current output is inside a Divi preview.
3739
+         *
3740
+         * @return bool
3741
+         *@since 1.0.6
3742
+         */
3743
+        public function is_divi_preview() {
3744
+            $result = false;
3745
+            if ( isset( $_REQUEST['et_fb'] ) || isset( $_REQUEST['et_pb_preview'] ) || ( is_admin() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'elementor' ) ) {
3746
+                $result = true;
3747
+            }
3766 3748
 
3767
-		/**
3768
-		 * Tests if the current output is inside a siteorigin builder preview.
3769
-		 *
3770
-		 * @return bool
3771
-		 *@since 1.0.6
3772
-		 */
3773
-		public function is_siteorigin_preview() {
3774
-			$result = false;
3775
-			if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
3776
-				$result = true;
3777
-			}
3749
+            return $result;
3750
+        }
3778 3751
 
3779
-			return $result;
3780
-		}
3752
+        /**
3753
+         * Tests if the current output is inside a Beaver builder preview.
3754
+         *
3755
+         * @return bool
3756
+         *@since 1.0.6
3757
+         */
3758
+        public function is_beaver_preview() {
3759
+            $result = false;
3760
+            if ( isset( $_REQUEST['fl_builder'] ) ) {
3761
+                $result = true;
3762
+            }
3781 3763
 
3782
-		/**
3783
-		 * Tests if the current output is inside a cornerstone builder preview.
3784
-		 *
3785
-		 * @return bool
3786
-		 *@since 1.0.8
3787
-		 */
3788
-		public function is_cornerstone_preview() {
3789
-			$result = false;
3790
-			if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
3791
-				$result = true;
3792
-			}
3764
+            return $result;
3765
+        }
3793 3766
 
3794
-			return $result;
3795
-		}
3767
+        /**
3768
+         * Tests if the current output is inside a siteorigin builder preview.
3769
+         *
3770
+         * @return bool
3771
+         *@since 1.0.6
3772
+         */
3773
+        public function is_siteorigin_preview() {
3774
+            $result = false;
3775
+            if ( ! empty( $_REQUEST['siteorigin_panels_live_editor'] ) ) {
3776
+                $result = true;
3777
+            }
3796 3778
 
3797
-		/**
3798
-		 * Tests if the current output is inside a fusion builder preview.
3799
-		 *
3800
-		 * @return bool
3801
-		 *@since 1.1.0
3802
-		 */
3803
-		public function is_fusion_preview() {
3804
-			$result = false;
3805
-			if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
3806
-				$result = true;
3807
-			}
3779
+            return $result;
3780
+        }
3808 3781
 
3809
-			return $result;
3810
-		}
3782
+        /**
3783
+         * Tests if the current output is inside a cornerstone builder preview.
3784
+         *
3785
+         * @return bool
3786
+         *@since 1.0.8
3787
+         */
3788
+        public function is_cornerstone_preview() {
3789
+            $result = false;
3790
+            if ( ! empty( $_REQUEST['cornerstone_preview'] ) || basename( $_SERVER['REQUEST_URI'] ) == 'cornerstone-endpoint' ) {
3791
+                $result = true;
3792
+            }
3811 3793
 
3812
-		/**
3813
-		 * Tests if the current output is inside a Oxygen builder preview.
3814
-		 *
3815
-		 * @return bool
3816
-		 *@since 1.0.18
3817
-		 */
3818
-		public function is_oxygen_preview() {
3819
-			$result = false;
3820
-			if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
3821
-				$result = true;
3822
-			}
3794
+            return $result;
3795
+        }
3823 3796
 
3824
-			return $result;
3825
-		}
3797
+        /**
3798
+         * Tests if the current output is inside a fusion builder preview.
3799
+         *
3800
+         * @return bool
3801
+         *@since 1.1.0
3802
+         */
3803
+        public function is_fusion_preview() {
3804
+            $result = false;
3805
+            if ( ! empty( $_REQUEST['fb-edit'] ) || ! empty( $_REQUEST['fusion_load_nonce'] ) ) {
3806
+                $result = true;
3807
+            }
3826 3808
 
3827
-		/**
3828
-		 * General function to check if we are in a preview situation.
3829
-		 *
3830
-		 * @return bool
3831
-		 *@since 1.0.6
3832
-		 */
3833
-		public function is_preview() {
3834
-			$preview = false;
3835
-			if ( $this->is_divi_preview() ) {
3836
-				$preview = true;
3837
-			} elseif ( $this->is_elementor_preview() ) {
3838
-				$preview = true;
3839
-			} elseif ( $this->is_beaver_preview() ) {
3840
-				$preview = true;
3841
-			} elseif ( $this->is_siteorigin_preview() ) {
3842
-				$preview = true;
3843
-			} elseif ( $this->is_cornerstone_preview() ) {
3844
-				$preview = true;
3845
-			} elseif ( $this->is_fusion_preview() ) {
3846
-				$preview = true;
3847
-			} elseif ( $this->is_oxygen_preview() ) {
3848
-				$preview = true;
3849
-			} elseif( $this->is_block_content_call() ) {
3850
-				$preview = true;
3851
-			}
3809
+            return $result;
3810
+        }
3852 3811
 
3853
-			return $preview;
3854
-		}
3812
+        /**
3813
+         * Tests if the current output is inside a Oxygen builder preview.
3814
+         *
3815
+         * @return bool
3816
+         *@since 1.0.18
3817
+         */
3818
+        public function is_oxygen_preview() {
3819
+            $result = false;
3820
+            if ( ! empty( $_REQUEST['ct_builder'] ) || ( ! empty( $_REQUEST['action'] ) && ( substr( $_REQUEST['action'], 0, 11 ) === "oxy_render_" || substr( $_REQUEST['action'], 0, 10 ) === "ct_render_" ) ) ) {
3821
+                $result = true;
3822
+            }
3855 3823
 
3856
-		/**
3857
-		 * Output the super title.
3858
-		 *
3859
-		 * @param $args
3860
-		 * @param array $instance
3861
-		 *
3862
-		 * @return string
3863
-		 */
3864
-		public function output_title( $args, $instance = array() ) {
3865
-			$output = '';
3866
-			if ( ! empty( $instance['title'] ) ) {
3867
-				/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
3868
-				$title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
3869
-
3870
-				if(empty($instance['widget_title_tag'])){
3871
-					$output = $args['before_title'] . $title . $args['after_title'];
3872
-				}else{
3873
-					$title_tag = esc_attr( $instance['widget_title_tag'] );
3874
-
3875
-					// classes
3876
-					$title_classes = array();
3877
-					$title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
3878
-					$title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
3879
-					$title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
3880
-					$title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
3881
-					$title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
3882
-					$title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
3883
-					$title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
3884
-					$title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
3885
-					$title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
3886
-					$title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
3887
-					$title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
3888
-					$title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
3889
-					$title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
3890
-
3891
-					$class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
3892
-					$output = "<$title_tag class='$class' >$title</$title_tag>";
3893
-				}
3824
+            return $result;
3825
+        }
3894 3826
 
3895
-			}
3827
+        /**
3828
+         * General function to check if we are in a preview situation.
3829
+         *
3830
+         * @return bool
3831
+         *@since 1.0.6
3832
+         */
3833
+        public function is_preview() {
3834
+            $preview = false;
3835
+            if ( $this->is_divi_preview() ) {
3836
+                $preview = true;
3837
+            } elseif ( $this->is_elementor_preview() ) {
3838
+                $preview = true;
3839
+            } elseif ( $this->is_beaver_preview() ) {
3840
+                $preview = true;
3841
+            } elseif ( $this->is_siteorigin_preview() ) {
3842
+                $preview = true;
3843
+            } elseif ( $this->is_cornerstone_preview() ) {
3844
+                $preview = true;
3845
+            } elseif ( $this->is_fusion_preview() ) {
3846
+                $preview = true;
3847
+            } elseif ( $this->is_oxygen_preview() ) {
3848
+                $preview = true;
3849
+            } elseif( $this->is_block_content_call() ) {
3850
+                $preview = true;
3851
+            }
3896 3852
 
3897
-			return $output;
3898
-		}
3853
+            return $preview;
3854
+        }
3855
+
3856
+        /**
3857
+         * Output the super title.
3858
+         *
3859
+         * @param $args
3860
+         * @param array $instance
3861
+         *
3862
+         * @return string
3863
+         */
3864
+        public function output_title( $args, $instance = array() ) {
3865
+            $output = '';
3866
+            if ( ! empty( $instance['title'] ) ) {
3867
+                /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
3868
+                $title  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
3869
+
3870
+                if(empty($instance['widget_title_tag'])){
3871
+                    $output = $args['before_title'] . $title . $args['after_title'];
3872
+                }else{
3873
+                    $title_tag = esc_attr( $instance['widget_title_tag'] );
3874
+
3875
+                    // classes
3876
+                    $title_classes = array();
3877
+                    $title_classes[] = !empty( $instance['widget_title_size_class'] ) ? sanitize_html_class( $instance['widget_title_size_class'] ) : '';
3878
+                    $title_classes[] = !empty( $instance['widget_title_align_class'] ) ? sanitize_html_class( $instance['widget_title_align_class'] ) : '';
3879
+                    $title_classes[] = !empty( $instance['widget_title_color_class'] ) ? "text-".sanitize_html_class( $instance['widget_title_color_class'] ) : '';
3880
+                    $title_classes[] = !empty( $instance['widget_title_border_class'] ) ? sanitize_html_class( $instance['widget_title_border_class'] ) : '';
3881
+                    $title_classes[] = !empty( $instance['widget_title_border_color_class'] ) ? "border-".sanitize_html_class( $instance['widget_title_border_color_class'] ) : '';
3882
+                    $title_classes[] = !empty( $instance['widget_title_mt_class'] ) ? "mt-".absint( $instance['widget_title_mt_class'] ) : '';
3883
+                    $title_classes[] = !empty( $instance['widget_title_mr_class'] ) ? "mr-".absint( $instance['widget_title_mr_class'] ) : '';
3884
+                    $title_classes[] = !empty( $instance['widget_title_mb_class'] ) ? "mb-".absint( $instance['widget_title_mb_class'] ) : '';
3885
+                    $title_classes[] = !empty( $instance['widget_title_ml_class'] ) ? "ml-".absint( $instance['widget_title_ml_class'] ) : '';
3886
+                    $title_classes[] = !empty( $instance['widget_title_pt_class'] ) ? "pt-".absint( $instance['widget_title_pt_class'] ) : '';
3887
+                    $title_classes[] = !empty( $instance['widget_title_pr_class'] ) ? "pr-".absint( $instance['widget_title_pr_class'] ) : '';
3888
+                    $title_classes[] = !empty( $instance['widget_title_pb_class'] ) ? "pb-".absint( $instance['widget_title_pb_class'] ) : '';
3889
+                    $title_classes[] = !empty( $instance['widget_title_pl_class'] ) ? "pl-".absint( $instance['widget_title_pl_class'] ) : '';
3890
+
3891
+                    $class = !empty( $title_classes ) ? implode(" ",$title_classes) : '';
3892
+                    $output = "<$title_tag class='$class' >$title</$title_tag>";
3893
+                }
3894
+
3895
+            }
3896
+
3897
+            return $output;
3898
+        }
3899 3899
 
3900
-		/**
3901
-		 * Outputs the options form inputs for the widget.
3902
-		 *
3903
-		 * @param array $instance The widget options.
3904
-		 */
3905
-		public function form( $instance ) {
3900
+        /**
3901
+         * Outputs the options form inputs for the widget.
3902
+         *
3903
+         * @param array $instance The widget options.
3904
+         */
3905
+        public function form( $instance ) {
3906 3906
 
3907
-			// set widget instance
3908
-			$this->instance = $instance;
3907
+            // set widget instance
3908
+            $this->instance = $instance;
3909 3909
 
3910
-			// set it as a SD widget
3911
-			echo $this->widget_advanced_toggle();
3910
+            // set it as a SD widget
3911
+            echo $this->widget_advanced_toggle();
3912 3912
 
3913
-			echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
3914
-			$arguments_raw = $this->get_arguments();
3913
+            echo "<p>" . esc_attr( $this->options['widget_ops']['description'] ) . "</p>";
3914
+            $arguments_raw = $this->get_arguments();
3915 3915
 
3916
-			if ( is_array( $arguments_raw ) ) {
3916
+            if ( is_array( $arguments_raw ) ) {
3917 3917
 
3918
-				$arguments = $this->group_arguments( $arguments_raw );
3918
+                $arguments = $this->group_arguments( $arguments_raw );
3919 3919
 
3920
-				// Do we have sections?
3921
-				$has_sections = $arguments == $arguments_raw ? false : true;
3920
+                // Do we have sections?
3921
+                $has_sections = $arguments == $arguments_raw ? false : true;
3922 3922
 
3923 3923
 
3924
-				if ( $has_sections ) {
3925
-					$panel_count = 0;
3926
-					foreach ( $arguments as $key => $args ) {
3924
+                if ( $has_sections ) {
3925
+                    $panel_count = 0;
3926
+                    foreach ( $arguments as $key => $args ) {
3927 3927
 
3928
-						?>
3928
+                        ?>
3929 3929
 						<script>
3930 3930
 							//							jQuery(this).find("i").toggleClass("fas fa-chevron-up fas fa-chevron-down");jQuery(this).next().toggle();
3931 3931
 						</script>
3932 3932
 						<?php
3933 3933
 
3934
-						$hide       = $panel_count ? ' style="display:none;" ' : '';
3935
-						$icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
3936
-						echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes( $key ) . "'>" . esc_attr( $key ) . " <i style='float:right;' class='" . $icon_class . "'></i></button>";
3937
-						echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
3934
+                        $hide       = $panel_count ? ' style="display:none;" ' : '';
3935
+                        $icon_class = $panel_count ? 'fas fa-chevron-up' : 'fas fa-chevron-down';
3936
+                        echo "<button onclick='jQuery(this).find(\"i\").toggleClass(\"fas fa-chevron-up fas fa-chevron-down\");jQuery(this).next().slideToggle();' type='button' class='sd-toggle-group-button sd-input-group-toggle" . sanitize_title_with_dashes( $key ) . "'>" . esc_attr( $key ) . " <i style='float:right;' class='" . $icon_class . "'></i></button>";
3937
+                        echo "<div class='sd-toggle-group sd-input-group-" . sanitize_title_with_dashes( $key ) . "' $hide>";
3938 3938
 
3939
-						foreach ( $args as $k => $a ) {
3939
+                        foreach ( $args as $k => $a ) {
3940 3940
 
3941
-							$this->widget_inputs_row_start($k, $a);
3942
-							$this->widget_inputs( $a, $instance );
3943
-							$this->widget_inputs_row_end($k, $a);
3941
+                            $this->widget_inputs_row_start($k, $a);
3942
+                            $this->widget_inputs( $a, $instance );
3943
+                            $this->widget_inputs_row_end($k, $a);
3944 3944
 
3945
-						}
3945
+                        }
3946 3946
 
3947
-						echo "</div>";
3947
+                        echo "</div>";
3948 3948
 
3949
-						$panel_count ++;
3949
+                        $panel_count ++;
3950 3950
 
3951
-					}
3952
-				} else {
3953
-					foreach ( $arguments as $key => $args ) {
3954
-						$this->widget_inputs_row_start($key, $args);
3955
-						$this->widget_inputs( $args, $instance );
3956
-						$this->widget_inputs_row_end($key, $args);
3957
-					}
3958
-				}
3951
+                    }
3952
+                } else {
3953
+                    foreach ( $arguments as $key => $args ) {
3954
+                        $this->widget_inputs_row_start($key, $args);
3955
+                        $this->widget_inputs( $args, $instance );
3956
+                        $this->widget_inputs_row_end($key, $args);
3957
+                    }
3958
+                }
3959 3959
 
3960
-			}
3961
-		}
3960
+            }
3961
+        }
3962 3962
 
3963
-		public function widget_inputs_row_start($key, $args){
3964
-			if(!empty($args['row'])){
3965
-				// maybe open
3966
-				if(!empty($args['row']['open'])){
3967
-					?>
3963
+        public function widget_inputs_row_start($key, $args){
3964
+            if(!empty($args['row'])){
3965
+                // maybe open
3966
+                if(!empty($args['row']['open'])){
3967
+                    ?>
3968 3968
 					<div class='bsui sd-argument ' data-argument='<?php echo esc_attr( $args['row']['key'] ); ?>' data-element_require='<?php if ( !empty($args['row']['element_require'])) {
3969
-						echo $this->convert_element_require( $args['row']['element_require'] );
3970
-					} ?>'>
3969
+                        echo $this->convert_element_require( $args['row']['element_require'] );
3970
+                    } ?>'>
3971 3971
 					<?php if(!empty($args['row']['title'])){ ?>
3972 3972
 					<label class="mb-0 "><?php echo esc_attr( $args['row']['title'] ); ?><?php echo $this->widget_field_desc( $args['row'] ); ?></label>
3973 3973
 					<?php }?>
3974 3974
 					<div class='row <?php if(!empty($args['row']['class'])){ echo esc_attr($args['row']['class']);} ?>'>
3975 3975
 					<div class='col pr-2'>
3976 3976
 					<?php
3977
-				}elseif(!empty($args['row']['close'])){
3978
-					echo "<div class='col pl-0'>";
3979
-				}else{
3980
-					echo "<div class='col pl-0 pr-2'>";
3981
-				}
3982
-			}
3983
-		}
3977
+                }elseif(!empty($args['row']['close'])){
3978
+                    echo "<div class='col pl-0'>";
3979
+                }else{
3980
+                    echo "<div class='col pl-0 pr-2'>";
3981
+                }
3982
+            }
3983
+        }
3984 3984
 
3985
-		public function widget_inputs_row_end($key, $args){
3985
+        public function widget_inputs_row_end($key, $args){
3986 3986
 
3987
-			if(!empty($args['row'])){
3988
-				// maybe close
3989
-				if(!empty($args['row']['close'])){
3990
-					echo "</div></div>";
3991
-				}
3987
+            if(!empty($args['row'])){
3988
+                // maybe close
3989
+                if(!empty($args['row']['close'])){
3990
+                    echo "</div></div>";
3991
+                }
3992 3992
 
3993
-				echo "</div>";
3994
-			}
3995
-		}
3993
+                echo "</div>";
3994
+            }
3995
+        }
3996 3996
 
3997
-		/**
3998
-		 * Get the hidden input that when added makes the advanced button show on widget settings.
3999
-		 *
4000
-		 * @return string
4001
-		 */
4002
-		public function widget_advanced_toggle() {
4003
-
4004
-			$output = '';
4005
-			if ( $this->block_show_advanced() ) {
4006
-				$val = 1;
4007
-			} else {
4008
-				$val = 0;
4009
-			}
3997
+        /**
3998
+         * Get the hidden input that when added makes the advanced button show on widget settings.
3999
+         *
4000
+         * @return string
4001
+         */
4002
+        public function widget_advanced_toggle() {
4010 4003
 
4011
-			$output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4004
+            $output = '';
4005
+            if ( $this->block_show_advanced() ) {
4006
+                $val = 1;
4007
+            } else {
4008
+                $val = 0;
4009
+            }
4012 4010
 
4013
-			return $output;
4014
-		}
4011
+            $output .= "<input type='hidden'  class='sd-show-advanced' value='$val' />";
4015 4012
 
4016
-		/**
4017
-		 * Convert require element.
4018
-		 *
4019
-		 * @param string $input Input element.
4020
-		 *
4021
-		 * @return string $output
4022
-		 *@since 1.0.0
4023
-		 *
4024
-		 */
4025
-		public function convert_element_require( $input ) {
4026
-
4027
-			$input = str_replace( "'", '"', $input );// we only want double quotes
4028
-
4029
-			$output = esc_attr( str_replace( array( "[%", "%]" ), array(
4030
-				"jQuery(form).find('[data-argument=\"",
4031
-				"\"]').find('input,select,textarea').val()"
4032
-			), $input ) );
4033
-
4034
-			return $output;
4035
-		}
4013
+            return $output;
4014
+        }
4036 4015
 
4037
-		/**
4038
-		 * Builds the inputs for the widget options.
4039
-		 *
4040
-		 * @param $args
4041
-		 * @param $instance
4042
-		 */
4043
-		public function widget_inputs( $args, $instance ) {
4044
-
4045
-			$class             = "";
4046
-			$element_require   = "";
4047
-			$custom_attributes = "";
4048
-
4049
-			// get value
4050
-			if ( isset( $instance[ $args['name'] ] ) ) {
4051
-				$value = $instance[ $args['name'] ];
4052
-			} elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4053
-				$value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4054
-			} else {
4055
-				$value = '';
4056
-			}
4016
+        /**
4017
+         * Convert require element.
4018
+         *
4019
+         * @param string $input Input element.
4020
+         *
4021
+         * @return string $output
4022
+         *@since 1.0.0
4023
+         *
4024
+         */
4025
+        public function convert_element_require( $input ) {
4057 4026
 
4058
-			// get placeholder
4059
-			if ( ! empty( $args['placeholder'] ) ) {
4060
-				$placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4061
-			} else {
4062
-				$placeholder = '';
4063
-			}
4027
+            $input = str_replace( "'", '"', $input );// we only want double quotes
4064 4028
 
4065
-			// get if advanced
4066
-			if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4067
-				$class .= " sd-advanced-setting ";
4068
-			}
4029
+            $output = esc_attr( str_replace( array( "[%", "%]" ), array(
4030
+                "jQuery(form).find('[data-argument=\"",
4031
+                "\"]').find('input,select,textarea').val()"
4032
+            ), $input ) );
4069 4033
 
4070
-			// element_require
4071
-			if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4072
-				$element_require = $args['element_require'];
4073
-			}
4034
+            return $output;
4035
+        }
4074 4036
 
4075
-			// custom_attributes
4076
-			if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4077
-				$custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4078
-			}
4037
+        /**
4038
+         * Builds the inputs for the widget options.
4039
+         *
4040
+         * @param $args
4041
+         * @param $instance
4042
+         */
4043
+        public function widget_inputs( $args, $instance ) {
4044
+
4045
+            $class             = "";
4046
+            $element_require   = "";
4047
+            $custom_attributes = "";
4048
+
4049
+            // get value
4050
+            if ( isset( $instance[ $args['name'] ] ) ) {
4051
+                $value = $instance[ $args['name'] ];
4052
+            } elseif ( ! isset( $instance[ $args['name'] ] ) && ! empty( $args['default'] ) ) {
4053
+                $value = is_array( $args['default'] ) ? array_map( "esc_html", $args['default'] ) : esc_html( $args['default'] );
4054
+            } else {
4055
+                $value = '';
4056
+            }
4057
+
4058
+            // get placeholder
4059
+            if ( ! empty( $args['placeholder'] ) ) {
4060
+                $placeholder = "placeholder='" . esc_html( $args['placeholder'] ) . "'";
4061
+            } else {
4062
+                $placeholder = '';
4063
+            }
4079 4064
 
4065
+            // get if advanced
4066
+            if ( isset( $args['advanced'] ) && $args['advanced'] ) {
4067
+                $class .= " sd-advanced-setting ";
4068
+            }
4080 4069
 
4081
-			// before wrapper
4082
-			?>
4070
+            // element_require
4071
+            if ( isset( $args['element_require'] ) && $args['element_require'] ) {
4072
+                $element_require = $args['element_require'];
4073
+            }
4074
+
4075
+            // custom_attributes
4076
+            if ( isset( $args['custom_attributes'] ) && $args['custom_attributes'] ) {
4077
+                $custom_attributes = $this->array_to_attributes( $args['custom_attributes'], true );
4078
+            }
4079
+
4080
+
4081
+            // before wrapper
4082
+            ?>
4083 4083
 			<p class="sd-argument <?php echo esc_attr( $class ); ?>"
4084 4084
 			data-argument='<?php echo esc_attr( $args['name'] ); ?>'
4085 4085
 			data-element_require='<?php if ( $element_require ) {
4086
-				echo $this->convert_element_require( $element_require );
4087
-			} ?>'
4086
+                echo $this->convert_element_require( $element_require );
4087
+            } ?>'
4088 4088
 			>
4089 4089
 			<?php
4090 4090
 
4091 4091
 
4092
-			switch ( $args['type'] ) {
4093
-				//array('text','password','number','email','tel','url','color')
4094
-				case "text":
4095
-				case "password":
4096
-				case "number":
4097
-				case "email":
4098
-				case "tel":
4099
-				case "url":
4100
-				case "color":
4101
-					?>
4092
+            switch ( $args['type'] ) {
4093
+                //array('text','password','number','email','tel','url','color')
4094
+                case "text":
4095
+                case "password":
4096
+                case "number":
4097
+                case "email":
4098
+                case "tel":
4099
+                case "url":
4100
+                case "color":
4101
+                    ?>
4102 4102
 					<label
4103 4103
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
4104 4104
 					<input <?php echo $placeholder; ?> class="widefat"
@@ -4109,47 +4109,47 @@  discard block
 block discarded – undo
4109 4109
 						                               value="<?php echo esc_attr( $value ); ?>">
4110 4110
 					<?php
4111 4111
 
4112
-					break;
4113
-				case "select":
4114
-					$multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4115
-					if ( $multiple ) {
4116
-						if ( empty( $value ) ) {
4117
-							$value = array();
4118
-						}
4119
-					}
4120
-					?>
4112
+                    break;
4113
+                case "select":
4114
+                    $multiple = isset( $args['multiple'] ) && $args['multiple'] ? true : false;
4115
+                    if ( $multiple ) {
4116
+                        if ( empty( $value ) ) {
4117
+                            $value = array();
4118
+                        }
4119
+                    }
4120
+                    ?>
4121 4121
 					<label
4122 4122
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
4123 4123
 					<select <?php echo $placeholder; ?> class="widefat"
4124 4124
 						<?php echo $custom_attributes; ?>
4125 4125
 						                                id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
4126 4126
 						                                name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) );
4127
-						                                if ( $multiple ) {
4128
-							                                echo "[]";
4129
-						                                } ?>"
4127
+                                                        if ( $multiple ) {
4128
+                                                            echo "[]";
4129
+                                                        } ?>"
4130 4130
 						<?php if ( $multiple ) {
4131
-							echo "multiple";
4132
-						} //@todo not implemented yet due to gutenberg not supporting it
4133
-						?>
4131
+                            echo "multiple";
4132
+                        } //@todo not implemented yet due to gutenberg not supporting it
4133
+                        ?>
4134 4134
 					>
4135 4135
 						<?php
4136 4136
 
4137
-						if ( ! empty( $args['options'] ) ) {
4138
-							foreach ( $args['options'] as $val => $label ) {
4139
-								if ( $multiple ) {
4140
-									$selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4141
-								} else {
4142
-									$selected = selected( $value, $val, false );
4143
-								}
4144
-								echo "<option value='$val' " . $selected . ">$label</option>";
4145
-							}
4146
-						}
4147
-						?>
4137
+                        if ( ! empty( $args['options'] ) ) {
4138
+                            foreach ( $args['options'] as $val => $label ) {
4139
+                                if ( $multiple ) {
4140
+                                    $selected = in_array( $val, $value ) ? 'selected="selected"' : '';
4141
+                                } else {
4142
+                                    $selected = selected( $value, $val, false );
4143
+                                }
4144
+                                echo "<option value='$val' " . $selected . ">$label</option>";
4145
+                            }
4146
+                        }
4147
+                        ?>
4148 4148
 					</select>
4149 4149
 					<?php
4150
-					break;
4151
-				case "checkbox":
4152
-					?>
4150
+                    break;
4151
+                case "checkbox":
4152
+                    ?>
4153 4153
 					<input <?php echo $placeholder; ?>
4154 4154
 						<?php checked( 1, $value, true ) ?>
4155 4155
 						<?php echo $custom_attributes; ?>
@@ -4159,9 +4159,9 @@  discard block
 block discarded – undo
4159 4159
 					<label
4160 4160
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args );?><?php echo $this->widget_field_desc( $args ); ?></label>
4161 4161
 					<?php
4162
-					break;
4163
-				case "textarea":
4164
-					?>
4162
+                    break;
4163
+                case "textarea":
4164
+                    ?>
4165 4165
 					<label
4166 4166
 						for="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"><?php echo $this->widget_field_title( $args ); ?><?php echo $this->widget_field_desc( $args ); ?></label>
4167 4167
 					<textarea <?php echo $placeholder; ?> class="widefat"
@@ -4171,282 +4171,282 @@  discard block
 block discarded – undo
4171 4171
 					><?php echo esc_attr( $value ); ?></textarea>
4172 4172
 					<?php
4173 4173
 
4174
-					break;
4175
-				case "hidden":
4176
-					?>
4174
+                    break;
4175
+                case "hidden":
4176
+                    ?>
4177 4177
 					<input id="<?php echo esc_attr( $this->get_field_id( $args['name'] ) ); ?>"
4178 4178
 					       name="<?php echo esc_attr( $this->get_field_name( $args['name'] ) ); ?>" type="hidden"
4179 4179
 					       value="<?php echo esc_attr( $value ); ?>">
4180 4180
 					<?php
4181
-					break;
4182
-				default:
4183
-					echo "No input type found!"; // @todo we need to add more input types.
4184
-			}
4181
+                    break;
4182
+                default:
4183
+                    echo "No input type found!"; // @todo we need to add more input types.
4184
+            }
4185 4185
 
4186
-			// after wrapper
4187
-			?>
4186
+            // after wrapper
4187
+            ?>
4188 4188
 			</p>
4189 4189
 			<?php
4190 4190
 
4191 4191
 
4192
-		}
4192
+        }
4193 4193
 
4194
-		public function get_widget_icon($icon = 'box-top', $title = ''){
4195
-			if($icon=='box-top'){
4196
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
4197
-			}elseif($icon=='box-right'){
4198
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
4199
-			}elseif($icon=='box-bottom'){
4200
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
4201
-			}elseif($icon=='box-left'){
4202
-				return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
4203
-			}
4204
-		}
4194
+        public function get_widget_icon($icon = 'box-top', $title = ''){
4195
+            if($icon=='box-top'){
4196
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.048" height="9.017" fill="#555D66"></rect><rect x="16.265" y="5.498" width="1.023" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.186" width="8.964" height="2.482" fill="#272B2F"></rect><rect x="5.487" y="16.261" width="9.026" height="1.037" fill="#555D66"></rect></svg>';
4197
+            }elseif($icon=='box-right'){
4198
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1.046" height="9.017" fill="#555D66"></rect><rect x="15.244" y="5.498" width="2.518" height="9.003" fill="#272B2F"></rect><rect x="5.518" y="2.719" width="8.964" height="0.954" fill="#555D66"></rect><rect x="5.487" y="16.308" width="9.026" height="0.99" fill="#555D66"></rect></svg>';
4199
+            }elseif($icon=='box-bottom'){
4200
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.714" y="5.492" width="1" height="9.017" fill="#555D66"></rect><rect x="16.261" y="5.498" width="1.027" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.968" fill="#555D66"></rect><rect x="5.487" y="15.28" width="9.026" height="2.499" fill="#272B2F"></rect></svg>';
4201
+            }elseif($icon=='box-left'){
4202
+                return '<svg title="'.esc_attr($title).'" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" role="img" aria-hidden="true" focusable="false"><rect x="2.202" y="5.492" width="2.503" height="9.017" fill="#272B2F"></rect><rect x="16.276" y="5.498" width="1.012" height="9.003" fill="#555D66"></rect><rect x="5.518" y="2.719" width="8.964" height="0.966" fill="#555D66"></rect><rect x="5.487" y="16.303" width="9.026" height="0.995" fill="#555D66"></rect></svg>';
4203
+            }
4204
+        }
4205 4205
 
4206
-		/**
4207
-		 * Get the widget input description html.
4208
-		 *
4209
-		 * @param $args
4210
-		 *
4211
-		 * @return string
4212
-		 * @todo, need to make its own tooltip script
4213
-		 */
4214
-		public function widget_field_desc( $args ) {
4215
-
4216
-			$description = '';
4217
-			if ( isset( $args['desc'] ) && $args['desc'] ) {
4218
-				if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4219
-					$description = $this->desc_tip( $args['desc'] );
4220
-				} else {
4221
-					$description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4222
-				}
4223
-			}
4206
+        /**
4207
+         * Get the widget input description html.
4208
+         *
4209
+         * @param $args
4210
+         *
4211
+         * @return string
4212
+         * @todo, need to make its own tooltip script
4213
+         */
4214
+        public function widget_field_desc( $args ) {
4215
+
4216
+            $description = '';
4217
+            if ( isset( $args['desc'] ) && $args['desc'] ) {
4218
+                if ( isset( $args['desc_tip'] ) && $args['desc_tip'] ) {
4219
+                    $description = $this->desc_tip( $args['desc'] );
4220
+                } else {
4221
+                    $description = '<span class="description">' . wp_kses_post( $args['desc'] ) . '</span>';
4222
+                }
4223
+            }
4224 4224
 
4225
-			return $description;
4226
-		}
4225
+            return $description;
4226
+        }
4227 4227
 
4228
-		/**
4229
-		 * Get the widget input title html.
4230
-		 *
4231
-		 * @param $args
4232
-		 *
4233
-		 * @return string
4234
-		 */
4235
-		public function widget_field_title( $args ) {
4236
-
4237
-			$title = '';
4238
-			if ( isset( $args['title'] ) && $args['title'] ) {
4239
-				if ( isset( $args['icon'] ) && $args['icon'] ) {
4240
-					$title = self::get_widget_icon( $args['icon'], $args['title']  );
4241
-				} else {
4242
-					$title = esc_attr($args['title']);
4243
-				}
4244
-			}
4228
+        /**
4229
+         * Get the widget input title html.
4230
+         *
4231
+         * @param $args
4232
+         *
4233
+         * @return string
4234
+         */
4235
+        public function widget_field_title( $args ) {
4236
+
4237
+            $title = '';
4238
+            if ( isset( $args['title'] ) && $args['title'] ) {
4239
+                if ( isset( $args['icon'] ) && $args['icon'] ) {
4240
+                    $title = self::get_widget_icon( $args['icon'], $args['title']  );
4241
+                } else {
4242
+                    $title = esc_attr($args['title']);
4243
+                }
4244
+            }
4245 4245
 
4246
-			return $title;
4247
-		}
4246
+            return $title;
4247
+        }
4248 4248
 
4249
-		/**
4250
-		 * Get the tool tip html.
4251
-		 *
4252
-		 * @param $tip
4253
-		 * @param bool $allow_html
4254
-		 *
4255
-		 * @return string
4256
-		 */
4257
-		function desc_tip( $tip, $allow_html = false ) {
4258
-			if ( $allow_html ) {
4259
-				$tip = $this->sanitize_tooltip( $tip );
4260
-			} else {
4261
-				$tip = esc_attr( $tip );
4262
-			}
4249
+        /**
4250
+         * Get the tool tip html.
4251
+         *
4252
+         * @param $tip
4253
+         * @param bool $allow_html
4254
+         *
4255
+         * @return string
4256
+         */
4257
+        function desc_tip( $tip, $allow_html = false ) {
4258
+            if ( $allow_html ) {
4259
+                $tip = $this->sanitize_tooltip( $tip );
4260
+            } else {
4261
+                $tip = esc_attr( $tip );
4262
+            }
4263 4263
 
4264
-			return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
4265
-		}
4264
+            return '<span class="gd-help-tip dashicons dashicons-editor-help" title="' . $tip . '"></span>';
4265
+        }
4266 4266
 
4267
-		/**
4268
-		 * Sanitize a string destined to be a tooltip.
4269
-		 *
4270
-		 * @param string $var
4271
-		 *
4272
-		 * @return string
4273
-		 */
4274
-		public function sanitize_tooltip( $var ) {
4275
-			return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4276
-				'br'     => array(),
4277
-				'em'     => array(),
4278
-				'strong' => array(),
4279
-				'small'  => array(),
4280
-				'span'   => array(),
4281
-				'ul'     => array(),
4282
-				'li'     => array(),
4283
-				'ol'     => array(),
4284
-				'p'      => array(),
4285
-			) ) );
4286
-		}
4267
+        /**
4268
+         * Sanitize a string destined to be a tooltip.
4269
+         *
4270
+         * @param string $var
4271
+         *
4272
+         * @return string
4273
+         */
4274
+        public function sanitize_tooltip( $var ) {
4275
+            return htmlspecialchars( wp_kses( html_entity_decode( $var ), array(
4276
+                'br'     => array(),
4277
+                'em'     => array(),
4278
+                'strong' => array(),
4279
+                'small'  => array(),
4280
+                'span'   => array(),
4281
+                'ul'     => array(),
4282
+                'li'     => array(),
4283
+                'ol'     => array(),
4284
+                'p'      => array(),
4285
+            ) ) );
4286
+        }
4287 4287
 
4288
-		/**
4289
-		 * Processing widget options on save
4290
-		 *
4291
-		 * @param array $new_instance The new options
4292
-		 * @param array $old_instance The previous options
4293
-		 *
4294
-		 * @return array
4295
-		 * @todo we should add some sanitation here.
4296
-		 */
4297
-		public function update( $new_instance, $old_instance ) {
4298
-
4299
-			//save the widget
4300
-			$instance = array_merge( (array) $old_instance, (array) $new_instance );
4301
-
4302
-			// set widget instance
4303
-			$this->instance = $instance;
4304
-
4305
-			if ( empty( $this->arguments ) ) {
4306
-				$this->get_arguments();
4307
-			}
4288
+        /**
4289
+         * Processing widget options on save
4290
+         *
4291
+         * @param array $new_instance The new options
4292
+         * @param array $old_instance The previous options
4293
+         *
4294
+         * @return array
4295
+         * @todo we should add some sanitation here.
4296
+         */
4297
+        public function update( $new_instance, $old_instance ) {
4308 4298
 
4309
-			// check for checkboxes
4310
-			if ( ! empty( $this->arguments ) ) {
4311
-				foreach ( $this->arguments as $argument ) {
4312
-					if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4313
-						$instance[ $argument['name'] ] = '0';
4314
-					}
4315
-				}
4316
-			}
4299
+            //save the widget
4300
+            $instance = array_merge( (array) $old_instance, (array) $new_instance );
4317 4301
 
4318
-			return $instance;
4319
-		}
4302
+            // set widget instance
4303
+            $this->instance = $instance;
4320 4304
 
4321
-		/**
4322
-		 * Checks if the current call is a ajax call to get the block content.
4323
-		 *
4324
-		 * This can be used in your widget to return different content as the block content.
4325
-		 *
4326
-		 * @return bool
4327
-		 *@since 1.0.3
4328
-		 */
4329
-		public function is_block_content_call() {
4330
-			$result = false;
4331
-			if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4332
-				$result = true;
4333
-			}
4305
+            if ( empty( $this->arguments ) ) {
4306
+                $this->get_arguments();
4307
+            }
4334 4308
 
4335
-			return $result;
4336
-		}
4309
+            // check for checkboxes
4310
+            if ( ! empty( $this->arguments ) ) {
4311
+                foreach ( $this->arguments as $argument ) {
4312
+                    if ( isset( $argument['type'] ) && $argument['type'] == 'checkbox' && ! isset( $new_instance[ $argument['name'] ] ) ) {
4313
+                        $instance[ $argument['name'] ] = '0';
4314
+                    }
4315
+                }
4316
+            }
4337 4317
 
4338
-		/**
4339
-		 * Get an instance hash that will be unique to the type and settings.
4340
-		 *
4341
-		 * @return string
4342
-		 *@since 1.0.20
4343
-		 */
4344
-		public function get_instance_hash(){
4345
-			$instance_string = $this->base_id.serialize($this->instance);
4346
-			return hash('crc32b',$instance_string);
4347
-		}
4318
+            return $instance;
4319
+        }
4348 4320
 
4349
-		/**
4350
-		 * Generate and return inline styles from CSS rules that will match the unique class of the instance.
4351
-		 *
4352
-		 * @param array $rules
4353
-		 *
4354
-		 * @return string
4355
-		 *@since 1.0.20
4356
-		 */
4357
-		public function get_instance_style($rules = array()){
4358
-			$css = '';
4359
-
4360
-			if(!empty($rules)){
4361
-				$rules = array_unique($rules);
4362
-				$instance_hash = $this->get_instance_hash();
4363
-				$css .= "<style>";
4364
-				foreach($rules as $rule){
4365
-					$css .= ".sdel-$instance_hash $rule";
4366
-				}
4367
-				$css .= "</style>";
4368
-			}
4321
+        /**
4322
+         * Checks if the current call is a ajax call to get the block content.
4323
+         *
4324
+         * This can be used in your widget to return different content as the block content.
4325
+         *
4326
+         * @return bool
4327
+         *@since 1.0.3
4328
+         */
4329
+        public function is_block_content_call() {
4330
+            $result = false;
4331
+            if ( wp_doing_ajax() && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'super_duper_output_shortcode' ) {
4332
+                $result = true;
4333
+            }
4369 4334
 
4370
-			return $css;
4371
-		}
4335
+            return $result;
4336
+        }
4337
+
4338
+        /**
4339
+         * Get an instance hash that will be unique to the type and settings.
4340
+         *
4341
+         * @return string
4342
+         *@since 1.0.20
4343
+         */
4344
+        public function get_instance_hash(){
4345
+            $instance_string = $this->base_id.serialize($this->instance);
4346
+            return hash('crc32b',$instance_string);
4347
+        }
4348
+
4349
+        /**
4350
+         * Generate and return inline styles from CSS rules that will match the unique class of the instance.
4351
+         *
4352
+         * @param array $rules
4353
+         *
4354
+         * @return string
4355
+         *@since 1.0.20
4356
+         */
4357
+        public function get_instance_style($rules = array()){
4358
+            $css = '';
4359
+
4360
+            if(!empty($rules)){
4361
+                $rules = array_unique($rules);
4362
+                $instance_hash = $this->get_instance_hash();
4363
+                $css .= "<style>";
4364
+                foreach($rules as $rule){
4365
+                    $css .= ".sdel-$instance_hash $rule";
4366
+                }
4367
+                $css .= "</style>";
4368
+            }
4369
+
4370
+            return $css;
4371
+        }
4372 4372
 
4373
-		/**
4374
-		 * Encode shortcodes tags.
4375
-		 *
4376
-		 * @param string $content Content to search for shortcode tags.
4377
-		 *
4373
+        /**
4374
+         * Encode shortcodes tags.
4375
+         *
4376
+         * @param string $content Content to search for shortcode tags.
4377
+         *
4378 4378
 *@return string Content with shortcode tags removed.
4379
-		 *@since 1.0.28
4380
-		 *
4381
-		 */
4382
-		public function encode_shortcodes( $content ) {
4383
-			// Avoids existing encoded tags.
4384
-			$trans   = array(
4385
-				'&#91;' => '&#091;',
4386
-				'&#93;' => '&#093;',
4387
-				'&amp;#91;' => '&#091;',
4388
-				'&amp;#93;' => '&#093;',
4389
-				'&lt;' => '&0lt;',
4390
-				'&gt;' => '&0gt;',
4391
-				'&amp;lt;' => '&0lt;',
4392
-				'&amp;gt;' => '&0gt;',
4393
-			);
4394
-
4395
-			$content = strtr( $content, $trans );
4396
-
4397
-			$trans   = array(
4398
-				'[' => '&#91;',
4399
-				']' => '&#93;',
4400
-				'<' => '&lt;',
4401
-				'>' => '&gt;',
4402
-				'"' => '&quot;',
4403
-				"'" => '&apos;',
4404
-			);
4405
-
4406
-			$content = strtr( $content, $trans );
4407
-
4408
-			return $content;
4409
-		}
4379
+         *@since 1.0.28
4380
+         *
4381
+         */
4382
+        public function encode_shortcodes( $content ) {
4383
+            // Avoids existing encoded tags.
4384
+            $trans   = array(
4385
+                '&#91;' => '&#091;',
4386
+                '&#93;' => '&#093;',
4387
+                '&amp;#91;' => '&#091;',
4388
+                '&amp;#93;' => '&#093;',
4389
+                '&lt;' => '&0lt;',
4390
+                '&gt;' => '&0gt;',
4391
+                '&amp;lt;' => '&0lt;',
4392
+                '&amp;gt;' => '&0gt;',
4393
+            );
4394
+
4395
+            $content = strtr( $content, $trans );
4396
+
4397
+            $trans   = array(
4398
+                '[' => '&#91;',
4399
+                ']' => '&#93;',
4400
+                '<' => '&lt;',
4401
+                '>' => '&gt;',
4402
+                '"' => '&quot;',
4403
+                "'" => '&apos;',
4404
+            );
4405
+
4406
+            $content = strtr( $content, $trans );
4407
+
4408
+            return $content;
4409
+        }
4410 4410
 
4411
-		/**
4412
-		 * Remove encoded shortcod tags.
4413
-		 *
4414
-		 * @param string $content Content to search for shortcode tags.
4415
-		 *
4411
+        /**
4412
+         * Remove encoded shortcod tags.
4413
+         *
4414
+         * @param string $content Content to search for shortcode tags.
4415
+         *
4416 4416
 *@return string Content with decoded shortcode tags.
4417
-		 *@since 1.0.28
4418
-		 *
4419
-		 */
4420
-		public function decode_shortcodes( $content ) {
4421
-			$trans   = array(
4422
-				'&#91;' => '[',
4423
-				'&#93;' => ']',
4424
-				'&amp;#91;' => '[',
4425
-				'&amp;#93;' => ']',
4426
-				'&lt;' => '<',
4427
-				'&gt;' => '>',
4428
-				'&amp;lt;' => '<',
4429
-				'&amp;gt;' => '>',
4430
-				'&quot;' => '"',
4431
-				'&apos;' => "'",
4432
-			);
4433
-
4434
-			$content = strtr( $content, $trans );
4435
-
4436
-			$trans   = array(
4437
-				'&#091;' => '&#91;',
4438
-				'&#093;' => '&#93;',
4439
-				'&amp;#091;' => '&#91;',
4440
-				'&amp;#093;' => '&#93;',
4441
-				'&0lt;' => '&lt;',
4442
-				'&0gt;' => '&gt;',
4443
-				'&amp;0lt;' => '&lt;',
4444
-				'&amp;0gt;' => '&gt;',
4445
-			);
4446
-
4447
-			$content = strtr( $content, $trans );
4448
-
4449
-			return $content;
4450
-		}
4451
-	}
4417
+         *@since 1.0.28
4418
+         *
4419
+         */
4420
+        public function decode_shortcodes( $content ) {
4421
+            $trans   = array(
4422
+                '&#91;' => '[',
4423
+                '&#93;' => ']',
4424
+                '&amp;#91;' => '[',
4425
+                '&amp;#93;' => ']',
4426
+                '&lt;' => '<',
4427
+                '&gt;' => '>',
4428
+                '&amp;lt;' => '<',
4429
+                '&amp;gt;' => '>',
4430
+                '&quot;' => '"',
4431
+                '&apos;' => "'",
4432
+            );
4433
+
4434
+            $content = strtr( $content, $trans );
4435
+
4436
+            $trans   = array(
4437
+                '&#091;' => '&#91;',
4438
+                '&#093;' => '&#93;',
4439
+                '&amp;#091;' => '&#91;',
4440
+                '&amp;#093;' => '&#93;',
4441
+                '&0lt;' => '&lt;',
4442
+                '&0gt;' => '&gt;',
4443
+                '&amp;0lt;' => '&lt;',
4444
+                '&amp;0gt;' => '&gt;',
4445
+            );
4446
+
4447
+            $content = strtr( $content, $trans );
4448
+
4449
+            return $content;
4450
+        }
4451
+    }
4452 4452
 }
Please login to merge, or discard this patch.
vendor/ayecode/wp-super-duper/sd-functions.php 1 patch
Indentation   +1357 added lines, -1357 removed lines patch added patch discarded remove patch
@@ -11,18 +11,18 @@  discard block
 block discarded – undo
11 11
  * @return mixed|void
12 12
  */
13 13
 function sd_pagenow_exclude() {
14
-	return apply_filters( 'sd_pagenow_exclude', array(
15
-		'upload.php',
16
-		'edit-comments.php',
17
-		'edit-tags.php',
18
-		'index.php',
19
-		'media-new.php',
20
-		'options-discussion.php',
21
-		'options-writing.php',
22
-		'edit.php',
23
-		'themes.php',
24
-		'users.php',
25
-	) );
14
+    return apply_filters( 'sd_pagenow_exclude', array(
15
+        'upload.php',
16
+        'edit-comments.php',
17
+        'edit-tags.php',
18
+        'index.php',
19
+        'media-new.php',
20
+        'options-discussion.php',
21
+        'options-writing.php',
22
+        'edit.php',
23
+        'themes.php',
24
+        'users.php',
25
+    ) );
26 26
 }
27 27
 
28 28
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @return mixed|void
35 35
  */
36 36
 function sd_widget_exclude() {
37
-	return apply_filters( 'sd_widget_exclude', array() );
37
+    return apply_filters( 'sd_widget_exclude', array() );
38 38
 }
39 39
 
40 40
 
@@ -47,70 +47,70 @@  discard block
 block discarded – undo
47 47
  * @return array
48 48
  */
49 49
 function sd_get_margin_input( $type = 'mt', $overwrite = array(), $include_negatives = true ) {
50
-	$options = array(
51
-		""     => __( 'None' ),
52
-		"auto" => __( 'auto' ),
53
-		"0"    => "0",
54
-		"1"    => "1",
55
-		"2"    => "2",
56
-		"3"    => "3",
57
-		"4"    => "4",
58
-		"5"    => "5",
59
-	);
60
-
61
-	if ( $include_negatives ) {
62
-		$options['n1'] = '-1';
63
-		$options['n2'] = '-2';
64
-		$options['n3'] = '-3';
65
-		$options['n4'] = '-4';
66
-		$options['n5'] = '-5';
67
-	}
68
-
69
-	$defaults = array(
70
-		'type'     => 'select',
71
-		'title'    => __( 'Margin top' ),
72
-		'options'  => $options,
73
-		'default'  => '',
74
-		'desc_tip' => true,
75
-		'group'    => __( "Wrapper Styles", "geodirectory" ),
50
+    $options = array(
51
+        ""     => __( 'None' ),
52
+        "auto" => __( 'auto' ),
53
+        "0"    => "0",
54
+        "1"    => "1",
55
+        "2"    => "2",
56
+        "3"    => "3",
57
+        "4"    => "4",
58
+        "5"    => "5",
59
+    );
60
+
61
+    if ( $include_negatives ) {
62
+        $options['n1'] = '-1';
63
+        $options['n2'] = '-2';
64
+        $options['n3'] = '-3';
65
+        $options['n4'] = '-4';
66
+        $options['n5'] = '-5';
67
+    }
68
+
69
+    $defaults = array(
70
+        'type'     => 'select',
71
+        'title'    => __( 'Margin top' ),
72
+        'options'  => $options,
73
+        'default'  => '',
74
+        'desc_tip' => true,
75
+        'group'    => __( "Wrapper Styles", "geodirectory" ),
76 76
 //		'device_type' => 'Desktop',
77
-	);
78
-
79
-	// title
80
-	if ( $type == 'mt' ) {
81
-		$defaults['title'] = __( 'Margin top' );
82
-		$defaults['icon']  = 'box-top';
83
-		$defaults['row']   = array(
84
-			'title' => __( 'Margins' ),
85
-			'key'   => 'wrapper-margins',
86
-			'open'  => true,
87
-			'class' => 'text-center',
88
-		);
89
-	} elseif ( $type == 'mr' ) {
90
-		$defaults['title'] = __( 'Margin right' );
91
-		$defaults['icon']  = 'box-right';
92
-		$defaults['row']   = array(
93
-			'key' => 'wrapper-margins',
94
-		);
95
-	} elseif ( $type == 'mb' ) {
96
-		$defaults['title'] = __( 'Margin bottom' );
97
-		$defaults['icon']  = 'box-bottom';
98
-		$defaults['row']   = array(
99
-			'key' => 'wrapper-margins',
100
-		);
101
-	} elseif ( $type == 'ml' ) {
102
-		$defaults['title'] = __( 'Margin left' );
103
-		$defaults['icon']  = 'box-left';
104
-		$defaults['row']   = array(
105
-			'key'   => 'wrapper-margins',
106
-			'close' => true,
107
-		);
108
-	}
109
-
110
-	$input = wp_parse_args( $overwrite, $defaults );
111
-
112
-
113
-	return $input;
77
+    );
78
+
79
+    // title
80
+    if ( $type == 'mt' ) {
81
+        $defaults['title'] = __( 'Margin top' );
82
+        $defaults['icon']  = 'box-top';
83
+        $defaults['row']   = array(
84
+            'title' => __( 'Margins' ),
85
+            'key'   => 'wrapper-margins',
86
+            'open'  => true,
87
+            'class' => 'text-center',
88
+        );
89
+    } elseif ( $type == 'mr' ) {
90
+        $defaults['title'] = __( 'Margin right' );
91
+        $defaults['icon']  = 'box-right';
92
+        $defaults['row']   = array(
93
+            'key' => 'wrapper-margins',
94
+        );
95
+    } elseif ( $type == 'mb' ) {
96
+        $defaults['title'] = __( 'Margin bottom' );
97
+        $defaults['icon']  = 'box-bottom';
98
+        $defaults['row']   = array(
99
+            'key' => 'wrapper-margins',
100
+        );
101
+    } elseif ( $type == 'ml' ) {
102
+        $defaults['title'] = __( 'Margin left' );
103
+        $defaults['icon']  = 'box-left';
104
+        $defaults['row']   = array(
105
+            'key'   => 'wrapper-margins',
106
+            'close' => true,
107
+        );
108
+    }
109
+
110
+    $input = wp_parse_args( $overwrite, $defaults );
111
+
112
+
113
+    return $input;
114 114
 }
115 115
 
116 116
 /**
@@ -122,61 +122,61 @@  discard block
 block discarded – undo
122 122
  * @return array
123 123
  */
124 124
 function sd_get_padding_input( $type = 'pt', $overwrite = array() ) {
125
-	$options = array(
126
-		""  => __( 'None' ),
127
-		"0" => "0",
128
-		"1" => "1",
129
-		"2" => "2",
130
-		"3" => "3",
131
-		"4" => "4",
132
-		"5" => "5",
133
-	);
134
-
135
-	$defaults = array(
136
-		'type'     => 'select',
137
-		'title'    => __( 'Padding top' ),
138
-		'options'  => $options,
139
-		'default'  => '',
140
-		'desc_tip' => true,
141
-		'group'    => __( "Wrapper Styles", "geodirectory" )
142
-	);
143
-
144
-	// title
145
-	if ( $type == 'pt' ) {
146
-		$defaults['title'] = __( 'Padding top' );
147
-		$defaults['icon']  = 'box-top';
148
-		$defaults['row']   = array(
149
-			'title' => __( 'Padding' ),
150
-			'key'   => 'wrapper-padding',
151
-			'open'  => true,
152
-			'class' => 'text-center',
153
-		);
154
-	} elseif ( $type == 'pr' ) {
155
-		$defaults['title'] = __( 'Padding right' );
156
-		$defaults['icon']  = 'box-right';
157
-		$defaults['row']   = array(
158
-			'key' => 'wrapper-padding',
159
-		);
160
-	} elseif ( $type == 'pb' ) {
161
-		$defaults['title'] = __( 'Padding bottom' );
162
-		$defaults['icon']  = 'box-bottom';
163
-		$defaults['row']   = array(
164
-			'key' => 'wrapper-padding',
165
-		);
166
-	} elseif ( $type == 'pl' ) {
167
-		$defaults['title'] = __( 'Padding left' );
168
-		$defaults['icon']  = 'box-left';
169
-		$defaults['row']   = array(
170
-			'key'   => 'wrapper-padding',
171
-			'close' => true,
172
-
173
-		);
174
-	}
175
-
176
-	$input = wp_parse_args( $overwrite, $defaults );
177
-
178
-
179
-	return $input;
125
+    $options = array(
126
+        ""  => __( 'None' ),
127
+        "0" => "0",
128
+        "1" => "1",
129
+        "2" => "2",
130
+        "3" => "3",
131
+        "4" => "4",
132
+        "5" => "5",
133
+    );
134
+
135
+    $defaults = array(
136
+        'type'     => 'select',
137
+        'title'    => __( 'Padding top' ),
138
+        'options'  => $options,
139
+        'default'  => '',
140
+        'desc_tip' => true,
141
+        'group'    => __( "Wrapper Styles", "geodirectory" )
142
+    );
143
+
144
+    // title
145
+    if ( $type == 'pt' ) {
146
+        $defaults['title'] = __( 'Padding top' );
147
+        $defaults['icon']  = 'box-top';
148
+        $defaults['row']   = array(
149
+            'title' => __( 'Padding' ),
150
+            'key'   => 'wrapper-padding',
151
+            'open'  => true,
152
+            'class' => 'text-center',
153
+        );
154
+    } elseif ( $type == 'pr' ) {
155
+        $defaults['title'] = __( 'Padding right' );
156
+        $defaults['icon']  = 'box-right';
157
+        $defaults['row']   = array(
158
+            'key' => 'wrapper-padding',
159
+        );
160
+    } elseif ( $type == 'pb' ) {
161
+        $defaults['title'] = __( 'Padding bottom' );
162
+        $defaults['icon']  = 'box-bottom';
163
+        $defaults['row']   = array(
164
+            'key' => 'wrapper-padding',
165
+        );
166
+    } elseif ( $type == 'pl' ) {
167
+        $defaults['title'] = __( 'Padding left' );
168
+        $defaults['icon']  = 'box-left';
169
+        $defaults['row']   = array(
170
+            'key'   => 'wrapper-padding',
171
+            'close' => true,
172
+
173
+        );
174
+    }
175
+
176
+    $input = wp_parse_args( $overwrite, $defaults );
177
+
178
+
179
+    return $input;
180 180
 }
181 181
 
182 182
 /**
@@ -189,58 +189,58 @@  discard block
 block discarded – undo
189 189
  */
190 190
 function sd_get_border_input( $type = 'border', $overwrite = array() ) {
191 191
 
192
-	$defaults = array(
193
-		'type'     => 'select',
194
-		'title'    => __( 'Border' ),
195
-		'options'  => array(),
196
-		'default'  => '',
197
-		'desc_tip' => true,
198
-		'group'    => __( "Wrapper Styles", "geodirectory" )
199
-	);
200
-
201
-	// title
202
-	if ( $type == 'rounded' ) {
203
-		$defaults['title']   = __( 'Border radius type' );
204
-		$defaults['options'] = array(
205
-			''               => __( "Default", "geodirectory" ),
206
-			'rounded'        => 'rounded',
207
-			'rounded-top'    => 'rounded-top',
208
-			'rounded-right'  => 'rounded-right',
209
-			'rounded-bottom' => 'rounded-bottom',
210
-			'rounded-left'   => 'rounded-left',
211
-			'rounded-circle' => 'rounded-circle',
212
-			'rounded-pill'   => 'rounded-pill',
213
-			'rounded-0'      => 'rounded-0',
214
-		);
215
-	} elseif ( $type == 'rounded_size' ) {
216
-		$defaults['title']   = __( 'Border radius size' );
217
-		$defaults['options'] = array(
218
-			''   => __( "Default", "geodirectory" ),
219
-			'sm' => __( "Small", "geodirectory" ),
220
-			'lg' => __( "Large", "geodirectory" ),
221
-		);
222
-	} elseif ( $type == 'type' ) {
223
-		$defaults['title']   = __( 'Border type' );
224
-		$defaults['options'] = array(
225
-			''              => __( "None", "geodirectory" ),
226
-			'border'        => __( "Full", "geodirectory" ),
227
-			'border-top'    => __( "Top", "geodirectory" ),
228
-			'border-bottom' => __( "Bottom", "geodirectory" ),
229
-			'border-left'   => __( "Left", "geodirectory" ),
230
-			'border-right'  => __( "Right", "geodirectory" ),
231
-		);
232
-	} else {
233
-		$defaults['title']   = __( 'Border color' );
234
-		$defaults['options'] = array(
235
-			                       ''  => __( "Default", "geodirectory" ),
236
-			                       '0' => __( "None", "geodirectory" ),
237
-		                       ) + sd_aui_colors();
238
-	}
239
-
240
-	$input = wp_parse_args( $overwrite, $defaults );
241
-
242
-
243
-	return $input;
192
+    $defaults = array(
193
+        'type'     => 'select',
194
+        'title'    => __( 'Border' ),
195
+        'options'  => array(),
196
+        'default'  => '',
197
+        'desc_tip' => true,
198
+        'group'    => __( "Wrapper Styles", "geodirectory" )
199
+    );
200
+
201
+    // title
202
+    if ( $type == 'rounded' ) {
203
+        $defaults['title']   = __( 'Border radius type' );
204
+        $defaults['options'] = array(
205
+            ''               => __( "Default", "geodirectory" ),
206
+            'rounded'        => 'rounded',
207
+            'rounded-top'    => 'rounded-top',
208
+            'rounded-right'  => 'rounded-right',
209
+            'rounded-bottom' => 'rounded-bottom',
210
+            'rounded-left'   => 'rounded-left',
211
+            'rounded-circle' => 'rounded-circle',
212
+            'rounded-pill'   => 'rounded-pill',
213
+            'rounded-0'      => 'rounded-0',
214
+        );
215
+    } elseif ( $type == 'rounded_size' ) {
216
+        $defaults['title']   = __( 'Border radius size' );
217
+        $defaults['options'] = array(
218
+            ''   => __( "Default", "geodirectory" ),
219
+            'sm' => __( "Small", "geodirectory" ),
220
+            'lg' => __( "Large", "geodirectory" ),
221
+        );
222
+    } elseif ( $type == 'type' ) {
223
+        $defaults['title']   = __( 'Border type' );
224
+        $defaults['options'] = array(
225
+            ''              => __( "None", "geodirectory" ),
226
+            'border'        => __( "Full", "geodirectory" ),
227
+            'border-top'    => __( "Top", "geodirectory" ),
228
+            'border-bottom' => __( "Bottom", "geodirectory" ),
229
+            'border-left'   => __( "Left", "geodirectory" ),
230
+            'border-right'  => __( "Right", "geodirectory" ),
231
+        );
232
+    } else {
233
+        $defaults['title']   = __( 'Border color' );
234
+        $defaults['options'] = array(
235
+                                    ''  => __( "Default", "geodirectory" ),
236
+                                    '0' => __( "None", "geodirectory" ),
237
+                                ) + sd_aui_colors();
238
+    }
239
+
240
+    $input = wp_parse_args( $overwrite, $defaults );
241
+
242
+
243
+    return $input;
244 244
 }
245 245
 
246 246
 /**
@@ -252,27 +252,27 @@  discard block
 block discarded – undo
252 252
  * @return array
253 253
  */
254 254
 function sd_get_shadow_input( $type = 'shadow', $overwrite = array() ) {
255
-	$options = array(
256
-		""          => __( 'None' ),
257
-		"shadow-sm" => __( 'Small' ),
258
-		"shadow"    => __( 'Regular' ),
259
-		"shadow-lg" => __( 'Large' ),
260
-	);
255
+    $options = array(
256
+        ""          => __( 'None' ),
257
+        "shadow-sm" => __( 'Small' ),
258
+        "shadow"    => __( 'Regular' ),
259
+        "shadow-lg" => __( 'Large' ),
260
+    );
261 261
 
262
-	$defaults = array(
263
-		'type'     => 'select',
264
-		'title'    => __( 'Shadow' ),
265
-		'options'  => $options,
266
-		'default'  => '',
267
-		'desc_tip' => true,
268
-		'group'    => __( "Wrapper Styles", "geodirectory" )
269
-	);
262
+    $defaults = array(
263
+        'type'     => 'select',
264
+        'title'    => __( 'Shadow' ),
265
+        'options'  => $options,
266
+        'default'  => '',
267
+        'desc_tip' => true,
268
+        'group'    => __( "Wrapper Styles", "geodirectory" )
269
+    );
270 270
 
271 271
 
272
-	$input = wp_parse_args( $overwrite, $defaults );
272
+    $input = wp_parse_args( $overwrite, $defaults );
273 273
 
274 274
 
275
-	return $input;
275
+    return $input;
276 276
 }
277 277
 
278 278
 /**
@@ -284,25 +284,25 @@  discard block
 block discarded – undo
284 284
  * @return array
285 285
  */
286 286
 function sd_get_background_input( $type = 'bg', $overwrite = array() ) {
287
-	$options = array(
288
-		           ''            => __( "None", "geodirectory" ),
289
-		           'transparent' => __( "Transparent", "geodirectory" ),
290
-	           ) + sd_aui_colors();
287
+    $options = array(
288
+                    ''            => __( "None", "geodirectory" ),
289
+                    'transparent' => __( "Transparent", "geodirectory" ),
290
+                ) + sd_aui_colors();
291 291
 
292
-	$defaults = array(
293
-		'type'     => 'select',
294
-		'title'    => __( 'Background color' ),
295
-		'options'  => $options,
296
-		'default'  => '',
297
-		'desc_tip' => true,
298
-		'group'    => __( "Wrapper Styles", "geodirectory" )
299
-	);
292
+    $defaults = array(
293
+        'type'     => 'select',
294
+        'title'    => __( 'Background color' ),
295
+        'options'  => $options,
296
+        'default'  => '',
297
+        'desc_tip' => true,
298
+        'group'    => __( "Wrapper Styles", "geodirectory" )
299
+    );
300 300
 
301 301
 
302
-	$input = wp_parse_args( $overwrite, $defaults );
302
+    $input = wp_parse_args( $overwrite, $defaults );
303 303
 
304 304
 
305
-	return $input;
305
+    return $input;
306 306
 }
307 307
 
308 308
 /**
@@ -314,108 +314,108 @@  discard block
 block discarded – undo
314 314
  * @return array
315 315
  */
316 316
 function sd_get_background_inputs( $type = 'bg', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) {
317
-	$options = array(
318
-		           ''            => __( "None", "geodirectory" ),
319
-		           'transparent' => __( "Transparent", "geodirectory" ),
320
-	           ) + sd_aui_colors()
321
-	           + array(
322
-		           'custom-color'    => __( "Custom Color", "geodirectory" ),
323
-		           'custom-gradient' => __( "Custom Gradient", "geodirectory" ),
317
+    $options = array(
318
+                    ''            => __( "None", "geodirectory" ),
319
+                    'transparent' => __( "Transparent", "geodirectory" ),
320
+                ) + sd_aui_colors()
321
+               + array(
322
+                    'custom-color'    => __( "Custom Color", "geodirectory" ),
323
+                    'custom-gradient' => __( "Custom Gradient", "geodirectory" ),
324 324
 //		           'custom-image' => __("Custom Image","geodirectory"),
325
-	           );
326
-
327
-	$defaults = array(
328
-		'type'     => 'select',
329
-		'title'    => __( 'Background Color' ),
330
-		'options'  => $options,
331
-		'default'  => '',
332
-		'desc_tip' => true,
333
-		'group'    => __( "Background", "geodirectory" )
334
-	);
335
-
336
-
337
-	if ( $overwrite !== false ) {
338
-		$input[ $type ] = wp_parse_args( $overwrite, $defaults );
339
-	}
340
-
341
-
342
-	if ( $overwrite_color !== false ) {
343
-		$input[ $type . '_color' ] = wp_parse_args( $overwrite_color, array(
344
-			'type'            => 'color',
345
-			'title'           => __( 'Custom color' ),
346
-			'placeholder'     => '',
347
-			'default'         => '#0073aa',
348
-			'desc_tip'        => true,
349
-			'group'           => __( "Background" ),
350
-			'element_require' => '[%' . $type . '%]=="custom-color"'
351
-		) );
352
-	}
353
-
354
-
355
-	if ( $overwrite_gradient !== false ) {
356
-		$input[ $type . '_gradient' ] = wp_parse_args( $overwrite_gradient, array(
357
-			'type'            => 'gradient',
358
-			'title'           => __( 'Custom gradient' ),
359
-			'placeholder'     => '',
360
-			'default'         => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
361
-			'desc_tip'        => true,
362
-			'group'           => __( "Background" ),
363
-			'element_require' => '[%' . $type . '%]=="custom-gradient"'
364
-		) );
365
-	}
366
-
367
-	if ( $overwrite_image !== false ) {
368
-
369
-		$input[ $type . '_image_fixed' ] = array(
370
-			'type'            => 'checkbox',
371
-			'title'           => __( 'Fixed background' ),
372
-			'default'         => '',
373
-			'desc_tip'        => true,
374
-			'group'           => __( "Background" ),
375
-			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )'
376
-
377
-		);
378
-
379
-		$input[ $type . '_image_use_featured' ] = array(
380
-			'type'            => 'checkbox',
381
-			'title'           => __( 'Use featured image' ),
382
-			'default'         => '',
383
-			'desc_tip'        => true,
384
-			'group'           => __( "Background" ),
385
-			'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )'
386
-
387
-		);
388
-
389
-
390
-		$input[ $type . '_image' ] = wp_parse_args( $overwrite_image, array(
391
-			'type'        => 'image',
392
-			'title'       => __( 'Custom image' ),
393
-			'placeholder' => '',
394
-			'default'     => '',
395
-			'desc_tip'    => true,
396
-			'group'       => __( "Background" ),
325
+                );
326
+
327
+    $defaults = array(
328
+        'type'     => 'select',
329
+        'title'    => __( 'Background Color' ),
330
+        'options'  => $options,
331
+        'default'  => '',
332
+        'desc_tip' => true,
333
+        'group'    => __( "Background", "geodirectory" )
334
+    );
335
+
336
+
337
+    if ( $overwrite !== false ) {
338
+        $input[ $type ] = wp_parse_args( $overwrite, $defaults );
339
+    }
340
+
341
+
342
+    if ( $overwrite_color !== false ) {
343
+        $input[ $type . '_color' ] = wp_parse_args( $overwrite_color, array(
344
+            'type'            => 'color',
345
+            'title'           => __( 'Custom color' ),
346
+            'placeholder'     => '',
347
+            'default'         => '#0073aa',
348
+            'desc_tip'        => true,
349
+            'group'           => __( "Background" ),
350
+            'element_require' => '[%' . $type . '%]=="custom-color"'
351
+        ) );
352
+    }
353
+
354
+
355
+    if ( $overwrite_gradient !== false ) {
356
+        $input[ $type . '_gradient' ] = wp_parse_args( $overwrite_gradient, array(
357
+            'type'            => 'gradient',
358
+            'title'           => __( 'Custom gradient' ),
359
+            'placeholder'     => '',
360
+            'default'         => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)',
361
+            'desc_tip'        => true,
362
+            'group'           => __( "Background" ),
363
+            'element_require' => '[%' . $type . '%]=="custom-gradient"'
364
+        ) );
365
+    }
366
+
367
+    if ( $overwrite_image !== false ) {
368
+
369
+        $input[ $type . '_image_fixed' ] = array(
370
+            'type'            => 'checkbox',
371
+            'title'           => __( 'Fixed background' ),
372
+            'default'         => '',
373
+            'desc_tip'        => true,
374
+            'group'           => __( "Background" ),
375
+            'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )'
376
+
377
+        );
378
+
379
+        $input[ $type . '_image_use_featured' ] = array(
380
+            'type'            => 'checkbox',
381
+            'title'           => __( 'Use featured image' ),
382
+            'default'         => '',
383
+            'desc_tip'        => true,
384
+            'group'           => __( "Background" ),
385
+            'element_require' => '( [%' . $type . '%]=="" || [%' . $type . '%]=="custom-color" || [%' . $type . '%]=="custom-gradient" || [%' . $type . '%]=="transparent" )'
386
+
387
+        );
388
+
389
+
390
+        $input[ $type . '_image' ] = wp_parse_args( $overwrite_image, array(
391
+            'type'        => 'image',
392
+            'title'       => __( 'Custom image' ),
393
+            'placeholder' => '',
394
+            'default'     => '',
395
+            'desc_tip'    => true,
396
+            'group'       => __( "Background" ),
397 397
 //			'element_require' => ' ![%' . $type . '_image_use_featured%] '
398
-		) );
399
-
400
-		$input[ $type . '_image_id' ] = wp_parse_args( $overwrite_image, array(
401
-			'type'        => 'hidden',
402
-			'hidden_type' => 'number',
403
-			'title'       => '',
404
-			'placeholder' => '',
405
-			'default'     => '',
406
-			'group'       => __( "Background" ),
407
-		) );
408
-
409
-		$input[ $type . '_image_xy' ] = wp_parse_args( $overwrite_image, array(
410
-			'type'        => 'image_xy',
411
-			'title'       => '',
412
-			'placeholder' => '',
413
-			'default'     => '',
414
-			'group'       => __( "Background" ),
415
-		) );
416
-	}
417
-
418
-	return $input;
398
+        ) );
399
+
400
+        $input[ $type . '_image_id' ] = wp_parse_args( $overwrite_image, array(
401
+            'type'        => 'hidden',
402
+            'hidden_type' => 'number',
403
+            'title'       => '',
404
+            'placeholder' => '',
405
+            'default'     => '',
406
+            'group'       => __( "Background" ),
407
+        ) );
408
+
409
+        $input[ $type . '_image_xy' ] = wp_parse_args( $overwrite_image, array(
410
+            'type'        => 'image_xy',
411
+            'title'       => '',
412
+            'placeholder' => '',
413
+            'default'     => '',
414
+            'group'       => __( "Background" ),
415
+        ) );
416
+    }
417
+
418
+    return $input;
419 419
 }
420 420
 
421 421
 /**
@@ -428,169 +428,169 @@  discard block
 block discarded – undo
428 428
  */
429 429
 function sd_get_shape_divider_inputs( $type = 'sd', $overwrite = array(), $overwrite_color = array(), $overwrite_gradient = array(), $overwrite_image = array() ) {
430 430
 
431
-	$options = array(
432
-		''                      => __( "None" ),
433
-		'mountains'             => __( "Mountains" ),
434
-		'drops'                 => __( "Drops" ),
435
-		'clouds'                => __( "Clouds" ),
436
-		'zigzag'                => __( "Zigzag" ),
437
-		'pyramids'              => __( "Pyramids" ),
438
-		'triangle'              => __( "Triangle" ),
439
-		'triangle-asymmetrical' => __( "Triangle Asymmetrical" ),
440
-		'tilt'                  => __( "Tilt" ),
441
-		'opacity-tilt'          => __( "Opacity Tilt" ),
442
-		'opacity-fan'           => __( "Opacity Fan" ),
443
-		'curve'                 => __( "Curve" ),
444
-		'curve-asymmetrical'    => __( "Curve Asymmetrical" ),
445
-		'waves'                 => __( "Waves" ),
446
-		'wave-brush'            => __( "Wave Brush" ),
447
-		'waves-pattern'         => __( "Waves Pattern" ),
448
-		'arrow'                 => __( "Arrow" ),
449
-		'split'                 => __( "Split" ),
450
-		'book'                  => __( "Book" ),
451
-	);
452
-
453
-	$defaults = array(
454
-		'type'     => 'select',
455
-		'title'    => __( 'Type' ),
456
-		'options'  => $options,
457
-		'default'  => '',
458
-		'desc_tip' => true,
459
-		'group'    => __( "Shape Divider" ),
460
-	);
461
-
462
-
463
-	$input[ $type ] = wp_parse_args( $overwrite, $defaults );
464
-
465
-
466
-	$input[ $type . '_notice' ] = array(
467
-		'type'            => 'notice',
468
-		'desc'            => __( 'Parent element must be position `relative`' ),
469
-		'status'          => 'warning',
470
-		'group'           => __( "Shape Divider" ),
471
-		'element_require' => '[%' . $type . '%]!=""',
472
-	);
473
-
474
-
475
-	$input[ $type . '_position' ] = wp_parse_args( $overwrite_color, array(
476
-		'type'            => 'select',
477
-		'title'           => __( 'Position' ),
478
-		'options'         => array(
479
-			'top'    => __( 'Top' ),
480
-			'bottom' => __( 'Bottom' ),
481
-			//'left'   => __('Left'),
482
-			//'right'   => __('Right'),
483
-		),
484
-		'desc_tip'        => true,
485
-		'group'           => __( "Shape Divider" ),
486
-		'element_require' => '[%' . $type . '%]!=""'
487
-	) );
488
-
489
-	$options = array(
490
-		           ''            => __( "None" ),
491
-		           'transparent' => __( "Transparent" ),
492
-	           ) + sd_aui_colors()
493
-	           + array(
494
-		           'custom-color' => __( "Custom Color" ),
495
-	           );
496
-
497
-	$input[ $type . '_color' ] = wp_parse_args( $overwrite_color, array(
498
-		'type'            => 'select',
499
-		'title'           => __( 'Color' ),
500
-		'options'         => $options,
501
-		'desc_tip'        => true,
502
-		'group'           => __( "Shape Divider" ),
503
-		'element_require' => '[%' . $type . '%]!=""'
504
-	) );
505
-
506
-	$input[ $type . '_custom_color' ] = wp_parse_args( $overwrite_color, array(
507
-		'type'            => 'color',
508
-		'title'           => __( 'Custom color' ),
509
-		'placeholder'     => '',
510
-		'default'         => '#0073aa',
511
-		'desc_tip'        => true,
512
-		'group'           => __( "Shape Divider" ),
513
-		'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""'
514
-	) );
515
-
516
-	$input[ $type . '_width' ] = wp_parse_args( $overwrite_gradient, array(
517
-		'type'              => 'range',
518
-		'title'             => __( 'Width' ),
519
-		'placeholder'       => '',
520
-		'default'           => '200',
521
-		'desc_tip'          => true,
522
-		'custom_attributes' => array(
523
-			'min' => 100,
524
-			'max' => 300,
525
-		),
526
-		'group'             => __( "Shape Divider" ),
527
-		'element_require'   => '[%' . $type . '%]!=""'
528
-	) );
529
-
530
-	$input[ $type . '_height' ] = array(
531
-		'type'              => 'range',
532
-		'title'             => __( 'Height' ),
533
-		'default'           => '100',
534
-		'desc_tip'          => true,
535
-		'custom_attributes' => array(
536
-			'min' => 0,
537
-			'max' => 500,
538
-		),
539
-		'group'             => __( "Shape Divider" ),
540
-		'element_require'   => '[%' . $type . '%]!=""'
541
-	);
542
-
543
-	$requires = array(
544
-		'mountains'             => array( 'flip' ),
545
-		'drops'                 => array( 'flip', 'invert' ),
546
-		'clouds'                => array( 'flip', 'invert' ),
547
-		'zigzag'                => array(),
548
-		'pyramids'              => array( 'flip', 'invert' ),
549
-		'triangle'              => array( 'invert' ),
550
-		'triangle-asymmetrical' => array( 'flip', 'invert' ),
551
-		'tilt'                  => array( 'flip' ),
552
-		'opacity-tilt'          => array( 'flip' ),
553
-		'opacity-fan'           => array(),
554
-		'curve'                 => array( 'invert' ),
555
-		'curve-asymmetrical'    => array( 'flip', 'invert' ),
556
-		'waves'                 => array( 'flip', 'invert' ),
557
-		'wave-brush'            => array( 'flip' ),
558
-		'waves-pattern'         => array( 'flip' ),
559
-		'arrow'                 => array( 'invert' ),
560
-		'split'                 => array( 'invert' ),
561
-		'book'                  => array( 'invert' ),
562
-	);
563
-
564
-	$input[ $type . '_flip' ] = array(
565
-		'type'            => 'checkbox',
566
-		'title'           => __( 'Flip' ),
567
-		'default'         => '',
568
-		'desc_tip'        => true,
569
-		'group'           => __( "Shape Divider" ),
570
-		'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' )
571
-	);
572
-
573
-	$input[ $type . '_invert' ] = array(
574
-		'type'            => 'checkbox',
575
-		'title'           => __( 'Invert' ),
576
-		'default'         => '',
577
-		'desc_tip'        => true,
578
-		'group'           => __( "Shape Divider" ),
579
-		'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' )
580
-	);
581
-
582
-	$input[ $type . '_btf' ] = array(
583
-		'type'            => 'checkbox',
584
-		'title'           => __( 'Bring to front' ),
585
-		'default'         => '',
586
-		'desc_tip'        => true,
587
-		'group'           => __( "Shape Divider" ),
588
-		'element_require' => '[%' . $type . '%]!=""'
589
-
590
-	);
591
-
592
-
593
-	return $input;
431
+    $options = array(
432
+        ''                      => __( "None" ),
433
+        'mountains'             => __( "Mountains" ),
434
+        'drops'                 => __( "Drops" ),
435
+        'clouds'                => __( "Clouds" ),
436
+        'zigzag'                => __( "Zigzag" ),
437
+        'pyramids'              => __( "Pyramids" ),
438
+        'triangle'              => __( "Triangle" ),
439
+        'triangle-asymmetrical' => __( "Triangle Asymmetrical" ),
440
+        'tilt'                  => __( "Tilt" ),
441
+        'opacity-tilt'          => __( "Opacity Tilt" ),
442
+        'opacity-fan'           => __( "Opacity Fan" ),
443
+        'curve'                 => __( "Curve" ),
444
+        'curve-asymmetrical'    => __( "Curve Asymmetrical" ),
445
+        'waves'                 => __( "Waves" ),
446
+        'wave-brush'            => __( "Wave Brush" ),
447
+        'waves-pattern'         => __( "Waves Pattern" ),
448
+        'arrow'                 => __( "Arrow" ),
449
+        'split'                 => __( "Split" ),
450
+        'book'                  => __( "Book" ),
451
+    );
452
+
453
+    $defaults = array(
454
+        'type'     => 'select',
455
+        'title'    => __( 'Type' ),
456
+        'options'  => $options,
457
+        'default'  => '',
458
+        'desc_tip' => true,
459
+        'group'    => __( "Shape Divider" ),
460
+    );
461
+
462
+
463
+    $input[ $type ] = wp_parse_args( $overwrite, $defaults );
464
+
465
+
466
+    $input[ $type . '_notice' ] = array(
467
+        'type'            => 'notice',
468
+        'desc'            => __( 'Parent element must be position `relative`' ),
469
+        'status'          => 'warning',
470
+        'group'           => __( "Shape Divider" ),
471
+        'element_require' => '[%' . $type . '%]!=""',
472
+    );
473
+
474
+
475
+    $input[ $type . '_position' ] = wp_parse_args( $overwrite_color, array(
476
+        'type'            => 'select',
477
+        'title'           => __( 'Position' ),
478
+        'options'         => array(
479
+            'top'    => __( 'Top' ),
480
+            'bottom' => __( 'Bottom' ),
481
+            //'left'   => __('Left'),
482
+            //'right'   => __('Right'),
483
+        ),
484
+        'desc_tip'        => true,
485
+        'group'           => __( "Shape Divider" ),
486
+        'element_require' => '[%' . $type . '%]!=""'
487
+    ) );
488
+
489
+    $options = array(
490
+                    ''            => __( "None" ),
491
+                    'transparent' => __( "Transparent" ),
492
+                ) + sd_aui_colors()
493
+               + array(
494
+                    'custom-color' => __( "Custom Color" ),
495
+                );
496
+
497
+    $input[ $type . '_color' ] = wp_parse_args( $overwrite_color, array(
498
+        'type'            => 'select',
499
+        'title'           => __( 'Color' ),
500
+        'options'         => $options,
501
+        'desc_tip'        => true,
502
+        'group'           => __( "Shape Divider" ),
503
+        'element_require' => '[%' . $type . '%]!=""'
504
+    ) );
505
+
506
+    $input[ $type . '_custom_color' ] = wp_parse_args( $overwrite_color, array(
507
+        'type'            => 'color',
508
+        'title'           => __( 'Custom color' ),
509
+        'placeholder'     => '',
510
+        'default'         => '#0073aa',
511
+        'desc_tip'        => true,
512
+        'group'           => __( "Shape Divider" ),
513
+        'element_require' => '[%' . $type . '_color%]=="custom-color" && [%' . $type . '%]!=""'
514
+    ) );
515
+
516
+    $input[ $type . '_width' ] = wp_parse_args( $overwrite_gradient, array(
517
+        'type'              => 'range',
518
+        'title'             => __( 'Width' ),
519
+        'placeholder'       => '',
520
+        'default'           => '200',
521
+        'desc_tip'          => true,
522
+        'custom_attributes' => array(
523
+            'min' => 100,
524
+            'max' => 300,
525
+        ),
526
+        'group'             => __( "Shape Divider" ),
527
+        'element_require'   => '[%' . $type . '%]!=""'
528
+    ) );
529
+
530
+    $input[ $type . '_height' ] = array(
531
+        'type'              => 'range',
532
+        'title'             => __( 'Height' ),
533
+        'default'           => '100',
534
+        'desc_tip'          => true,
535
+        'custom_attributes' => array(
536
+            'min' => 0,
537
+            'max' => 500,
538
+        ),
539
+        'group'             => __( "Shape Divider" ),
540
+        'element_require'   => '[%' . $type . '%]!=""'
541
+    );
542
+
543
+    $requires = array(
544
+        'mountains'             => array( 'flip' ),
545
+        'drops'                 => array( 'flip', 'invert' ),
546
+        'clouds'                => array( 'flip', 'invert' ),
547
+        'zigzag'                => array(),
548
+        'pyramids'              => array( 'flip', 'invert' ),
549
+        'triangle'              => array( 'invert' ),
550
+        'triangle-asymmetrical' => array( 'flip', 'invert' ),
551
+        'tilt'                  => array( 'flip' ),
552
+        'opacity-tilt'          => array( 'flip' ),
553
+        'opacity-fan'           => array(),
554
+        'curve'                 => array( 'invert' ),
555
+        'curve-asymmetrical'    => array( 'flip', 'invert' ),
556
+        'waves'                 => array( 'flip', 'invert' ),
557
+        'wave-brush'            => array( 'flip' ),
558
+        'waves-pattern'         => array( 'flip' ),
559
+        'arrow'                 => array( 'invert' ),
560
+        'split'                 => array( 'invert' ),
561
+        'book'                  => array( 'invert' ),
562
+    );
563
+
564
+    $input[ $type . '_flip' ] = array(
565
+        'type'            => 'checkbox',
566
+        'title'           => __( 'Flip' ),
567
+        'default'         => '',
568
+        'desc_tip'        => true,
569
+        'group'           => __( "Shape Divider" ),
570
+        'element_require' => sd_get_element_require_string( $requires, 'flip', 'sd' )
571
+    );
572
+
573
+    $input[ $type . '_invert' ] = array(
574
+        'type'            => 'checkbox',
575
+        'title'           => __( 'Invert' ),
576
+        'default'         => '',
577
+        'desc_tip'        => true,
578
+        'group'           => __( "Shape Divider" ),
579
+        'element_require' => sd_get_element_require_string( $requires, 'invert', 'sd' )
580
+    );
581
+
582
+    $input[ $type . '_btf' ] = array(
583
+        'type'            => 'checkbox',
584
+        'title'           => __( 'Bring to front' ),
585
+        'default'         => '',
586
+        'desc_tip'        => true,
587
+        'group'           => __( "Shape Divider" ),
588
+        'element_require' => '[%' . $type . '%]!=""'
589
+
590
+    );
591
+
592
+
593
+    return $input;
594 594
 }
595 595
 
596 596
 /**
@@ -603,23 +603,23 @@  discard block
 block discarded – undo
603 603
  * @return string
604 604
  */
605 605
 function sd_get_element_require_string( $args, $key, $type ) {
606
-	$output   = '';
607
-	$requires = array();
606
+    $output   = '';
607
+    $requires = array();
608 608
 
609
-	if ( ! empty( $args ) ) {
610
-		foreach ( $args as $t => $k ) {
611
-			if ( in_array( $key, $k ) ) {
612
-				$requires[] = '[%' . $type . '%]=="' . $t . '"';
613
-			}
614
-		}
609
+    if ( ! empty( $args ) ) {
610
+        foreach ( $args as $t => $k ) {
611
+            if ( in_array( $key, $k ) ) {
612
+                $requires[] = '[%' . $type . '%]=="' . $t . '"';
613
+            }
614
+        }
615 615
 
616
-		if ( ! empty( $requires ) ) {
617
-			$output = '(' . implode( ' || ', $requires ) . ')';
618
-		}
619
-	}
616
+        if ( ! empty( $requires ) ) {
617
+            $output = '(' . implode( ' || ', $requires ) . ')';
618
+        }
619
+    }
620 620
 
621 621
 
622
-	return $output;
622
+    return $output;
623 623
 }
624 624
 
625 625
 /**
@@ -631,44 +631,44 @@  discard block
 block discarded – undo
631 631
  * @return array
632 632
  */
633 633
 function sd_get_text_color_input( $type = 'text_color', $overwrite = array(), $has_custom = false ) {
634
-	$options = array(
635
-		           '' => __( "None" ),
636
-	           ) + sd_aui_colors();
634
+    $options = array(
635
+                    '' => __( "None" ),
636
+                ) + sd_aui_colors();
637 637
 
638
-	if ( $has_custom ) {
639
-		$options['custom'] = __( 'Custom color' );
640
-	}
638
+    if ( $has_custom ) {
639
+        $options['custom'] = __( 'Custom color' );
640
+    }
641 641
 
642
-	$defaults = array(
643
-		'type'     => 'select',
644
-		'title'    => __( 'Text color' ),
645
-		'options'  => $options,
646
-		'default'  => '',
647
-		'desc_tip' => true,
648
-		'group'    => __( "Typography" )
649
-	);
642
+    $defaults = array(
643
+        'type'     => 'select',
644
+        'title'    => __( 'Text color' ),
645
+        'options'  => $options,
646
+        'default'  => '',
647
+        'desc_tip' => true,
648
+        'group'    => __( "Typography" )
649
+    );
650 650
 
651 651
 
652
-	$input = wp_parse_args( $overwrite, $defaults );
652
+    $input = wp_parse_args( $overwrite, $defaults );
653 653
 
654 654
 
655
-	return $input;
655
+    return $input;
656 656
 }
657 657
 
658 658
 function sd_get_text_color_input_group( $type = 'text_color', $overwrite = array(), $overwrite_custom = array() ) {
659
-	$inputs = array();
659
+    $inputs = array();
660 660
 
661
-	if ( $overwrite !== false ) {
662
-		$inputs[ $type ] = sd_get_text_color_input( $type, $overwrite, true );
663
-	}
661
+    if ( $overwrite !== false ) {
662
+        $inputs[ $type ] = sd_get_text_color_input( $type, $overwrite, true );
663
+    }
664 664
 
665
-	if ( $overwrite_custom !== false ) {
666
-		$custom            = $type . "_custom";
667
-		$inputs[ $custom ] = sd_get_custom_color_input( $custom, $overwrite_custom, $type );
668
-	}
665
+    if ( $overwrite_custom !== false ) {
666
+        $custom            = $type . "_custom";
667
+        $inputs[ $custom ] = sd_get_custom_color_input( $custom, $overwrite_custom, $type );
668
+    }
669 669
 
670 670
 
671
-	return $inputs;
671
+    return $inputs;
672 672
 }
673 673
 
674 674
 /**
@@ -682,24 +682,24 @@  discard block
 block discarded – undo
682 682
 function sd_get_custom_color_input( $type = 'color_custom', $overwrite = array(), $parent_type = '' ) {
683 683
 
684 684
 
685
-	$defaults = array(
686
-		'type'              => 'color',
687
-		'title'             => __( 'Custom color' ),
688
-		'default'           => '',
689
-		'placeholder'       => '',
690
-		'desc_tip'          => true,
691
-		'group'             => __( "Typography" )
692
-	);
685
+    $defaults = array(
686
+        'type'              => 'color',
687
+        'title'             => __( 'Custom color' ),
688
+        'default'           => '',
689
+        'placeholder'       => '',
690
+        'desc_tip'          => true,
691
+        'group'             => __( "Typography" )
692
+    );
693 693
 
694
-	if ( $parent_type ) {
695
-		$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
696
-	}
694
+    if ( $parent_type ) {
695
+        $defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
696
+    }
697 697
 
698 698
 
699
-	$input = wp_parse_args( $overwrite, $defaults );
699
+    $input = wp_parse_args( $overwrite, $defaults );
700 700
 
701 701
 
702
-	return $input;
702
+    return $input;
703 703
 }
704 704
 
705 705
 /**
@@ -712,45 +712,45 @@  discard block
 block discarded – undo
712 712
  */
713 713
 function sd_get_col_input( $type = 'col', $overwrite = array() ) {
714 714
 
715
-	$device_size = '';
716
-	if ( ! empty( $overwrite['device_type'] ) ) {
717
-		if ( $overwrite['device_type'] == 'Tablet' ) {
718
-			$device_size = '-md';
719
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
720
-			$device_size = '-lg';
721
-		}
722
-	}
723
-	$options = array(
724
-		''   => __( 'auto' ),
725
-		'1'  => '1/12',
726
-		'2'  => '2/12',
727
-		'3'  => '3/12',
728
-		'4'  => '4/12',
729
-		'5'  => '5/12',
730
-		'6'  => '6/12',
731
-		'7'  => '7/12',
732
-		'8'  => '8/12',
733
-		'9'  => '9/12',
734
-		'10' => '10/12',
735
-		'11' => '11/12',
736
-		'12' => '12/12',
737
-	);
738
-
739
-	$defaults = array(
740
-		'type'            => 'select',
741
-		'title'           => __( 'Column width' ),
742
-		'options'         => $options,
743
-		'default'         => '',
744
-		'desc_tip'        => true,
745
-		'group'           => __( "Container" ),
746
-		'element_require' => '[%container%]=="col"',
747
-	);
748
-
749
-
750
-	$input = wp_parse_args( $overwrite, $defaults );
751
-
752
-
753
-	return $input;
715
+    $device_size = '';
716
+    if ( ! empty( $overwrite['device_type'] ) ) {
717
+        if ( $overwrite['device_type'] == 'Tablet' ) {
718
+            $device_size = '-md';
719
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
720
+            $device_size = '-lg';
721
+        }
722
+    }
723
+    $options = array(
724
+        ''   => __( 'auto' ),
725
+        '1'  => '1/12',
726
+        '2'  => '2/12',
727
+        '3'  => '3/12',
728
+        '4'  => '4/12',
729
+        '5'  => '5/12',
730
+        '6'  => '6/12',
731
+        '7'  => '7/12',
732
+        '8'  => '8/12',
733
+        '9'  => '9/12',
734
+        '10' => '10/12',
735
+        '11' => '11/12',
736
+        '12' => '12/12',
737
+    );
738
+
739
+    $defaults = array(
740
+        'type'            => 'select',
741
+        'title'           => __( 'Column width' ),
742
+        'options'         => $options,
743
+        'default'         => '',
744
+        'desc_tip'        => true,
745
+        'group'           => __( "Container" ),
746
+        'element_require' => '[%container%]=="col"',
747
+    );
748
+
749
+
750
+    $input = wp_parse_args( $overwrite, $defaults );
751
+
752
+
753
+    return $input;
754 754
 }
755 755
 
756 756
 /**
@@ -763,39 +763,39 @@  discard block
 block discarded – undo
763 763
  */
764 764
 function sd_get_row_cols_input( $type = 'row_cols', $overwrite = array() ) {
765 765
 
766
-	$device_size = '';
767
-	if ( ! empty( $overwrite['device_type'] ) ) {
768
-		if ( $overwrite['device_type'] == 'Tablet' ) {
769
-			$device_size = '-md';
770
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
771
-			$device_size = '-lg';
772
-		}
773
-	}
774
-	$options = array(
775
-		''  => __( 'auto' ),
776
-		'1' => '1',
777
-		'2' => '2',
778
-		'3' => '3',
779
-		'4' => '4',
780
-		'5' => '5',
781
-		'6' => '6',
782
-	);
783
-
784
-	$defaults = array(
785
-		'type'            => 'select',
786
-		'title'           => __( 'Row columns' ),
787
-		'options'         => $options,
788
-		'default'         => '',
789
-		'desc_tip'        => true,
790
-		'group'           => __( "Container" ),
791
-		'element_require' => '[%container%]=="row"',
792
-	);
793
-
794
-
795
-	$input = wp_parse_args( $overwrite, $defaults );
796
-
797
-
798
-	return $input;
766
+    $device_size = '';
767
+    if ( ! empty( $overwrite['device_type'] ) ) {
768
+        if ( $overwrite['device_type'] == 'Tablet' ) {
769
+            $device_size = '-md';
770
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
771
+            $device_size = '-lg';
772
+        }
773
+    }
774
+    $options = array(
775
+        ''  => __( 'auto' ),
776
+        '1' => '1',
777
+        '2' => '2',
778
+        '3' => '3',
779
+        '4' => '4',
780
+        '5' => '5',
781
+        '6' => '6',
782
+    );
783
+
784
+    $defaults = array(
785
+        'type'            => 'select',
786
+        'title'           => __( 'Row columns' ),
787
+        'options'         => $options,
788
+        'default'         => '',
789
+        'desc_tip'        => true,
790
+        'group'           => __( "Container" ),
791
+        'element_require' => '[%container%]=="row"',
792
+    );
793
+
794
+
795
+    $input = wp_parse_args( $overwrite, $defaults );
796
+
797
+
798
+    return $input;
799 799
 }
800 800
 
801 801
 /**
@@ -808,35 +808,35 @@  discard block
 block discarded – undo
808 808
  */
809 809
 function sd_get_text_align_input( $type = 'text_align', $overwrite = array() ) {
810 810
 
811
-	$device_size = '';
812
-	if ( ! empty( $overwrite['device_type'] ) ) {
813
-		if ( $overwrite['device_type'] == 'Tablet' ) {
814
-			$device_size = '-md';
815
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
816
-			$device_size = '-lg';
817
-		}
818
-	}
819
-	$options = array(
820
-		''                                => __( "Default" ),
821
-		'text' . $device_size . '-left'   => __( "Left" ),
822
-		'text' . $device_size . '-right'  => __( "Right" ),
823
-		'text' . $device_size . '-center' => __( "Center" ),
824
-	);
825
-
826
-	$defaults = array(
827
-		'type'     => 'select',
828
-		'title'    => __( 'Text align' ),
829
-		'options'  => $options,
830
-		'default'  => '',
831
-		'desc_tip' => true,
832
-		'group'    => __( "Typography" )
833
-	);
834
-
835
-
836
-	$input = wp_parse_args( $overwrite, $defaults );
837
-
838
-
839
-	return $input;
811
+    $device_size = '';
812
+    if ( ! empty( $overwrite['device_type'] ) ) {
813
+        if ( $overwrite['device_type'] == 'Tablet' ) {
814
+            $device_size = '-md';
815
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
816
+            $device_size = '-lg';
817
+        }
818
+    }
819
+    $options = array(
820
+        ''                                => __( "Default" ),
821
+        'text' . $device_size . '-left'   => __( "Left" ),
822
+        'text' . $device_size . '-right'  => __( "Right" ),
823
+        'text' . $device_size . '-center' => __( "Center" ),
824
+    );
825
+
826
+    $defaults = array(
827
+        'type'     => 'select',
828
+        'title'    => __( 'Text align' ),
829
+        'options'  => $options,
830
+        'default'  => '',
831
+        'desc_tip' => true,
832
+        'group'    => __( "Typography" )
833
+    );
834
+
835
+
836
+    $input = wp_parse_args( $overwrite, $defaults );
837
+
838
+
839
+    return $input;
840 840
 }
841 841
 
842 842
 /**
@@ -849,41 +849,41 @@  discard block
 block discarded – undo
849 849
  */
850 850
 function sd_get_display_input( $type = 'display', $overwrite = array() ) {
851 851
 
852
-	$device_size = '';
853
-	if ( ! empty( $overwrite['device_type'] ) ) {
854
-		if ( $overwrite['device_type'] == 'Tablet' ) {
855
-			$device_size = '-md';
856
-		} elseif ( $overwrite['device_type'] == 'Desktop' ) {
857
-			$device_size = '-lg';
858
-		}
859
-	}
860
-	$options = array(
861
-		''                                   => __( "Default" ),
862
-		'd' . $device_size . '-none'         => "none",
863
-		'd' . $device_size . '-inline'       => "inline",
864
-		'd' . $device_size . '-inline-block' => "inline-block",
865
-		'd' . $device_size . '-block'        => "block",
866
-		'd' . $device_size . '-table'        => "table",
867
-		'd' . $device_size . '-table-cell'   => "table-cell",
868
-		'd' . $device_size . '-table-row'    => "table-row",
869
-		'd' . $device_size . '-flex'         => "flex",
870
-		'd' . $device_size . '-inline-flex'  => "inline-flex",
871
-	);
872
-
873
-	$defaults = array(
874
-		'type'     => 'select',
875
-		'title'    => __( 'Display' ),
876
-		'options'  => $options,
877
-		'default'  => '',
878
-		'desc_tip' => true,
879
-		'group'    => __( "Wrapper Styles" )
880
-	);
881
-
882
-
883
-	$input = wp_parse_args( $overwrite, $defaults );
884
-
885
-
886
-	return $input;
852
+    $device_size = '';
853
+    if ( ! empty( $overwrite['device_type'] ) ) {
854
+        if ( $overwrite['device_type'] == 'Tablet' ) {
855
+            $device_size = '-md';
856
+        } elseif ( $overwrite['device_type'] == 'Desktop' ) {
857
+            $device_size = '-lg';
858
+        }
859
+    }
860
+    $options = array(
861
+        ''                                   => __( "Default" ),
862
+        'd' . $device_size . '-none'         => "none",
863
+        'd' . $device_size . '-inline'       => "inline",
864
+        'd' . $device_size . '-inline-block' => "inline-block",
865
+        'd' . $device_size . '-block'        => "block",
866
+        'd' . $device_size . '-table'        => "table",
867
+        'd' . $device_size . '-table-cell'   => "table-cell",
868
+        'd' . $device_size . '-table-row'    => "table-row",
869
+        'd' . $device_size . '-flex'         => "flex",
870
+        'd' . $device_size . '-inline-flex'  => "inline-flex",
871
+    );
872
+
873
+    $defaults = array(
874
+        'type'     => 'select',
875
+        'title'    => __( 'Display' ),
876
+        'options'  => $options,
877
+        'default'  => '',
878
+        'desc_tip' => true,
879
+        'group'    => __( "Wrapper Styles" )
880
+    );
881
+
882
+
883
+    $input = wp_parse_args( $overwrite, $defaults );
884
+
885
+
886
+    return $input;
887 887
 }
888 888
 
889 889
 /**
@@ -896,19 +896,19 @@  discard block
 block discarded – undo
896 896
  */
897 897
 function sd_get_text_justify_input( $type = 'text_justify', $overwrite = array() ) {
898 898
 
899
-	$defaults = array(
900
-		'type'     => 'checkbox',
901
-		'title'    => __( 'Text justify' ),
902
-		'default'  => '',
903
-		'desc_tip' => true,
904
-		'group'    => __( "Typography" )
905
-	);
899
+    $defaults = array(
900
+        'type'     => 'checkbox',
901
+        'title'    => __( 'Text justify' ),
902
+        'default'  => '',
903
+        'desc_tip' => true,
904
+        'group'    => __( "Typography" )
905
+    );
906 906
 
907 907
 
908
-	$input = wp_parse_args( $overwrite, $defaults );
908
+    $input = wp_parse_args( $overwrite, $defaults );
909 909
 
910 910
 
911
-	return $input;
911
+    return $input;
912 912
 }
913 913
 
914 914
 /**
@@ -921,51 +921,51 @@  discard block
 block discarded – undo
921 921
  * @return array
922 922
  */
923 923
 function sd_aui_colors( $include_branding = false, $include_outlines = false, $outline_button_only_text = false ) {
924
-	$theme_colors = array();
925
-
926
-	$theme_colors["primary"]   = __( 'Primary' );
927
-	$theme_colors["secondary"] = __( 'Secondary' );
928
-	$theme_colors["success"]   = __( 'Success' );
929
-	$theme_colors["danger"]    = __( 'Danger' );
930
-	$theme_colors["warning"]   = __( 'Warning' );
931
-	$theme_colors["info"]      = __( 'Info' );
932
-	$theme_colors["light"]     = __( 'Light' );
933
-	$theme_colors["dark"]      = __( 'Dark' );
934
-	$theme_colors["white"]     = __( 'White' );
935
-	$theme_colors["purple"]    = __( 'Purple' );
936
-	$theme_colors["salmon"]    = __( 'Salmon' );
937
-	$theme_colors["cyan"]      = __( 'Cyan' );
938
-	$theme_colors["gray"]      = __( 'Gray' );
939
-	$theme_colors["gray-dark"]      = __( 'Gray dark' );
940
-	$theme_colors["indigo"]    = __( 'Indigo' );
941
-	$theme_colors["orange"]    = __( 'Orange' );
942
-
943
-	if ( $include_outlines ) {
944
-		$button_only                       = $outline_button_only_text ? " " . __( "(button only)" ) : '';
945
-		$theme_colors["outline-primary"]   = __( 'Primary outline' ) . $button_only;
946
-		$theme_colors["outline-secondary"] = __( 'Secondary outline' ) . $button_only;
947
-		$theme_colors["outline-success"]   = __( 'Success outline' ) . $button_only;
948
-		$theme_colors["outline-danger"]    = __( 'Danger outline' ) . $button_only;
949
-		$theme_colors["outline-warning"]   = __( 'Warning outline' ) . $button_only;
950
-		$theme_colors["outline-info"]      = __( 'Info outline' ) . $button_only;
951
-		$theme_colors["outline-light"]     = __( 'Light outline' ) . $button_only;
952
-		$theme_colors["outline-dark"]      = __( 'Dark outline' ) . $button_only;
953
-		$theme_colors["outline-white"]     = __( 'White outline' ) . $button_only;
954
-		$theme_colors["outline-purple"]    = __( 'Purple outline' ) . $button_only;
955
-		$theme_colors["outline-salmon"]    = __( 'Salmon outline' ) . $button_only;
956
-		$theme_colors["outline-cyan"]      = __( 'Cyan outline' ) . $button_only;
957
-		$theme_colors["outline-gray"]      = __( 'Gray outline' ) . $button_only;
958
-		$theme_colors["outline-gray-dark"]      = __( 'Gray dark outline' ) . $button_only;
959
-		$theme_colors["outline-indigo"]    = __( 'Indigo outline' ) . $button_only;
960
-		$theme_colors["outline-orange"]    = __( 'Orange outline' ) . $button_only;
961
-	}
962
-
963
-
964
-	if ( $include_branding ) {
965
-		$theme_colors = $theme_colors + sd_aui_branding_colors();
966
-	}
967
-
968
-	return apply_filters( 'sd_aui_colors', $theme_colors, $include_outlines, $include_branding );
924
+    $theme_colors = array();
925
+
926
+    $theme_colors["primary"]   = __( 'Primary' );
927
+    $theme_colors["secondary"] = __( 'Secondary' );
928
+    $theme_colors["success"]   = __( 'Success' );
929
+    $theme_colors["danger"]    = __( 'Danger' );
930
+    $theme_colors["warning"]   = __( 'Warning' );
931
+    $theme_colors["info"]      = __( 'Info' );
932
+    $theme_colors["light"]     = __( 'Light' );
933
+    $theme_colors["dark"]      = __( 'Dark' );
934
+    $theme_colors["white"]     = __( 'White' );
935
+    $theme_colors["purple"]    = __( 'Purple' );
936
+    $theme_colors["salmon"]    = __( 'Salmon' );
937
+    $theme_colors["cyan"]      = __( 'Cyan' );
938
+    $theme_colors["gray"]      = __( 'Gray' );
939
+    $theme_colors["gray-dark"]      = __( 'Gray dark' );
940
+    $theme_colors["indigo"]    = __( 'Indigo' );
941
+    $theme_colors["orange"]    = __( 'Orange' );
942
+
943
+    if ( $include_outlines ) {
944
+        $button_only                       = $outline_button_only_text ? " " . __( "(button only)" ) : '';
945
+        $theme_colors["outline-primary"]   = __( 'Primary outline' ) . $button_only;
946
+        $theme_colors["outline-secondary"] = __( 'Secondary outline' ) . $button_only;
947
+        $theme_colors["outline-success"]   = __( 'Success outline' ) . $button_only;
948
+        $theme_colors["outline-danger"]    = __( 'Danger outline' ) . $button_only;
949
+        $theme_colors["outline-warning"]   = __( 'Warning outline' ) . $button_only;
950
+        $theme_colors["outline-info"]      = __( 'Info outline' ) . $button_only;
951
+        $theme_colors["outline-light"]     = __( 'Light outline' ) . $button_only;
952
+        $theme_colors["outline-dark"]      = __( 'Dark outline' ) . $button_only;
953
+        $theme_colors["outline-white"]     = __( 'White outline' ) . $button_only;
954
+        $theme_colors["outline-purple"]    = __( 'Purple outline' ) . $button_only;
955
+        $theme_colors["outline-salmon"]    = __( 'Salmon outline' ) . $button_only;
956
+        $theme_colors["outline-cyan"]      = __( 'Cyan outline' ) . $button_only;
957
+        $theme_colors["outline-gray"]      = __( 'Gray outline' ) . $button_only;
958
+        $theme_colors["outline-gray-dark"]      = __( 'Gray dark outline' ) . $button_only;
959
+        $theme_colors["outline-indigo"]    = __( 'Indigo outline' ) . $button_only;
960
+        $theme_colors["outline-orange"]    = __( 'Orange outline' ) . $button_only;
961
+    }
962
+
963
+
964
+    if ( $include_branding ) {
965
+        $theme_colors = $theme_colors + sd_aui_branding_colors();
966
+    }
967
+
968
+    return apply_filters( 'sd_aui_colors', $theme_colors, $include_outlines, $include_branding );
969 969
 }
970 970
 
971 971
 /**
@@ -974,19 +974,19 @@  discard block
 block discarded – undo
974 974
  * @return array
975 975
  */
976 976
 function sd_aui_branding_colors() {
977
-	return array(
978
-		"facebook"  => __( 'Facebook' ),
979
-		"twitter"   => __( 'Twitter' ),
980
-		"instagram" => __( 'Instagram' ),
981
-		"linkedin"  => __( 'Linkedin' ),
982
-		"flickr"    => __( 'Flickr' ),
983
-		"github"    => __( 'GitHub' ),
984
-		"youtube"   => __( 'YouTube' ),
985
-		"wordpress" => __( 'WordPress' ),
986
-		"google"    => __( 'Google' ),
987
-		"yahoo"     => __( 'Yahoo' ),
988
-		"vkontakte" => __( 'Vkontakte' ),
989
-	);
977
+    return array(
978
+        "facebook"  => __( 'Facebook' ),
979
+        "twitter"   => __( 'Twitter' ),
980
+        "instagram" => __( 'Instagram' ),
981
+        "linkedin"  => __( 'Linkedin' ),
982
+        "flickr"    => __( 'Flickr' ),
983
+        "github"    => __( 'GitHub' ),
984
+        "youtube"   => __( 'YouTube' ),
985
+        "wordpress" => __( 'WordPress' ),
986
+        "google"    => __( 'Google' ),
987
+        "yahoo"     => __( 'Yahoo' ),
988
+        "vkontakte" => __( 'Vkontakte' ),
989
+    );
990 990
 }
991 991
 
992 992
 
@@ -1001,38 +1001,38 @@  discard block
 block discarded – undo
1001 1001
 function sd_get_container_class_input( $type = 'container', $overwrite = array() ) {
1002 1002
 
1003 1003
 
1004
-	$options = array(
1005
-		"container"       => __( 'container (default)' ),
1006
-		"container-sm"    => 'container-sm',
1007
-		"container-md"    => 'container-md',
1008
-		"container-lg"    => 'container-lg',
1009
-		"container-xl"    => 'container-xl',
1010
-		"container-xxl"   => 'container-xxl',
1011
-		"container-fluid" => 'container-fluid',
1012
-		"row"             => 'row',
1013
-		"col"             => 'col',
1014
-		"card"            => 'card',
1015
-		"card-header"     => 'card-header',
1016
-		"card-body"       => 'card-body',
1017
-		"card-footer"     => 'card-footer',
1018
-		"list-group"      => 'list-group',
1019
-		"list-group-item" => 'list-group-item',
1020
-	);
1021
-
1022
-	$defaults = array(
1023
-		'type'     => 'select',
1024
-		'title'    => __( 'Type' ),
1025
-		'options'  => $options,
1026
-		'default'  => '',
1027
-		'desc_tip' => true,
1028
-		'group'    => __( "Container" )
1029
-	);
1030
-
1031
-
1032
-	$input = wp_parse_args( $overwrite, $defaults );
1033
-
1034
-
1035
-	return $input;
1004
+    $options = array(
1005
+        "container"       => __( 'container (default)' ),
1006
+        "container-sm"    => 'container-sm',
1007
+        "container-md"    => 'container-md',
1008
+        "container-lg"    => 'container-lg',
1009
+        "container-xl"    => 'container-xl',
1010
+        "container-xxl"   => 'container-xxl',
1011
+        "container-fluid" => 'container-fluid',
1012
+        "row"             => 'row',
1013
+        "col"             => 'col',
1014
+        "card"            => 'card',
1015
+        "card-header"     => 'card-header',
1016
+        "card-body"       => 'card-body',
1017
+        "card-footer"     => 'card-footer',
1018
+        "list-group"      => 'list-group',
1019
+        "list-group-item" => 'list-group-item',
1020
+    );
1021
+
1022
+    $defaults = array(
1023
+        'type'     => 'select',
1024
+        'title'    => __( 'Type' ),
1025
+        'options'  => $options,
1026
+        'default'  => '',
1027
+        'desc_tip' => true,
1028
+        'group'    => __( "Container" )
1029
+    );
1030
+
1031
+
1032
+    $input = wp_parse_args( $overwrite, $defaults );
1033
+
1034
+
1035
+    return $input;
1036 1036
 }
1037 1037
 
1038 1038
 /**
@@ -1046,32 +1046,32 @@  discard block
 block discarded – undo
1046 1046
 function sd_get_position_class_input( $type = 'position', $overwrite = array() ) {
1047 1047
 
1048 1048
 
1049
-	$options = array(
1050
-		""                  => __( 'Default' ),
1051
-		"position-static"   => 'static',
1052
-		"position-relative" => 'relative',
1053
-		"position-absolute" => 'absolute',
1054
-		"position-fixed"    => 'fixed',
1055
-		"position-sticky"   => 'sticky',
1056
-		"fixed-top"         => 'fixed-top',
1057
-		"fixed-bottom"      => 'fixed-bottom',
1058
-		"sticky-top"        => 'sticky-top',
1059
-	);
1049
+    $options = array(
1050
+        ""                  => __( 'Default' ),
1051
+        "position-static"   => 'static',
1052
+        "position-relative" => 'relative',
1053
+        "position-absolute" => 'absolute',
1054
+        "position-fixed"    => 'fixed',
1055
+        "position-sticky"   => 'sticky',
1056
+        "fixed-top"         => 'fixed-top',
1057
+        "fixed-bottom"      => 'fixed-bottom',
1058
+        "sticky-top"        => 'sticky-top',
1059
+    );
1060 1060
 
1061
-	$defaults = array(
1062
-		'type'     => 'select',
1063
-		'title'    => __( 'Position' ),
1064
-		'options'  => $options,
1065
-		'default'  => '',
1066
-		'desc_tip' => true,
1067
-		'group'    => __( "Wrapper Styles" )
1068
-	);
1061
+    $defaults = array(
1062
+        'type'     => 'select',
1063
+        'title'    => __( 'Position' ),
1064
+        'options'  => $options,
1065
+        'default'  => '',
1066
+        'desc_tip' => true,
1067
+        'group'    => __( "Wrapper Styles" )
1068
+    );
1069 1069
 
1070 1070
 
1071
-	$input = wp_parse_args( $overwrite, $defaults );
1071
+    $input = wp_parse_args( $overwrite, $defaults );
1072 1072
 
1073 1073
 
1074
-	return $input;
1074
+    return $input;
1075 1075
 }
1076 1076
 
1077 1077
 /**
@@ -1084,40 +1084,40 @@  discard block
 block discarded – undo
1084 1084
  */
1085 1085
 function sd_get_sticky_offset_input( $type = 'top', $overwrite = array() ) {
1086 1086
 
1087
-	$defaults = array(
1088
-		'type'            => 'number',
1089
-		'title'           => __( 'Sticky offset' ),
1090
-		//'desc' =>  __('Sticky offset'),
1091
-		'default'         => '',
1092
-		'desc_tip'        => true,
1093
-		'group'           => __( "Wrapper Styles" ),
1094
-		'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"'
1095
-	);
1096
-
1097
-	// title
1098
-	if ( $type == 'top' ) {
1099
-		$defaults['title'] = __( 'Top offset' );
1100
-		$defaults['icon']  = 'box-top';
1101
-		$defaults['row']   = array(
1102
-			'title' => __( 'Sticky offset' ),
1103
-			'key'   => 'sticky-offset',
1104
-			'open'  => true,
1105
-			'class' => 'text-center',
1106
-		);
1107
-	} elseif ( $type == 'bottom' ) {
1108
-		$defaults['title'] = __( 'Bottom offset' );
1109
-		$defaults['icon']  = 'box-bottom';
1110
-		$defaults['row']   = array(
1111
-			'key'   => 'sticky-offset',
1112
-			'close' => true,
1113
-		);
1114
-	}
1115
-
1116
-
1117
-	$input = wp_parse_args( $overwrite, $defaults );
1118
-
1119
-
1120
-	return $input;
1087
+    $defaults = array(
1088
+        'type'            => 'number',
1089
+        'title'           => __( 'Sticky offset' ),
1090
+        //'desc' =>  __('Sticky offset'),
1091
+        'default'         => '',
1092
+        'desc_tip'        => true,
1093
+        'group'           => __( "Wrapper Styles" ),
1094
+        'element_require' => '[%position%]=="sticky" || [%position%]=="sticky-top"'
1095
+    );
1096
+
1097
+    // title
1098
+    if ( $type == 'top' ) {
1099
+        $defaults['title'] = __( 'Top offset' );
1100
+        $defaults['icon']  = 'box-top';
1101
+        $defaults['row']   = array(
1102
+            'title' => __( 'Sticky offset' ),
1103
+            'key'   => 'sticky-offset',
1104
+            'open'  => true,
1105
+            'class' => 'text-center',
1106
+        );
1107
+    } elseif ( $type == 'bottom' ) {
1108
+        $defaults['title'] = __( 'Bottom offset' );
1109
+        $defaults['icon']  = 'box-bottom';
1110
+        $defaults['row']   = array(
1111
+            'key'   => 'sticky-offset',
1112
+            'close' => true,
1113
+        );
1114
+    }
1115
+
1116
+
1117
+    $input = wp_parse_args( $overwrite, $defaults );
1118
+
1119
+
1120
+    return $input;
1121 1121
 }
1122 1122
 
1123 1123
 /**
@@ -1131,38 +1131,38 @@  discard block
 block discarded – undo
1131 1131
 function sd_get_font_size_input( $type = 'font_size', $overwrite = array(), $has_custom = false ) {
1132 1132
 
1133 1133
 
1134
-	$options = array(
1135
-		""          => __( 'Inherit from parent' ),
1136
-		"h6"        => 'h6',
1137
-		"h5"        => 'h5',
1138
-		"h4"        => 'h4',
1139
-		"h3"        => 'h3',
1140
-		"h2"        => 'h2',
1141
-		"h1"        => 'h1',
1142
-		"display-1" => "display-1",
1143
-		"display-2" => "display-2",
1144
-		"display-3" => "display-3",
1145
-		"display-4" => "display-4",
1146
-	);
1134
+    $options = array(
1135
+        ""          => __( 'Inherit from parent' ),
1136
+        "h6"        => 'h6',
1137
+        "h5"        => 'h5',
1138
+        "h4"        => 'h4',
1139
+        "h3"        => 'h3',
1140
+        "h2"        => 'h2',
1141
+        "h1"        => 'h1',
1142
+        "display-1" => "display-1",
1143
+        "display-2" => "display-2",
1144
+        "display-3" => "display-3",
1145
+        "display-4" => "display-4",
1146
+    );
1147 1147
 
1148
-	if ( $has_custom ) {
1149
-		$options['custom'] = __( 'Custom size' );
1150
-	}
1148
+    if ( $has_custom ) {
1149
+        $options['custom'] = __( 'Custom size' );
1150
+    }
1151 1151
 
1152
-	$defaults = array(
1153
-		'type'     => 'select',
1154
-		'title'    => __( 'Font size' ),
1155
-		'options'  => $options,
1156
-		'default'  => '',
1157
-		'desc_tip' => true,
1158
-		'group'    => __( "Typography" )
1159
-	);
1152
+    $defaults = array(
1153
+        'type'     => 'select',
1154
+        'title'    => __( 'Font size' ),
1155
+        'options'  => $options,
1156
+        'default'  => '',
1157
+        'desc_tip' => true,
1158
+        'group'    => __( "Typography" )
1159
+    );
1160 1160
 
1161 1161
 
1162
-	$input = wp_parse_args( $overwrite, $defaults );
1162
+    $input = wp_parse_args( $overwrite, $defaults );
1163 1163
 
1164 1164
 
1165
-	return $input;
1165
+    return $input;
1166 1166
 }
1167 1167
 
1168 1168
 /**
@@ -1176,29 +1176,29 @@  discard block
 block discarded – undo
1176 1176
 function sd_get_font_custom_size_input( $type = 'font_size_custom', $overwrite = array(), $parent_type = '' ) {
1177 1177
 
1178 1178
 
1179
-	$defaults = array(
1180
-		'type'              => 'number',
1181
-		'title'             => __( 'Font size (rem)' ),
1182
-		'default'           => '',
1183
-		'placeholder'       => '1.25',
1184
-		'custom_attributes' => array(
1185
-			'step' => '0.1',
1186
-			'min'  => '0',
1187
-			'max'  => '100',
1188
-		),
1189
-		'desc_tip'          => true,
1190
-		'group'             => __( "Typography" )
1191
-	);
1179
+    $defaults = array(
1180
+        'type'              => 'number',
1181
+        'title'             => __( 'Font size (rem)' ),
1182
+        'default'           => '',
1183
+        'placeholder'       => '1.25',
1184
+        'custom_attributes' => array(
1185
+            'step' => '0.1',
1186
+            'min'  => '0',
1187
+            'max'  => '100',
1188
+        ),
1189
+        'desc_tip'          => true,
1190
+        'group'             => __( "Typography" )
1191
+    );
1192 1192
 
1193
-	if ( $parent_type ) {
1194
-		$defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
1195
-	}
1193
+    if ( $parent_type ) {
1194
+        $defaults['element_require'] = '[%' . $parent_type . '%]=="custom"';
1195
+    }
1196 1196
 
1197 1197
 
1198
-	$input = wp_parse_args( $overwrite, $defaults );
1198
+    $input = wp_parse_args( $overwrite, $defaults );
1199 1199
 
1200 1200
 
1201
-	return $input;
1201
+    return $input;
1202 1202
 }
1203 1203
 
1204 1204
 /**
@@ -1212,19 +1212,19 @@  discard block
 block discarded – undo
1212 1212
 function sd_get_font_size_input_group( $type = 'font_size', $overwrite = array(), $overwrite_custom = array() ) {
1213 1213
 
1214 1214
 
1215
-	$inputs = array();
1215
+    $inputs = array();
1216 1216
 
1217
-	if ( $overwrite !== false ) {
1218
-		$inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true );
1219
-	}
1217
+    if ( $overwrite !== false ) {
1218
+        $inputs[ $type ] = sd_get_font_size_input( $type, $overwrite, true );
1219
+    }
1220 1220
 
1221
-	if ( $overwrite_custom !== false ) {
1222
-		$custom            = $type . "_custom";
1223
-		$inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type );
1224
-	}
1221
+    if ( $overwrite_custom !== false ) {
1222
+        $custom            = $type . "_custom";
1223
+        $inputs[ $custom ] = sd_get_font_custom_size_input( $custom, $overwrite_custom, $type );
1224
+    }
1225 1225
 
1226 1226
 
1227
-	return $inputs;
1227
+    return $inputs;
1228 1228
 }
1229 1229
 
1230 1230
 /**
@@ -1238,35 +1238,35 @@  discard block
 block discarded – undo
1238 1238
 function sd_get_font_weight_input( $type = 'font_weight', $overwrite = array() ) {
1239 1239
 
1240 1240
 
1241
-	$options = array(
1242
-		""                                => __( 'Inherit' ),
1243
-		"font-weight-bold"                => 'bold',
1244
-		"font-weight-bolder"              => 'bolder',
1245
-		"font-weight-normal"              => 'normal',
1246
-		"font-weight-light"               => 'light',
1247
-		"font-weight-lighter"             => 'lighter',
1248
-		"font-italic"                     => 'italic',
1249
-		"font-weight-bold font-italic"    => 'bold italic',
1250
-		"font-weight-bolder font-italic"  => 'bolder italic',
1251
-		"font-weight-normal font-italic"  => 'normal italic',
1252
-		"font-weight-light font-italic"   => 'light italic',
1253
-		"font-weight-lighter font-italic" => 'lighter italic',
1254
-	);
1241
+    $options = array(
1242
+        ""                                => __( 'Inherit' ),
1243
+        "font-weight-bold"                => 'bold',
1244
+        "font-weight-bolder"              => 'bolder',
1245
+        "font-weight-normal"              => 'normal',
1246
+        "font-weight-light"               => 'light',
1247
+        "font-weight-lighter"             => 'lighter',
1248
+        "font-italic"                     => 'italic',
1249
+        "font-weight-bold font-italic"    => 'bold italic',
1250
+        "font-weight-bolder font-italic"  => 'bolder italic',
1251
+        "font-weight-normal font-italic"  => 'normal italic',
1252
+        "font-weight-light font-italic"   => 'light italic',
1253
+        "font-weight-lighter font-italic" => 'lighter italic',
1254
+    );
1255 1255
 
1256
-	$defaults = array(
1257
-		'type'     => 'select',
1258
-		'title'    => __( 'Appearance' ),
1259
-		'options'  => $options,
1260
-		'default'  => '',
1261
-		'desc_tip' => true,
1262
-		'group'    => __( "Typography" )
1263
-	);
1256
+    $defaults = array(
1257
+        'type'     => 'select',
1258
+        'title'    => __( 'Appearance' ),
1259
+        'options'  => $options,
1260
+        'default'  => '',
1261
+        'desc_tip' => true,
1262
+        'group'    => __( "Typography" )
1263
+    );
1264 1264
 
1265 1265
 
1266
-	$input = wp_parse_args( $overwrite, $defaults );
1266
+    $input = wp_parse_args( $overwrite, $defaults );
1267 1267
 
1268 1268
 
1269
-	return $input;
1269
+    return $input;
1270 1270
 }
1271 1271
 
1272 1272
 /**
@@ -1280,27 +1280,27 @@  discard block
 block discarded – undo
1280 1280
 function sd_get_font_case_input( $type = 'font_weight', $overwrite = array() ) {
1281 1281
 
1282 1282
 
1283
-	$options = array(
1284
-		""                => __( 'Default' ),
1285
-		"text-lowercase"  => __( 'lowercase' ),
1286
-		"text-uppercase"  => __( 'UPPERCASE' ),
1287
-		"text-capitalize" => __( 'Capitalize' ),
1288
-	);
1283
+    $options = array(
1284
+        ""                => __( 'Default' ),
1285
+        "text-lowercase"  => __( 'lowercase' ),
1286
+        "text-uppercase"  => __( 'UPPERCASE' ),
1287
+        "text-capitalize" => __( 'Capitalize' ),
1288
+    );
1289 1289
 
1290
-	$defaults = array(
1291
-		'type'     => 'select',
1292
-		'title'    => __( 'Letter case' ),
1293
-		'options'  => $options,
1294
-		'default'  => '',
1295
-		'desc_tip' => true,
1296
-		'group'    => __( "Typography" )
1297
-	);
1290
+    $defaults = array(
1291
+        'type'     => 'select',
1292
+        'title'    => __( 'Letter case' ),
1293
+        'options'  => $options,
1294
+        'default'  => '',
1295
+        'desc_tip' => true,
1296
+        'group'    => __( "Typography" )
1297
+    );
1298 1298
 
1299 1299
 
1300
-	$input = wp_parse_args( $overwrite, $defaults );
1300
+    $input = wp_parse_args( $overwrite, $defaults );
1301 1301
 
1302 1302
 
1303
-	return $input;
1303
+    return $input;
1304 1304
 }
1305 1305
 
1306 1306
 /**
@@ -1315,24 +1315,24 @@  discard block
 block discarded – undo
1315 1315
 function sd_get_font_italic_input( $type = 'font_italic', $overwrite = array() ) {
1316 1316
 
1317 1317
 
1318
-	$options = array(
1319
-		""            => __( 'No' ),
1320
-		"font-italic" => __( 'Yes' )
1321
-	);
1318
+    $options = array(
1319
+        ""            => __( 'No' ),
1320
+        "font-italic" => __( 'Yes' )
1321
+    );
1322 1322
 
1323
-	$defaults = array(
1324
-		'type'     => 'select',
1325
-		'title'    => __( 'Font italic' ),
1326
-		'options'  => $options,
1327
-		'default'  => '',
1328
-		'desc_tip' => true,
1329
-		'group'    => __( "Typography" )
1330
-	);
1323
+    $defaults = array(
1324
+        'type'     => 'select',
1325
+        'title'    => __( 'Font italic' ),
1326
+        'options'  => $options,
1327
+        'default'  => '',
1328
+        'desc_tip' => true,
1329
+        'group'    => __( "Typography" )
1330
+    );
1331 1331
 
1332
-	$input = wp_parse_args( $overwrite, $defaults );
1332
+    $input = wp_parse_args( $overwrite, $defaults );
1333 1333
 
1334 1334
 
1335
-	return $input;
1335
+    return $input;
1336 1336
 }
1337 1337
 
1338 1338
 /**
@@ -1346,19 +1346,19 @@  discard block
 block discarded – undo
1346 1346
 function sd_get_anchor_input( $type = 'anchor', $overwrite = array() ) {
1347 1347
 
1348 1348
 
1349
-	$defaults = array(
1350
-		'type'     => 'text',
1351
-		'title'    => __( 'HTML anchor' ),
1352
-		'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.' ),
1353
-		'default'  => '',
1354
-		'desc_tip' => true,
1355
-		'group'    => __( "Advanced" )
1356
-	);
1349
+    $defaults = array(
1350
+        'type'     => 'text',
1351
+        'title'    => __( 'HTML anchor' ),
1352
+        '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.' ),
1353
+        'default'  => '',
1354
+        'desc_tip' => true,
1355
+        'group'    => __( "Advanced" )
1356
+    );
1357 1357
 
1358
-	$input = wp_parse_args( $overwrite, $defaults );
1358
+    $input = wp_parse_args( $overwrite, $defaults );
1359 1359
 
1360 1360
 
1361
-	return $input;
1361
+    return $input;
1362 1362
 }
1363 1363
 
1364 1364
 /**
@@ -1371,19 +1371,19 @@  discard block
 block discarded – undo
1371 1371
  */
1372 1372
 function sd_get_class_input( $type = 'css_class', $overwrite = array() ) {
1373 1373
 
1374
-	$defaults = array(
1375
-		'type'     => 'text',
1376
-		'title'    => __( 'Additional CSS class(es)' ),
1377
-		'desc'     => __( 'Separate multiple classes with spaces.' ),
1378
-		'default'  => '',
1379
-		'desc_tip' => true,
1380
-		'group'    => __( "Advanced" )
1381
-	);
1374
+    $defaults = array(
1375
+        'type'     => 'text',
1376
+        'title'    => __( 'Additional CSS class(es)' ),
1377
+        'desc'     => __( 'Separate multiple classes with spaces.' ),
1378
+        'default'  => '',
1379
+        'desc_tip' => true,
1380
+        'group'    => __( "Advanced" )
1381
+    );
1382 1382
 
1383
-	$input = wp_parse_args( $overwrite, $defaults );
1383
+    $input = wp_parse_args( $overwrite, $defaults );
1384 1384
 
1385 1385
 
1386
-	return $input;
1386
+    return $input;
1387 1387
 }
1388 1388
 
1389 1389
 
@@ -1397,318 +1397,318 @@  discard block
 block discarded – undo
1397 1397
  */
1398 1398
 function sd_build_aui_class( $args ) {
1399 1399
 
1400
-	$classes = array();
1401
-
1402
-	// margins.
1403
-	if ( isset( $args['mt'] ) && $args['mt'] !== '' ) {
1404
-		$classes[] = "mt-" . sanitize_html_class( $args['mt'] );
1405
-		$mt        = $args['mt'];
1406
-	} else {
1407
-		$mt = null;
1408
-	}
1409
-	if ( isset( $args['mr'] ) && $args['mr'] !== '' ) {
1410
-		$classes[] = "mr-" . sanitize_html_class( $args['mr'] );
1411
-		$mr        = $args['mr'];
1412
-	} else {
1413
-		$mr = null;
1414
-	}
1415
-	if ( isset( $args['mb'] ) && $args['mb'] !== '' ) {
1416
-		$classes[] = "mb-" . sanitize_html_class( $args['mb'] );
1417
-		$mb        = $args['mb'];
1418
-	} else {
1419
-		$mb = null;
1420
-	}
1421
-	if ( isset( $args['ml'] ) && $args['ml'] !== '' ) {
1422
-		$classes[] = "ml-" . sanitize_html_class( $args['ml'] );
1423
-		$ml        = $args['ml'];
1424
-	} else {
1425
-		$ml = null;
1426
-	}
1427
-
1428
-	// margins tablet.
1429
-	if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) {
1430
-		$classes[] = "mt-md-" . sanitize_html_class( $args['mt_md'] );
1431
-		$mt_md     = $args['mt_md'];
1432
-	} else {
1433
-		$mt_md = null;
1434
-	}
1435
-	if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) {
1436
-		$classes[] = "mr-md-" . sanitize_html_class( $args['mr_md'] );
1437
-		$mt_md     = $args['mr_md'];
1438
-	} else {
1439
-		$mr_md = null;
1440
-	}
1441
-	if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) {
1442
-		$classes[] = "mb-md-" . sanitize_html_class( $args['mb_md'] );
1443
-		$mt_md     = $args['mb_md'];
1444
-	} else {
1445
-		$mb_md = null;
1446
-	}
1447
-	if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) {
1448
-		$classes[] = "ml-md-" . sanitize_html_class( $args['ml_md'] );
1449
-		$mt_md     = $args['ml_md'];
1450
-	} else {
1451
-		$ml_md = null;
1452
-	}
1453
-
1454
-	// margins desktop.
1455
-	if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) {
1456
-		if ( $mt == null && $mt_md == null ) {
1457
-			$classes[] = "mt-" . sanitize_html_class( $args['mt_lg'] );
1458
-		} else {
1459
-			$classes[] = "mt-lg-" . sanitize_html_class( $args['mt_lg'] );
1460
-		}
1461
-	}
1462
-	if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) {
1463
-		if ( $mr == null && $mr_md == null ) {
1464
-			$classes[] = "mr-" . sanitize_html_class( $args['mr_lg'] );
1465
-		} else {
1466
-			$classes[] = "mr-lg-" . sanitize_html_class( $args['mr_lg'] );
1467
-		}
1468
-	}
1469
-	if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) {
1470
-		if ( $mb == null && $mb_md == null ) {
1471
-			$classes[] = "mb-" . sanitize_html_class( $args['mb_lg'] );
1472
-		} else {
1473
-			$classes[] = "mb-lg-" . sanitize_html_class( $args['mb_lg'] );
1474
-		}
1475
-	}
1476
-	if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) {
1477
-		if ( $ml == null && $ml_md == null ) {
1478
-			$classes[] = "ml-" . sanitize_html_class( $args['ml_lg'] );
1479
-		} else {
1480
-			$classes[] = "ml-lg-" . sanitize_html_class( $args['ml_lg'] );
1481
-		}
1482
-	}
1483
-
1484
-
1485
-	// padding.
1486
-	if ( isset( $args['pt'] ) && $args['pt'] !== '' ) {
1487
-		$classes[] = "pt-" . sanitize_html_class( $args['pt'] );
1488
-		$pt        = $args['pt'];
1489
-	} else {
1490
-		$pt = null;
1491
-	}
1492
-	if ( isset( $args['pr'] ) && $args['pr'] !== '' ) {
1493
-		$classes[] = "pr-" . sanitize_html_class( $args['pr'] );
1494
-		$pr        = $args['pr'];
1495
-	} else {
1496
-		$pr = null;
1497
-	}
1498
-	if ( isset( $args['pb'] ) && $args['pb'] !== '' ) {
1499
-		$classes[] = "pb-" . sanitize_html_class( $args['pb'] );
1500
-		$pb        = $args['pb'];
1501
-	} else {
1502
-		$pb = null;
1503
-	}
1504
-	if ( isset( $args['pl'] ) && $args['pl'] !== '' ) {
1505
-		$classes[] = "pl-" . sanitize_html_class( $args['pl'] );
1506
-		$pl        = $args['pl'];
1507
-	} else {
1508
-		$pl = null;
1509
-	}
1510
-
1511
-	// padding tablet.
1512
-	if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) {
1513
-		$classes[] = "pt-md-" . sanitize_html_class( $args['pt_md'] );
1514
-		$pt_md     = $args['pt_md'];
1515
-	} else {
1516
-		$pt_md = null;
1517
-	}
1518
-	if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) {
1519
-		$classes[] = "pr-md-" . sanitize_html_class( $args['pr_md'] );
1520
-		$pt_md     = $args['pr_md'];
1521
-	} else {
1522
-		$pr_md = null;
1523
-	}
1524
-	if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) {
1525
-		$classes[] = "pb-md-" . sanitize_html_class( $args['pb_md'] );
1526
-		$pt_md     = $args['pb_md'];
1527
-	} else {
1528
-		$pb_md = null;
1529
-	}
1530
-	if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) {
1531
-		$classes[] = "pl-md-" . sanitize_html_class( $args['pl_md'] );
1532
-		$pt_md     = $args['pl_md'];
1533
-	} else {
1534
-		$pl_md = null;
1535
-	}
1536
-
1537
-	// padding desktop.
1538
-	if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) {
1539
-		if ( $pt == null && $pt_md == null ) {
1540
-			$classes[] = "pt-" . sanitize_html_class( $args['pt_lg'] );
1541
-		} else {
1542
-			$classes[] = "pt-lg-" . sanitize_html_class( $args['pt_lg'] );
1543
-		}
1544
-	}
1545
-	if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) {
1546
-		if ( $pr == null && $pr_md == null ) {
1547
-			$classes[] = "pr-" . sanitize_html_class( $args['pr_lg'] );
1548
-		} else {
1549
-			$classes[] = "pr-lg-" . sanitize_html_class( $args['pr_lg'] );
1550
-		}
1551
-	}
1552
-	if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) {
1553
-		if ( $pb == null && $pb_md == null ) {
1554
-			$classes[] = "pb-" . sanitize_html_class( $args['pb_lg'] );
1555
-		} else {
1556
-			$classes[] = "pb-lg-" . sanitize_html_class( $args['pb_lg'] );
1557
-		}
1558
-	}
1559
-	if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) {
1560
-		if ( $pl == null && $pl_md == null ) {
1561
-			$classes[] = "pl-" . sanitize_html_class( $args['pl_lg'] );
1562
-		} else {
1563
-			$classes[] = "pl-lg-" . sanitize_html_class( $args['pl_lg'] );
1564
-		}
1565
-	}
1566
-
1567
-	// row cols, mobile, tablet, desktop
1568
-	if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) {
1569
-		$classes[] = sanitize_html_class( "row-cols-" . $args['row_cols'] );
1570
-		$row_cols  = $args['row_cols'];
1571
-	} else {
1572
-		$row_cols = null;
1573
-	}
1574
-	if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) {
1575
-		$classes[]   = sanitize_html_class( "row-cols-md-" . $args['row_cols_md'] );
1576
-		$row_cols_md = $args['row_cols_md'];
1577
-	} else {
1578
-		$row_cols_md = null;
1579
-	}
1580
-	if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) {
1581
-		if ( $row_cols == null && $row_cols_md == null ) {
1582
-			$classes[] = sanitize_html_class( "row-cols-" . $args['row_cols_lg'] );
1583
-		} else {
1584
-			$classes[] = sanitize_html_class( "row-cols-lg-" . $args['row_cols_lg'] );
1585
-		}
1586
-	}
1587
-
1588
-	// columns , mobile, tablet, desktop
1589
-	if ( ! empty( $args['col'] ) && $args['col'] !== '' ) {
1590
-		$classes[] = sanitize_html_class( "col-" . $args['col'] );
1591
-		$col       = $args['col'];
1592
-	} else {
1593
-		$col = null;
1594
-	}
1595
-	if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) {
1596
-		$classes[] = sanitize_html_class( "col-md-" . $args['col_md'] );
1597
-		$col_md    = $args['col_md'];
1598
-	} else {
1599
-		$col_md = null;
1600
-	}
1601
-	if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) {
1602
-		if ( $col == null && $col_md == null ) {
1603
-			$classes[] = sanitize_html_class( "col-" . $args['col_lg'] );
1604
-		} else {
1605
-			$classes[] = sanitize_html_class( "col-lg-" . $args['col_lg'] );
1606
-		}
1607
-	}
1608
-
1609
-
1610
-	// border
1611
-	if ( ! empty( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' ) ) {
1612
-		$classes[] = "border-0";
1613
-	} elseif ( ! empty( $args['border'] ) ) {
1614
-		$classes[] = "border border-" . sanitize_html_class( $args['border'] );
1615
-	}
1616
-
1617
-	// border radius type
1618
-	if ( ! empty( $args['rounded'] ) ) {
1619
-		$classes[] = sanitize_html_class( $args['rounded'] );
1620
-	}
1621
-
1622
-	// border radius size
1623
-	if ( ! empty( $args['rounded_size'] ) ) {
1624
-		$classes[] = "rounded-" . sanitize_html_class( $args['rounded_size'] );
1625
-		// if we set a size then we need to remove "rounded" if set
1626
-		if ( ( $key = array_search( "rounded", $classes ) ) !== false ) {
1627
-			unset( $classes[ $key ] );
1628
-		}
1629
-	}
1630
-
1631
-	// shadow
1632
-	//if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); }
1633
-
1634
-	// background
1635
-	if ( ! empty( $args['bg'] ) ) {
1636
-		$classes[] = "bg-" . sanitize_html_class( $args['bg'] );
1637
-	}
1638
-
1639
-	// text_color
1640
-	if ( ! empty( $args['text_color'] ) ) {
1641
-		$classes[] = "text-" . sanitize_html_class( $args['text_color'] );
1642
-	}
1643
-
1644
-	// text_align
1645
-	if ( ! empty( $args['text_justify'] ) ) {
1646
-		$classes[] = 'text-justify';
1647
-	} else {
1648
-		if ( ! empty( $args['text_align'] ) ) {
1649
-			$classes[]  = sanitize_html_class( $args['text_align'] );
1650
-			$text_align = $args['text_align'];
1651
-		} else {
1652
-			$text_align = null;
1653
-		}
1654
-		if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) {
1655
-			$classes[]     = sanitize_html_class( $args['text_align_md'] );
1656
-			$text_align_md = $args['text_align_md'];
1657
-		} else {
1658
-			$text_align_md = null;
1659
-		}
1660
-		if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) {
1661
-			if ( $text_align == null && $text_align_md == null ) {
1662
-				$classes[] = sanitize_html_class( str_replace( "-lg", "", $args['text_align_lg'] ) );
1663
-			} else {
1664
-				$classes[] = sanitize_html_class( $args['text_align_lg'] );
1665
-			}
1666
-		}
1667
-	}
1668
-
1669
-	// display
1670
-	if ( ! empty( $args['display'] ) ) {
1671
-		$classes[] = sanitize_html_class( $args['display'] );
1672
-		$display   = $args['display'];
1673
-	} else {
1674
-		$display = null;
1675
-	}
1676
-	if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) {
1677
-		$classes[]  = sanitize_html_class( $args['display_md'] );
1678
-		$display_md = $args['display_md'];
1679
-	} else {
1680
-		$display_md = null;
1681
-	}
1682
-	if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) {
1683
-		if ( $display == null && $display_md == null ) {
1684
-			$classes[] = sanitize_html_class( str_replace( "-lg", "", $args['display_lg'] ) );
1685
-		} else {
1686
-			$classes[] = sanitize_html_class( $args['display_lg'] );
1687
-		}
1688
-	}
1689
-
1690
-
1691
-	// bgtus - background transparent until scroll
1692
-	if ( ! empty( $args['bgtus'] ) ) {
1693
-		$classes[] = sanitize_html_class( "bg-transparent-until-scroll" );
1694
-	}
1695
-
1696
-
1697
-	// build classes from build keys
1698
-	$build_keys = sd_get_class_build_keys();
1699
-	if ( ! empty( $build_keys ) ) {
1700
-		foreach ( $build_keys as $key ) {
1701
-			if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) {
1702
-				continue;
1703
-			}
1704
-			if ( ! empty( $args[ $key ] ) ) {
1705
-				$classes[] = sd_sanitize_html_classes( $args[ $key ] );
1706
-			}
1707
-		}
1708
-	}
1709
-
1710
-
1711
-	return implode( " ", $classes );
1400
+    $classes = array();
1401
+
1402
+    // margins.
1403
+    if ( isset( $args['mt'] ) && $args['mt'] !== '' ) {
1404
+        $classes[] = "mt-" . sanitize_html_class( $args['mt'] );
1405
+        $mt        = $args['mt'];
1406
+    } else {
1407
+        $mt = null;
1408
+    }
1409
+    if ( isset( $args['mr'] ) && $args['mr'] !== '' ) {
1410
+        $classes[] = "mr-" . sanitize_html_class( $args['mr'] );
1411
+        $mr        = $args['mr'];
1412
+    } else {
1413
+        $mr = null;
1414
+    }
1415
+    if ( isset( $args['mb'] ) && $args['mb'] !== '' ) {
1416
+        $classes[] = "mb-" . sanitize_html_class( $args['mb'] );
1417
+        $mb        = $args['mb'];
1418
+    } else {
1419
+        $mb = null;
1420
+    }
1421
+    if ( isset( $args['ml'] ) && $args['ml'] !== '' ) {
1422
+        $classes[] = "ml-" . sanitize_html_class( $args['ml'] );
1423
+        $ml        = $args['ml'];
1424
+    } else {
1425
+        $ml = null;
1426
+    }
1427
+
1428
+    // margins tablet.
1429
+    if ( isset( $args['mt_md'] ) && $args['mt_md'] !== '' ) {
1430
+        $classes[] = "mt-md-" . sanitize_html_class( $args['mt_md'] );
1431
+        $mt_md     = $args['mt_md'];
1432
+    } else {
1433
+        $mt_md = null;
1434
+    }
1435
+    if ( isset( $args['mr_md'] ) && $args['mr_md'] !== '' ) {
1436
+        $classes[] = "mr-md-" . sanitize_html_class( $args['mr_md'] );
1437
+        $mt_md     = $args['mr_md'];
1438
+    } else {
1439
+        $mr_md = null;
1440
+    }
1441
+    if ( isset( $args['mb_md'] ) && $args['mb_md'] !== '' ) {
1442
+        $classes[] = "mb-md-" . sanitize_html_class( $args['mb_md'] );
1443
+        $mt_md     = $args['mb_md'];
1444
+    } else {
1445
+        $mb_md = null;
1446
+    }
1447
+    if ( isset( $args['ml_md'] ) && $args['ml_md'] !== '' ) {
1448
+        $classes[] = "ml-md-" . sanitize_html_class( $args['ml_md'] );
1449
+        $mt_md     = $args['ml_md'];
1450
+    } else {
1451
+        $ml_md = null;
1452
+    }
1453
+
1454
+    // margins desktop.
1455
+    if ( isset( $args['mt_lg'] ) && $args['mt_lg'] !== '' ) {
1456
+        if ( $mt == null && $mt_md == null ) {
1457
+            $classes[] = "mt-" . sanitize_html_class( $args['mt_lg'] );
1458
+        } else {
1459
+            $classes[] = "mt-lg-" . sanitize_html_class( $args['mt_lg'] );
1460
+        }
1461
+    }
1462
+    if ( isset( $args['mr_lg'] ) && $args['mr_lg'] !== '' ) {
1463
+        if ( $mr == null && $mr_md == null ) {
1464
+            $classes[] = "mr-" . sanitize_html_class( $args['mr_lg'] );
1465
+        } else {
1466
+            $classes[] = "mr-lg-" . sanitize_html_class( $args['mr_lg'] );
1467
+        }
1468
+    }
1469
+    if ( isset( $args['mb_lg'] ) && $args['mb_lg'] !== '' ) {
1470
+        if ( $mb == null && $mb_md == null ) {
1471
+            $classes[] = "mb-" . sanitize_html_class( $args['mb_lg'] );
1472
+        } else {
1473
+            $classes[] = "mb-lg-" . sanitize_html_class( $args['mb_lg'] );
1474
+        }
1475
+    }
1476
+    if ( isset( $args['ml_lg'] ) && $args['ml_lg'] !== '' ) {
1477
+        if ( $ml == null && $ml_md == null ) {
1478
+            $classes[] = "ml-" . sanitize_html_class( $args['ml_lg'] );
1479
+        } else {
1480
+            $classes[] = "ml-lg-" . sanitize_html_class( $args['ml_lg'] );
1481
+        }
1482
+    }
1483
+
1484
+
1485
+    // padding.
1486
+    if ( isset( $args['pt'] ) && $args['pt'] !== '' ) {
1487
+        $classes[] = "pt-" . sanitize_html_class( $args['pt'] );
1488
+        $pt        = $args['pt'];
1489
+    } else {
1490
+        $pt = null;
1491
+    }
1492
+    if ( isset( $args['pr'] ) && $args['pr'] !== '' ) {
1493
+        $classes[] = "pr-" . sanitize_html_class( $args['pr'] );
1494
+        $pr        = $args['pr'];
1495
+    } else {
1496
+        $pr = null;
1497
+    }
1498
+    if ( isset( $args['pb'] ) && $args['pb'] !== '' ) {
1499
+        $classes[] = "pb-" . sanitize_html_class( $args['pb'] );
1500
+        $pb        = $args['pb'];
1501
+    } else {
1502
+        $pb = null;
1503
+    }
1504
+    if ( isset( $args['pl'] ) && $args['pl'] !== '' ) {
1505
+        $classes[] = "pl-" . sanitize_html_class( $args['pl'] );
1506
+        $pl        = $args['pl'];
1507
+    } else {
1508
+        $pl = null;
1509
+    }
1510
+
1511
+    // padding tablet.
1512
+    if ( isset( $args['pt_md'] ) && $args['pt_md'] !== '' ) {
1513
+        $classes[] = "pt-md-" . sanitize_html_class( $args['pt_md'] );
1514
+        $pt_md     = $args['pt_md'];
1515
+    } else {
1516
+        $pt_md = null;
1517
+    }
1518
+    if ( isset( $args['pr_md'] ) && $args['pr_md'] !== '' ) {
1519
+        $classes[] = "pr-md-" . sanitize_html_class( $args['pr_md'] );
1520
+        $pt_md     = $args['pr_md'];
1521
+    } else {
1522
+        $pr_md = null;
1523
+    }
1524
+    if ( isset( $args['pb_md'] ) && $args['pb_md'] !== '' ) {
1525
+        $classes[] = "pb-md-" . sanitize_html_class( $args['pb_md'] );
1526
+        $pt_md     = $args['pb_md'];
1527
+    } else {
1528
+        $pb_md = null;
1529
+    }
1530
+    if ( isset( $args['pl_md'] ) && $args['pl_md'] !== '' ) {
1531
+        $classes[] = "pl-md-" . sanitize_html_class( $args['pl_md'] );
1532
+        $pt_md     = $args['pl_md'];
1533
+    } else {
1534
+        $pl_md = null;
1535
+    }
1536
+
1537
+    // padding desktop.
1538
+    if ( isset( $args['pt_lg'] ) && $args['pt_lg'] !== '' ) {
1539
+        if ( $pt == null && $pt_md == null ) {
1540
+            $classes[] = "pt-" . sanitize_html_class( $args['pt_lg'] );
1541
+        } else {
1542
+            $classes[] = "pt-lg-" . sanitize_html_class( $args['pt_lg'] );
1543
+        }
1544
+    }
1545
+    if ( isset( $args['pr_lg'] ) && $args['pr_lg'] !== '' ) {
1546
+        if ( $pr == null && $pr_md == null ) {
1547
+            $classes[] = "pr-" . sanitize_html_class( $args['pr_lg'] );
1548
+        } else {
1549
+            $classes[] = "pr-lg-" . sanitize_html_class( $args['pr_lg'] );
1550
+        }
1551
+    }
1552
+    if ( isset( $args['pb_lg'] ) && $args['pb_lg'] !== '' ) {
1553
+        if ( $pb == null && $pb_md == null ) {
1554
+            $classes[] = "pb-" . sanitize_html_class( $args['pb_lg'] );
1555
+        } else {
1556
+            $classes[] = "pb-lg-" . sanitize_html_class( $args['pb_lg'] );
1557
+        }
1558
+    }
1559
+    if ( isset( $args['pl_lg'] ) && $args['pl_lg'] !== '' ) {
1560
+        if ( $pl == null && $pl_md == null ) {
1561
+            $classes[] = "pl-" . sanitize_html_class( $args['pl_lg'] );
1562
+        } else {
1563
+            $classes[] = "pl-lg-" . sanitize_html_class( $args['pl_lg'] );
1564
+        }
1565
+    }
1566
+
1567
+    // row cols, mobile, tablet, desktop
1568
+    if ( ! empty( $args['row_cols'] ) && $args['row_cols'] !== '' ) {
1569
+        $classes[] = sanitize_html_class( "row-cols-" . $args['row_cols'] );
1570
+        $row_cols  = $args['row_cols'];
1571
+    } else {
1572
+        $row_cols = null;
1573
+    }
1574
+    if ( ! empty( $args['row_cols_md'] ) && $args['row_cols_md'] !== '' ) {
1575
+        $classes[]   = sanitize_html_class( "row-cols-md-" . $args['row_cols_md'] );
1576
+        $row_cols_md = $args['row_cols_md'];
1577
+    } else {
1578
+        $row_cols_md = null;
1579
+    }
1580
+    if ( ! empty( $args['row_cols_lg'] ) && $args['row_cols_lg'] !== '' ) {
1581
+        if ( $row_cols == null && $row_cols_md == null ) {
1582
+            $classes[] = sanitize_html_class( "row-cols-" . $args['row_cols_lg'] );
1583
+        } else {
1584
+            $classes[] = sanitize_html_class( "row-cols-lg-" . $args['row_cols_lg'] );
1585
+        }
1586
+    }
1587
+
1588
+    // columns , mobile, tablet, desktop
1589
+    if ( ! empty( $args['col'] ) && $args['col'] !== '' ) {
1590
+        $classes[] = sanitize_html_class( "col-" . $args['col'] );
1591
+        $col       = $args['col'];
1592
+    } else {
1593
+        $col = null;
1594
+    }
1595
+    if ( ! empty( $args['col_md'] ) && $args['col_md'] !== '' ) {
1596
+        $classes[] = sanitize_html_class( "col-md-" . $args['col_md'] );
1597
+        $col_md    = $args['col_md'];
1598
+    } else {
1599
+        $col_md = null;
1600
+    }
1601
+    if ( ! empty( $args['col_lg'] ) && $args['col_lg'] !== '' ) {
1602
+        if ( $col == null && $col_md == null ) {
1603
+            $classes[] = sanitize_html_class( "col-" . $args['col_lg'] );
1604
+        } else {
1605
+            $classes[] = sanitize_html_class( "col-lg-" . $args['col_lg'] );
1606
+        }
1607
+    }
1608
+
1609
+
1610
+    // border
1611
+    if ( ! empty( $args['border'] ) && ( $args['border'] == 'none' || $args['border'] === '0' ) ) {
1612
+        $classes[] = "border-0";
1613
+    } elseif ( ! empty( $args['border'] ) ) {
1614
+        $classes[] = "border border-" . sanitize_html_class( $args['border'] );
1615
+    }
1616
+
1617
+    // border radius type
1618
+    if ( ! empty( $args['rounded'] ) ) {
1619
+        $classes[] = sanitize_html_class( $args['rounded'] );
1620
+    }
1621
+
1622
+    // border radius size
1623
+    if ( ! empty( $args['rounded_size'] ) ) {
1624
+        $classes[] = "rounded-" . sanitize_html_class( $args['rounded_size'] );
1625
+        // if we set a size then we need to remove "rounded" if set
1626
+        if ( ( $key = array_search( "rounded", $classes ) ) !== false ) {
1627
+            unset( $classes[ $key ] );
1628
+        }
1629
+    }
1630
+
1631
+    // shadow
1632
+    //if ( !empty( $args['shadow'] ) ) { $classes[] = sanitize_html_class($args['shadow']); }
1633
+
1634
+    // background
1635
+    if ( ! empty( $args['bg'] ) ) {
1636
+        $classes[] = "bg-" . sanitize_html_class( $args['bg'] );
1637
+    }
1638
+
1639
+    // text_color
1640
+    if ( ! empty( $args['text_color'] ) ) {
1641
+        $classes[] = "text-" . sanitize_html_class( $args['text_color'] );
1642
+    }
1643
+
1644
+    // text_align
1645
+    if ( ! empty( $args['text_justify'] ) ) {
1646
+        $classes[] = 'text-justify';
1647
+    } else {
1648
+        if ( ! empty( $args['text_align'] ) ) {
1649
+            $classes[]  = sanitize_html_class( $args['text_align'] );
1650
+            $text_align = $args['text_align'];
1651
+        } else {
1652
+            $text_align = null;
1653
+        }
1654
+        if ( ! empty( $args['text_align_md'] ) && $args['text_align_md'] !== '' ) {
1655
+            $classes[]     = sanitize_html_class( $args['text_align_md'] );
1656
+            $text_align_md = $args['text_align_md'];
1657
+        } else {
1658
+            $text_align_md = null;
1659
+        }
1660
+        if ( ! empty( $args['text_align_lg'] ) && $args['text_align_lg'] !== '' ) {
1661
+            if ( $text_align == null && $text_align_md == null ) {
1662
+                $classes[] = sanitize_html_class( str_replace( "-lg", "", $args['text_align_lg'] ) );
1663
+            } else {
1664
+                $classes[] = sanitize_html_class( $args['text_align_lg'] );
1665
+            }
1666
+        }
1667
+    }
1668
+
1669
+    // display
1670
+    if ( ! empty( $args['display'] ) ) {
1671
+        $classes[] = sanitize_html_class( $args['display'] );
1672
+        $display   = $args['display'];
1673
+    } else {
1674
+        $display = null;
1675
+    }
1676
+    if ( ! empty( $args['display_md'] ) && $args['display_md'] !== '' ) {
1677
+        $classes[]  = sanitize_html_class( $args['display_md'] );
1678
+        $display_md = $args['display_md'];
1679
+    } else {
1680
+        $display_md = null;
1681
+    }
1682
+    if ( ! empty( $args['display_lg'] ) && $args['display_lg'] !== '' ) {
1683
+        if ( $display == null && $display_md == null ) {
1684
+            $classes[] = sanitize_html_class( str_replace( "-lg", "", $args['display_lg'] ) );
1685
+        } else {
1686
+            $classes[] = sanitize_html_class( $args['display_lg'] );
1687
+        }
1688
+    }
1689
+
1690
+
1691
+    // bgtus - background transparent until scroll
1692
+    if ( ! empty( $args['bgtus'] ) ) {
1693
+        $classes[] = sanitize_html_class( "bg-transparent-until-scroll" );
1694
+    }
1695
+
1696
+
1697
+    // build classes from build keys
1698
+    $build_keys = sd_get_class_build_keys();
1699
+    if ( ! empty( $build_keys ) ) {
1700
+        foreach ( $build_keys as $key ) {
1701
+            if ( $key == 'font_size' && ! empty( $args[ $key ] ) && $args[ $key ] == 'custom' ) {
1702
+                continue;
1703
+            }
1704
+            if ( ! empty( $args[ $key ] ) ) {
1705
+                $classes[] = sd_sanitize_html_classes( $args[ $key ] );
1706
+            }
1707
+        }
1708
+    }
1709
+
1710
+
1711
+    return implode( " ", $classes );
1712 1712
 }
1713 1713
 
1714 1714
 /**
@@ -1720,80 +1720,80 @@  discard block
 block discarded – undo
1720 1720
  */
1721 1721
 function sd_build_aui_styles( $args ) {
1722 1722
 
1723
-	$styles = array();
1724
-
1725
-	// background color
1726
-	if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) {
1727
-		if ( $args['bg'] == 'custom-color' ) {
1728
-			$styles['background-color'] = $args['bg_color'];
1729
-		} else if ( $args['bg'] == 'custom-gradient' ) {
1730
-			$styles['background-image'] = $args['bg_gradient'];
1731
-
1732
-			// use background on text.
1733
-			if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) {
1734
-				$styles['background-clip']         = "text";
1735
-				$styles['-webkit-background-clip'] = "text";
1736
-				$styles['text-fill-color']         = "transparent";
1737
-				$styles['-webkit-text-fill-color'] = "transparent";
1738
-			}
1739
-		}
1740
-	}
1741
-
1742
-	if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) {
1743
-		$hasImage = true;
1744
-		if ( $styles['background-color'] !== undefined && $args['bg'] == 'custom-color' ) {
1745
-			$styles['background-image']      = "url(" . $args['bg_image'] . ")";
1746
-			$styles['background-blend-mode'] = "overlay";
1747
-		} else if ( $styles['background-image'] !== undefined && $args['bg'] == 'custom-gradient' ) {
1748
-			$styles['background-image'] .= ",url(" . $args['bg_image'] . ")";
1749
-		} else if ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) {
1750
-			// do nothing as we alreay have a preset
1751
-			$hasImage = false;
1752
-		} else {
1753
-			$styles['background-image'] = "url(" . $args['bg_image'] . ")";
1754
-		}
1755
-
1756
-		if ( $hasImage ) {
1757
-			$styles['background-size'] = "cover";
1758
-
1759
-			if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) {
1760
-				$styles['background-attachment'] = "fixed";
1761
-			}
1762
-		}
1763
-
1764
-		if ( $hasImage && ! empty( $args['bg_image_xy'] ) && $args['bg_image_xy'] . x . length ) {
1765
-			$styles['background-position'] = ( $args['bg_image_xy'] . x * 100 ) . "% " . ( $args['bg_image_xy'] . y * 100 ) . "%";
1766
-		}
1767
-	}
1768
-
1769
-	// sticky offset top
1770
-	if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) {
1771
-		$styles['top'] = absint( $args['sticky_offset_top'] );
1772
-	}
1773
-
1774
-	// sticky offset bottom
1775
-	if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) {
1776
-		$styles['bottom'] = absint( $args['sticky_offset_bottom'] );
1777
-	}
1778
-
1779
-	// font size
1780
-	if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) {
1781
-		$styles['font-size'] = (float) $args['font_size_custom'] . "rem";
1782
-	}
1783
-
1784
-	// font color
1785
-	if ( ! empty( $args['text_color_custom'] ) && $args['text_color_custom'] !== '' ) {
1786
-		$styles['color'] = esc_attr( $args['text_color_custom'] );
1787
-	}
1788
-
1789
-	$style_string = '';
1790
-	if ( ! empty( $styles ) ) {
1791
-		foreach ( $styles as $key => $val ) {
1792
-			$style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';';
1793
-		}
1794
-	}
1795
-
1796
-	return $style_string;
1723
+    $styles = array();
1724
+
1725
+    // background color
1726
+    if ( ! empty( $args['bg'] ) && $args['bg'] !== '' ) {
1727
+        if ( $args['bg'] == 'custom-color' ) {
1728
+            $styles['background-color'] = $args['bg_color'];
1729
+        } else if ( $args['bg'] == 'custom-gradient' ) {
1730
+            $styles['background-image'] = $args['bg_gradient'];
1731
+
1732
+            // use background on text.
1733
+            if ( ! empty( $args['bg_on_text'] ) && $args['bg_on_text'] ) {
1734
+                $styles['background-clip']         = "text";
1735
+                $styles['-webkit-background-clip'] = "text";
1736
+                $styles['text-fill-color']         = "transparent";
1737
+                $styles['-webkit-text-fill-color'] = "transparent";
1738
+            }
1739
+        }
1740
+    }
1741
+
1742
+    if ( ! empty( $args['bg_image'] ) && $args['bg_image'] !== '' ) {
1743
+        $hasImage = true;
1744
+        if ( $styles['background-color'] !== undefined && $args['bg'] == 'custom-color' ) {
1745
+            $styles['background-image']      = "url(" . $args['bg_image'] . ")";
1746
+            $styles['background-blend-mode'] = "overlay";
1747
+        } else if ( $styles['background-image'] !== undefined && $args['bg'] == 'custom-gradient' ) {
1748
+            $styles['background-image'] .= ",url(" . $args['bg_image'] . ")";
1749
+        } else if ( ! empty( $args['bg'] ) && $args['bg'] != '' && $args['bg'] != 'transparent' ) {
1750
+            // do nothing as we alreay have a preset
1751
+            $hasImage = false;
1752
+        } else {
1753
+            $styles['background-image'] = "url(" . $args['bg_image'] . ")";
1754
+        }
1755
+
1756
+        if ( $hasImage ) {
1757
+            $styles['background-size'] = "cover";
1758
+
1759
+            if ( ! empty( $args['bg_image_fixed'] ) && $args['bg_image_fixed'] ) {
1760
+                $styles['background-attachment'] = "fixed";
1761
+            }
1762
+        }
1763
+
1764
+        if ( $hasImage && ! empty( $args['bg_image_xy'] ) && $args['bg_image_xy'] . x . length ) {
1765
+            $styles['background-position'] = ( $args['bg_image_xy'] . x * 100 ) . "% " . ( $args['bg_image_xy'] . y * 100 ) . "%";
1766
+        }
1767
+    }
1768
+
1769
+    // sticky offset top
1770
+    if ( ! empty( $args['sticky_offset_top'] ) && $args['sticky_offset_top'] !== '' ) {
1771
+        $styles['top'] = absint( $args['sticky_offset_top'] );
1772
+    }
1773
+
1774
+    // sticky offset bottom
1775
+    if ( ! empty( $args['sticky_offset_bottom'] ) && $args['sticky_offset_bottom'] !== '' ) {
1776
+        $styles['bottom'] = absint( $args['sticky_offset_bottom'] );
1777
+    }
1778
+
1779
+    // font size
1780
+    if ( ! empty( $args['font_size_custom'] ) && $args['font_size_custom'] !== '' ) {
1781
+        $styles['font-size'] = (float) $args['font_size_custom'] . "rem";
1782
+    }
1783
+
1784
+    // font color
1785
+    if ( ! empty( $args['text_color_custom'] ) && $args['text_color_custom'] !== '' ) {
1786
+        $styles['color'] = esc_attr( $args['text_color_custom'] );
1787
+    }
1788
+
1789
+    $style_string = '';
1790
+    if ( ! empty( $styles ) ) {
1791
+        foreach ( $styles as $key => $val ) {
1792
+            $style_string .= esc_attr( $key ) . ':' . esc_attr( $val ) . ';';
1793
+        }
1794
+    }
1795
+
1796
+    return $style_string;
1797 1797
 
1798 1798
 }
1799 1799
 
@@ -1806,19 +1806,19 @@  discard block
 block discarded – undo
1806 1806
  * @return string
1807 1807
  */
1808 1808
 function sd_sanitize_html_classes( $classes, $sep = " " ) {
1809
-	$return = "";
1809
+    $return = "";
1810 1810
 
1811
-	if ( ! is_array( $classes ) ) {
1812
-		$classes = explode( $sep, $classes );
1813
-	}
1811
+    if ( ! is_array( $classes ) ) {
1812
+        $classes = explode( $sep, $classes );
1813
+    }
1814 1814
 
1815
-	if ( ! empty( $classes ) ) {
1816
-		foreach ( $classes as $class ) {
1817
-			$return .= sanitize_html_class( $class ) . " ";
1818
-		}
1819
-	}
1815
+    if ( ! empty( $classes ) ) {
1816
+        foreach ( $classes as $class ) {
1817
+            $return .= sanitize_html_class( $class ) . " ";
1818
+        }
1819
+    }
1820 1820
 
1821
-	return $return;
1821
+    return $return;
1822 1822
 }
1823 1823
 
1824 1824
 
@@ -1828,21 +1828,21 @@  discard block
 block discarded – undo
1828 1828
  * @return void
1829 1829
  */
1830 1830
 function sd_get_class_build_keys() {
1831
-	$keys = array(
1832
-		'container',
1833
-		'position',
1834
-		'flex_direction',
1835
-		'shadow',
1836
-		'rounded',
1837
-		'nav_style',
1838
-		'horizontal_alignment',
1839
-		'nav_fill',
1840
-		'width',
1841
-		'font_weight',
1842
-		'font_size',
1843
-		'font_case',
1844
-		'css_class',
1845
-	);
1846
-
1847
-	return apply_filters( "sd_class_build_keys", $keys );
1831
+    $keys = array(
1832
+        'container',
1833
+        'position',
1834
+        'flex_direction',
1835
+        'shadow',
1836
+        'rounded',
1837
+        'nav_style',
1838
+        'horizontal_alignment',
1839
+        'nav_fill',
1840
+        'width',
1841
+        'font_weight',
1842
+        'font_size',
1843
+        'font_case',
1844
+        'css_class',
1845
+    );
1846
+
1847
+    return apply_filters( "sd_class_build_keys", $keys );
1848 1848
 }
Please login to merge, or discard this patch.
includes/reports/class-getpaid-reports-export.php 1 patch
Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -12,47 +12,47 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class GetPaid_Reports_Export {
14 14
 
15
-	/**
16
-	 * Displays the reports tab.
17
-	 *
18
-	 */
19
-	public function display() {
20
-
21
-		echo "<div class='row mt-4' style='max-width: 920px;' >";
22
-		foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
23
-			$this->display_post_type_export( $post_type );
24
-		}
25
-		$this->display_subscription_export();
26
-		echo '</div>';
27
-
28
-	}
29
-
30
-	/**
31
-	 * Retrieves the download url.
32
-	 *
33
-	 */
34
-	public function get_download_url( $post_type ) {
35
-
36
-		return wp_nonce_url(
37
-			add_query_arg(
38
-				array(
39
-					'getpaid-admin-action' => 'export_invoices',
40
-					'post_type'            => urlencode( $post_type ),
41
-				)
42
-			),
43
-			'getpaid-nonce',
44
-			'getpaid-nonce'
45
-		);
46
-
47
-	}
48
-
49
-	/**
50
-	 * Displays a single post type export card.
51
-	 *
52
-	 */
53
-	public function display_post_type_export( $post_type ) {
54
-
55
-		?>
15
+    /**
16
+     * Displays the reports tab.
17
+     *
18
+     */
19
+    public function display() {
20
+
21
+        echo "<div class='row mt-4' style='max-width: 920px;' >";
22
+        foreach ( array_keys( getpaid_get_invoice_post_types() ) as $post_type ) {
23
+            $this->display_post_type_export( $post_type );
24
+        }
25
+        $this->display_subscription_export();
26
+        echo '</div>';
27
+
28
+    }
29
+
30
+    /**
31
+     * Retrieves the download url.
32
+     *
33
+     */
34
+    public function get_download_url( $post_type ) {
35
+
36
+        return wp_nonce_url(
37
+            add_query_arg(
38
+                array(
39
+                    'getpaid-admin-action' => 'export_invoices',
40
+                    'post_type'            => urlencode( $post_type ),
41
+                )
42
+            ),
43
+            'getpaid-nonce',
44
+            'getpaid-nonce'
45
+        );
46
+
47
+    }
48
+
49
+    /**
50
+     * Displays a single post type export card.
51
+     *
52
+     */
53
+    public function display_post_type_export( $post_type ) {
54
+
55
+        ?>
56 56
 
57 57
 		<div class="col-12 col-md-6">
58 58
 			<div class="card m-0 p-0" style="max-width:100%">
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 				<div class="card-header">
61 61
 					<strong>
62 62
 						<?php
63
-							printf(
64
-								esc_html__( 'Export %s', 'invoicing' ),
65
-								esc_html( getpaid_get_post_type_label( $post_type ) )
66
-							);
67
-						?>
63
+                            printf(
64
+                                esc_html__( 'Export %s', 'invoicing' ),
65
+                                esc_html( getpaid_get_post_type_label( $post_type ) )
66
+                            );
67
+                        ?>
68 68
 					</strong>
69 69
 				</div>
70 70
 
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 					<form method="post" action="<?php echo esc_url( $this->get_download_url( $post_type ) ); ?>">
74 74
 
75 75
 						<?php
76
-							$this->generate_from_date( $post_type );
77
-							$this->generate_to_date( $post_type );
78
-							$this->generate_post_status_select( $post_type );
79
-							$this->generate_file_type_select( $post_type );
80
-							submit_button( __( 'Download', 'invoicing' ) );
81
-						?>
76
+                            $this->generate_from_date( $post_type );
77
+                            $this->generate_to_date( $post_type );
78
+                            $this->generate_post_status_select( $post_type );
79
+                            $this->generate_file_type_select( $post_type );
80
+                            submit_button( __( 'Download', 'invoicing' ) );
81
+                        ?>
82 82
 
83 83
 					</form>
84 84
 
@@ -89,135 +89,135 @@  discard block
 block discarded – undo
89 89
 
90 90
 		<?php
91 91
 
92
-	}
93
-
94
-	/**
95
-	 * Generates the from date input field.
96
-	 *
97
-	 */
98
-	public function generate_from_date( $post_type ) {
99
-
100
-		aui()->input(
101
-			array(
102
-				'type'             => 'datepicker',
103
-				'id'               => esc_attr( "$post_type-from_date" ),
104
-				'name'             => 'from_date',
105
-				'label'            => __( 'From Date', 'invoicing' ),
106
-				'label_type'       => 'vertical',
107
-				'placeholder'      => 'YYYY-MM-DD',
108
-				'extra_attributes' => array(
109
-					'data-enable-time' => 'false',
110
-					'data-allow-input' => 'true',
111
-				),
112
-			),
113
-			true
114
-		);
115
-
116
-	}
117
-
118
-	/**
119
-	 * Generates the to date input field.
120
-	 *
121
-	 */
122
-	public function generate_to_date( $post_type ) {
123
-
124
-		aui()->input(
125
-			array(
126
-				'type'             => 'datepicker',
127
-				'id'               => esc_attr( "$post_type-to_date" ),
128
-				'name'             => 'to_date',
129
-				'label'            => __( 'To Date', 'invoicing' ),
130
-				'label_type'       => 'vertical',
131
-				'placeholder'      => 'YYYY-MM-DD',
132
-				'extra_attributes' => array(
133
-					'data-enable-time' => 'false',
134
-					'data-allow-input' => 'true',
135
-				),
136
-			),
137
-			true
138
-		);
139
-	}
140
-
141
-	/**
142
-	 * Generates the to post status select field.
143
-	 *
144
-	 */
145
-	public function generate_post_status_select( $post_type ) {
146
-
147
-		if ( 'subscriptions' === $post_type ) {
148
-			$options = getpaid_get_subscription_statuses();
149
-		} else {
150
-			$options = wpinv_get_invoice_statuses( true, false, $post_type );
151
-		}
152
-
153
-		aui()->select(
154
-			array(
155
-				'name'        => 'status',
156
-				'id'          => esc_attr( "$post_type-status" ),
157
-				'placeholder' => __( 'All Statuses', 'invoicing' ),
158
-				'label'       => __( 'Status', 'invoicing' ),
159
-				'label_type'  => 'vertical',
160
-				'label_class' => 'd-block',
161
-				'options'     => $options,
162
-			),
163
-			true
164
-		);
165
-
166
-	}
167
-
168
-	/**
169
-	 * Generates the to file type select field.
170
-	 *
171
-	 */
172
-	public function generate_file_type_select( $post_type ) {
173
-
174
-		aui()->select(
175
-			array(
176
-				'name'        => 'file_type',
177
-				'id'          => esc_attr( "$post_type-file_type" ),
178
-				'placeholder' => __( 'Select File Type', 'invoicing' ),
179
-				'label'       => __( 'Export File', 'invoicing' ),
180
-				'label_type'  => 'vertical',
181
-				'label_class' => 'd-block',
182
-				'value'       => 'csv',
183
-				'options'     => array(
184
-					'csv'  => __( 'CSV', 'invoicing' ),
185
-					'xml'  => __( 'XML', 'invoicing' ),
186
-					'json' => __( 'JSON', 'invoicing' ),
187
-				),
188
-			),
189
-			true
190
-		);
191
-
192
-	}
193
-
194
-	/**
195
-	 * Displays a field's markup.
196
-	 *
197
-	 */
198
-	public function display_markup( $markup ) {
199
-
200
-		echo wp_kses(
201
-			str_replace(
202
-				array(
203
-					'form-control',
204
-					'custom-select',
205
-				),
206
-				'regular-text',
207
-				$markup
208
-			),
209
-			getpaid_allowed_html()
210
-		);
211
-
212
-	}
213
-
214
-	/**
215
-	 * Displays a subscription export card.
216
-	 *
217
-	 */
218
-	public function display_subscription_export() {
219
-
220
-		?>
92
+    }
93
+
94
+    /**
95
+     * Generates the from date input field.
96
+     *
97
+     */
98
+    public function generate_from_date( $post_type ) {
99
+
100
+        aui()->input(
101
+            array(
102
+                'type'             => 'datepicker',
103
+                'id'               => esc_attr( "$post_type-from_date" ),
104
+                'name'             => 'from_date',
105
+                'label'            => __( 'From Date', 'invoicing' ),
106
+                'label_type'       => 'vertical',
107
+                'placeholder'      => 'YYYY-MM-DD',
108
+                'extra_attributes' => array(
109
+                    'data-enable-time' => 'false',
110
+                    'data-allow-input' => 'true',
111
+                ),
112
+            ),
113
+            true
114
+        );
115
+
116
+    }
117
+
118
+    /**
119
+     * Generates the to date input field.
120
+     *
121
+     */
122
+    public function generate_to_date( $post_type ) {
123
+
124
+        aui()->input(
125
+            array(
126
+                'type'             => 'datepicker',
127
+                'id'               => esc_attr( "$post_type-to_date" ),
128
+                'name'             => 'to_date',
129
+                'label'            => __( 'To Date', 'invoicing' ),
130
+                'label_type'       => 'vertical',
131
+                'placeholder'      => 'YYYY-MM-DD',
132
+                'extra_attributes' => array(
133
+                    'data-enable-time' => 'false',
134
+                    'data-allow-input' => 'true',
135
+                ),
136
+            ),
137
+            true
138
+        );
139
+    }
140
+
141
+    /**
142
+     * Generates the to post status select field.
143
+     *
144
+     */
145
+    public function generate_post_status_select( $post_type ) {
146
+
147
+        if ( 'subscriptions' === $post_type ) {
148
+            $options = getpaid_get_subscription_statuses();
149
+        } else {
150
+            $options = wpinv_get_invoice_statuses( true, false, $post_type );
151
+        }
152
+
153
+        aui()->select(
154
+            array(
155
+                'name'        => 'status',
156
+                'id'          => esc_attr( "$post_type-status" ),
157
+                'placeholder' => __( 'All Statuses', 'invoicing' ),
158
+                'label'       => __( 'Status', 'invoicing' ),
159
+                'label_type'  => 'vertical',
160
+                'label_class' => 'd-block',
161
+                'options'     => $options,
162
+            ),
163
+            true
164
+        );
165
+
166
+    }
167
+
168
+    /**
169
+     * Generates the to file type select field.
170
+     *
171
+     */
172
+    public function generate_file_type_select( $post_type ) {
173
+
174
+        aui()->select(
175
+            array(
176
+                'name'        => 'file_type',
177
+                'id'          => esc_attr( "$post_type-file_type" ),
178
+                'placeholder' => __( 'Select File Type', 'invoicing' ),
179
+                'label'       => __( 'Export File', 'invoicing' ),
180
+                'label_type'  => 'vertical',
181
+                'label_class' => 'd-block',
182
+                'value'       => 'csv',
183
+                'options'     => array(
184
+                    'csv'  => __( 'CSV', 'invoicing' ),
185
+                    'xml'  => __( 'XML', 'invoicing' ),
186
+                    'json' => __( 'JSON', 'invoicing' ),
187
+                ),
188
+            ),
189
+            true
190
+        );
191
+
192
+    }
193
+
194
+    /**
195
+     * Displays a field's markup.
196
+     *
197
+     */
198
+    public function display_markup( $markup ) {
199
+
200
+        echo wp_kses(
201
+            str_replace(
202
+                array(
203
+                    'form-control',
204
+                    'custom-select',
205
+                ),
206
+                'regular-text',
207
+                $markup
208
+            ),
209
+            getpaid_allowed_html()
210
+        );
211
+
212
+    }
213
+
214
+    /**
215
+     * Displays a subscription export card.
216
+     *
217
+     */
218
+    public function display_subscription_export() {
219
+
220
+        ?>
221 221
 
222 222
 		<div class="col-12 col-md-6">
223 223
 			<div class="card m-0 p-0" style="max-width:100%">
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 					<form method="post" action="<?php echo esc_url( $this->get_download_url( 'subscriptions' ) ); ?>">
234 234
 
235 235
 						<?php
236
-							$this->generate_from_date( 'subscriptions' );
237
-							$this->generate_to_date( 'subscriptions' );
238
-							$this->generate_post_status_select( 'subscriptions' );
239
-							$this->generate_file_type_select( 'subscriptions' );
240
-							submit_button( __( 'Download', 'invoicing' ) );
241
-						?>
236
+                            $this->generate_from_date( 'subscriptions' );
237
+                            $this->generate_to_date( 'subscriptions' );
238
+                            $this->generate_post_status_select( 'subscriptions' );
239
+                            $this->generate_file_type_select( 'subscriptions' );
240
+                            submit_button( __( 'Download', 'invoicing' ) );
241
+                        ?>
242 242
 
243 243
 					</form>
244 244
 
@@ -249,6 +249,6 @@  discard block
 block discarded – undo
249 249
 
250 250
 		<?php
251 251
 
252
-	}
252
+    }
253 253
 
254 254
 }
Please login to merge, or discard this patch.